Supporting meta transactions

Last modified:

All CenturionDEX V2 pool tokens support meta-transaction approvals via the permit function. This obviates the need for a blocking approve transaction before programmatic interactions with pool tokens can occur.

CRC-712

In vanilla CRC-20 token contracts, owners may only register approvals by directly calling a function which uses msg.sender to permission itself. With meta-approvals, ownership and permissioning are derived from a signature passed into the function by the caller (sometimes referred to as the relayer). Because signing typed data can be a tricky endeavor, CenturionDEX V2 relies on CRC-712, a signature standard with widespread community support, to ensure user safety and wallet compatibility.

Domain Separator

keccak256(
  abi.encode(
    keccak256('EIP712Domain(string name,string version,uint256 chainId,address verifyingContract)'),
    keccak256(bytes(name)),
    keccak256(bytes('1')),
    chainId,
    address(this)
  )
);
  • name is always CenturionDEX V2, see name.
  • chainId is determined from the CRC-1344 chainid opcode.
  • address(this) is the address of the pair, see Pair Addresses.

Permit Typehash

keccak256('Permit(address owner,address spender,uint256 value,uint256 nonce,uint256 deadline)');`