Skip to content

Commit

Permalink
Whitelist Quickswap by default on Polygon
Browse files Browse the repository at this point in the history
  • Loading branch information
miohtama committed Mar 22, 2024
1 parent b00d54a commit 0917563
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
6 changes: 3 additions & 3 deletions eth_defi/enzyme/generic_adapter_vault.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
from eth_defi.hotwallet import HotWallet
from eth_defi.token import TokenDetails, fetch_erc20_details
from eth_defi.trace import assert_transaction_success_with_explanation
from eth_defi.uniswap_v2.constants import UNISWAP_V2_DEPLOYMENTS
from eth_defi.uniswap_v2.constants import UNISWAP_V2_DEPLOYMENTS, QUICKSWAP_DEPLOYMENTS
from eth_defi.uniswap_v2.utils import ZERO_ADDRESS
from eth_defi.uniswap_v3.constants import UNISWAP_V3_DEPLOYMENTS

Expand Down Expand Up @@ -293,7 +293,7 @@ def deploy_vault_with_generic_adapter(
match web3.eth.chain_id:
case 137:
uniswap_v3_router = UNISWAP_V3_DEPLOYMENTS["polygon"]["router"]
uniswap_v2_router = None
uniswap_v2_router = QUICKSWAP_DEPLOYMENTS["polygon"]["router"]
case 1:
uniswap_v2_router = UNISWAP_V2_DEPLOYMENTS["ethereum"]["router"]
uniswap_v3_router = UNISWAP_V3_DEPLOYMENTS["ethereum"]["router"]
Expand All @@ -303,7 +303,7 @@ def deploy_vault_with_generic_adapter(
uniswap_v3_router = None

if uniswap_v2 and uniswap_v2_router:
logger.info("Whitelisting Uniswap V2 router %s", uniswap_v2_router)
logger.info("Whitelisting Uniswap/Quickswap V2 router %s", uniswap_v2_router)
tx_hash = vault.guard_contract.functions.whitelistUniswapV2Router(uniswap_v2_router, "").transact({"from": deployer.address})
assert_transaction_success_with_explanation(web3, tx_hash)

Expand Down
7 changes: 7 additions & 0 deletions eth_defi/uniswap_v2/constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,10 @@
"router": "0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D",
},
}

QUICKSWAP_DEPLOYMENTS = {
"ethereum": {
"factory": "0x5757371414417b8C6CAad45bAeF941aBc7d3Ab32",
"router": "0xa5E0829CaCEd8fFDD4De3c43696c57F7D7A678ff",
},
}

0 comments on commit 0917563

Please sign in to comment.