inputToken.approve(PERMIT2, MAX_UINT_256)
User TX #1:
router.multicall()
with below array as the calldata:
[
(Optional) router.selfPermit()
router.pullToken()
or router.pullTokenWithPermit2()
,
(Optional) router.approve()
,
router.deposit()
/ router.redeemFromRouter
,
(Optional) router.approve()
,
router.deposit()
/ router.redeemFromRouter
,
]
Router will pull the input token from the user, and deposit it for itself for intermediary vaults, and deposit for user for the last vault, transferring desired vault shares to the user.
router.selfPermit()
call, build the calldata, and add to multicall() param arrayrouter.pullToken()
calldata, and add to the multicall() param arrayasset.allowance(address(user), address(PERMIT2)
asset.approve(address(PERMIT2), type(uint256).max)
router.pullTokenWithPermit2()
calldata and add to the multicall() param arraypreview*
functions
previewDeposit
or previewRedeem
for calculating expected shares minted at each deposit step or expected assets received at each redeems.asset.allowance(address(router), address(vault))
router.approve(asset, vault, MAX_UINT256)
calls before each deposits so that the Router is able to deposit successfullyrouter.multicall()
with the params and check that expected return data at each step is correct.previewDeposit
call showed:
1e18 LP token → 0.9e18 Yearn Vault V2 → 0.9e18 Yearn Gauge → 0.8e18 CoveYearnStrategy → 0.8e18 AutoCompoundingRewardsGauge
Frontend requests Permit signature for transferring the 1e18 LP token from Alice to the router and generates v, r, s.
previewDeposit
call showed:
1e18 LP token → 0.9e18 Yearn Vault V2 → 0.9e18 Yearn Gauge → 0.8e18 CoveYearnStrategy → 0.8e18 AutoCompoundingRewardsGauge
Frontend requests Permit signature for transferring the 2e18 LP token from Ben to the router and generates v, r, s.