diff --git a/sdks/v4-sdk/src/PositionManager.ts b/sdks/v4-sdk/src/PositionManager.ts index d80a3f0c..003468a7 100644 --- a/sdks/v4-sdk/src/PositionManager.ts +++ b/sdks/v4-sdk/src/PositionManager.ts @@ -19,7 +19,7 @@ import { ZERO_LIQUIDITY, } from './internalConstants' import { V4PositionPlanner } from './utils' -import { abi } from './utils/abi' +import { positionManagerAbi } from './utils/positionManagerAbi' export interface CommonOptions { /** @@ -204,7 +204,7 @@ function shouldCreatePool(options: MintOptions): boolean { } export abstract class V4PositionManager { - public static INTERFACE: Interface = new Interface(abi) + public static INTERFACE: Interface = new Interface(positionManagerAbi) /** * Cannot be constructed. diff --git a/sdks/v4-sdk/src/utils/abi.ts b/sdks/v4-sdk/src/utils/abi.ts deleted file mode 100644 index 8d04c043..00000000 --- a/sdks/v4-sdk/src/utils/abi.ts +++ /dev/null @@ -1,530 +0,0 @@ -// TODO: import this from npm -export const abi = [ - { - type: 'constructor', - inputs: [ - { name: '_poolManager', type: 'address', internalType: 'contract IPoolManager' }, - { name: '_permit2', type: 'address', internalType: 'contract IAllowanceTransfer' }, - { name: '_unsubscribeGasLimit', type: 'uint256', internalType: 'uint256' }, - { name: '_tokenDescriptor', type: 'address', internalType: 'contract IPositionDescriptor' }, - ], - stateMutability: 'nonpayable', - }, - { - type: 'function', - name: 'DOMAIN_SEPARATOR', - inputs: [], - outputs: [{ name: '', type: 'bytes32', internalType: 'bytes32' }], - stateMutability: 'view', - }, - { - type: 'function', - name: 'approve', - inputs: [ - { name: 'spender', type: 'address', internalType: 'address' }, - { name: 'id', type: 'uint256', internalType: 'uint256' }, - ], - outputs: [], - stateMutability: 'nonpayable', - }, - { - type: 'function', - name: 'balanceOf', - inputs: [{ name: 'owner', type: 'address', internalType: 'address' }], - outputs: [{ name: '', type: 'uint256', internalType: 'uint256' }], - stateMutability: 'view', - }, - { - type: 'function', - name: 'getApproved', - inputs: [{ name: '', type: 'uint256', internalType: 'uint256' }], - outputs: [{ name: '', type: 'address', internalType: 'address' }], - stateMutability: 'view', - }, - { - type: 'function', - name: 'getPoolAndPositionInfo', - inputs: [{ name: 'tokenId', type: 'uint256', internalType: 'uint256' }], - outputs: [ - { - name: 'poolKey', - type: 'tuple', - internalType: 'struct PoolKey', - components: [ - { name: 'currency0', type: 'address', internalType: 'Currency' }, - { name: 'currency1', type: 'address', internalType: 'Currency' }, - { name: 'fee', type: 'uint24', internalType: 'uint24' }, - { name: 'tickSpacing', type: 'int24', internalType: 'int24' }, - { name: 'hooks', type: 'address', internalType: 'contract IHooks' }, - ], - }, - { name: 'info', type: 'uint256', internalType: 'PositionInfo' }, - ], - stateMutability: 'view', - }, - { - type: 'function', - name: 'getPositionLiquidity', - inputs: [{ name: 'tokenId', type: 'uint256', internalType: 'uint256' }], - outputs: [{ name: 'liquidity', type: 'uint128', internalType: 'uint128' }], - stateMutability: 'view', - }, - { - type: 'function', - name: 'initializePool', - inputs: [ - { - name: 'key', - type: 'tuple', - internalType: 'struct PoolKey', - components: [ - { name: 'currency0', type: 'address', internalType: 'Currency' }, - { name: 'currency1', type: 'address', internalType: 'Currency' }, - { name: 'fee', type: 'uint24', internalType: 'uint24' }, - { name: 'tickSpacing', type: 'int24', internalType: 'int24' }, - { name: 'hooks', type: 'address', internalType: 'contract IHooks' }, - ], - }, - { name: 'sqrtPriceX96', type: 'uint160', internalType: 'uint160' }, - ], - outputs: [{ name: '', type: 'int24', internalType: 'int24' }], - stateMutability: 'payable', - }, - { - type: 'function', - name: 'isApprovedForAll', - inputs: [ - { name: '', type: 'address', internalType: 'address' }, - { name: '', type: 'address', internalType: 'address' }, - ], - outputs: [{ name: '', type: 'bool', internalType: 'bool' }], - stateMutability: 'view', - }, - { - type: 'function', - name: 'modifyLiquidities', - inputs: [ - { name: 'unlockData', type: 'bytes', internalType: 'bytes' }, - { name: 'deadline', type: 'uint256', internalType: 'uint256' }, - ], - outputs: [], - stateMutability: 'payable', - }, - { - type: 'function', - name: 'modifyLiquiditiesWithoutUnlock', - inputs: [ - { name: 'actions', type: 'bytes', internalType: 'bytes' }, - { name: 'params', type: 'bytes[]', internalType: 'bytes[]' }, - ], - outputs: [], - stateMutability: 'payable', - }, - { - type: 'function', - name: 'msgSender', - inputs: [], - outputs: [{ name: '', type: 'address', internalType: 'address' }], - stateMutability: 'view', - }, - { - type: 'function', - name: 'multicall', - inputs: [{ name: 'data', type: 'bytes[]', internalType: 'bytes[]' }], - outputs: [{ name: 'results', type: 'bytes[]', internalType: 'bytes[]' }], - stateMutability: 'payable', - }, - { - type: 'function', - name: 'name', - inputs: [], - outputs: [{ name: '', type: 'string', internalType: 'string' }], - stateMutability: 'view', - }, - { - type: 'function', - name: 'nextTokenId', - inputs: [], - outputs: [{ name: '', type: 'uint256', internalType: 'uint256' }], - stateMutability: 'view', - }, - { - type: 'function', - name: 'nonces', - inputs: [ - { name: 'owner', type: 'address', internalType: 'address' }, - { name: 'word', type: 'uint256', internalType: 'uint256' }, - ], - outputs: [{ name: 'bitmap', type: 'uint256', internalType: 'uint256' }], - stateMutability: 'view', - }, - { - type: 'function', - name: 'ownerOf', - inputs: [{ name: 'id', type: 'uint256', internalType: 'uint256' }], - outputs: [{ name: 'owner', type: 'address', internalType: 'address' }], - stateMutability: 'view', - }, - { - type: 'function', - name: 'permit', - inputs: [ - { name: 'spender', type: 'address', internalType: 'address' }, - { name: 'tokenId', type: 'uint256', internalType: 'uint256' }, - { name: 'deadline', type: 'uint256', internalType: 'uint256' }, - { name: 'nonce', type: 'uint256', internalType: 'uint256' }, - { name: 'signature', type: 'bytes', internalType: 'bytes' }, - ], - outputs: [], - stateMutability: 'payable', - }, - { - type: 'function', - name: 'permit', - inputs: [ - { name: 'owner', type: 'address', internalType: 'address' }, - { - name: 'permitSingle', - type: 'tuple', - internalType: 'struct IAllowanceTransfer.PermitSingle', - components: [ - { - name: 'details', - type: 'tuple', - internalType: 'struct IAllowanceTransfer.PermitDetails', - components: [ - { name: 'token', type: 'address', internalType: 'address' }, - { name: 'amount', type: 'uint160', internalType: 'uint160' }, - { name: 'expiration', type: 'uint48', internalType: 'uint48' }, - { name: 'nonce', type: 'uint48', internalType: 'uint48' }, - ], - }, - { name: 'spender', type: 'address', internalType: 'address' }, - { name: 'sigDeadline', type: 'uint256', internalType: 'uint256' }, - ], - }, - { name: 'signature', type: 'bytes', internalType: 'bytes' }, - ], - outputs: [{ name: 'err', type: 'bytes', internalType: 'bytes' }], - stateMutability: 'payable', - }, - { - type: 'function', - name: 'permit2', - inputs: [], - outputs: [{ name: '', type: 'address', internalType: 'contract IAllowanceTransfer' }], - stateMutability: 'view', - }, - { - type: 'function', - name: 'permitBatch', - inputs: [ - { name: 'owner', type: 'address', internalType: 'address' }, - { - name: '_permitBatch', - type: 'tuple', - internalType: 'struct IAllowanceTransfer.PermitBatch', - components: [ - { - name: 'details', - type: 'tuple[]', - internalType: 'struct IAllowanceTransfer.PermitDetails[]', - components: [ - { name: 'token', type: 'address', internalType: 'address' }, - { name: 'amount', type: 'uint160', internalType: 'uint160' }, - { name: 'expiration', type: 'uint48', internalType: 'uint48' }, - { name: 'nonce', type: 'uint48', internalType: 'uint48' }, - ], - }, - { name: 'spender', type: 'address', internalType: 'address' }, - { name: 'sigDeadline', type: 'uint256', internalType: 'uint256' }, - ], - }, - { name: 'signature', type: 'bytes', internalType: 'bytes' }, - ], - outputs: [{ name: 'err', type: 'bytes', internalType: 'bytes' }], - stateMutability: 'payable', - }, - { - type: 'function', - name: 'permitForAll', - inputs: [ - { name: 'owner', type: 'address', internalType: 'address' }, - { name: 'operator', type: 'address', internalType: 'address' }, - { name: 'approved', type: 'bool', internalType: 'bool' }, - { name: 'deadline', type: 'uint256', internalType: 'uint256' }, - { name: 'nonce', type: 'uint256', internalType: 'uint256' }, - { name: 'signature', type: 'bytes', internalType: 'bytes' }, - ], - outputs: [], - stateMutability: 'payable', - }, - { - type: 'function', - name: 'poolKeys', - inputs: [{ name: 'poolId', type: 'bytes25', internalType: 'bytes25' }], - outputs: [ - { name: 'currency0', type: 'address', internalType: 'Currency' }, - { name: 'currency1', type: 'address', internalType: 'Currency' }, - { name: 'fee', type: 'uint24', internalType: 'uint24' }, - { name: 'tickSpacing', type: 'int24', internalType: 'int24' }, - { name: 'hooks', type: 'address', internalType: 'contract IHooks' }, - ], - stateMutability: 'view', - }, - { - type: 'function', - name: 'poolManager', - inputs: [], - outputs: [{ name: '', type: 'address', internalType: 'contract IPoolManager' }], - stateMutability: 'view', - }, - { - type: 'function', - name: 'positionInfo', - inputs: [{ name: 'tokenId', type: 'uint256', internalType: 'uint256' }], - outputs: [{ name: 'info', type: 'uint256', internalType: 'PositionInfo' }], - stateMutability: 'view', - }, - { - type: 'function', - name: 'revokeNonce', - inputs: [{ name: 'nonce', type: 'uint256', internalType: 'uint256' }], - outputs: [], - stateMutability: 'payable', - }, - { - type: 'function', - name: 'safeTransferFrom', - inputs: [ - { name: 'from', type: 'address', internalType: 'address' }, - { name: 'to', type: 'address', internalType: 'address' }, - { name: 'id', type: 'uint256', internalType: 'uint256' }, - ], - outputs: [], - stateMutability: 'nonpayable', - }, - { - type: 'function', - name: 'safeTransferFrom', - inputs: [ - { name: 'from', type: 'address', internalType: 'address' }, - { name: 'to', type: 'address', internalType: 'address' }, - { name: 'id', type: 'uint256', internalType: 'uint256' }, - { name: 'data', type: 'bytes', internalType: 'bytes' }, - ], - outputs: [], - stateMutability: 'nonpayable', - }, - { - type: 'function', - name: 'setApprovalForAll', - inputs: [ - { name: 'operator', type: 'address', internalType: 'address' }, - { name: 'approved', type: 'bool', internalType: 'bool' }, - ], - outputs: [], - stateMutability: 'nonpayable', - }, - { - type: 'function', - name: 'subscribe', - inputs: [ - { name: 'tokenId', type: 'uint256', internalType: 'uint256' }, - { name: 'newSubscriber', type: 'address', internalType: 'address' }, - { name: 'data', type: 'bytes', internalType: 'bytes' }, - ], - outputs: [], - stateMutability: 'payable', - }, - { - type: 'function', - name: 'subscriber', - inputs: [{ name: 'tokenId', type: 'uint256', internalType: 'uint256' }], - outputs: [{ name: 'subscriber', type: 'address', internalType: 'contract ISubscriber' }], - stateMutability: 'view', - }, - { - type: 'function', - name: 'supportsInterface', - inputs: [{ name: 'interfaceId', type: 'bytes4', internalType: 'bytes4' }], - outputs: [{ name: '', type: 'bool', internalType: 'bool' }], - stateMutability: 'view', - }, - { - type: 'function', - name: 'symbol', - inputs: [], - outputs: [{ name: '', type: 'string', internalType: 'string' }], - stateMutability: 'view', - }, - { - type: 'function', - name: 'tokenDescriptor', - inputs: [], - outputs: [{ name: '', type: 'address', internalType: 'contract IPositionDescriptor' }], - stateMutability: 'view', - }, - { - type: 'function', - name: 'tokenURI', - inputs: [{ name: 'tokenId', type: 'uint256', internalType: 'uint256' }], - outputs: [{ name: '', type: 'string', internalType: 'string' }], - stateMutability: 'view', - }, - { - type: 'function', - name: 'transferFrom', - inputs: [ - { name: 'from', type: 'address', internalType: 'address' }, - { name: 'to', type: 'address', internalType: 'address' }, - { name: 'id', type: 'uint256', internalType: 'uint256' }, - ], - outputs: [], - stateMutability: 'nonpayable', - }, - { - type: 'function', - name: 'unlockCallback', - inputs: [{ name: 'data', type: 'bytes', internalType: 'bytes' }], - outputs: [{ name: '', type: 'bytes', internalType: 'bytes' }], - stateMutability: 'nonpayable', - }, - { - type: 'function', - name: 'unsubscribe', - inputs: [{ name: 'tokenId', type: 'uint256', internalType: 'uint256' }], - outputs: [], - stateMutability: 'payable', - }, - { - type: 'function', - name: 'unsubscribeGasLimit', - inputs: [], - outputs: [{ name: '', type: 'uint256', internalType: 'uint256' }], - stateMutability: 'view', - }, - { - type: 'event', - name: 'Approval', - inputs: [ - { name: 'owner', type: 'address', indexed: true, internalType: 'address' }, - { name: 'spender', type: 'address', indexed: true, internalType: 'address' }, - { name: 'id', type: 'uint256', indexed: true, internalType: 'uint256' }, - ], - anonymous: false, - }, - { - type: 'event', - name: 'ApprovalForAll', - inputs: [ - { name: 'owner', type: 'address', indexed: true, internalType: 'address' }, - { name: 'operator', type: 'address', indexed: true, internalType: 'address' }, - { name: 'approved', type: 'bool', indexed: false, internalType: 'bool' }, - ], - anonymous: false, - }, - { - type: 'event', - name: 'Subscription', - inputs: [ - { name: 'tokenId', type: 'uint256', indexed: true, internalType: 'uint256' }, - { name: 'subscriber', type: 'address', indexed: true, internalType: 'address' }, - ], - anonymous: false, - }, - { - type: 'event', - name: 'Transfer', - inputs: [ - { name: 'from', type: 'address', indexed: true, internalType: 'address' }, - { name: 'to', type: 'address', indexed: true, internalType: 'address' }, - { name: 'id', type: 'uint256', indexed: true, internalType: 'uint256' }, - ], - anonymous: false, - }, - { - type: 'event', - name: 'Unsubscription', - inputs: [ - { name: 'tokenId', type: 'uint256', indexed: true, internalType: 'uint256' }, - { name: 'subscriber', type: 'address', indexed: true, internalType: 'address' }, - ], - anonymous: false, - }, - { - type: 'error', - name: 'AlreadySubscribed', - inputs: [ - { name: 'tokenId', type: 'uint256', internalType: 'uint256' }, - { name: 'subscriber', type: 'address', internalType: 'address' }, - ], - }, - { type: 'error', name: 'ContractLocked', inputs: [] }, - { type: 'error', name: 'DeadlinePassed', inputs: [{ name: 'deadline', type: 'uint256', internalType: 'uint256' }] }, - { - type: 'error', - name: 'DeltaNotNegative', - inputs: [{ name: 'currency', type: 'address', internalType: 'Currency' }], - }, - { - type: 'error', - name: 'DeltaNotPositive', - inputs: [{ name: 'currency', type: 'address', internalType: 'Currency' }], - }, - { type: 'error', name: 'GasLimitTooLow', inputs: [] }, - { type: 'error', name: 'InputLengthMismatch', inputs: [] }, - { type: 'error', name: 'InvalidContractSignature', inputs: [] }, - { type: 'error', name: 'InvalidSignature', inputs: [] }, - { type: 'error', name: 'InvalidSignatureLength', inputs: [] }, - { type: 'error', name: 'InvalidSigner', inputs: [] }, - { - type: 'error', - name: 'MaximumAmountExceeded', - inputs: [ - { name: 'maximumAmount', type: 'uint128', internalType: 'uint128' }, - { name: 'amountRequested', type: 'uint128', internalType: 'uint128' }, - ], - }, - { - type: 'error', - name: 'MinimumAmountInsufficient', - inputs: [ - { name: 'minimumAmount', type: 'uint128', internalType: 'uint128' }, - { name: 'amountReceived', type: 'uint128', internalType: 'uint128' }, - ], - }, - { type: 'error', name: 'NoCodeSubscriber', inputs: [] }, - { type: 'error', name: 'NoSelfPermit', inputs: [] }, - { type: 'error', name: 'NonceAlreadyUsed', inputs: [] }, - { type: 'error', name: 'NotApproved', inputs: [{ name: 'caller', type: 'address', internalType: 'address' }] }, - { type: 'error', name: 'NotPoolManager', inputs: [] }, - { type: 'error', name: 'NotSubscribed', inputs: [] }, - { type: 'error', name: 'SignatureDeadlineExpired', inputs: [] }, - { type: 'error', name: 'Unauthorized', inputs: [] }, - { type: 'error', name: 'UnsupportedAction', inputs: [{ name: 'action', type: 'uint256', internalType: 'uint256' }] }, - { - type: 'error', - name: 'Wrap__ModifyLiquidityNotificationReverted', - inputs: [ - { name: 'subscriber', type: 'address', internalType: 'address' }, - { name: 'reason', type: 'bytes', internalType: 'bytes' }, - ], - }, - { - type: 'error', - name: 'Wrap__SubscriptionReverted', - inputs: [ - { name: 'subscriber', type: 'address', internalType: 'address' }, - { name: 'reason', type: 'bytes', internalType: 'bytes' }, - ], - }, - { - type: 'error', - name: 'Wrap__TransferNotificationReverted', - inputs: [ - { name: 'subscriber', type: 'address', internalType: 'address' }, - { name: 'reason', type: 'bytes', internalType: 'bytes' }, - ], - }, -] diff --git a/sdks/v4-sdk/src/utils/positionManagerAbi.ts b/sdks/v4-sdk/src/utils/positionManagerAbi.ts new file mode 100644 index 00000000..3816364f --- /dev/null +++ b/sdks/v4-sdk/src/utils/positionManagerAbi.ts @@ -0,0 +1,1314 @@ +// TODO: import this from npm +export const positionManagerAbi = [ + { + type: 'constructor', + inputs: [ + { + name: '_poolManager', + type: 'address', + internalType: 'contract IPoolManager', + }, + { + name: '_permit2', + type: 'address', + internalType: 'contract IAllowanceTransfer', + }, + { + name: '_unsubscribeGasLimit', + type: 'uint256', + internalType: 'uint256', + }, + { + name: '_tokenDescriptor', + type: 'address', + internalType: 'contract IPositionDescriptor', + }, + { + name: '_weth9', + type: 'address', + internalType: 'contract IWETH9', + }, + ], + stateMutability: 'nonpayable', + }, + { + type: 'receive', + stateMutability: 'payable', + }, + { + type: 'function', + name: 'DOMAIN_SEPARATOR', + inputs: [], + outputs: [ + { + name: '', + type: 'bytes32', + internalType: 'bytes32', + }, + ], + stateMutability: 'view', + }, + { + type: 'function', + name: 'WETH9', + inputs: [], + outputs: [ + { + name: '', + type: 'address', + internalType: 'contract IWETH9', + }, + ], + stateMutability: 'view', + }, + { + type: 'function', + name: 'approve', + inputs: [ + { + name: 'spender', + type: 'address', + internalType: 'address', + }, + { + name: 'id', + type: 'uint256', + internalType: 'uint256', + }, + ], + outputs: [], + stateMutability: 'nonpayable', + }, + { + type: 'function', + name: 'balanceOf', + inputs: [ + { + name: 'owner', + type: 'address', + internalType: 'address', + }, + ], + outputs: [ + { + name: '', + type: 'uint256', + internalType: 'uint256', + }, + ], + stateMutability: 'view', + }, + { + type: 'function', + name: 'getApproved', + inputs: [ + { + name: '', + type: 'uint256', + internalType: 'uint256', + }, + ], + outputs: [ + { + name: '', + type: 'address', + internalType: 'address', + }, + ], + stateMutability: 'view', + }, + { + type: 'function', + name: 'getPoolAndPositionInfo', + inputs: [ + { + name: 'tokenId', + type: 'uint256', + internalType: 'uint256', + }, + ], + outputs: [ + { + name: 'poolKey', + type: 'tuple', + internalType: 'struct PoolKey', + components: [ + { + name: 'currency0', + type: 'address', + internalType: 'Currency', + }, + { + name: 'currency1', + type: 'address', + internalType: 'Currency', + }, + { + name: 'fee', + type: 'uint24', + internalType: 'uint24', + }, + { + name: 'tickSpacing', + type: 'int24', + internalType: 'int24', + }, + { + name: 'hooks', + type: 'address', + internalType: 'contract IHooks', + }, + ], + }, + { + name: 'info', + type: 'uint256', + internalType: 'PositionInfo', + }, + ], + stateMutability: 'view', + }, + { + type: 'function', + name: 'getPositionLiquidity', + inputs: [ + { + name: 'tokenId', + type: 'uint256', + internalType: 'uint256', + }, + ], + outputs: [ + { + name: 'liquidity', + type: 'uint128', + internalType: 'uint128', + }, + ], + stateMutability: 'view', + }, + { + type: 'function', + name: 'initializePool', + inputs: [ + { + name: 'key', + type: 'tuple', + internalType: 'struct PoolKey', + components: [ + { + name: 'currency0', + type: 'address', + internalType: 'Currency', + }, + { + name: 'currency1', + type: 'address', + internalType: 'Currency', + }, + { + name: 'fee', + type: 'uint24', + internalType: 'uint24', + }, + { + name: 'tickSpacing', + type: 'int24', + internalType: 'int24', + }, + { + name: 'hooks', + type: 'address', + internalType: 'contract IHooks', + }, + ], + }, + { + name: 'sqrtPriceX96', + type: 'uint160', + internalType: 'uint160', + }, + ], + outputs: [ + { + name: '', + type: 'int24', + internalType: 'int24', + }, + ], + stateMutability: 'payable', + }, + { + type: 'function', + name: 'isApprovedForAll', + inputs: [ + { + name: '', + type: 'address', + internalType: 'address', + }, + { + name: '', + type: 'address', + internalType: 'address', + }, + ], + outputs: [ + { + name: '', + type: 'bool', + internalType: 'bool', + }, + ], + stateMutability: 'view', + }, + { + type: 'function', + name: 'modifyLiquidities', + inputs: [ + { + name: 'unlockData', + type: 'bytes', + internalType: 'bytes', + }, + { + name: 'deadline', + type: 'uint256', + internalType: 'uint256', + }, + ], + outputs: [], + stateMutability: 'payable', + }, + { + type: 'function', + name: 'modifyLiquiditiesWithoutUnlock', + inputs: [ + { + name: 'actions', + type: 'bytes', + internalType: 'bytes', + }, + { + name: 'params', + type: 'bytes[]', + internalType: 'bytes[]', + }, + ], + outputs: [], + stateMutability: 'payable', + }, + { + type: 'function', + name: 'msgSender', + inputs: [], + outputs: [ + { + name: '', + type: 'address', + internalType: 'address', + }, + ], + stateMutability: 'view', + }, + { + type: 'function', + name: 'multicall', + inputs: [ + { + name: 'data', + type: 'bytes[]', + internalType: 'bytes[]', + }, + ], + outputs: [ + { + name: 'results', + type: 'bytes[]', + internalType: 'bytes[]', + }, + ], + stateMutability: 'payable', + }, + { + type: 'function', + name: 'name', + inputs: [], + outputs: [ + { + name: '', + type: 'string', + internalType: 'string', + }, + ], + stateMutability: 'view', + }, + { + type: 'function', + name: 'nextTokenId', + inputs: [], + outputs: [ + { + name: '', + type: 'uint256', + internalType: 'uint256', + }, + ], + stateMutability: 'view', + }, + { + type: 'function', + name: 'nonces', + inputs: [ + { + name: 'owner', + type: 'address', + internalType: 'address', + }, + { + name: 'word', + type: 'uint256', + internalType: 'uint256', + }, + ], + outputs: [ + { + name: 'bitmap', + type: 'uint256', + internalType: 'uint256', + }, + ], + stateMutability: 'view', + }, + { + type: 'function', + name: 'ownerOf', + inputs: [ + { + name: 'id', + type: 'uint256', + internalType: 'uint256', + }, + ], + outputs: [ + { + name: 'owner', + type: 'address', + internalType: 'address', + }, + ], + stateMutability: 'view', + }, + { + type: 'function', + name: 'permit', + inputs: [ + { + name: 'spender', + type: 'address', + internalType: 'address', + }, + { + name: 'tokenId', + type: 'uint256', + internalType: 'uint256', + }, + { + name: 'deadline', + type: 'uint256', + internalType: 'uint256', + }, + { + name: 'nonce', + type: 'uint256', + internalType: 'uint256', + }, + { + name: 'signature', + type: 'bytes', + internalType: 'bytes', + }, + ], + outputs: [], + stateMutability: 'payable', + }, + { + type: 'function', + name: 'permit', + inputs: [ + { + name: 'owner', + type: 'address', + internalType: 'address', + }, + { + name: 'permitSingle', + type: 'tuple', + internalType: 'struct IAllowanceTransfer.PermitSingle', + components: [ + { + name: 'details', + type: 'tuple', + internalType: 'struct IAllowanceTransfer.PermitDetails', + components: [ + { + name: 'token', + type: 'address', + internalType: 'address', + }, + { + name: 'amount', + type: 'uint160', + internalType: 'uint160', + }, + { + name: 'expiration', + type: 'uint48', + internalType: 'uint48', + }, + { + name: 'nonce', + type: 'uint48', + internalType: 'uint48', + }, + ], + }, + { + name: 'spender', + type: 'address', + internalType: 'address', + }, + { + name: 'sigDeadline', + type: 'uint256', + internalType: 'uint256', + }, + ], + }, + { + name: 'signature', + type: 'bytes', + internalType: 'bytes', + }, + ], + outputs: [ + { + name: 'err', + type: 'bytes', + internalType: 'bytes', + }, + ], + stateMutability: 'payable', + }, + { + type: 'function', + name: 'permit2', + inputs: [], + outputs: [ + { + name: '', + type: 'address', + internalType: 'contract IAllowanceTransfer', + }, + ], + stateMutability: 'view', + }, + { + type: 'function', + name: 'permitBatch', + inputs: [ + { + name: 'owner', + type: 'address', + internalType: 'address', + }, + { + name: '_permitBatch', + type: 'tuple', + internalType: 'struct IAllowanceTransfer.PermitBatch', + components: [ + { + name: 'details', + type: 'tuple[]', + internalType: 'struct IAllowanceTransfer.PermitDetails[]', + components: [ + { + name: 'token', + type: 'address', + internalType: 'address', + }, + { + name: 'amount', + type: 'uint160', + internalType: 'uint160', + }, + { + name: 'expiration', + type: 'uint48', + internalType: 'uint48', + }, + { + name: 'nonce', + type: 'uint48', + internalType: 'uint48', + }, + ], + }, + { + name: 'spender', + type: 'address', + internalType: 'address', + }, + { + name: 'sigDeadline', + type: 'uint256', + internalType: 'uint256', + }, + ], + }, + { + name: 'signature', + type: 'bytes', + internalType: 'bytes', + }, + ], + outputs: [ + { + name: 'err', + type: 'bytes', + internalType: 'bytes', + }, + ], + stateMutability: 'payable', + }, + { + type: 'function', + name: 'permitForAll', + inputs: [ + { + name: 'owner', + type: 'address', + internalType: 'address', + }, + { + name: 'operator', + type: 'address', + internalType: 'address', + }, + { + name: 'approved', + type: 'bool', + internalType: 'bool', + }, + { + name: 'deadline', + type: 'uint256', + internalType: 'uint256', + }, + { + name: 'nonce', + type: 'uint256', + internalType: 'uint256', + }, + { + name: 'signature', + type: 'bytes', + internalType: 'bytes', + }, + ], + outputs: [], + stateMutability: 'payable', + }, + { + type: 'function', + name: 'poolKeys', + inputs: [ + { + name: 'poolId', + type: 'bytes25', + internalType: 'bytes25', + }, + ], + outputs: [ + { + name: 'currency0', + type: 'address', + internalType: 'Currency', + }, + { + name: 'currency1', + type: 'address', + internalType: 'Currency', + }, + { + name: 'fee', + type: 'uint24', + internalType: 'uint24', + }, + { + name: 'tickSpacing', + type: 'int24', + internalType: 'int24', + }, + { + name: 'hooks', + type: 'address', + internalType: 'contract IHooks', + }, + ], + stateMutability: 'view', + }, + { + type: 'function', + name: 'poolManager', + inputs: [], + outputs: [ + { + name: '', + type: 'address', + internalType: 'contract IPoolManager', + }, + ], + stateMutability: 'view', + }, + { + type: 'function', + name: 'positionInfo', + inputs: [ + { + name: 'tokenId', + type: 'uint256', + internalType: 'uint256', + }, + ], + outputs: [ + { + name: 'info', + type: 'uint256', + internalType: 'PositionInfo', + }, + ], + stateMutability: 'view', + }, + { + type: 'function', + name: 'revokeNonce', + inputs: [ + { + name: 'nonce', + type: 'uint256', + internalType: 'uint256', + }, + ], + outputs: [], + stateMutability: 'payable', + }, + { + type: 'function', + name: 'safeTransferFrom', + inputs: [ + { + name: 'from', + type: 'address', + internalType: 'address', + }, + { + name: 'to', + type: 'address', + internalType: 'address', + }, + { + name: 'id', + type: 'uint256', + internalType: 'uint256', + }, + ], + outputs: [], + stateMutability: 'nonpayable', + }, + { + type: 'function', + name: 'safeTransferFrom', + inputs: [ + { + name: 'from', + type: 'address', + internalType: 'address', + }, + { + name: 'to', + type: 'address', + internalType: 'address', + }, + { + name: 'id', + type: 'uint256', + internalType: 'uint256', + }, + { + name: 'data', + type: 'bytes', + internalType: 'bytes', + }, + ], + outputs: [], + stateMutability: 'nonpayable', + }, + { + type: 'function', + name: 'setApprovalForAll', + inputs: [ + { + name: 'operator', + type: 'address', + internalType: 'address', + }, + { + name: 'approved', + type: 'bool', + internalType: 'bool', + }, + ], + outputs: [], + stateMutability: 'nonpayable', + }, + { + type: 'function', + name: 'subscribe', + inputs: [ + { + name: 'tokenId', + type: 'uint256', + internalType: 'uint256', + }, + { + name: 'newSubscriber', + type: 'address', + internalType: 'address', + }, + { + name: 'data', + type: 'bytes', + internalType: 'bytes', + }, + ], + outputs: [], + stateMutability: 'payable', + }, + { + type: 'function', + name: 'subscriber', + inputs: [ + { + name: 'tokenId', + type: 'uint256', + internalType: 'uint256', + }, + ], + outputs: [ + { + name: 'subscriber', + type: 'address', + internalType: 'contract ISubscriber', + }, + ], + stateMutability: 'view', + }, + { + type: 'function', + name: 'supportsInterface', + inputs: [ + { + name: 'interfaceId', + type: 'bytes4', + internalType: 'bytes4', + }, + ], + outputs: [ + { + name: '', + type: 'bool', + internalType: 'bool', + }, + ], + stateMutability: 'view', + }, + { + type: 'function', + name: 'symbol', + inputs: [], + outputs: [ + { + name: '', + type: 'string', + internalType: 'string', + }, + ], + stateMutability: 'view', + }, + { + type: 'function', + name: 'tokenDescriptor', + inputs: [], + outputs: [ + { + name: '', + type: 'address', + internalType: 'contract IPositionDescriptor', + }, + ], + stateMutability: 'view', + }, + { + type: 'function', + name: 'tokenURI', + inputs: [ + { + name: 'tokenId', + type: 'uint256', + internalType: 'uint256', + }, + ], + outputs: [ + { + name: '', + type: 'string', + internalType: 'string', + }, + ], + stateMutability: 'view', + }, + { + type: 'function', + name: 'transferFrom', + inputs: [ + { + name: 'from', + type: 'address', + internalType: 'address', + }, + { + name: 'to', + type: 'address', + internalType: 'address', + }, + { + name: 'id', + type: 'uint256', + internalType: 'uint256', + }, + ], + outputs: [], + stateMutability: 'nonpayable', + }, + { + type: 'function', + name: 'unlockCallback', + inputs: [ + { + name: 'data', + type: 'bytes', + internalType: 'bytes', + }, + ], + outputs: [ + { + name: '', + type: 'bytes', + internalType: 'bytes', + }, + ], + stateMutability: 'nonpayable', + }, + { + type: 'function', + name: 'unsubscribe', + inputs: [ + { + name: 'tokenId', + type: 'uint256', + internalType: 'uint256', + }, + ], + outputs: [], + stateMutability: 'payable', + }, + { + type: 'function', + name: 'unsubscribeGasLimit', + inputs: [], + outputs: [ + { + name: '', + type: 'uint256', + internalType: 'uint256', + }, + ], + stateMutability: 'view', + }, + { + type: 'event', + name: 'Approval', + inputs: [ + { + name: 'owner', + type: 'address', + indexed: true, + internalType: 'address', + }, + { + name: 'spender', + type: 'address', + indexed: true, + internalType: 'address', + }, + { + name: 'id', + type: 'uint256', + indexed: true, + internalType: 'uint256', + }, + ], + anonymous: false, + }, + { + type: 'event', + name: 'ApprovalForAll', + inputs: [ + { + name: 'owner', + type: 'address', + indexed: true, + internalType: 'address', + }, + { + name: 'operator', + type: 'address', + indexed: true, + internalType: 'address', + }, + { + name: 'approved', + type: 'bool', + indexed: false, + internalType: 'bool', + }, + ], + anonymous: false, + }, + { + type: 'event', + name: 'Subscription', + inputs: [ + { + name: 'tokenId', + type: 'uint256', + indexed: true, + internalType: 'uint256', + }, + { + name: 'subscriber', + type: 'address', + indexed: true, + internalType: 'address', + }, + ], + anonymous: false, + }, + { + type: 'event', + name: 'Transfer', + inputs: [ + { + name: 'from', + type: 'address', + indexed: true, + internalType: 'address', + }, + { + name: 'to', + type: 'address', + indexed: true, + internalType: 'address', + }, + { + name: 'id', + type: 'uint256', + indexed: true, + internalType: 'uint256', + }, + ], + anonymous: false, + }, + { + type: 'event', + name: 'Unsubscription', + inputs: [ + { + name: 'tokenId', + type: 'uint256', + indexed: true, + internalType: 'uint256', + }, + { + name: 'subscriber', + type: 'address', + indexed: true, + internalType: 'address', + }, + ], + anonymous: false, + }, + { + type: 'error', + name: 'AlreadySubscribed', + inputs: [ + { + name: 'tokenId', + type: 'uint256', + internalType: 'uint256', + }, + { + name: 'subscriber', + type: 'address', + internalType: 'address', + }, + ], + }, + { + type: 'error', + name: 'BurnNotificationReverted', + inputs: [ + { + name: 'subscriber', + type: 'address', + internalType: 'address', + }, + { + name: 'reason', + type: 'bytes', + internalType: 'bytes', + }, + ], + }, + { + type: 'error', + name: 'ContractLocked', + inputs: [], + }, + { + type: 'error', + name: 'DeadlinePassed', + inputs: [ + { + name: 'deadline', + type: 'uint256', + internalType: 'uint256', + }, + ], + }, + { + type: 'error', + name: 'DeltaNotNegative', + inputs: [ + { + name: 'currency', + type: 'address', + internalType: 'Currency', + }, + ], + }, + { + type: 'error', + name: 'DeltaNotPositive', + inputs: [ + { + name: 'currency', + type: 'address', + internalType: 'Currency', + }, + ], + }, + { + type: 'error', + name: 'GasLimitTooLow', + inputs: [], + }, + { + type: 'error', + name: 'InputLengthMismatch', + inputs: [], + }, + { + type: 'error', + name: 'InsufficientBalance', + inputs: [], + }, + { + type: 'error', + name: 'InvalidContractSignature', + inputs: [], + }, + { + type: 'error', + name: 'InvalidEthSender', + inputs: [], + }, + { + type: 'error', + name: 'InvalidSignature', + inputs: [], + }, + { + type: 'error', + name: 'InvalidSignatureLength', + inputs: [], + }, + { + type: 'error', + name: 'InvalidSigner', + inputs: [], + }, + { + type: 'error', + name: 'MaximumAmountExceeded', + inputs: [ + { + name: 'maximumAmount', + type: 'uint128', + internalType: 'uint128', + }, + { + name: 'amountRequested', + type: 'uint128', + internalType: 'uint128', + }, + ], + }, + { + type: 'error', + name: 'MinimumAmountInsufficient', + inputs: [ + { + name: 'minimumAmount', + type: 'uint128', + internalType: 'uint128', + }, + { + name: 'amountReceived', + type: 'uint128', + internalType: 'uint128', + }, + ], + }, + { + type: 'error', + name: 'ModifyLiquidityNotificationReverted', + inputs: [ + { + name: 'subscriber', + type: 'address', + internalType: 'address', + }, + { + name: 'reason', + type: 'bytes', + internalType: 'bytes', + }, + ], + }, + { + type: 'error', + name: 'NoCodeSubscriber', + inputs: [], + }, + { + type: 'error', + name: 'NoSelfPermit', + inputs: [], + }, + { + type: 'error', + name: 'NonceAlreadyUsed', + inputs: [], + }, + { + type: 'error', + name: 'NotApproved', + inputs: [ + { + name: 'caller', + type: 'address', + internalType: 'address', + }, + ], + }, + { + type: 'error', + name: 'NotPoolManager', + inputs: [], + }, + { + type: 'error', + name: 'NotSubscribed', + inputs: [], + }, + { + type: 'error', + name: 'PoolManagerMustBeLocked', + inputs: [], + }, + { + type: 'error', + name: 'SignatureDeadlineExpired', + inputs: [], + }, + { + type: 'error', + name: 'SubscriptionReverted', + inputs: [ + { + name: 'subscriber', + type: 'address', + internalType: 'address', + }, + { + name: 'reason', + type: 'bytes', + internalType: 'bytes', + }, + ], + }, + { + type: 'error', + name: 'TransferNotificationReverted', + inputs: [ + { + name: 'subscriber', + type: 'address', + internalType: 'address', + }, + { + name: 'reason', + type: 'bytes', + internalType: 'bytes', + }, + ], + }, + { + type: 'error', + name: 'Unauthorized', + inputs: [], + }, + { + type: 'error', + name: 'UnsupportedAction', + inputs: [ + { + name: 'action', + type: 'uint256', + internalType: 'uint256', + }, + ], + }, +] diff --git a/sdks/v4-sdk/src/utils/v4BaseActionsParser.test.ts b/sdks/v4-sdk/src/utils/v4BaseActionsParser.test.ts index 283402b9..78ca8f6a 100644 --- a/sdks/v4-sdk/src/utils/v4BaseActionsParser.test.ts +++ b/sdks/v4-sdk/src/utils/v4BaseActionsParser.test.ts @@ -45,21 +45,7 @@ describe('Command Parser', () => { ], }, }, - { - input: new V4Planner().addAction(Actions.SETTLE_TAKE_PAIR, [addressOne, addressTwo]), - result: { - actions: [ - { - actionName: 'SETTLE_TAKE_PAIR', - actionType: Actions.SETTLE_TAKE_PAIR, - params: [ - { name: 'settleCurrency', value: addressOne }, - { name: 'takeCurrency', value: addressTwo }, - ], - }, - ], - }, - }, + { input: new V4Planner().addAction(Actions.TAKE_PAIR, [addressOne, addressTwo, addressOne]), result: { diff --git a/sdks/v4-sdk/src/utils/v4Planner.test.ts b/sdks/v4-sdk/src/utils/v4Planner.test.ts index 3005857b..bdc4264a 100644 --- a/sdks/v4-sdk/src/utils/v4Planner.test.ts +++ b/sdks/v4-sdk/src/utils/v4Planner.test.ts @@ -81,7 +81,7 @@ describe('RouterPlanner', () => { }, ]) - expect(planner.actions).toEqual('0x04') + expect(planner.actions).toEqual('0x06') expect(planner.params[0]).toEqual( '0x0000000000000000000000000000000000000000000000000000000000000020000000000000000000000000a0b86991c6218b36c1d19d4a2e9eb0ce3606eb48000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc20000000000000000000000000000000000000000000000000000000000000bb8000000000000000000000000000000000000000000000000000000000000000a000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000de0b6b3a764000000000000000000000000000000000000000000000000000006f05b59d3b20000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001400000000000000000000000000000000000000000000000000000000000000000' ) @@ -111,7 +111,7 @@ describe('RouterPlanner', () => { ) tradePlanner.addTrade(trade) - expect(planner.actions).toEqual('0x05') + expect(planner.actions).toEqual('0x07') expect(planner.params[0]).toEqual( '0x00000000000000000000000000000000000000000000000000000000000000200000000000000000000000006b175474e89094c44da98b954eedeac495271d0f00000000000000000000000000000000000000000000000000000000000000800000000000000000000000000000000000000000000000000de0b6b3a76400000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000000100000000000000000000000000a0b86991c6218b36c1d19d4a2e9eb0ce3606eb480000000000000000000000000000000000000000000000000000000000000bb8000000000000000000000000000000000000000000000000000000000000000a000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000a00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc20000000000000000000000000000000000000000000000000000000000000bb8000000000000000000000000000000000000000000000000000000000000000a000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000a00000000000000000000000000000000000000000000000000000000000000000' ) @@ -130,7 +130,7 @@ describe('RouterPlanner', () => { ) planner.addTrade(trade, slippageTolerance) - expect(planner.actions).toEqual('0x07') + expect(planner.actions).toEqual('0x09') expect(planner.params[0]).toEqual( '0x0000000000000000000000000000000000000000000000000000000000000020000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc200000000000000000000000000000000000000000000000000000000000000800000000000000000000000000000000000000000000000000de0b6b3a764000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000001000000000000000000000000006b175474e89094c44da98b954eedeac495271d0f0000000000000000000000000000000000000000000000000000000000000bb8000000000000000000000000000000000000000000000000000000000000000a000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000a00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000a0b86991c6218b36c1d19d4a2e9eb0ce3606eb480000000000000000000000000000000000000000000000000000000000000bb8000000000000000000000000000000000000000000000000000000000000000a000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000a00000000000000000000000000000000000000000000000000000000000000000' ) @@ -146,7 +146,7 @@ describe('RouterPlanner', () => { ) planner.addTrade(trade, slippageTolerance) - expect(planner.actions).toEqual('0x07') + expect(planner.actions).toEqual('0x09') expect(planner.params[0]).toEqual( '0x0000000000000000000000000000000000000000000000000000000000000020000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc200000000000000000000000000000000000000000000000000000000000000800000000000000000000000000000000000000000000000000de0b6b3a764000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000001000000000000000000000000006b175474e89094c44da98b954eedeac495271d0f0000000000000000000000000000000000000000000000000000000000000bb8000000000000000000000000000000000000000000000000000000000000000a000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000a00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000a0b86991c6218b36c1d19d4a2e9eb0ce3606eb480000000000000000000000000000000000000000000000000000000000000bb8000000000000000000000000000000000000000000000000000000000000000a000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000a00000000000000000000000000000000000000000000000000000000000000000' ) @@ -162,7 +162,7 @@ describe('RouterPlanner', () => { ) planner.addTrade(trade, slippageTolerance) - expect(planner.actions).toEqual('0x05') + expect(planner.actions).toEqual('0x07') expect(planner.params[0]).toEqual( '0x0000000000000000000000000000000000000000000000000000000000000020000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc200000000000000000000000000000000000000000000000000000000000000800000000000000000000000000000000000000000000000000de0b6b3a76400000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000000100000000000000000000000000a0b86991c6218b36c1d19d4a2e9eb0ce3606eb480000000000000000000000000000000000000000000000000000000000000bb8000000000000000000000000000000000000000000000000000000000000000a000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000a000000000000000000000000000000000000000000000000000000000000000000000000000000000000000006b175474e89094c44da98b954eedeac495271d0f0000000000000000000000000000000000000000000000000000000000000bb8000000000000000000000000000000000000000000000000000000000000000a000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000a00000000000000000000000000000000000000000000000000000000000000000' ) @@ -201,7 +201,7 @@ describe('RouterPlanner', () => { const payerIsUser = true planner.addSettle(DAI, payerIsUser) - expect(planner.actions).toEqual('0x09') + expect(planner.actions).toEqual('0x0b') expect(planner.params[0]).toEqual( '0x0000000000000000000000006b175474e89094c44da98b954eedeac495271d0f00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001' ) @@ -212,7 +212,7 @@ describe('RouterPlanner', () => { const amount = BigNumber.from('8') planner.addSettle(DAI, payerIsUser, amount) - expect(planner.actions).toEqual('0x09') + expect(planner.actions).toEqual('0x0b') expect(planner.params[0]).toEqual( '0x0000000000000000000000006b175474e89094c44da98b954eedeac495271d0f00000000000000000000000000000000000000000000000000000000000000080000000000000000000000000000000000000000000000000000000000000001' ) @@ -223,7 +223,7 @@ describe('RouterPlanner', () => { const amount = BigNumber.from('8') planner.addSettle(DAI, payerIsUser, amount) - expect(planner.actions).toEqual('0x09') + expect(planner.actions).toEqual('0x0b') expect(planner.params[0]).toEqual( '0x0000000000000000000000006b175474e89094c44da98b954eedeac495271d0f00000000000000000000000000000000000000000000000000000000000000080000000000000000000000000000000000000000000000000000000000000000' ) @@ -235,7 +235,7 @@ describe('RouterPlanner', () => { const recipient = '0xaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa' planner.addTake(DAI, recipient) - expect(planner.actions).toEqual('0x12') + expect(planner.actions).toEqual('0x0e') expect(planner.params[0]).toEqual( '0x0000000000000000000000006b175474e89094c44da98b954eedeac495271d0f000000000000000000000000aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa0000000000000000000000000000000000000000000000000000000000000000' ) @@ -246,7 +246,7 @@ describe('RouterPlanner', () => { const amount = BigNumber.from('8') planner.addTake(DAI, recipient, amount) - expect(planner.actions).toEqual('0x12') + expect(planner.actions).toEqual('0x0e') expect(planner.params[0]).toEqual( '0x0000000000000000000000006b175474e89094c44da98b954eedeac495271d0f000000000000000000000000aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa0000000000000000000000000000000000000000000000000000000000000008' ) diff --git a/sdks/v4-sdk/src/utils/v4Planner.ts b/sdks/v4-sdk/src/utils/v4Planner.ts index 09f7aa02..bd75bf35 100644 --- a/sdks/v4-sdk/src/utils/v4Planner.ts +++ b/sdks/v4-sdk/src/utils/v4Planner.ts @@ -8,6 +8,7 @@ import { encodeRouteToPath } from './encodeRouteToPath' /** * Actions * @description Constants that define what action to perform + * Not all actions are supported yet. * @enum {number} */ export enum Actions { @@ -17,27 +18,35 @@ export enum Actions { DECREASE_LIQUIDITY = 0x01, MINT_POSITION = 0x02, BURN_POSITION = 0x03, + + // for fee on transfer tokens + // INCREASE_LIQUIDITY_FROM_DELTAS = 0x04, + // MINT_POSITION_FROM_DELTAS = 0x05, + // swapping - SWAP_EXACT_IN_SINGLE = 0x04, - SWAP_EXACT_IN = 0x05, - SWAP_EXACT_OUT_SINGLE = 0x06, - SWAP_EXACT_OUT = 0x07, + SWAP_EXACT_IN_SINGLE = 0x06, + SWAP_EXACT_IN = 0x07, + SWAP_EXACT_OUT_SINGLE = 0x08, + SWAP_EXACT_OUT = 0x09, // closing deltas on the pool manager // settling - SETTLE = 0x09, - SETTLE_ALL = 0x10, - SETTLE_PAIR = 0x11, + SETTLE = 0x0b, + SETTLE_ALL = 0x0c, + SETTLE_PAIR = 0x0d, // taking - TAKE = 0x12, - TAKE_ALL = 0x13, - TAKE_PORTION = 0x14, - TAKE_PAIR = 0x15, - - SETTLE_TAKE_PAIR = 0x16, - - CLOSE_CURRENCY = 0x17, - SWEEP = 0x19, + TAKE = 0x0e, + TAKE_ALL = 0x0f, + TAKE_PORTION = 0x10, + TAKE_PAIR = 0x11, + + CLOSE_CURRENCY = 0x12, + // CLEAR_OR_TAKE = 0x13, + SWEEP = 0x14, + + // for wrapping/unwrapping native + // WRAP = 0x15, + // UNWRAP = 0x16, } export enum Subparser { @@ -150,10 +159,6 @@ export const V4_BASE_ACTIONS_ABI_DEFINITION: { [key in Actions]: readonly ParamT { name: 'currency1', type: 'address' }, { name: 'recipient', type: 'address' }, ], - [Actions.SETTLE_TAKE_PAIR]: [ - { name: 'settleCurrency', type: 'address' }, - { name: 'takeCurrency', type: 'address' }, - ], [Actions.CLOSE_CURRENCY]: [{ name: 'currency', type: 'address' }], [Actions.SWEEP]: [ { name: 'currency', type: 'address' },