Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

set wd fee to 0 on all bsc strats #61

Merged
merged 1 commit into from
Jan 28, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion great_ape_safe/great_ape_safe.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

interface.ERC20 doesnt work, because brownie will then also interpret lp tokens as an ERC20, thus excluding the lp methods.

except:
token = Contract.from_explorer(token) if type(token) != Contract else token
if token.address not in df['address']:
Expand Down
10 changes: 9 additions & 1 deletion helpers/addresses.py
Original file line number Diff line number Diff line change
Expand Up @@ -436,6 +436,11 @@
"bcakebBadgerBtcb": "0x857F91f735f4B03b19D2b5c6E476C73DB8241F55",
"bcakebDiggBtcb": "0xa861Ba302674b08f7F2F24381b705870521DDfed",
},
"strategies": {
"cakeBnbBtcb": "0x120BB9F87bAB3C49b89c7745eDC07FED50786534",
"cakeBdiggBtcbV2": "0xC8C53A293edca5a0146d713b9b95b0cd0a2e5ca4",
"cakeBbadgerBtcbV2": "0x2A842e01724F10d093aE8a46A01e66DbCf3C7373",
},
"coingecko_tokens": {
"badger-dao": "0x753fbc5800a8C8e3Fb6DC6415810d627A387Dfc9",
"badger-sett-badger": "0x1F7216fdB338247512Ec99715587bb97BBf96eae",
Expand All @@ -447,7 +452,10 @@
'airdropable_tokens': {
'EPS': "0xA7f552078dcC247C2684336020c03648500C6d9F"
},
"pancakeswap_routerV2": "0x10ED43C718714eb63d5aA57B78B54704E256024E"
"pancakeswap": {
"router_v1": "0x05fF2B0DB69458A0750badebc4f9e13aDd608C7F",
"router_v2": "0x10ED43C718714eb63d5aA57B78B54704E256024E",
},
}

ADDRESSES_POLYGON = {
Expand Down
40 changes: 40 additions & 0 deletions interfaces/badger/IStrategy.sol
Original file line number Diff line number Diff line change
@@ -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;
}
95 changes: 95 additions & 0 deletions interfaces/pancake/IPancakeRouter01.sol
Original file line number Diff line number Diff line change
@@ -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);
}
44 changes: 44 additions & 0 deletions interfaces/pancake/IPancakeRouter02.sol
Original file line number Diff line number Diff line change
@@ -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;
}
15 changes: 15 additions & 0 deletions scripts/issue/58/disable_wd_fees_bsc.py
Original file line number Diff line number Diff line change
@@ -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()