diff --git a/src/quote/swap/adapters/zeroex_v2/abis/SignatureTransfer.ts b/src/quote/swap/adapters/zeroex_v2/abis/SignatureTransfer.ts deleted file mode 100644 index 4eb87a5f..00000000 --- a/src/quote/swap/adapters/zeroex_v2/abis/SignatureTransfer.ts +++ /dev/null @@ -1,254 +0,0 @@ -export const SignatureTransferABI = [ - { - 'inputs': [ - { 'internalType': 'uint256', 'name': 'maxAmount', 'type': 'uint256' }, - ], - 'name': 'InvalidAmount', - 'type': 'error', - }, - { 'inputs': [], 'name': 'LengthMismatch', 'type': 'error' }, - { - 'anonymous': false, - 'inputs': [ - { - 'indexed': true, - 'internalType': 'address', - 'name': 'owner', - 'type': 'address', - }, - { - 'indexed': false, - 'internalType': 'uint256', - 'name': 'word', - 'type': 'uint256', - }, - { - 'indexed': false, - 'internalType': 'uint256', - 'name': 'mask', - 'type': 'uint256', - }, - ], - 'name': 'UnorderedNonceInvalidation', - 'type': 'event', - }, - { - 'inputs': [], - 'name': 'DOMAIN_SEPARATOR', - 'outputs': [{ 'internalType': 'bytes32', 'name': '', 'type': 'bytes32' }], - 'stateMutability': 'view', - 'type': 'function', - }, - { - 'inputs': [ - { 'internalType': 'uint256', 'name': 'wordPos', 'type': 'uint256' }, - { 'internalType': 'uint256', 'name': 'mask', 'type': 'uint256' }, - ], - 'name': 'invalidateUnorderedNonces', - 'outputs': [], - 'stateMutability': 'nonpayable', - 'type': 'function', - }, - { - 'inputs': [ - { 'internalType': 'address', 'name': '', 'type': 'address' }, - { 'internalType': 'uint256', 'name': '', 'type': 'uint256' }, - ], - 'name': 'nonceBitmap', - 'outputs': [{ 'internalType': 'uint256', 'name': '', 'type': 'uint256' }], - 'stateMutability': 'view', - 'type': 'function', - }, - { - 'inputs': [ - { - 'components': [ - { - 'components': [ - { 'internalType': 'address', 'name': 'token', 'type': 'address' }, - { - 'internalType': 'uint256', - 'name': 'amount', - 'type': 'uint256', - }, - ], - 'internalType': 'struct ISignatureTransfer.TokenPermissions', - 'name': 'permitted', - 'type': 'tuple', - }, - { 'internalType': 'uint256', 'name': 'nonce', 'type': 'uint256' }, - { 'internalType': 'uint256', 'name': 'deadline', 'type': 'uint256' }, - ], - 'internalType': 'struct ISignatureTransfer.PermitTransferFrom', - 'name': 'permit', - 'type': 'tuple', - }, - { - 'components': [ - { 'internalType': 'address', 'name': 'to', 'type': 'address' }, - { - 'internalType': 'uint256', - 'name': 'requestedAmount', - 'type': 'uint256', - }, - ], - 'internalType': 'struct ISignatureTransfer.SignatureTransferDetails', - 'name': 'transferDetails', - 'type': 'tuple', - }, - { 'internalType': 'address', 'name': 'owner', 'type': 'address' }, - { 'internalType': 'bytes', 'name': 'signature', 'type': 'bytes' }, - ], - 'name': 'permitTransferFrom', - 'outputs': [], - 'stateMutability': 'nonpayable', - 'type': 'function', - }, - { - 'inputs': [ - { - 'components': [ - { - 'components': [ - { 'internalType': 'address', 'name': 'token', 'type': 'address' }, - { - 'internalType': 'uint256', - 'name': 'amount', - 'type': 'uint256', - }, - ], - 'internalType': 'struct ISignatureTransfer.TokenPermissions[]', - 'name': 'permitted', - 'type': 'tuple[]', - }, - { 'internalType': 'uint256', 'name': 'nonce', 'type': 'uint256' }, - { 'internalType': 'uint256', 'name': 'deadline', 'type': 'uint256' }, - ], - 'internalType': 'struct ISignatureTransfer.PermitBatchTransferFrom', - 'name': 'permit', - 'type': 'tuple', - }, - { - 'components': [ - { 'internalType': 'address', 'name': 'to', 'type': 'address' }, - { - 'internalType': 'uint256', - 'name': 'requestedAmount', - 'type': 'uint256', - }, - ], - 'internalType': 'struct ISignatureTransfer.SignatureTransferDetails[]', - 'name': 'transferDetails', - 'type': 'tuple[]', - }, - { 'internalType': 'address', 'name': 'owner', 'type': 'address' }, - { 'internalType': 'bytes', 'name': 'signature', 'type': 'bytes' }, - ], - 'name': 'permitTransferFrom', - 'outputs': [], - 'stateMutability': 'nonpayable', - 'type': 'function', - }, - { - 'inputs': [ - { - 'components': [ - { - 'components': [ - { 'internalType': 'address', 'name': 'token', 'type': 'address' }, - { - 'internalType': 'uint256', - 'name': 'amount', - 'type': 'uint256', - }, - ], - 'internalType': 'struct ISignatureTransfer.TokenPermissions', - 'name': 'permitted', - 'type': 'tuple', - }, - { 'internalType': 'uint256', 'name': 'nonce', 'type': 'uint256' }, - { 'internalType': 'uint256', 'name': 'deadline', 'type': 'uint256' }, - ], - 'internalType': 'struct ISignatureTransfer.PermitTransferFrom', - 'name': 'permit', - 'type': 'tuple', - }, - { - 'components': [ - { 'internalType': 'address', 'name': 'to', 'type': 'address' }, - { - 'internalType': 'uint256', - 'name': 'requestedAmount', - 'type': 'uint256', - }, - ], - 'internalType': 'struct ISignatureTransfer.SignatureTransferDetails', - 'name': 'transferDetails', - 'type': 'tuple', - }, - { 'internalType': 'address', 'name': 'owner', 'type': 'address' }, - { 'internalType': 'bytes32', 'name': 'witness', 'type': 'bytes32' }, - { - 'internalType': 'string', - 'name': 'witnessTypeString', - 'type': 'string', - }, - { 'internalType': 'bytes', 'name': 'signature', 'type': 'bytes' }, - ], - 'name': 'permitWitnessTransferFrom', - 'outputs': [], - 'stateMutability': 'nonpayable', - 'type': 'function', - }, - { - 'inputs': [ - { - 'components': [ - { - 'components': [ - { 'internalType': 'address', 'name': 'token', 'type': 'address' }, - { - 'internalType': 'uint256', - 'name': 'amount', - 'type': 'uint256', - }, - ], - 'internalType': 'struct ISignatureTransfer.TokenPermissions[]', - 'name': 'permitted', - 'type': 'tuple[]', - }, - { 'internalType': 'uint256', 'name': 'nonce', 'type': 'uint256' }, - { 'internalType': 'uint256', 'name': 'deadline', 'type': 'uint256' }, - ], - 'internalType': 'struct ISignatureTransfer.PermitBatchTransferFrom', - 'name': 'permit', - 'type': 'tuple', - }, - { - 'components': [ - { 'internalType': 'address', 'name': 'to', 'type': 'address' }, - { - 'internalType': 'uint256', - 'name': 'requestedAmount', - 'type': 'uint256', - }, - ], - 'internalType': 'struct ISignatureTransfer.SignatureTransferDetails[]', - 'name': 'transferDetails', - 'type': 'tuple[]', - }, - { 'internalType': 'address', 'name': 'owner', 'type': 'address' }, - { 'internalType': 'bytes32', 'name': 'witness', 'type': 'bytes32' }, - { - 'internalType': 'string', - 'name': 'witnessTypeString', - 'type': 'string', - }, - { 'internalType': 'bytes', 'name': 'signature', 'type': 'bytes' }, - ], - 'name': 'permitWitnessTransferFrom', - 'outputs': [], - 'stateMutability': 'nonpayable', - 'type': 'function', - }, -] as const diff --git a/src/quote/swap/adapters/zeroex_v2/decode.ts b/src/quote/swap/adapters/zeroex_v2/decode.ts index 47c78a1b..e31c606f 100644 --- a/src/quote/swap/adapters/zeroex_v2/decode.ts +++ b/src/quote/swap/adapters/zeroex_v2/decode.ts @@ -1,52 +1,5 @@ import { type Hex, decodeFunctionData, parseAbi } from 'viem' -export const IEIP712_ABI = [ - { - inputs: [], - name: 'DOMAIN_SEPARATOR', - outputs: [ - { - internalType: 'bytes32', - name: '', - type: 'bytes32', - }, - ], - stateMutability: 'view', - type: 'function', - }, -] as const - -export const MainnetSettler = [ - { - 'inputs': [ - { - 'components': [ - { 'internalType': 'address', 'name': 'recipient', 'type': 'address' }, - { - 'internalType': 'contract IERC20', - 'name': 'buyToken', - 'type': 'address', - }, - { - 'internalType': 'uint256', - 'name': 'minAmountOut', - 'type': 'uint256', - }, - ], - 'internalType': 'struct SettlerBase.AllowedSlippage', - 'name': 'slippage', - 'type': 'tuple', - }, - { 'internalType': 'bytes[]', 'name': 'actions', 'type': 'bytes[]' }, - { 'internalType': 'bytes32', 'name': '', 'type': 'bytes32' }, - ], - 'name': 'execute', - 'outputs': [{ 'internalType': 'bool', 'name': '', 'type': 'bool' }], - 'stateMutability': 'payable', - 'type': 'function', - }, -] as const - function decodeAllowanceCallData(callData: Hex) { const { functionName, args } = decodeFunctionData({ abi: parseAbi([