From a74b8151dc2a1731016240c95fb21c8fb9dfeab2 Mon Sep 17 00:00:00 2001 From: HowardP Date: Thu, 10 Dec 2020 19:34:37 +0800 Subject: [PATCH 1/3] Update README.md --- README.md | 31 ++++++++++++++----------------- 1 file changed, 14 insertions(+), 17 deletions(-) diff --git a/README.md b/README.md index ce24aa4..a74cfda 100644 --- a/README.md +++ b/README.md @@ -15,40 +15,37 @@ python 3 目前生产合约都在 **contracts/standard**下面 - - - ## 机器池介绍 -机枪池由3部分组成 +机枪池由 3 部分组成 Controller、vault、Strategy -Controller的作用是设置某个代币对应的vault以及Strategy +Controller 的作用是设置某个代币对应的 vault 以及 Strategy -vault的作用是 用户充值,提现,领取奖励 +vault 的作用是 用户充值,提现,领取奖励 -Strategy的作用是 把用户充值的币接入各种收益率高的地方挖矿(Strategy是可以切换的) +Strategy 的作用是 把用户充值的币接入各种收益率高的地方挖矿(Strategy 是可以切换的) 生产用的合约在 [合约配置](https://raw.githubusercontent.com/yfii/yvault/master/contracts/standard/config.json) -abi文件参考 [vault](abi/vault.json) -abi文件参考 [Strategy](abi/strategy.json) +[vault](abi/vault.json) abi 文件参考 +[Strategy](abi/strategy.json) abi 文件参考 ## abi -### 操作 -`function deposit(uint amount)` 用户入金 需要先对vault合约进行代币授权 +### 操作(Write SmartContract) -`function withdraw(uint amount)` 用户提现 +`function deposit(uint amount)` 用户入金 需要先对 vault 合约进行代币授权 -### 读 +`function withdraw(uint amount)` 用户提现 -`function balanceOf(address user) public view returns (uint256)` 查看用户有的iToken数量 +### 读 (Read SmartContract) -`function getPricePerFullShare() public view returns (uint)` 查看每个iToken换回原来token的比例 +`function balanceOf(address user) public view returns (uint256)` 查看用户有的 iToken 数量 -这边返回的值需要 除以1e18 +`function getPricePerFullShare() public view returns (uint)` 查看每个 iToken 换回原来 token 的比例 -可以换回原来代币的数量为: 用户持有的iToken数量*getPricePerFullShare/1e18 +这边返回的值需要 除以 1e18 +可以换回原来代币的数量为: 用户持有的 iToken 数量\*getPricePerFullShare/1e18 From ef304b7ba03b610b5e4408c1b7ccbc986ed7d124 Mon Sep 17 00:00:00 2001 From: HowardP Date: Thu, 10 Dec 2020 21:08:11 +0800 Subject: [PATCH 2/3] BTC + BTC --- bscpd/strategy/bnb.sol | 1 + bscpd/strategy/btc.sol | 220 ++++++++++++++++++++++++ bscpd/strategy/busd.sol | 4 +- bscpd/strategy/eth.sol | 1 - bscpd/strategy/usdt.sol | 1 - bscpd/vault/btc.sol | 340 +++++++++++++++++++++++++++++++++++++ contracts/Controller.sol | 4 +- contracts/yfiicontract.sol | 2 +- 8 files changed, 566 insertions(+), 7 deletions(-) create mode 100644 bscpd/strategy/btc.sol create mode 100644 bscpd/vault/btc.sol diff --git a/bscpd/strategy/bnb.sol b/bscpd/strategy/bnb.sol index c3eaa73..7a8543d 100644 --- a/bscpd/strategy/bnb.sol +++ b/bscpd/strategy/bnb.sol @@ -185,6 +185,7 @@ contract StrategyFortube { address constant public eth_address = address(0xbBbBBBBbbBBBbbbBbbBbbbbBBbBbbbbBbBbbBBbB); address constant public want = address(0xbb4CdB9CBd36B01bD1cBaEBF2De08d9173bc095c); //wbnb + address constant public output = address(0x658A109C5900BC6d2357c87549B651670E5b0539); //for address public unirouter = address(0x039B5818e51dfEC86c1D56A4668787AF0Ed1c068); //Unisave address constant public weth = address(0xbb4CdB9CBd36B01bD1cBaEBF2De08d9173bc095c); // used for for <> weth <> usdc route diff --git a/bscpd/strategy/btc.sol b/bscpd/strategy/btc.sol new file mode 100644 index 0000000..204ab7b --- /dev/null +++ b/bscpd/strategy/btc.sol @@ -0,0 +1,220 @@ + + + +/////////// +contract StrategyFortube { + using SafeERC20 for IERC20; + using Address for address; + using SafeMath for uint256; + + address constant public output = address(0x658A109C5900BC6d2357c87549B651670E5b0539); //for + address public unirouter = address(0x039B5818e51dfEC86c1D56A4668787AF0Ed1c068); // unisave + address constant public weth = address(0xbb4CdB9CBd36B01bD1cBaEBF2De08d9173bc095c); // used for for <> weth <> usdc route + + address constant public yfii = address(0x7F70642d88cf1C4a3a7abb072B53B929b653edA5); + + address constant public fortube = address(0x0cEA0832e9cdBb5D476040D58Ea07ecfbeBB7672);//主合约. + address public fortube_reward = address(0x55838F18e79cFd3EA22Eea08Bd3Ec18d67f314ed); //领取奖励的合约 + + address public want; + + + uint public strategyfee = 100; + uint public fee = 300; + uint public burnfee = 500; + uint public callfee = 100; + uint constant public max = 1000; + + uint public withdrawalFee = 0; + uint constant public withdrawalMax = 10000; + + address public governance; + address public strategyDev; + address public controller; + address public burnAddress = 0xB6af2DabCEBC7d30E440714A33E5BD45CEEd103a; //設置燒毀帳號 + + string public getName; + + address[] public swap2YFIIRouting; + address[] public swap2TokenRouting; + + + constructor(address _want) public { + want = _want; + governance = msg.sender; /// msg.sender or tx.origin? + controller = 0x5B916D02A9745C64EC6C0AFe41Ee4893Dd5a01B7; + getName = string( + abi.encodePacked("yfii:Strategy:", + abi.encodePacked(IERC20(want).name(),"The Force Token" + ) + )); + swap2YFIIRouting = [output,weth,yfii]; + swap2TokenRouting = [output,weth,want]; + doApprove(); + strategyDev = tx.origin; + } + + function doApprove () public{ //設置通過 Approve 動作 + IERC20(output).safeApprove(unirouter, 0); + IERC20(output).safeApprove(unirouter, uint(-1)); + } + + function setFortubeReward(address _reward) public { + require(msg.sender == governance, "!governance"); + fortube_reward = _reward; + } + function setUnirouter(address _unirouter) public { // 設置前面設置的 Router 去販賣 + require(msg.sender == governance, "!governance"); + unirouter = _unirouter; + } + + + function deposit() public { // 將手上的BEP20進行充值 + uint _want = IERC20(want).balanceOf(address(this)); + address _controller = For(fortube).controller(); + if (_want > 0) { //充入金額必須大於零啊 + IERC20(want).safeApprove(_controller, 0); + IERC20(want).safeApprove(_controller, _want); + For(fortube).deposit(want,_want); + } + } + + // Controller only function for creating additional rewards from dust + function withdraw(IERC20 _asset) external returns (uint balance) { + require(msg.sender == controller, "!controller"); + require(want != address(_asset), "want"); + address _controller = For(fortube).controller(); + /////////// 要求Controller 不能跟所得到的 fToken 為同一個地址 /////////// /////////// + require(IBankController(_controller).getFTokeAddress(want) != address(_asset),"fToken"); + balance = _asset.balanceOf(address(this)); + //////////////////////////////////////////////////////////////////////////////// + _asset.safeTransfer(controller, balance); + } + + // Withdraw partial funds, normally used with a vault withdrawal + function withdraw(uint _amount) external { + require(msg.sender == controller, "!controller"); + uint _balance = IERC20(want).balanceOf(address(this)); + if (_balance < _amount) { + _amount = _withdrawSome(_amount.sub(_balance)); + _amount = _amount.add(_balance); + } + + uint _fee = 0; + if (withdrawalFee>0){ + _fee = _amount.mul(withdrawalFee).div(withdrawalMax); + IERC20(want).safeTransfer(Controller(controller).rewards(), _fee); + } + + + address _vault = Controller(controller).vaults(address(want)); + require(_vault != address(0), "!vault"); // additional protection so we don't burn the funds + IERC20(want).safeTransfer(_vault, _amount.sub(_fee)); + } + + // Withdraw all funds, normally used when migrating strategies + function withdrawAll() external returns (uint balance) { + require(msg.sender == controller || msg.sender == governance,"!governance"); + _withdrawAll(); + + + balance = IERC20(want).balanceOf(address(this)); + + address _vault = Controller(controller).vaults(address(want)); + require(_vault != address(0), "!vault"); // additional protection so we don't burn the funds + IERC20(want).safeTransfer(_vault, balance); + } + + function _withdrawAll() internal { + address _controller = For(fortube).controller(); + IFToken fToken = IFToken(IBankController(_controller).getFTokeAddress(want)); + uint b = fToken.balanceOf(address(this)); + For(fortube).withdraw(want,b); + } + + function harvest() public { + require(!Address.isContract(msg.sender),"!contract"); + ForReward(fortube_reward).claimReward(); //收割利息,將獎勵代幣賣掉 + doswap(); // 賣, Exchange + dosplit(); //分yfii + deposit(); + } + + function doswap() internal { + uint256 _2token = IERC20(output).balanceOf(address(this)); //100% + // uint256 _2yfii = IERC20(output).balanceOf(address(this)).mul(10).div(100); //10% + UniswapRouter(unirouter).swapExactTokensForTokens(_2token, 0, swap2TokenRouting, address(this), now.add(1800)); + // UniswapRouter(unirouter).swapExactTokensForTokens(_2yfii, 0, swap2YFIIRouting, address(this), now.add(1800)); + } + function dosplit() internal{ + uint b = IERC20(want).balanceOf(address(this)).mul(10).div(100);//10% want + uint _fee = b.mul(fee).div(max); + uint _callfee = b.mul(callfee).div(max); + uint _burnfee = b.mul(burnfee).div(max); + IERC20(want).safeTransfer(Controller(controller).rewards(), _fee); //3% 3% team + IERC20(want).safeTransfer(msg.sender, _callfee); //call fee 1% + IERC20(want).safeTransfer(burnAddress, _burnfee); //burn fee 5% + + if (strategyfee >0){ + uint _strategyfee = b.mul(strategyfee).div(max); //1% + IERC20(want).safeTransfer(strategyDev, _strategyfee); + } + } + + function _withdrawSome(uint256 _amount) internal returns (uint) { + For(fortube).withdrawUnderlying(want,_amount); + return _amount; + } + + function balanceOfWant() public view returns (uint) { + return IERC20(want).balanceOf(address(this)); + } + + function balanceOfPool() public view returns (uint) { // Pool 之中佔比 + address _controller = For(fortube).controller(); + IFToken fToken = IFToken(IBankController(_controller).getFTokeAddress(want)); + return fToken.calcBalanceOfUnderlying(address(this)); + } + + + function balanceOf() public view returns (uint) { + return balanceOfWant() + .add(balanceOfPool()); + } + + function setGovernance(address _governance) external { + require(msg.sender == governance, "!governance"); + governance = _governance; + } + + function setController(address _controller) external { + require(msg.sender == governance, "!governance"); + controller = _controller; + } + function setFee(uint256 _fee) external{ + require(msg.sender == governance, "!governance"); + fee = _fee; + } + function setStrategyFee(uint256 _fee) external{ + require(msg.sender == governance, "!governance"); + strategyfee = _fee; + } + function setCallFee(uint256 _fee) external{ + require(msg.sender == governance, "!governance"); + callfee = _fee; + } + function setBurnFee(uint256 _fee) external{ + require(msg.sender == governance, "!governance"); + burnfee = _fee; + } + function setBurnAddress(address _burnAddress) public{ + require(msg.sender == governance, "!governance"); + burnAddress = _burnAddress; + } + + function setWithdrawalFee(uint _withdrawalFee) external { + require(msg.sender == governance, "!governance"); + require(_withdrawalFee <=100,"fee >= 1%"); //max:1% + withdrawalFee = _withdrawalFee; + } +} diff --git a/bscpd/strategy/busd.sol b/bscpd/strategy/busd.sol index acc3045..f74577c 100644 --- a/bscpd/strategy/busd.sol +++ b/bscpd/strategy/busd.sol @@ -271,7 +271,7 @@ contract StrategyFortube { _amount = _amount.add(_balance); } - uint _fee = 0; + uint _fee = 0; if (withdrawalFee>0){ _fee = _amount.mul(withdrawalFee).div(withdrawalMax); IERC20(want).safeTransfer(Controller(controller).rewards(), _fee); @@ -306,7 +306,7 @@ contract StrategyFortube { function harvest() public { require(!Address.isContract(msg.sender),"!contract"); ForReward(fortube_reward).claimReward(); - doswap(); + doswap(); dosplit();//分yfii deposit(); } diff --git a/bscpd/strategy/eth.sol b/bscpd/strategy/eth.sol index e8ccc95..c62226f 100644 --- a/bscpd/strategy/eth.sol +++ b/bscpd/strategy/eth.sol @@ -9,7 +9,6 @@ contract StrategyFortube { address constant public yfii = address(0x7F70642d88cf1C4a3a7abb072B53B929b653edA5); - address constant public fortube = address(0x0cEA0832e9cdBb5D476040D58Ea07ecfbeBB7672);//主合约. address public fortube_reward = address(0x55838F18e79cFd3EA22Eea08Bd3Ec18d67f314ed); //领取奖励的合约 diff --git a/bscpd/strategy/usdt.sol b/bscpd/strategy/usdt.sol index 90ab238..948d744 100644 --- a/bscpd/strategy/usdt.sol +++ b/bscpd/strategy/usdt.sol @@ -251,7 +251,6 @@ contract StrategyFortube { IERC20(want).safeApprove(_controller, _want); For(fortube).deposit(want,_want); } - } // Controller only function for creating additional rewards from dust diff --git a/bscpd/vault/btc.sol b/bscpd/vault/btc.sol new file mode 100644 index 0000000..5c04c35 --- /dev/null +++ b/bscpd/vault/btc.sol @@ -0,0 +1,340 @@ + +pragma solidity ^0.5.16; + +interface IERC20 { + function totalSupply() external view returns (uint256); + function balanceOf(address account) external view returns (uint256); + function transfer(address recipient, uint256 amount) external returns (bool); + function allowance(address owner, address spender) external view returns (uint256); + function approve(address spender, uint256 amount) external returns (bool); + function transferFrom(address sender, address recipient, uint256 amount) external returns (bool); + event Transfer(address indexed from, address indexed to, uint256 value); + event Approval(address indexed owner, address indexed spender, uint256 value); +} + +contract Context { + constructor () internal { } + // solhint-disable-previous-line no-empty-blocks + + function _msgSender() internal view returns (address payable) { + return msg.sender; + } + + function _msgData() internal view returns (bytes memory) { + this; // silence state mutability warning without generating bytecode - see https://github.com/ethereum/solidity/issues/2691 + return msg.data; + } +} + +contract ERC20 is Context, IERC20 { + using SafeMath for uint256; + + mapping (address => uint256) private _balances; + + mapping (address => mapping (address => uint256)) private _allowances; + + uint256 private _totalSupply; + function totalSupply() public view returns (uint256) { + return _totalSupply; + } + function balanceOf(address account) public view returns (uint256) { + return _balances[account]; + } + function transfer(address recipient, uint256 amount) public returns (bool) { + _transfer(_msgSender(), recipient, amount); + return true; + } + function allowance(address owner, address spender) public view returns (uint256) { + return _allowances[owner][spender]; + } + function approve(address spender, uint256 amount) public returns (bool) { + _approve(_msgSender(), spender, amount); + return true; + } + function transferFrom(address sender, address recipient, uint256 amount) public returns (bool) { + _transfer(sender, recipient, amount); + _approve(sender, _msgSender(), _allowances[sender][_msgSender()].sub(amount, "ERC20: transfer amount exceeds allowance")); + return true; + } + function increaseAllowance(address spender, uint256 addedValue) public returns (bool) { + _approve(_msgSender(), spender, _allowances[_msgSender()][spender].add(addedValue)); + return true; + } + function decreaseAllowance(address spender, uint256 subtractedValue) public returns (bool) { + _approve(_msgSender(), spender, _allowances[_msgSender()][spender].sub(subtractedValue, "ERC20: decreased allowance below zero")); + return true; + } + function _transfer(address sender, address recipient, uint256 amount) internal { + require(sender != address(0), "ERC20: transfer from the zero address"); + require(recipient != address(0), "ERC20: transfer to the zero address"); + + _balances[sender] = _balances[sender].sub(amount, "ERC20: transfer amount exceeds balance"); + _balances[recipient] = _balances[recipient].add(amount); + emit Transfer(sender, recipient, amount); + } + function _mint(address account, uint256 amount) internal { + require(account != address(0), "ERC20: mint to the zero address"); + + _totalSupply = _totalSupply.add(amount); + _balances[account] = _balances[account].add(amount); + emit Transfer(address(0), account, amount); + } + function _burn(address account, uint256 amount) internal { + require(account != address(0), "ERC20: burn from the zero address"); + + _balances[account] = _balances[account].sub(amount, "ERC20: burn amount exceeds balance"); + _totalSupply = _totalSupply.sub(amount); + emit Transfer(account, address(0), amount); + } + function _approve(address owner, address spender, uint256 amount) internal { + require(owner != address(0), "ERC20: approve from the zero address"); + require(spender != address(0), "ERC20: approve to the zero address"); + + _allowances[owner][spender] = amount; + emit Approval(owner, spender, amount); + } + function _burnFrom(address account, uint256 amount) internal { + _burn(account, amount); + _approve(account, _msgSender(), _allowances[account][_msgSender()].sub(amount, "ERC20: burn amount exceeds allowance")); + } +} + +contract ERC20Detailed is IERC20 { + string private _name; + string private _symbol; + uint8 private _decimals; + + constructor (string memory name, string memory symbol, uint8 decimals) public { + _name = name; + _symbol = symbol; + _decimals = decimals; + } + function name() public view returns (string memory) { + return _name; + } + function symbol() public view returns (string memory) { + return _symbol; + } + function decimals() public view returns (uint8) { + return _decimals; + } +} + +library SafeMath { + function add(uint256 a, uint256 b) internal pure returns (uint256) { + uint256 c = a + b; + require(c >= a, "SafeMath: addition overflow"); + + return c; + } + function sub(uint256 a, uint256 b) internal pure returns (uint256) { + return sub(a, b, "SafeMath: subtraction overflow"); + } + function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) { + require(b <= a, errorMessage); + uint256 c = a - b; + + return c; + } + function mul(uint256 a, uint256 b) internal pure returns (uint256) { + if (a == 0) { + return 0; + } + + uint256 c = a * b; + require(c / a == b, "SafeMath: multiplication overflow"); + + return c; + } + function div(uint256 a, uint256 b) internal pure returns (uint256) { + return div(a, b, "SafeMath: division by zero"); + } + function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) { + // Solidity only automatically asserts when dividing by 0 + require(b > 0, errorMessage); + uint256 c = a / b; + + return c; + } + function mod(uint256 a, uint256 b) internal pure returns (uint256) { + return mod(a, b, "SafeMath: modulo by zero"); + } + function mod(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) { + require(b != 0, errorMessage); + return a % b; + } +} + +library Address { + function isContract(address account) internal view returns (bool) { + bytes32 codehash; + bytes32 accountHash = 0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470; + // solhint-disable-next-line no-inline-assembly + assembly { codehash := extcodehash(account) } + return (codehash != 0x0 && codehash != accountHash); + } + function toPayable(address account) internal pure returns (address payable) { + return address(uint160(account)); + } + function sendValue(address payable recipient, uint256 amount) internal { + require(address(this).balance >= amount, "Address: insufficient balance"); + + // solhint-disable-next-line avoid-call-value + (bool success, ) = recipient.call.value(amount)(""); + require(success, "Address: unable to send value, recipient may have reverted"); + } +} + +library SafeERC20 { + using SafeMath for uint256; + using Address for address; + + function safeTransfer(IERC20 token, address to, uint256 value) internal { + callOptionalReturn(token, abi.encodeWithSelector(token.transfer.selector, to, value)); + } + + function safeTransferFrom(IERC20 token, address from, address to, uint256 value) internal { + callOptionalReturn(token, abi.encodeWithSelector(token.transferFrom.selector, from, to, value)); + } + + function safeApprove(IERC20 token, address spender, uint256 value) internal { + require((value == 0) || (token.allowance(address(this), spender) == 0), + "SafeERC20: approve from non-zero to non-zero allowance" + ); + callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, value)); + } + + function safeIncreaseAllowance(IERC20 token, address spender, uint256 value) internal { + uint256 newAllowance = token.allowance(address(this), spender).add(value); + callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance)); + } + + function safeDecreaseAllowance(IERC20 token, address spender, uint256 value) internal { + uint256 newAllowance = token.allowance(address(this), spender).sub(value, "SafeERC20: decreased allowance below zero"); + callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance)); + } + function callOptionalReturn(IERC20 token, bytes memory data) private { + require(address(token).isContract(), "SafeERC20: call to non-contract"); + + // solhint-disable-next-line avoid-low-level-calls + (bool success, bytes memory returndata) = address(token).call(data); + require(success, "SafeERC20: low-level call failed"); + + if (returndata.length > 0) { // Return data is optional + // solhint-disable-next-line max-line-length + require(abi.decode(returndata, (bool)), "SafeERC20: ERC20 operation did not succeed"); + } + } +} + + +//////////////////////////////////////////////////////////////////////////////////////////////////// + +contract iVault is ERC20, ERC20Detailed { + using SafeERC20 for IERC20; + using Address for address; + using SafeMath for uint256; + + IERC20 public token; + + uint public min = 9900; // Altcoin 9900, StableCoin 9500? + uint public constant max = 10000; + + address public governance; + address public controller; + + constructor (address _token) public ERC20Detailed( + string(abi.encodePacked("yfii ", ERC20Detailed(_token).name())), + string(abi.encodePacked("i", ERC20Detailed(_token).symbol())), + ERC20Detailed(_token).decimals() + ) { + token = IERC20(_token); + governance = tx.origin; // msg.sender or tx.origin? + controller = 0x5B916D02A9745C64EC6C0AFe41Ee4893Dd5a01B7; + } + + function balance() public view returns (uint) { // + return token.balanceOf(address(this)) + .add(Controller(controller).balanceOf(address(token))); + } + + function setMin(uint _min) external { + require(msg.sender == governance, "!governance"); + min = _min; + } + + function setGovernance(address _governance) public { + require(msg.sender == governance, "!governance"); + governance = _governance; + } + + function setController(address _controller) public { + require(msg.sender == governance, "!governance"); + controller = _controller; + } + + + // 限制最小提現以及轉移數量 + // Custom logic in here for how much the vault allows to be borrowed + // Sets minimum required on-hand to keep small withdrawals cheap + function available() public view returns (uint) { + return token.balanceOf(address(this)).mul(min).div(max); + } + + function earn() public { + uint _bal = available(); + token.safeTransfer(controller, _bal); + Controller(controller).earn(address(token), _bal); + } + + function depositAll() external { //允許全部提出 + deposit(token.balanceOf(msg.sender)); + } + + function deposit(uint _amount) public { //提現 + uint _pool = balance(); + uint _before = token.balanceOf(address(this)); + token.safeTransferFrom(msg.sender, address(this), _amount); + uint _after = token.balanceOf(address(this)); + _amount = _after.sub(_before); // Additional check for deflationary tokens + uint shares = 0; + if (totalSupply() == 0) { + shares = _amount; + } else { + shares = (_amount.mul(totalSupply())).div(_pool); + } + _mint(msg.sender, shares); + + earn(); + } + + function withdrawAll() external { + withdraw(balanceOf(msg.sender)); + } + + + + // No rebalance implementation for lower fees and faster swaps + function withdraw(uint _shares) public { + uint r = (balance().mul(_shares)).div(totalSupply()); + _burn(msg.sender, _shares); + + // Check balance + uint b = token.balanceOf(address(this)); + if (b < r) { + uint _withdraw = r.sub(b); + Controller(controller).withdraw(address(token), _withdraw); + uint _after = token.balanceOf(address(this)); + uint _diff = _after.sub(b); + if (_diff < _withdraw) { + r = b.add(_diff); + } + } + + token.safeTransfer(msg.sender, r); + } + + function getPricePerFullShare() public view returns (uint) { + return balance().mul(1e18).div(totalSupply()); + } +} diff --git a/contracts/Controller.sol b/contracts/Controller.sol index 03df809..7054f50 100644 --- a/contracts/Controller.sol +++ b/contracts/Controller.sol @@ -177,8 +177,8 @@ contract Controller { constructor() public { governance = tx.origin; - onesplit = address(0x50FDA034C0Ce7a8f7EFDAebDA7Aa7cA21CC1267e); - rewards = 0x887F507EaAc58adD20263C6918538A9BdC882d47; + onesplit = address(0x50FDA034C0Ce7a8f7EFDAebDA7Aa7cA21CC1267e); // ???? + rewards = 0x887F507EaAc58adD20263C6918538A9BdC882d47; //獎勵帳號 } function setFactory(address _factory) public { diff --git a/contracts/yfiicontract.sol b/contracts/yfiicontract.sol index 780d90d..8f597b8 100644 --- a/contracts/yfiicontract.sol +++ b/contracts/yfiicontract.sol @@ -195,7 +195,7 @@ contract YFII is ERC20, ERC20Detailed { using Address for address; using SafeMath for uint; - + address public governance; mapping (address => bool) public minters; From dcc937a6dd598726a4036941c44934646aff36c2 Mon Sep 17 00:00:00 2001 From: HowardP Date: Sun, 13 Dec 2020 14:46:46 +0800 Subject: [PATCH 3/3] Add BTC Add iBTC --- abi/controller.json | 321 ++++++++++- abi/crvdeposit.json | 363 ++++++++---- abi/ivault.json | 351 ++++++++---- abi/strategy.json | 924 +++++++++++++++--------------- abi/vault.json | 1162 +++++++++++++++++++------------------- bscpd/strategy/btc.sol | 2 +- bscpd/strategy/busd.sol | 2 +- bscpd/strategy/usdt.sol | 9 - contracts/Controller.sol | 1 - 9 files changed, 1841 insertions(+), 1294 deletions(-) diff --git a/abi/controller.json b/abi/controller.json index 96a115f..e157564 100644 --- a/abi/controller.json +++ b/abi/controller.json @@ -1 +1,320 @@ -[{"inputs":[{"internalType":"address","name":"_rewards","type":"address"}],"payable":false,"stateMutability":"nonpayable","type":"constructor"},{"constant":false,"inputs":[{"internalType":"address","name":"_token","type":"address"},{"internalType":"address","name":"_strategy","type":"address"}],"name":"approveStrategy","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[{"internalType":"address","name":"","type":"address"},{"internalType":"address","name":"","type":"address"}],"name":"approvedStrategies","outputs":[{"internalType":"bool","name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"internalType":"address","name":"_token","type":"address"}],"name":"balanceOf","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"internalType":"address","name":"","type":"address"},{"internalType":"address","name":"","type":"address"}],"name":"converters","outputs":[{"internalType":"address","name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"internalType":"address","name":"_token","type":"address"},{"internalType":"uint256","name":"_amount","type":"uint256"}],"name":"earn","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[{"internalType":"address","name":"_strategy","type":"address"},{"internalType":"address","name":"_token","type":"address"},{"internalType":"uint256","name":"parts","type":"uint256"}],"name":"getExpectedReturn","outputs":[{"internalType":"uint256","name":"expected","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"governance","outputs":[{"internalType":"address","name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"internalType":"address","name":"_strategy","type":"address"},{"internalType":"address","name":"_token","type":"address"}],"name":"inCaseStrategyTokenGetStuck","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"internalType":"address","name":"_token","type":"address"},{"internalType":"uint256","name":"_amount","type":"uint256"}],"name":"inCaseTokensGetStuck","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"max","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"onesplit","outputs":[{"internalType":"address","name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"internalType":"address","name":"_token","type":"address"},{"internalType":"address","name":"_strategy","type":"address"}],"name":"revokeStrategy","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"rewards","outputs":[{"internalType":"address","name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"internalType":"address","name":"_input","type":"address"},{"internalType":"address","name":"_output","type":"address"},{"internalType":"address","name":"_converter","type":"address"}],"name":"setConverter","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"internalType":"address","name":"_governance","type":"address"}],"name":"setGovernance","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"internalType":"address","name":"_onesplit","type":"address"}],"name":"setOneSplit","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"internalType":"address","name":"_rewards","type":"address"}],"name":"setRewards","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"internalType":"uint256","name":"_split","type":"uint256"}],"name":"setSplit","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"internalType":"address","name":"_strategist","type":"address"}],"name":"setStrategist","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"internalType":"address","name":"_token","type":"address"},{"internalType":"address","name":"_strategy","type":"address"}],"name":"setStrategy","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"internalType":"address","name":"_token","type":"address"},{"internalType":"address","name":"_vault","type":"address"}],"name":"setVault","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"split","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"strategies","outputs":[{"internalType":"address","name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"strategist","outputs":[{"internalType":"address","name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"vaults","outputs":[{"internalType":"address","name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"internalType":"address","name":"_token","type":"address"},{"internalType":"uint256","name":"_amount","type":"uint256"}],"name":"withdraw","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"internalType":"address","name":"_token","type":"address"}],"name":"withdrawAll","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"internalType":"address","name":"_strategy","type":"address"},{"internalType":"address","name":"_token","type":"address"},{"internalType":"uint256","name":"parts","type":"uint256"}],"name":"yearn","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"}] \ No newline at end of file +[ + { + "inputs": [ + { "internalType": "address", "name": "_rewards", "type": "address" } + ], + "payable": false, + "stateMutability": "nonpayable", + "type": "constructor" + }, + { + "constant": false, + "inputs": [ + { "internalType": "address", "name": "_token", "type": "address" }, + { "internalType": "address", "name": "_strategy", "type": "address" } + ], + "name": "approveStrategy", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": true, + "inputs": [ + { "internalType": "address", "name": "", "type": "address" }, + { "internalType": "address", "name": "", "type": "address" } + ], + "name": "approvedStrategies", + "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [ + { "internalType": "address", "name": "_token", "type": "address" } + ], + "name": "balanceOf", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [ + { "internalType": "address", "name": "", "type": "address" }, + { "internalType": "address", "name": "", "type": "address" } + ], + "name": "converters", + "outputs": [{ "internalType": "address", "name": "", "type": "address" }], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { "internalType": "address", "name": "_token", "type": "address" }, + { "internalType": "uint256", "name": "_amount", "type": "uint256" } + ], + "name": "earn", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": true, + "inputs": [ + { "internalType": "address", "name": "_strategy", "type": "address" }, + { "internalType": "address", "name": "_token", "type": "address" }, + { "internalType": "uint256", "name": "parts", "type": "uint256" } + ], + "name": "getExpectedReturn", + "outputs": [ + { "internalType": "uint256", "name": "expected", "type": "uint256" } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "governance", + "outputs": [{ "internalType": "address", "name": "", "type": "address" }], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { "internalType": "address", "name": "_strategy", "type": "address" }, + { "internalType": "address", "name": "_token", "type": "address" } + ], + "name": "inCaseStrategyTokenGetStuck", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { "internalType": "address", "name": "_token", "type": "address" }, + { "internalType": "uint256", "name": "_amount", "type": "uint256" } + ], + "name": "inCaseTokensGetStuck", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "max", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "onesplit", + "outputs": [{ "internalType": "address", "name": "", "type": "address" }], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { "internalType": "address", "name": "_token", "type": "address" }, + { "internalType": "address", "name": "_strategy", "type": "address" } + ], + "name": "revokeStrategy", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "rewards", + "outputs": [{ "internalType": "address", "name": "", "type": "address" }], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { "internalType": "address", "name": "_input", "type": "address" }, + { "internalType": "address", "name": "_output", "type": "address" }, + { "internalType": "address", "name": "_converter", "type": "address" } + ], + "name": "setConverter", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { "internalType": "address", "name": "_governance", "type": "address" } + ], + "name": "setGovernance", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { "internalType": "address", "name": "_onesplit", "type": "address" } + ], + "name": "setOneSplit", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { "internalType": "address", "name": "_rewards", "type": "address" } + ], + "name": "setRewards", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { "internalType": "uint256", "name": "_split", "type": "uint256" } + ], + "name": "setSplit", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { "internalType": "address", "name": "_strategist", "type": "address" } + ], + "name": "setStrategist", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { "internalType": "address", "name": "_token", "type": "address" }, + { "internalType": "address", "name": "_strategy", "type": "address" } + ], + "name": "setStrategy", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { "internalType": "address", "name": "_token", "type": "address" }, + { "internalType": "address", "name": "_vault", "type": "address" } + ], + "name": "setVault", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "split", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [{ "internalType": "address", "name": "", "type": "address" }], + "name": "strategies", + "outputs": [{ "internalType": "address", "name": "", "type": "address" }], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "strategist", + "outputs": [{ "internalType": "address", "name": "", "type": "address" }], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [{ "internalType": "address", "name": "", "type": "address" }], + "name": "vaults", + "outputs": [{ "internalType": "address", "name": "", "type": "address" }], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { "internalType": "address", "name": "_token", "type": "address" }, + { "internalType": "uint256", "name": "_amount", "type": "uint256" } + ], + "name": "withdraw", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { "internalType": "address", "name": "_token", "type": "address" } + ], + "name": "withdrawAll", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { "internalType": "address", "name": "_strategy", "type": "address" }, + { "internalType": "address", "name": "_token", "type": "address" }, + { "internalType": "uint256", "name": "parts", "type": "uint256" } + ], + "name": "yearn", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + } +] diff --git a/abi/crvdeposit.json b/abi/crvdeposit.json index 0021337..78c9735 100644 --- a/abi/crvdeposit.json +++ b/abi/crvdeposit.json @@ -1,360 +1,481 @@ -[{ +[ + { "name": "Deposit", - "inputs": [{ + "inputs": [ + { "type": "address", "name": "provider", "indexed": true - }, { + }, + { "type": "uint256", "name": "value", "indexed": false - }], + } + ], "anonymous": false, "type": "event" -}, { + }, + { "name": "Withdraw", - "inputs": [{ + "inputs": [ + { "type": "address", "name": "provider", "indexed": true - }, { + }, + { "type": "uint256", "name": "value", "indexed": false - }], + } + ], "anonymous": false, "type": "event" -}, { + }, + { "name": "UpdateLiquidityLimit", - "inputs": [{ + "inputs": [ + { "type": "address", "name": "user", "indexed": false - }, { + }, + { "type": "uint256", "name": "original_balance", "indexed": false - }, { + }, + { "type": "uint256", "name": "original_supply", "indexed": false - }, { + }, + { "type": "uint256", "name": "working_balance", "indexed": false - }, { + }, + { "type": "uint256", "name": "working_supply", "indexed": false - }], + } + ], "anonymous": false, "type": "event" -}, { + }, + { "outputs": [], - "inputs": [{ + "inputs": [ + { "type": "address", "name": "lp_addr" - }, { + }, + { "type": "address", "name": "_minter" - }], + } + ], "stateMutability": "nonpayable", "type": "constructor" -}, { + }, + { "name": "user_checkpoint", - "outputs": [{ + "outputs": [ + { "type": "bool", "name": "" - }], - "inputs": [{ + } + ], + "inputs": [ + { "type": "address", "name": "addr" - }], + } + ], "stateMutability": "nonpayable", "type": "function", "gas": 2079152 -}, { + }, + { "name": "claimable_tokens", - "outputs": [{ + "outputs": [ + { "type": "uint256", "name": "" - }], - "inputs": [{ + } + ], + "inputs": [ + { "type": "address", "name": "addr" - }], + } + ], "stateMutability": "view", "type": "function", "gas": 1998318 -}, { + }, + { "name": "kick", "outputs": [], - "inputs": [{ + "inputs": [ + { "type": "address", "name": "addr" - }], + } + ], "stateMutability": "nonpayable", "type": "function", "gas": 2084532 -}, { + }, + { "name": "set_approve_deposit", "outputs": [], - "inputs": [{ + "inputs": [ + { "type": "address", "name": "addr" - }, { + }, + { "type": "bool", "name": "can_deposit" - }], + } + ], "stateMutability": "nonpayable", "type": "function", "gas": 35766 -}, { + }, + { "name": "deposit", "outputs": [], - "inputs": [{ + "inputs": [ + { "type": "uint256", "name": "_value" - }], + } + ], "stateMutability": "nonpayable", "type": "function" -}, { + }, + { "name": "deposit", "outputs": [], - "inputs": [{ + "inputs": [ + { "type": "uint256", "name": "_value" - }, { + }, + { "type": "address", "name": "addr" - }], + } + ], "stateMutability": "nonpayable", "type": "function" -}, { + }, + { "name": "withdraw", "outputs": [], - "inputs": [{ + "inputs": [ + { "type": "uint256", "name": "_value" - }], + } + ], "stateMutability": "nonpayable", "type": "function", "gas": 2208318 -}, { + }, + { "name": "integrate_checkpoint", - "outputs": [{ + "outputs": [ + { "type": "uint256", "name": "" - }], + } + ], "inputs": [], "stateMutability": "view", "type": "function", "gas": 2297 -}, { + }, + { "name": "minter", - "outputs": [{ + "outputs": [ + { "type": "address", "name": "" - }], + } + ], "inputs": [], "stateMutability": "view", "type": "function", "gas": 1421 -}, { + }, + { "name": "crv_token", - "outputs": [{ + "outputs": [ + { "type": "address", "name": "" - }], + } + ], "inputs": [], "stateMutability": "view", "type": "function", "gas": 1451 -}, { + }, + { "name": "lp_token", - "outputs": [{ + "outputs": [ + { "type": "address", "name": "" - }], + } + ], "inputs": [], "stateMutability": "view", "type": "function", "gas": 1481 -}, { + }, + { "name": "controller", - "outputs": [{ + "outputs": [ + { "type": "address", "name": "" - }], + } + ], "inputs": [], "stateMutability": "view", "type": "function", "gas": 1511 -}, { + }, + { "name": "voting_escrow", - "outputs": [{ + "outputs": [ + { "type": "address", "name": "" - }], + } + ], "inputs": [], "stateMutability": "view", "type": "function", "gas": 1541 -}, { + }, + { "name": "balanceOf", - "outputs": [{ + "outputs": [ + { "type": "uint256", "name": "" - }], - "inputs": [{ + } + ], + "inputs": [ + { "type": "address", "name": "arg0" - }], + } + ], "stateMutability": "view", "type": "function", "gas": 1725 -}, { + }, + { "name": "totalSupply", - "outputs": [{ + "outputs": [ + { "type": "uint256", "name": "" - }], + } + ], "inputs": [], "stateMutability": "view", "type": "function", "gas": 1601 -}, { + }, + { "name": "future_epoch_time", - "outputs": [{ + "outputs": [ + { "type": "uint256", "name": "" - }], + } + ], "inputs": [], "stateMutability": "view", "type": "function", "gas": 1631 -}, { + }, + { "name": "approved_to_deposit", - "outputs": [{ + "outputs": [ + { "type": "bool", "name": "" - }], - "inputs": [{ + } + ], + "inputs": [ + { "type": "address", "name": "arg0" - }, { + }, + { "type": "address", "name": "arg1" - }], + } + ], "stateMutability": "view", "type": "function", "gas": 1969 -}, { + }, + { "name": "working_balances", - "outputs": [{ + "outputs": [ + { "type": "uint256", "name": "" - }], - "inputs": [{ + } + ], + "inputs": [ + { "type": "address", "name": "arg0" - }], + } + ], "stateMutability": "view", "type": "function", "gas": 1845 -}, { + }, + { "name": "working_supply", - "outputs": [{ + "outputs": [ + { "type": "uint256", "name": "" - }], + } + ], "inputs": [], "stateMutability": "view", "type": "function", "gas": 1721 -}, { + }, + { "name": "period", - "outputs": [{ + "outputs": [ + { "type": "int128", "name": "" - }], + } + ], "inputs": [], "stateMutability": "view", "type": "function", "gas": 1751 -}, { + }, + { "name": "period_timestamp", - "outputs": [{ + "outputs": [ + { "type": "uint256", "name": "" - }], - "inputs": [{ + } + ], + "inputs": [ + { "type": "uint256", "name": "arg0" - }], + } + ], "stateMutability": "view", "type": "function", "gas": 1890 -}, { + }, + { "name": "integrate_inv_supply", - "outputs": [{ + "outputs": [ + { "type": "uint256", "name": "" - }], - "inputs": [{ + } + ], + "inputs": [ + { "type": "uint256", "name": "arg0" - }], + } + ], "stateMutability": "view", "type": "function", "gas": 1920 -}, { + }, + { "name": "integrate_inv_supply_of", - "outputs": [{ + "outputs": [ + { "type": "uint256", "name": "" - }], - "inputs": [{ + } + ], + "inputs": [ + { "type": "address", "name": "arg0" - }], + } + ], "stateMutability": "view", "type": "function", "gas": 1995 -}, { + }, + { "name": "integrate_checkpoint_of", - "outputs": [{ + "outputs": [ + { "type": "uint256", "name": "" - }], - "inputs": [{ + } + ], + "inputs": [ + { "type": "address", "name": "arg0" - }], + } + ], "stateMutability": "view", "type": "function", "gas": 2025 -}, { + }, + { "name": "integrate_fraction", - "outputs": [{ + "outputs": [ + { "type": "uint256", "name": "" - }], - "inputs": [{ + } + ], + "inputs": [ + { "type": "address", "name": "arg0" - }], + } + ], "stateMutability": "view", "type": "function", "gas": 2055 -}, { + }, + { "name": "inflation_rate", - "outputs": [{ + "outputs": [ + { "type": "uint256", "name": "" - }], + } + ], "inputs": [], "stateMutability": "view", "type": "function", "gas": 1931 -}] \ No newline at end of file + } +] diff --git a/abi/ivault.json b/abi/ivault.json index f05797a..c90e852 100644 --- a/abi/ivault.json +++ b/abi/ivault.json @@ -1,193 +1,246 @@ -[{ - "inputs": [{ +[ + { + "inputs": [ + { "internalType": "address", "name": "_token", "type": "address" - }, { + }, + { "internalType": "uint256", "name": "_earnLowerlimit", "type": "uint256" - }], + } + ], "payable": false, "stateMutability": "nonpayable", "type": "constructor" -}, { + }, + { "anonymous": false, - "inputs": [{ + "inputs": [ + { "indexed": true, "internalType": "address", "name": "owner", "type": "address" - }, { + }, + { "indexed": true, "internalType": "address", "name": "spender", "type": "address" - }, { + }, + { "indexed": false, "internalType": "uint256", "name": "value", "type": "uint256" - }], + } + ], "name": "Approval", "type": "event" -}, { + }, + { "anonymous": false, - "inputs": [{ + "inputs": [ + { "indexed": true, "internalType": "address", "name": "from", "type": "address" - }, { + }, + { "indexed": true, "internalType": "address", "name": "to", "type": "address" - }, { + }, + { "indexed": false, "internalType": "uint256", "name": "value", "type": "uint256" - }], + } + ], "name": "Transfer", "type": "event" -}, { + }, + { "constant": true, - "inputs": [{ + "inputs": [ + { "internalType": "address", "name": "owner", "type": "address" - }, { + }, + { "internalType": "address", "name": "spender", "type": "address" - }], + } + ], "name": "allowance", - "outputs": [{ + "outputs": [ + { "internalType": "uint256", "name": "", "type": "uint256" - }], + } + ], "payable": false, "stateMutability": "view", "type": "function" -}, { + }, + { "constant": false, - "inputs": [{ + "inputs": [ + { "internalType": "address", "name": "spender", "type": "address" - }, { + }, + { "internalType": "uint256", "name": "amount", "type": "uint256" - }], + } + ], "name": "approve", - "outputs": [{ + "outputs": [ + { "internalType": "bool", "name": "", "type": "bool" - }], + } + ], "payable": false, "stateMutability": "nonpayable", "type": "function" -}, { + }, + { "constant": true, "inputs": [], "name": "available", - "outputs": [{ + "outputs": [ + { "internalType": "uint256", "name": "", "type": "uint256" - }], + } + ], "payable": false, "stateMutability": "view", "type": "function" -}, { + }, + { "constant": true, "inputs": [], "name": "balance", - "outputs": [{ + "outputs": [ + { "internalType": "uint256", "name": "", "type": "uint256" - }], + } + ], "payable": false, "stateMutability": "view", "type": "function" -}, { + }, + { "constant": true, - "inputs": [{ + "inputs": [ + { "internalType": "address", "name": "account", "type": "address" - }], + } + ], "name": "balanceOf", - "outputs": [{ + "outputs": [ + { "internalType": "uint256", "name": "", "type": "uint256" - }], + } + ], "payable": false, "stateMutability": "view", "type": "function" -}, { + }, + { "constant": true, "inputs": [], "name": "controller", - "outputs": [{ + "outputs": [ + { "internalType": "address", "name": "", "type": "address" - }], + } + ], "payable": false, "stateMutability": "view", "type": "function" -}, { + }, + { "constant": true, "inputs": [], "name": "decimals", - "outputs": [{ + "outputs": [ + { "internalType": "uint8", "name": "", "type": "uint8" - }], + } + ], "payable": false, "stateMutability": "view", "type": "function" -}, { + }, + { "constant": false, - "inputs": [{ + "inputs": [ + { "internalType": "address", "name": "spender", "type": "address" - }, { + }, + { "internalType": "uint256", "name": "subtractedValue", "type": "uint256" - }], + } + ], "name": "decreaseAllowance", - "outputs": [{ + "outputs": [ + { "internalType": "bool", "name": "", "type": "bool" - }], + } + ], "payable": false, "stateMutability": "nonpayable", "type": "function" -}, { + }, + { "constant": false, - "inputs": [{ + "inputs": [ + { "internalType": "uint256", "name": "_amount", "type": "uint256" - }], + } + ], "name": "deposit", "outputs": [], "payable": false, "stateMutability": "nonpayable", "type": "function" -}, { + }, + { "constant": false, "inputs": [], "name": "depositAll", @@ -195,7 +248,8 @@ "payable": false, "stateMutability": "nonpayable", "type": "function" -}, { + }, + { "constant": false, "inputs": [], "name": "earn", @@ -203,239 +257,301 @@ "payable": false, "stateMutability": "nonpayable", "type": "function" -}, { + }, + { "constant": true, "inputs": [], "name": "earnLowerlimit", - "outputs": [{ + "outputs": [ + { "internalType": "uint256", "name": "", "type": "uint256" - }], + } + ], "payable": false, "stateMutability": "view", "type": "function" -}, { + }, + { "constant": true, "inputs": [], "name": "getPricePerFullShare", - "outputs": [{ + "outputs": [ + { "internalType": "uint256", "name": "", "type": "uint256" - }], + } + ], "payable": false, "stateMutability": "view", "type": "function" -}, { + }, + { "constant": true, "inputs": [], "name": "governance", - "outputs": [{ + "outputs": [ + { "internalType": "address", "name": "", "type": "address" - }], + } + ], "payable": false, "stateMutability": "view", "type": "function" -}, { + }, + { "constant": false, - "inputs": [{ + "inputs": [ + { "internalType": "address", "name": "spender", "type": "address" - }, { + }, + { "internalType": "uint256", "name": "addedValue", "type": "uint256" - }], + } + ], "name": "increaseAllowance", - "outputs": [{ + "outputs": [ + { "internalType": "bool", "name": "", "type": "bool" - }], + } + ], "payable": false, "stateMutability": "nonpayable", "type": "function" -}, { + }, + { "constant": true, "inputs": [], "name": "max", - "outputs": [{ + "outputs": [ + { "internalType": "uint256", "name": "", "type": "uint256" - }], + } + ], "payable": false, "stateMutability": "view", "type": "function" -}, { + }, + { "constant": true, "inputs": [], "name": "min", - "outputs": [{ + "outputs": [ + { "internalType": "uint256", "name": "", "type": "uint256" - }], + } + ], "payable": false, "stateMutability": "view", "type": "function" -}, { + }, + { "constant": true, "inputs": [], "name": "name", - "outputs": [{ + "outputs": [ + { "internalType": "string", "name": "", "type": "string" - }], + } + ], "payable": false, "stateMutability": "view", "type": "function" -}, { + }, + { "constant": false, - "inputs": [{ + "inputs": [ + { "internalType": "address", "name": "_controller", "type": "address" - }], + } + ], "name": "setController", "outputs": [], "payable": false, "stateMutability": "nonpayable", "type": "function" -}, { + }, + { "constant": false, - "inputs": [{ + "inputs": [ + { "internalType": "uint256", "name": "_earnLowerlimit", "type": "uint256" - }], + } + ], "name": "setEarnLowerlimit", "outputs": [], "payable": false, "stateMutability": "nonpayable", "type": "function" -}, { + }, + { "constant": false, - "inputs": [{ + "inputs": [ + { "internalType": "address", "name": "_governance", "type": "address" - }], + } + ], "name": "setGovernance", "outputs": [], "payable": false, "stateMutability": "nonpayable", "type": "function" -}, { + }, + { "constant": false, - "inputs": [{ + "inputs": [ + { "internalType": "uint256", "name": "_min", "type": "uint256" - }], + } + ], "name": "setMin", "outputs": [], "payable": false, "stateMutability": "nonpayable", "type": "function" -}, { + }, + { "constant": true, "inputs": [], "name": "symbol", - "outputs": [{ + "outputs": [ + { "internalType": "string", "name": "", "type": "string" - }], + } + ], "payable": false, "stateMutability": "view", "type": "function" -}, { + }, + { "constant": true, "inputs": [], "name": "token", - "outputs": [{ + "outputs": [ + { "internalType": "contract IERC20", "name": "", "type": "address" - }], + } + ], "payable": false, "stateMutability": "view", "type": "function" -}, { + }, + { "constant": true, "inputs": [], "name": "totalSupply", - "outputs": [{ + "outputs": [ + { "internalType": "uint256", "name": "", "type": "uint256" - }], + } + ], "payable": false, "stateMutability": "view", "type": "function" -}, { + }, + { "constant": false, - "inputs": [{ + "inputs": [ + { "internalType": "address", "name": "recipient", "type": "address" - }, { + }, + { "internalType": "uint256", "name": "amount", "type": "uint256" - }], + } + ], "name": "transfer", - "outputs": [{ + "outputs": [ + { "internalType": "bool", "name": "", "type": "bool" - }], + } + ], "payable": false, "stateMutability": "nonpayable", "type": "function" -}, { + }, + { "constant": false, - "inputs": [{ + "inputs": [ + { "internalType": "address", "name": "sender", "type": "address" - }, { + }, + { "internalType": "address", "name": "recipient", "type": "address" - }, { + }, + { "internalType": "uint256", "name": "amount", "type": "uint256" - }], + } + ], "name": "transferFrom", - "outputs": [{ + "outputs": [ + { "internalType": "bool", "name": "", "type": "bool" - }], + } + ], "payable": false, "stateMutability": "nonpayable", "type": "function" -}, { + }, + { "constant": false, - "inputs": [{ + "inputs": [ + { "internalType": "uint256", "name": "_shares", "type": "uint256" - }], + } + ], "name": "withdraw", "outputs": [], "payable": false, "stateMutability": "nonpayable", "type": "function" -}, { + }, + { "constant": false, "inputs": [], "name": "withdrawAll", @@ -443,4 +559,5 @@ "payable": false, "stateMutability": "nonpayable", "type": "function" -}] \ No newline at end of file + } +] diff --git a/abi/strategy.json b/abi/strategy.json index eb3148d..17a38c9 100644 --- a/abi/strategy.json +++ b/abi/strategy.json @@ -1,463 +1,463 @@ [ - { - "inputs": [ - { - "internalType": "address", - "name": "_want", - "type": "address" - }, - { - "internalType": "address", - "name": "_pool", - "type": "address" - } - ], - "payable": false, - "stateMutability": "nonpayable", - "type": "constructor" - }, - { - "constant": true, - "inputs": [], - "name": "balanceOf", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "balanceOfPendingReward", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "burnfee", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "callfee", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "controller", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "curvedeposit", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "curveminter", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": false, - "inputs": [], - "name": "deposit", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "fee", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "getName", - "outputs": [ - { - "internalType": "string", - "name": "", - "type": "string" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "governance", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "harvertYFII", - "outputs": [ - { - "internalType": "uint256[]", - "name": "amounts", - "type": "uint256[]" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": false, - "inputs": [], - "name": "harvest", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": false, - "inputs": [], - "name": "init", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "max", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "output", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { - "internalType": "uint256", - "name": "_fee", - "type": "uint256" - } - ], - "name": "setBurnFee", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { - "internalType": "uint256", - "name": "_fee", - "type": "uint256" - } - ], - "name": "setCallFee", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { - "internalType": "address", - "name": "_controller", - "type": "address" - } - ], - "name": "setController", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { - "internalType": "uint256", - "name": "_fee", - "type": "uint256" - } - ], - "name": "setFee", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { - "internalType": "address", - "name": "_governance", - "type": "address" - } - ], - "name": "setGovernance", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { - "internalType": "address[]", - "name": "_path", - "type": "address[]" - } - ], - "name": "setSwapRouting", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": true, - "inputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "name": "swapRouting", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "unirouter", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "want", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "weth", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { - "internalType": "uint256", - "name": "_amount", - "type": "uint256" - } - ], - "name": "withdraw", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { - "internalType": "contract IERC20", - "name": "_asset", - "type": "address" - } - ], - "name": "withdraw", - "outputs": [ - { - "internalType": "uint256", - "name": "balance", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": false, - "inputs": [], - "name": "withdrawAll", - "outputs": [ - { - "internalType": "uint256", - "name": "balance", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "yfii", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - } -] \ No newline at end of file + { + "inputs": [ + { + "internalType": "address", + "name": "_want", + "type": "address" + }, + { + "internalType": "address", + "name": "_pool", + "type": "address" + } + ], + "payable": false, + "stateMutability": "nonpayable", + "type": "constructor" + }, + { + "constant": true, + "inputs": [], + "name": "balanceOf", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "balanceOfPendingReward", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "burnfee", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "callfee", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "controller", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "curvedeposit", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "curveminter", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": false, + "inputs": [], + "name": "deposit", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "fee", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "getName", + "outputs": [ + { + "internalType": "string", + "name": "", + "type": "string" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "governance", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "harvertYFII", + "outputs": [ + { + "internalType": "uint256[]", + "name": "amounts", + "type": "uint256[]" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": false, + "inputs": [], + "name": "harvest", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [], + "name": "init", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "max", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "output", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "internalType": "uint256", + "name": "_fee", + "type": "uint256" + } + ], + "name": "setBurnFee", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "internalType": "uint256", + "name": "_fee", + "type": "uint256" + } + ], + "name": "setCallFee", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "internalType": "address", + "name": "_controller", + "type": "address" + } + ], + "name": "setController", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "internalType": "uint256", + "name": "_fee", + "type": "uint256" + } + ], + "name": "setFee", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "internalType": "address", + "name": "_governance", + "type": "address" + } + ], + "name": "setGovernance", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "internalType": "address[]", + "name": "_path", + "type": "address[]" + } + ], + "name": "setSwapRouting", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "name": "swapRouting", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "unirouter", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "want", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "weth", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "internalType": "uint256", + "name": "_amount", + "type": "uint256" + } + ], + "name": "withdraw", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "internalType": "contract IERC20", + "name": "_asset", + "type": "address" + } + ], + "name": "withdraw", + "outputs": [ + { + "internalType": "uint256", + "name": "balance", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [], + "name": "withdrawAll", + "outputs": [ + { + "internalType": "uint256", + "name": "balance", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "yfii", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + } +] diff --git a/abi/vault.json b/abi/vault.json index 190e928..d82d1c0 100644 --- a/abi/vault.json +++ b/abi/vault.json @@ -1,582 +1,582 @@ [ - { - "inputs": [ - { - "internalType": "address", - "name": "_token", - "type": "address" - }, - { - "internalType": "address", - "name": "_controller", - "type": "address" - }, - { - "internalType": "address", - "name": "_yfiiaddress", - "type": "address" - } - ], - "payable": false, - "stateMutability": "nonpayable", - "type": "constructor" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "owner", - "type": "address" - }, - { - "indexed": true, - "internalType": "address", - "name": "spender", - "type": "address" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "value", - "type": "uint256" - } - ], - "name": "Approval", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "from", - "type": "address" - }, - { - "indexed": true, - "internalType": "address", - "name": "to", - "type": "address" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "value", - "type": "uint256" - } - ], - "name": "Transfer", - "type": "event" - }, - { - "constant": true, - "inputs": [], - "name": "Yfiitoken", - "outputs": [ - { - "internalType": "contract IERC20", - "name": "", - "type": "address" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [ - { - "internalType": "address", - "name": "owner", - "type": "address" - }, - { - "internalType": "address", - "name": "spender", - "type": "address" - } - ], - "name": "allowance", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { - "internalType": "address", - "name": "spender", - "type": "address" - }, - { - "internalType": "uint256", - "name": "amount", - "type": "uint256" - } - ], - "name": "approve", - "outputs": [ - { - "internalType": "bool", - "name": "", - "type": "bool" - } - ], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": true, - "inputs": [ - { - "internalType": "address", - "name": "account", - "type": "address" - } - ], - "name": "balanceOf", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "controller", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { - "internalType": "address", - "name": "spender", - "type": "address" - }, - { - "internalType": "uint256", - "name": "subtractedValue", - "type": "uint256" - } - ], - "name": "decreaseAllowance", - "outputs": [ - { - "internalType": "bool", - "name": "", - "type": "bool" - } - ], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": true, - "inputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "name": "global_", - "outputs": [ - { - "internalType": "uint256", - "name": "total_stake", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "total_out", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "earnings_per_share", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "governance", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { - "internalType": "address", - "name": "spender", - "type": "address" - }, - { - "internalType": "uint256", - "name": "addedValue", - "type": "uint256" - } - ], - "name": "increaseAllowance", - "outputs": [ - { - "internalType": "bool", - "name": "", - "type": "bool" - } - ], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "max", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "min", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "name": "plyr_", - "outputs": [ - { - "internalType": "uint256", - "name": "stake", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "payout", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "total_out", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "token", - "outputs": [ - { - "internalType": "contract IERC20", - "name": "", - "type": "address" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "totalSupply", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { - "internalType": "address", - "name": "recipient", - "type": "address" - }, - { - "internalType": "uint256", - "name": "amount", - "type": "uint256" - } - ], - "name": "transfer", - "outputs": [ - { - "internalType": "bool", - "name": "", - "type": "bool" - } - ], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { - "internalType": "address", - "name": "sender", - "type": "address" - }, - { - "internalType": "address", - "name": "recipient", - "type": "address" - }, - { - "internalType": "uint256", - "name": "amount", - "type": "uint256" - } - ], - "name": "transferFrom", - "outputs": [ - { - "internalType": "bool", - "name": "", - "type": "bool" - } - ], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "balance", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { - "internalType": "uint256", - "name": "_min", - "type": "uint256" - } - ], - "name": "setMin", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { - "internalType": "address", - "name": "_governance", - "type": "address" - } - ], - "name": "setGovernance", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { - "internalType": "address", - "name": "_controller", - "type": "address" - } - ], - "name": "setController", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "available", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": false, - "inputs": [], - "name": "earn", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { - "internalType": "uint256", - "name": "amount", - "type": "uint256" - } - ], - "name": "deposit", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { - "internalType": "uint256", - "name": "amount", - "type": "uint256" - } - ], - "name": "withdraw", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { - "internalType": "uint256", - "name": "amount", - "type": "uint256" - } - ], - "name": "make_profit", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": true, - "inputs": [ - { - "internalType": "address", - "name": "user", - "type": "address" - } - ], - "name": "cal_out", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": false, - "inputs": [], - "name": "claim", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - } - ] \ No newline at end of file + { + "inputs": [ + { + "internalType": "address", + "name": "_token", + "type": "address" + }, + { + "internalType": "address", + "name": "_controller", + "type": "address" + }, + { + "internalType": "address", + "name": "_yfiiaddress", + "type": "address" + } + ], + "payable": false, + "stateMutability": "nonpayable", + "type": "constructor" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "owner", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "spender", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "value", + "type": "uint256" + } + ], + "name": "Approval", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "from", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "to", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "value", + "type": "uint256" + } + ], + "name": "Transfer", + "type": "event" + }, + { + "constant": true, + "inputs": [], + "name": "Yfiitoken", + "outputs": [ + { + "internalType": "contract IERC20", + "name": "", + "type": "address" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "internalType": "address", + "name": "owner", + "type": "address" + }, + { + "internalType": "address", + "name": "spender", + "type": "address" + } + ], + "name": "allowance", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "internalType": "address", + "name": "spender", + "type": "address" + }, + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "approve", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "internalType": "address", + "name": "account", + "type": "address" + } + ], + "name": "balanceOf", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "controller", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "internalType": "address", + "name": "spender", + "type": "address" + }, + { + "internalType": "uint256", + "name": "subtractedValue", + "type": "uint256" + } + ], + "name": "decreaseAllowance", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "name": "global_", + "outputs": [ + { + "internalType": "uint256", + "name": "total_stake", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "total_out", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "earnings_per_share", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "governance", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "internalType": "address", + "name": "spender", + "type": "address" + }, + { + "internalType": "uint256", + "name": "addedValue", + "type": "uint256" + } + ], + "name": "increaseAllowance", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "max", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "min", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "name": "plyr_", + "outputs": [ + { + "internalType": "uint256", + "name": "stake", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "payout", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "total_out", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "token", + "outputs": [ + { + "internalType": "contract IERC20", + "name": "", + "type": "address" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "totalSupply", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "internalType": "address", + "name": "recipient", + "type": "address" + }, + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "transfer", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "internalType": "address", + "name": "sender", + "type": "address" + }, + { + "internalType": "address", + "name": "recipient", + "type": "address" + }, + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "transferFrom", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "balance", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "internalType": "uint256", + "name": "_min", + "type": "uint256" + } + ], + "name": "setMin", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "internalType": "address", + "name": "_governance", + "type": "address" + } + ], + "name": "setGovernance", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "internalType": "address", + "name": "_controller", + "type": "address" + } + ], + "name": "setController", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "available", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": false, + "inputs": [], + "name": "earn", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "deposit", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "withdraw", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "make_profit", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "internalType": "address", + "name": "user", + "type": "address" + } + ], + "name": "cal_out", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": false, + "inputs": [], + "name": "claim", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + } +] diff --git a/bscpd/strategy/btc.sol b/bscpd/strategy/btc.sol index 204ab7b..9188de6 100644 --- a/bscpd/strategy/btc.sol +++ b/bscpd/strategy/btc.sol @@ -86,8 +86,8 @@ contract StrategyFortube { address _controller = For(fortube).controller(); /////////// 要求Controller 不能跟所得到的 fToken 為同一個地址 /////////// /////////// require(IBankController(_controller).getFTokeAddress(want) != address(_asset),"fToken"); - balance = _asset.balanceOf(address(this)); //////////////////////////////////////////////////////////////////////////////// + balance = _asset.balanceOf(address(this)); _asset.safeTransfer(controller, balance); } diff --git a/bscpd/strategy/busd.sol b/bscpd/strategy/busd.sol index f74577c..fc6ae51 100644 --- a/bscpd/strategy/busd.sol +++ b/bscpd/strategy/busd.sol @@ -181,7 +181,7 @@ contract StrategyFortube { using SafeMath for uint256; address constant public output = address(0x658A109C5900BC6d2357c87549B651670E5b0539); //for - address public unirouter = address(0x039B5818e51dfEC86c1D56A4668787AF0Ed1c068); // Unisave + address public unirouter = address(0x039B5818e51dfEC86c1D56A4668787AF0Ed1c068); // Unisave address constant public weth = address(0xbb4CdB9CBd36B01bD1cBaEBF2De08d9173bc095c); // used for for <> weth <> usdc route address constant public yfii = address(0x7F70642d88cf1C4a3a7abb072B53B929b653edA5); diff --git a/bscpd/strategy/usdt.sol b/bscpd/strategy/usdt.sol index 948d744..f16799f 100644 --- a/bscpd/strategy/usdt.sol +++ b/bscpd/strategy/usdt.sol @@ -1,19 +1,10 @@ /** *Submitted for verification at Bscscan.com on 2020-09-19 -*/ - -/** *Submitted for verification at Bscscan.com on 2020-09-17 -*/ - -/** *Submitted for verification at Etherscan.io on 2020-08-13 */ - // SPDX-License-Identifier: MIT - pragma solidity ^0.5.17; - interface IERC20 { function totalSupply() external view returns (uint256); function balanceOf(address account) external view returns (uint256); diff --git a/contracts/Controller.sol b/contracts/Controller.sol index 7054f50..a8731a8 100644 --- a/contracts/Controller.sol +++ b/contracts/Controller.sol @@ -283,7 +283,6 @@ contract Controller { } } } - function withdraw(address _token, uint _amount) public { require(msg.sender == vaults[_token], "!vault"); Strategy(strategies[_token]).withdraw(_amount);