-
-
Save banteg/7d391171fbeaff5735028851b2f51f35 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from brownie import accounts, chain, Contract, Wei | |
from eth_abi.packed import encode_abi_packed | |
user = accounts[0] | |
weth = Contract('0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2', owner=user) | |
dai = '0x6B175474E89094C44Da98b954EedeAC495271d0F' | |
rai = '0x03ab458634910AaD20eF5f1C8ee96F1D6ac54919' | |
# https://github.com/Uniswap/uniswap-v3-periphery/blob/main/deploys.md | |
quoter = Contract('0xb27308f9F90D607463bb33eA1BeBb41C27CE5AB6') | |
router = Contract('0xE592427A0AEce92De3Edee1F18E0157C05861564', owner=user) | |
amount = Wei('1 ether') | |
weth.deposit({'amount': amount}) | |
weth.approve(router, amount) | |
path = encode_abi_packed(['address', 'uint24', 'address', 'uint24', 'address'], [str(weth), 3000, dai, 500, rai]) | |
quote = quoter.quoteExactInput.call(path, amount) | |
deadline = chain.time() + 600 | |
tx = router.exactInput((path, user, deadline, amount, quote * 0.99)) | |
tx.info() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment