mirror of
https://github.com/Instadapp/InstaContract.git
synced 2024-07-29 22:47:45 +00:00
Fixed standard error and optimised code.
This commit is contained in:
parent
7b65b2c384
commit
399c068e54
|
@ -1,116 +1,116 @@
|
|||
// withdraw the extra assets other than global balance (in case anyone donated for free) and then no need for seperate brokerage calculation
|
||||
// IMPORTANT CHECK - decimals() - how the balance of tokens with less than 18 decimals are stored. Factor it.
|
||||
// update the balance along with "transferAssets" functions and also check the for onlyAllowedResolver
|
||||
// transfer assets to different address (create 2 different mappings) - 48 hour time to transfer all - send email for this
|
||||
// // withdraw the extra assets other than global balance (in case anyone donated for free) and then no need for seperate brokerage calculation
|
||||
// // IMPORTANT CHECK - decimals() - how the balance of tokens with less than 18 decimals are stored. Factor it.
|
||||
// // update the balance along with "transferAssets" functions and also check the for onlyAllowedResolver
|
||||
// // transfer assets to different address (create 2 different mappings) - 48 hour time to transfer all - send email for this
|
||||
|
||||
pragma solidity ^0.4.24;
|
||||
// pragma solidity ^0.4.24;
|
||||
|
||||
import "openzeppelin-solidity/contracts/math/SafeMath.sol";
|
||||
import "openzeppelin-solidity/contracts/token/ERC20/IERC20.sol";
|
||||
// import "openzeppelin-solidity/contracts/math/SafeMath.sol";
|
||||
// import "openzeppelin-solidity/contracts/token/ERC20/IERC20.sol";
|
||||
|
||||
interface AddressRegistry {
|
||||
function getAddr(string name) external view returns(address);
|
||||
function isApprovedResolver(address user) external view returns(bool);
|
||||
}
|
||||
// interface AddressRegistry {
|
||||
// function getAddr(string name) external view returns(address);
|
||||
// function isApprovedResolver(address user) external view returns(bool);
|
||||
// }
|
||||
|
||||
|
||||
contract Registry {
|
||||
// contract Registry {
|
||||
|
||||
address public registryAddress;
|
||||
AddressRegistry addrReg = AddressRegistry(registryAddress);
|
||||
// address public registryAddress;
|
||||
// AddressRegistry addrReg = AddressRegistry(registryAddress);
|
||||
|
||||
modifier onlyAllowedResolver(address user) {
|
||||
require(
|
||||
addrReg.isApprovedResolver(user),
|
||||
"Permission Denied"
|
||||
);
|
||||
_;
|
||||
}
|
||||
// modifier onlyAllowedResolver(address user) {
|
||||
// require(
|
||||
// addrReg.isApprovedResolver(user),
|
||||
// "Permission Denied"
|
||||
// );
|
||||
// _;
|
||||
// }
|
||||
|
||||
function getAddress(string name) internal view returns(address addr) {
|
||||
addr = addrReg.getAddr(name);
|
||||
require(addr != address(0), "Invalid Address");
|
||||
}
|
||||
// function getAddress(string name) internal view returns(address addr) {
|
||||
// addr = addrReg.getAddr(name);
|
||||
// require(addr != address(0), "Invalid Address");
|
||||
// }
|
||||
|
||||
}
|
||||
// }
|
||||
|
||||
|
||||
contract AssetDB is Registry {
|
||||
// contract AssetDB is Registry {
|
||||
|
||||
using SafeMath for uint;
|
||||
using SafeMath for uint256;
|
||||
// using SafeMath for uint;
|
||||
// using SafeMath for uint256;
|
||||
|
||||
mapping(address => mapping(address => uint)) balances;
|
||||
address eth = 0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE;
|
||||
// mapping(address => mapping(address => uint)) balances;
|
||||
// address eth = 0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE;
|
||||
|
||||
function getBalance(
|
||||
address assetHolder,
|
||||
address tokenAddr
|
||||
) public view returns (uint256 balance)
|
||||
{
|
||||
balance = balances[assetHolder][tokenAddr];
|
||||
}
|
||||
// function getBalance(
|
||||
// address assetHolder,
|
||||
// address tokenAddr
|
||||
// ) public view returns (uint256 balance)
|
||||
// {
|
||||
// balance = balances[assetHolder][tokenAddr];
|
||||
// }
|
||||
|
||||
function deposit(address tknAddr, uint amount) public payable {
|
||||
if (msg.value > 0) {
|
||||
balances[msg.sender][eth] = balances[msg.sender][eth].add(msg.value);
|
||||
} else {
|
||||
IERC20 tokenFunctions = IERC20(tknAddr);
|
||||
tokenFunctions.transferFrom(msg.sender, address(this), amount);
|
||||
balances[msg.sender][tknAddr] = balances[msg.sender][tknAddr].add(amount);
|
||||
}
|
||||
}
|
||||
// function deposit(address tknAddr, uint amount) public payable {
|
||||
// if (msg.value > 0) {
|
||||
// balances[msg.sender][eth] = balances[msg.sender][eth].add(msg.value);
|
||||
// } else {
|
||||
// IERC20 tokenFunctions = IERC20(tknAddr);
|
||||
// tokenFunctions.transferFrom(msg.sender, address(this), amount);
|
||||
// balances[msg.sender][tknAddr] = balances[msg.sender][tknAddr].add(amount);
|
||||
// }
|
||||
// }
|
||||
|
||||
function withdraw(address tknAddr, uint amount) public {
|
||||
require(balances[msg.sender][tknAddr] >= amount, "Insufficient Balance");
|
||||
balances[msg.sender][tknAddr] = balances[msg.sender][tknAddr].sub(amount);
|
||||
if (tknAddr == eth) {
|
||||
msg.sender.transfer(amount);
|
||||
} else {
|
||||
IERC20 tokenFunctions = IERC20(tknAddr);
|
||||
tokenFunctions.transfer(msg.sender, amount);
|
||||
}
|
||||
}
|
||||
// function withdraw(address tknAddr, uint amount) public {
|
||||
// require(balances[msg.sender][tknAddr] >= amount, "Insufficient Balance");
|
||||
// balances[msg.sender][tknAddr] = balances[msg.sender][tknAddr].sub(amount);
|
||||
// if (tknAddr == eth) {
|
||||
// msg.sender.transfer(amount);
|
||||
// } else {
|
||||
// IERC20 tokenFunctions = IERC20(tknAddr);
|
||||
// tokenFunctions.transfer(msg.sender, amount);
|
||||
// }
|
||||
// }
|
||||
|
||||
function updateBalance(
|
||||
address tokenAddr,
|
||||
uint amount,
|
||||
bool credit,
|
||||
address user
|
||||
) public onlyAllowedResolver(user)
|
||||
{
|
||||
if (credit) {
|
||||
balances[user][tokenAddr] = balances[user][tokenAddr].add(amount);
|
||||
} else {
|
||||
balances[user][tokenAddr] = balances[user][tokenAddr].sub(amount);
|
||||
}
|
||||
}
|
||||
// function updateBalance(
|
||||
// address tokenAddr,
|
||||
// uint amount,
|
||||
// bool credit,
|
||||
// address user
|
||||
// ) public onlyAllowedResolver(user)
|
||||
// {
|
||||
// if (credit) {
|
||||
// balances[user][tokenAddr] = balances[user][tokenAddr].add(amount);
|
||||
// } else {
|
||||
// balances[user][tokenAddr] = balances[user][tokenAddr].sub(amount);
|
||||
// }
|
||||
// }
|
||||
|
||||
function transferAssets(
|
||||
address tokenAddress,
|
||||
uint amount,
|
||||
address sendTo,
|
||||
address user
|
||||
) public onlyAllowedResolver(user)
|
||||
{
|
||||
if (tokenAddress == eth) {
|
||||
sendTo.transfer(amount);
|
||||
} else {
|
||||
IERC20 tokenFunctions = IERC20(tokenAddress);
|
||||
tokenFunctions.transfer(sendTo, amount);
|
||||
}
|
||||
balances[user][tokenAddress] = balances[user][tokenAddress].sub(amount);
|
||||
}
|
||||
// function transferAssets(
|
||||
// address tokenAddress,
|
||||
// uint amount,
|
||||
// address sendTo,
|
||||
// address user
|
||||
// ) public onlyAllowedResolver(user)
|
||||
// {
|
||||
// if (tokenAddress == eth) {
|
||||
// sendTo.transfer(amount);
|
||||
// } else {
|
||||
// IERC20 tokenFunctions = IERC20(tokenAddress);
|
||||
// tokenFunctions.transfer(sendTo, amount);
|
||||
// }
|
||||
// balances[user][tokenAddress] = balances[user][tokenAddress].sub(amount);
|
||||
// }
|
||||
|
||||
}
|
||||
// }
|
||||
|
||||
|
||||
contract MoatAsset is AssetDB {
|
||||
// contract MoatAsset is AssetDB {
|
||||
|
||||
constructor(address rAddr) public {
|
||||
registryAddress = rAddr;
|
||||
}
|
||||
// constructor(address rAddr) public {
|
||||
// registryAddress = rAddr;
|
||||
// }
|
||||
|
||||
function () public payable {}
|
||||
// function () public payable {}
|
||||
|
||||
}
|
||||
// }
|
||||
|
|
|
@ -1,58 +1,58 @@
|
|||
pragma solidity ^0.4.24;
|
||||
// pragma solidity ^0.4.24;
|
||||
|
||||
import "openzeppelin-solidity/contracts/token/ERC20/IERC20.sol";
|
||||
// import "openzeppelin-solidity/contracts/token/ERC20/IERC20.sol";
|
||||
|
||||
interface AddressRegistry {
|
||||
function getAddr(string name) external view returns(address);
|
||||
}
|
||||
// interface AddressRegistry {
|
||||
// function getAddr(string name) external view returns(address);
|
||||
// }
|
||||
|
||||
|
||||
contract Registry {
|
||||
// contract Registry {
|
||||
|
||||
address public registryAddress;
|
||||
modifier onlyAdmin() {
|
||||
require(
|
||||
msg.sender == getAddress("admin"),
|
||||
"Permission Denied"
|
||||
);
|
||||
_;
|
||||
}
|
||||
// address public registryAddress;
|
||||
// modifier onlyAdmin() {
|
||||
// require(
|
||||
// msg.sender == getAddress("admin"),
|
||||
// "Permission Denied"
|
||||
// );
|
||||
// _;
|
||||
// }
|
||||
|
||||
function getAddress(string name) internal view returns(address addr) {
|
||||
AddressRegistry addrReg = AddressRegistry(registryAddress);
|
||||
addr = addrReg.getAddr(name);
|
||||
require(addr != address(0), "Invalid Address");
|
||||
}
|
||||
// function getAddress(string name) internal view returns(address addr) {
|
||||
// AddressRegistry addrReg = AddressRegistry(registryAddress);
|
||||
// addr = addrReg.getAddr(name);
|
||||
// require(addr != address(0), "Invalid Address");
|
||||
// }
|
||||
|
||||
}
|
||||
// }
|
||||
|
||||
|
||||
contract FeeDetail is Registry {
|
||||
// contract FeeDetail is Registry {
|
||||
|
||||
uint public fees;
|
||||
function setFees(uint cut) public onlyAdmin { // 200 means 0.5%
|
||||
fees = cut;
|
||||
}
|
||||
// uint public fees;
|
||||
// function setFees(uint cut) public onlyAdmin { // 200 means 0.5%
|
||||
// fees = cut;
|
||||
// }
|
||||
|
||||
}
|
||||
// }
|
||||
|
||||
|
||||
contract MoatResolver is FeeDetail {
|
||||
// contract MoatResolver is FeeDetail {
|
||||
|
||||
function () public payable {}
|
||||
// function () public payable {}
|
||||
|
||||
constructor(address rAddr, uint cut) public { // 200 means 0.5%
|
||||
registryAddress = rAddr;
|
||||
setFees(cut);
|
||||
}
|
||||
// constructor(address rAddr, uint cut) public { // 200 means 0.5%
|
||||
// registryAddress = rAddr;
|
||||
// setFees(cut);
|
||||
// }
|
||||
|
||||
function collectAsset(address tokenAddress, uint amount) public onlyAdmin {
|
||||
if (tokenAddress == 0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE) {
|
||||
msg.sender.transfer(amount);
|
||||
} else {
|
||||
IERC20 tokenFunctions = IERC20(tokenAddress);
|
||||
tokenFunctions.transfer(msg.sender, amount);
|
||||
}
|
||||
}
|
||||
// function collectAsset(address tokenAddress, uint amount) public onlyAdmin {
|
||||
// if (tokenAddress == 0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE) {
|
||||
// msg.sender.transfer(amount);
|
||||
// } else {
|
||||
// IERC20 tokenFunctions = IERC20(tokenAddress);
|
||||
// tokenFunctions.transfer(msg.sender, amount);
|
||||
// }
|
||||
// }
|
||||
|
||||
}
|
||||
// }
|
||||
|
|
|
@ -1,37 +1,7 @@
|
|||
pragma solidity ^0.4.24;
|
||||
|
||||
// import "openzeppelin-solidity/contracts/math/SafeMath.sol";
|
||||
// import "openzeppelin-solidity/contracts/token/ERC20/IERC20.sol";
|
||||
|
||||
interface IERC20 {
|
||||
function totalSupply() external view returns (uint256);
|
||||
|
||||
function balanceOf(address who) external view returns (uint256);
|
||||
|
||||
function allowance(address owner, address spender)
|
||||
external view returns (uint256);
|
||||
|
||||
function transfer(address to, uint256 value) external returns (bool);
|
||||
|
||||
function approve(address spender, uint256 value)
|
||||
external returns (bool);
|
||||
|
||||
function transferFrom(address from, address to, uint256 value)
|
||||
external returns (bool);
|
||||
|
||||
event Transfer(
|
||||
address indexed from,
|
||||
address indexed to,
|
||||
uint256 value
|
||||
);
|
||||
|
||||
event Approval(
|
||||
address indexed owner,
|
||||
address indexed spender,
|
||||
uint256 value
|
||||
);
|
||||
}
|
||||
|
||||
import "openzeppelin-solidity/contracts/math/SafeMath.sol";
|
||||
import "openzeppelin-solidity/contracts/token/ERC20/IERC20.sol";
|
||||
|
||||
|
||||
interface AddressRegistry {
|
||||
|
@ -78,8 +48,8 @@ contract Registry {
|
|||
|
||||
contract Trade is Registry {
|
||||
|
||||
// using SafeMath for uint;
|
||||
// using SafeMath for uint256;
|
||||
using SafeMath for uint;
|
||||
using SafeMath for uint256;
|
||||
|
||||
uint public fees;
|
||||
|
||||
|
@ -103,6 +73,7 @@ contract Trade is Registry {
|
|||
{
|
||||
address protocolAdmin = getAddress("admin");
|
||||
uint sellQty = srcAmt;
|
||||
uint ethQty;
|
||||
uint feecut;
|
||||
if (fees > 0) {
|
||||
feecut = srcAmt / fees;
|
||||
|
@ -114,13 +85,14 @@ contract Trade is Registry {
|
|||
if (src == getAddress("eth")) {
|
||||
require(msg.value == srcAmt, "Invalid Operation");
|
||||
if (feecut > 0) {protocolAdmin.transfer(feecut);}
|
||||
ethQty = sellQty;
|
||||
} else {
|
||||
tokenFunctions.transferFrom(msg.sender, address(this), srcAmt);
|
||||
if (feecut > 0) {tokenFunctions.transfer(protocolAdmin, feecut);}
|
||||
}
|
||||
|
||||
Kyber kyberFunctions = Kyber(getAddress("kyber"));
|
||||
destAmt = kyberFunctions.trade.value(sellQty)(
|
||||
destAmt = kyberFunctions.trade.value(ethQty)(
|
||||
src,
|
||||
sellQty,
|
||||
dest,
|
||||
|
@ -147,7 +119,8 @@ contract Trade is Registry {
|
|||
address src,
|
||||
address dest,
|
||||
uint srcAmt
|
||||
) public view returns (uint, uint) {
|
||||
) public view returns (uint, uint)
|
||||
{
|
||||
Kyber kyberFunctions = Kyber(getAddress("kyber"));
|
||||
return kyberFunctions.getExpectedRate(
|
||||
src,
|
||||
|
@ -187,4 +160,4 @@ contract MoatKyber is Trade {
|
|||
fees = cut;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
|
@ -21,7 +21,7 @@ interface MakerCDP {
|
|||
}
|
||||
|
||||
interface PriceInterface {
|
||||
function peek() public view returns (bytes32, bool);
|
||||
function peek() external view returns (bytes32, bool);
|
||||
}
|
||||
|
||||
interface WETHFace {
|
||||
|
@ -55,15 +55,15 @@ contract GlobalVar is Registry {
|
|||
using SafeMath for uint256;
|
||||
|
||||
// kovan network
|
||||
address public weth = 0xd0A1E359811322d97991E03f863a0C30C2cF029C;
|
||||
address public peth = 0xf4d791139cE033Ad35DB2B2201435fAd668B1b64;
|
||||
address public mkr = 0xAaF64BFCC32d0F15873a02163e7E500671a4ffcD;
|
||||
address public dai = 0xC4375B7De8af5a38a93548eb8453a498222C4fF2;
|
||||
address public eth = 0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee;
|
||||
|
||||
address public pricefeed = 0xA944bd4b25C9F186A846fd5668941AA3d3B8425F;
|
||||
address public cdpAddr = 0xa71937147b55Deb8a530C7229C442Fd3F31b7db2;
|
||||
MakerCDP loanMaster = MakerCDP(cdpAddr);
|
||||
// address public weth = 0xd0A1E359811322d97991E03f863a0C30C2cF029C;
|
||||
// address public peth = 0xf4d791139cE033Ad35DB2B2201435fAd668B1b64;
|
||||
// address public mkr = 0xAaF64BFCC32d0F15873a02163e7E500671a4ffcD;
|
||||
// address public dai = 0xC4375B7De8af5a38a93548eb8453a498222C4fF2;
|
||||
// address public eth = 0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee;
|
||||
// address public pricefeed = 0xA944bd4b25C9F186A846fd5668941AA3d3B8425F;
|
||||
// address public cdpAddr = 0xa71937147b55Deb8a530C7229C442Fd3F31b7db2;
|
||||
|
||||
MakerCDP loanMaster = MakerCDP(getAddress("cdp"));
|
||||
|
||||
bytes32 public blankCDP = 0x0000000000000000000000000000000000000000000000000000000000000000;
|
||||
mapping (address => bytes32) public cdps; // borrower >>> CDP Bytes
|
||||
|
@ -78,8 +78,8 @@ contract IssueLoan is GlobalVar {
|
|||
event LoanedDAI(address borrower, uint loanDAI, uint fees);
|
||||
event OpenedNewCDP(address borrower, bytes32 cdpBytes);
|
||||
|
||||
function pethPEReth(uint eth) public view returns (uint rPETH) {
|
||||
rPETH = eth * (10 ** 27) / loanMaster.per();
|
||||
function pethPEReth(uint ethNum) public view returns (uint rPETH) {
|
||||
rPETH = ethNum * (10 ** 27) / loanMaster.per();
|
||||
}
|
||||
|
||||
function borrow(uint daiDraw) public payable {
|
||||
|
@ -92,8 +92,8 @@ contract IssueLoan is GlobalVar {
|
|||
}
|
||||
|
||||
function lockETH() public payable {
|
||||
WETHFace wethFunction = WETHFace(weth);
|
||||
wethFunction.deposit.value(msg.value)(); // ETH to WETH
|
||||
WETHFace wethTkn = WETHFace(getAddress("weth"));
|
||||
wethTkn.deposit.value(msg.value)(); // ETH to WETH
|
||||
uint pethToLock = pethPEReth(msg.value);
|
||||
loanMaster.join(pethToLock); // WETH to PETH
|
||||
loanMaster.lock(cdps[msg.sender], pethToLock); // PETH to CDP
|
||||
|
@ -104,16 +104,16 @@ contract IssueLoan is GlobalVar {
|
|||
require(!freezed, "Operation Disabled");
|
||||
loanMaster.draw(cdps[msg.sender], daiDraw);
|
||||
uint feecut = deductFees(daiDraw);
|
||||
IERC20 tokenFunctions = IERC20(dai);
|
||||
tokenFunctions.transfer(msg.sender, daiDraw - feecut);
|
||||
IERC20 daiTkn = IERC20(getAddress("dai"));
|
||||
daiTkn.transfer(msg.sender, daiDraw - feecut);
|
||||
emit LoanedDAI(msg.sender, daiDraw, feecut);
|
||||
}
|
||||
|
||||
function deductFees(uint volume) internal returns(uint brokerage) {
|
||||
if (fees > 0) {
|
||||
brokerage = volume / fees;
|
||||
IERC20 tokenFunctions = IERC20(dai);
|
||||
tokenFunctions.transfer(getAddress("admin"), brokerage);
|
||||
IERC20 daiTkn = IERC20(getAddress("dai"));
|
||||
daiTkn.transfer(getAddress("admin"), brokerage);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -136,8 +136,8 @@ contract RepayLoan is IssueLoan {
|
|||
}
|
||||
|
||||
function wipeDAI(uint daiWipe, uint mkrFees) public {
|
||||
IERC20 mkrTkn = IERC20(mkr);
|
||||
IERC20 daiTkn = IERC20(dai);
|
||||
IERC20 mkrTkn = IERC20(getAddress("mkr"));
|
||||
IERC20 daiTkn = IERC20(getAddress("dai"));
|
||||
mkrTkn.transferFrom(msg.sender, address(this), mkrFees); // MKR tokens to pay the debt fees
|
||||
daiTkn.transferFrom(msg.sender, address(this), daiWipe); // DAI to pay the debt
|
||||
loanMaster.wipe(cdps[msg.sender], daiWipe);
|
||||
|
@ -150,8 +150,8 @@ contract RepayLoan is IssueLoan {
|
|||
uint pethToUnlock = pethPEReth(ethFree);
|
||||
loanMaster.free(cdps[msg.sender], pethToUnlock); // CDP to PETH
|
||||
loanMaster.exit(pethToUnlock); // PETH to WETH
|
||||
WETHFace wethFunction = WETHFace(weth);
|
||||
wethFunction.withdraw(ethFree); // WETH to ETH
|
||||
WETHFace wethTkn = WETHFace(getAddress("weth"));
|
||||
wethTkn.withdraw(ethFree); // WETH to ETH
|
||||
msg.sender.transfer(ethFree);
|
||||
emit UnlockedETH(msg.sender, ethFree);
|
||||
}
|
||||
|
@ -170,9 +170,11 @@ contract BorrowTasks is RepayLoan {
|
|||
cdps[msg.sender] = blankCDP;
|
||||
}
|
||||
|
||||
function getETHRate() public view returns (uint ethprice) {
|
||||
PriceInterface ethRate = PriceInterface(pricefeed);
|
||||
(ethprice, ) = uint(ethRate.peek()) / 10**18;
|
||||
function getETHRate() public view returns (uint) {
|
||||
PriceInterface ethRate = PriceInterface(getAddress("price"));
|
||||
bytes32 ethrate;
|
||||
(ethrate, ) = ethRate.peek();
|
||||
return (uint(ethrate) / 10**18);
|
||||
}
|
||||
|
||||
function getCDPID(address borrower) public view returns (uint) {
|
||||
|
@ -180,13 +182,14 @@ contract BorrowTasks is RepayLoan {
|
|||
}
|
||||
|
||||
function approveERC20() public {
|
||||
IERC20 wethTkn = IERC20(weth);
|
||||
address cdpAddr = getAddress("cdp");
|
||||
IERC20 wethTkn = IERC20(getAddress("weth"));
|
||||
wethTkn.approve(cdpAddr, 2**256 - 1);
|
||||
IERC20 pethTkn = IERC20(peth);
|
||||
IERC20 pethTkn = IERC20(getAddress("peth"));
|
||||
pethTkn.approve(cdpAddr, 2**256 - 1);
|
||||
IERC20 mkrTkn = IERC20(mkr);
|
||||
IERC20 mkrTkn = IERC20(getAddress("mkr"));
|
||||
mkrTkn.approve(cdpAddr, 2**256 - 1);
|
||||
IERC20 daiTkn = IERC20(dai);
|
||||
IERC20 daiTkn = IERC20(getAddress("dai"));
|
||||
daiTkn.approve(cdpAddr, 2**256 - 1);
|
||||
}
|
||||
|
||||
|
@ -203,7 +206,7 @@ contract MoatMaker is BorrowTasks {
|
|||
function () public payable {}
|
||||
|
||||
function collectAsset(address tokenAddress, uint amount) public onlyAdmin {
|
||||
if (tokenAddress == eth) {
|
||||
if (tokenAddress == getAddress("eth")) {
|
||||
msg.sender.transfer(amount);
|
||||
} else {
|
||||
IERC20 tokenFunctions = IERC20(tokenAddress);
|
||||
|
|
Loading…
Reference in New Issue
Block a user