Approving ERC20s in our multicall
Before calling a contract with tokens from a swap, you must first approve the contract to spend the Squid Multicall contract's balance. Below is the Javascript code to approve the multicall's current balance of the tokens.
You will see that the approve transaction has "0" as the approval amount. This is because the approval amount set to be the current balance of the ERC20 token specified in payload
line 22
payload
payload
is an object passed into the Squid smart contracts for call types 1 and ?? It is used for patching the current balance of a token into the calldata of the next call. This allows us to make long strings of calls, even if the output of each call is not deterministic (e.g. slippage).
Last updated