Permit
For swaps from supported EIP-2616 tokens, the `permit` parameter allows swapping without an approval transaction beforehand.
EIP-2612 tokens can be swapped directly without an initial approval transaction. The client needs to provide a directly usable permit
calldata as a parameter to EVM Swaps API call. Refer to the EIP-2612 specification for how to sign and encode this call. permit
ABI is provided below for reference:
function permit(address owner, address spender, uint value, uint deadline, uint8 v, bytes32 r, bytes32 s) external
owner
: the swap's token senderspender
: the KyberSwap router address as returned by the GET-route APIvalue
: the amount of token to be swappeddeadline
: deadline by which the permit is validv
,r
,s
: a validsecp256k1
signature from the swap's token sender for the following message:
keccak256(abi.encodePacked(
hex"1901",
DOMAIN_SEPARATOR,
keccak256(abi.encode(
keccak256("Permit(address owner,address spender,uint256 value,uint256 nonce,uint256 deadline)"),
owner,
spender,
value,
nonce,
deadline))
))
Last updated
Was this helpful?