Uniswap
UniswapV2Router02 swapExactTokensForTokens 截止日期
我試圖通過解鎖 DAI 代幣持有者帳戶,使用 UniswapV2Router02 函式 swapExactTokensForTokens() 與 USDC 交換一些 DAI 和布朗尼和 python,我收到此錯誤:
VirtualMachineError: revert: UniswapV2Router: EXPIRED
我認為這是因為截止日期參數,我不知道該放什麼值
from brownie import accounts, interface from datetime import datetime DAI_TOKEN = "0x6B175474E89094C44Da98b954EedeAC495271d0F" USDC_TOKEN = "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48" DAI_HOLDER = "0x6F3F68525E5EdaD6F06f8b0EaE0DD7B9F695aF13" path = [DAI_TOKEN, USDC_TOKEN] def main(): manipulate() def manipulate(): account = DAI_HOLDER router = interface.IUniswapV2Router02("0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D") erc = interface.IERC20(DAI_TOKEN) erc.approve(router, 100, {"from": account}) tx = router.swapExactTokensForTokens( 100, 90, path, DAI_HOLDER, (datetime.now() + 250), {"from": account} )
嘗試將時間戳增加到
(datetime.now() + 60000)
基本上為 1 分鐘,250
即 250 毫秒,這可能不足以執行。