From 90e648e61d2e729f06a08a5fe2a254f026044429 Mon Sep 17 00:00:00 2001 From: jorijnsmit Date: Fri, 28 Jan 2022 16:35:00 +0000 Subject: [PATCH] set wd fee to 0 on all bsc strats --- great_ape_safe/great_ape_safe.py | 2 +- helpers/addresses.py | 10 ++- interfaces/badger/IStrategy.sol | 40 +++++++++++ interfaces/pancake/IPancakeRouter01.sol | 95 +++++++++++++++++++++++++ interfaces/pancake/IPancakeRouter02.sol | 44 ++++++++++++ scripts/issue/58/disable_wd_fees_bsc.py | 15 ++++ 6 files changed, 204 insertions(+), 2 deletions(-) create mode 100644 interfaces/badger/IStrategy.sol create mode 100644 interfaces/pancake/IPancakeRouter01.sol create mode 100644 interfaces/pancake/IPancakeRouter02.sol create mode 100644 scripts/issue/58/disable_wd_fees_bsc.py diff --git a/great_ape_safe/great_ape_safe.py b/great_ape_safe/great_ape_safe.py index 40e1b890..23396e46 100644 --- a/great_ape_safe/great_ape_safe.py +++ b/great_ape_safe/great_ape_safe.py @@ -79,7 +79,7 @@ def take_snapshot(self, tokens): df['decimals'].append(18) for token in tqdm(tokens): try: - token = interface.ERC20(token) if type(token) != Contract else token + token = Contract(token) if type(token) != Contract else token except: token = Contract.from_explorer(token) if type(token) != Contract else token if token.address not in df['address']: diff --git a/helpers/addresses.py b/helpers/addresses.py index 324bd8aa..edff741f 100644 --- a/helpers/addresses.py +++ b/helpers/addresses.py @@ -436,6 +436,11 @@ "bcakebBadgerBtcb": "0x857F91f735f4B03b19D2b5c6E476C73DB8241F55", "bcakebDiggBtcb": "0xa861Ba302674b08f7F2F24381b705870521DDfed", }, + "strategies": { + "cakeBnbBtcb": "0x120BB9F87bAB3C49b89c7745eDC07FED50786534", + "cakeBdiggBtcbV2": "0xC8C53A293edca5a0146d713b9b95b0cd0a2e5ca4", + "cakeBbadgerBtcbV2": "0x2A842e01724F10d093aE8a46A01e66DbCf3C7373", + }, "coingecko_tokens": { "badger-dao": "0x753fbc5800a8C8e3Fb6DC6415810d627A387Dfc9", "badger-sett-badger": "0x1F7216fdB338247512Ec99715587bb97BBf96eae", @@ -447,7 +452,10 @@ 'airdropable_tokens': { 'EPS': "0xA7f552078dcC247C2684336020c03648500C6d9F" }, - "pancakeswap_routerV2": "0x10ED43C718714eb63d5aA57B78B54704E256024E" + "pancakeswap": { + "router_v1": "0x05fF2B0DB69458A0750badebc4f9e13aDd608C7F", + "router_v2": "0x10ED43C718714eb63d5aA57B78B54704E256024E", + }, } ADDRESSES_POLYGON = { diff --git a/interfaces/badger/IStrategy.sol b/interfaces/badger/IStrategy.sol new file mode 100644 index 00000000..bee07b37 --- /dev/null +++ b/interfaces/badger/IStrategy.sol @@ -0,0 +1,40 @@ +// SPDX-License-Identifier: MIT +pragma solidity >=0.5.0 <0.8.0; + +interface IStrategy { + function want() external view returns (address); + + function deposit() external; + + // NOTE: must exclude any tokens used in the yield + // Controller role - withdraw should return to Controller + function withdrawOther(address) external returns (uint256 balance); + + // Controller | Vault role - withdraw should always return to Vault + function withdraw(uint256) external; + + // Controller | Vault role - withdraw should always return to Vault + function withdrawAll() external returns (uint256); + + function balanceOf() external view returns (uint256); + + function getName() external pure returns (string memory); + + function setStrategist(address _strategist) external; + + function setWithdrawalFee(uint256 _withdrawalFee) external; + + function setPerformanceFeeStrategist(uint256 _performanceFeeStrategist) + external; + + function setPerformanceFeeGovernance(uint256 _performanceFeeGovernance) + external; + + function setGovernance(address _governance) external; + + function setController(address _controller) external; + + function tend() external; + + function harvest() external; +} diff --git a/interfaces/pancake/IPancakeRouter01.sol b/interfaces/pancake/IPancakeRouter01.sol new file mode 100644 index 00000000..032a2c46 --- /dev/null +++ b/interfaces/pancake/IPancakeRouter01.sol @@ -0,0 +1,95 @@ +pragma solidity >=0.6.2; + +interface IPancakeRouter01 { + function factory() external pure returns (address); + function WETH() external pure returns (address); + + function addLiquidity( + address tokenA, + address tokenB, + uint amountADesired, + uint amountBDesired, + uint amountAMin, + uint amountBMin, + address to, + uint deadline + ) external returns (uint amountA, uint amountB, uint liquidity); + function addLiquidityETH( + address token, + uint amountTokenDesired, + uint amountTokenMin, + uint amountETHMin, + address to, + uint deadline + ) external payable returns (uint amountToken, uint amountETH, uint liquidity); + function removeLiquidity( + address tokenA, + address tokenB, + uint liquidity, + uint amountAMin, + uint amountBMin, + address to, + uint deadline + ) external returns (uint amountA, uint amountB); + function removeLiquidityETH( + address token, + uint liquidity, + uint amountTokenMin, + uint amountETHMin, + address to, + uint deadline + ) external returns (uint amountToken, uint amountETH); + function removeLiquidityWithPermit( + address tokenA, + address tokenB, + uint liquidity, + uint amountAMin, + uint amountBMin, + address to, + uint deadline, + bool approveMax, uint8 v, bytes32 r, bytes32 s + ) external returns (uint amountA, uint amountB); + function removeLiquidityETHWithPermit( + address token, + uint liquidity, + uint amountTokenMin, + uint amountETHMin, + address to, + uint deadline, + bool approveMax, uint8 v, bytes32 r, bytes32 s + ) external returns (uint amountToken, uint amountETH); + function swapExactTokensForTokens( + uint amountIn, + uint amountOutMin, + address[] calldata path, + address to, + uint deadline + ) external returns (uint[] memory amounts); + function swapTokensForExactTokens( + uint amountOut, + uint amountInMax, + address[] calldata path, + address to, + uint deadline + ) external returns (uint[] memory amounts); + function swapExactETHForTokens(uint amountOutMin, address[] calldata path, address to, uint deadline) + external + payable + returns (uint[] memory amounts); + function swapTokensForExactETH(uint amountOut, uint amountInMax, address[] calldata path, address to, uint deadline) + external + returns (uint[] memory amounts); + function swapExactTokensForETH(uint amountIn, uint amountOutMin, address[] calldata path, address to, uint deadline) + external + returns (uint[] memory amounts); + function swapETHForExactTokens(uint amountOut, address[] calldata path, address to, uint deadline) + external + payable + returns (uint[] memory amounts); + + function quote(uint amountA, uint reserveA, uint reserveB) external pure returns (uint amountB); + function getAmountOut(uint amountIn, uint reserveIn, uint reserveOut) external pure returns (uint amountOut); + function getAmountIn(uint amountOut, uint reserveIn, uint reserveOut) external pure returns (uint amountIn); + function getAmountsOut(uint amountIn, address[] calldata path) external view returns (uint[] memory amounts); + function getAmountsIn(uint amountOut, address[] calldata path) external view returns (uint[] memory amounts); +} diff --git a/interfaces/pancake/IPancakeRouter02.sol b/interfaces/pancake/IPancakeRouter02.sol new file mode 100644 index 00000000..a5a1a8ba --- /dev/null +++ b/interfaces/pancake/IPancakeRouter02.sol @@ -0,0 +1,44 @@ +pragma solidity >=0.6.2; + +import './IPancakeRouter01.sol'; + +interface IPancakeRouter02 is IPancakeRouter01 { + function removeLiquidityETHSupportingFeeOnTransferTokens( + address token, + uint liquidity, + uint amountTokenMin, + uint amountETHMin, + address to, + uint deadline + ) external returns (uint amountETH); + function removeLiquidityETHWithPermitSupportingFeeOnTransferTokens( + address token, + uint liquidity, + uint amountTokenMin, + uint amountETHMin, + address to, + uint deadline, + bool approveMax, uint8 v, bytes32 r, bytes32 s + ) external returns (uint amountETH); + + function swapExactTokensForTokensSupportingFeeOnTransferTokens( + uint amountIn, + uint amountOutMin, + address[] calldata path, + address to, + uint deadline + ) external; + function swapExactETHForTokensSupportingFeeOnTransferTokens( + uint amountOutMin, + address[] calldata path, + address to, + uint deadline + ) external payable; + function swapExactTokensForETHSupportingFeeOnTransferTokens( + uint amountIn, + uint amountOutMin, + address[] calldata path, + address to, + uint deadline + ) external; +} diff --git a/scripts/issue/58/disable_wd_fees_bsc.py b/scripts/issue/58/disable_wd_fees_bsc.py new file mode 100644 index 00000000..f489038e --- /dev/null +++ b/scripts/issue/58/disable_wd_fees_bsc.py @@ -0,0 +1,15 @@ +from brownie import interface + +from great_ape_safe import GreatApeSafe +from helpers.addresses import registry + + +def main(): + """ + set withdrawal fees to 0 on all three bsc setts + """ + ops = GreatApeSafe(registry.bsc.badger_wallets.ops_multisig) + for addr in registry.bsc.strategies.values(): + strat = interface.IStrategy(addr, owner=ops.account) + strat.setWithdrawalFee(0) + ops.post_safe_tx()