/** * PoolManager Precompile ABI (0x0400) * Native Lux v4-style AMM implementation */ export const POOL_MANAGER_ABI = [ // Pool initialization { type: 'function', name: 'initialize', inputs: [ { name: 'key', type: 'tuple', components: [ { name: 'currency0', type: 'address' }, { name: 'currency1', type: 'address' }, { name: 'fee', type: 'uint24' }, { name: 'tickSpacing', type: 'int24' }, { name: 'hooks', type: 'address' }, ], }, { name: 'sqrtPriceX96', type: 'uint160' }, { name: 'hookData', type: 'bytes' }, ], outputs: [{ name: 'tick', type: 'int24' }], stateMutability: 'nonpayable', }, // Flash accounting lock { type: 'function', name: 'lock', inputs: [{ name: 'data', type: 'bytes' }], outputs: [{ name: 'result', type: 'bytes' }], stateMutability: 'nonpayable', }, // Swap { type: 'function', name: 'swap', inputs: [ { name: 'key', type: 'tuple', components: [ { name: 'currency0', type: 'address' }, { name: 'currency1', type: 'address' }, { name: 'fee', type: 'uint24' }, { name: 'tickSpacing', type: 'int24' }, { name: 'hooks', type: 'address' }, ], }, { name: 'params', type: 'tuple', components: [ { name: 'zeroForOne', type: 'bool' }, { name: 'amountSpecified', type: 'int256' }, { name: 'sqrtPriceLimitX96', type: 'uint160' }, ], }, { name: 'hookData', type: 'bytes' }, ], outputs: [{ name: 'delta', type: 'int256' }], stateMutability: 'nonpayable', }, // Modify liquidity { type: 'function', name: 'modifyLiquidity', inputs: [ { name: 'key', type: 'tuple', components: [ { name: 'currency0', type: 'address' }, { name: 'currency1', type: 'address' }, { name: 'fee', type: 'uint24' }, { name: 'tickSpacing', type: 'int24' }, { name: 'hooks', type: 'address' }, ], }, { name: 'params', type: 'tuple', components: [ { name: 'tickLower', type: 'int24' }, { name: 'tickUpper', type: 'int24' }, { name: 'liquidityDelta', type: 'int256' }, { name: 'salt', type: 'bytes32' }, ], }, { name: 'hookData', type: 'bytes' }, ], outputs: [ { name: 'delta', type: 'int256' }, { name: 'feeDelta', type: 'int256' }, ], stateMutability: 'nonpayable', }, // Donate { type: 'function', name: 'donate', inputs: [ { name: 'key', type: 'tuple', components: [ { name: 'currency0', type: 'address' }, { name: 'currency1', type: 'address' }, { name: 'fee', type: 'uint24' }, { name: 'tickSpacing', type: 'int24' }, { name: 'hooks', type: 'address' }, ], }, { name: 'amount0', type: 'uint256' }, { name: 'amount1', type: 'uint256' }, { name: 'hookData', type: 'bytes' }, ], outputs: [{ name: 'delta', type: 'int256' }], stateMutability: 'nonpayable', }, // Settle and take for flash accounting { type: 'function', name: 'settle', inputs: [{ name: 'currency', type: 'address' }], outputs: [{ name: 'paid', type: 'uint256' }], stateMutability: 'payable', }, { type: 'function', name: 'take', inputs: [ { name: 'currency', type: 'address' }, { name: 'to', type: 'address' }, { name: 'amount', type: 'uint256' }, ], outputs: [], stateMutability: 'nonpayable', }, // Pool state queries { type: 'function', name: 'getSlot0', inputs: [{ name: 'poolId', type: 'bytes32' }], outputs: [ { name: 'sqrtPriceX96', type: 'uint160' }, { name: 'tick', type: 'int24' }, { name: 'protocolFee', type: 'uint24' }, { name: 'lpFee', type: 'uint24' }, ], stateMutability: 'view', }, { type: 'function', name: 'getLiquidity', inputs: [{ name: 'poolId', type: 'bytes32' }], outputs: [{ name: 'liquidity', type: 'uint128' }], stateMutability: 'view', }, // Events { type: 'event', name: 'Initialize', inputs: [ { name: 'id', type: 'bytes32', indexed: true }, { name: 'currency0', type: 'address', indexed: true }, { name: 'currency1', type: 'address', indexed: true }, { name: 'fee', type: 'uint24', indexed: false }, { name: 'tickSpacing', type: 'int24', indexed: false }, { name: 'hooks', type: 'address', indexed: false }, { name: 'sqrtPriceX96', type: 'uint160', indexed: false }, { name: 'tick', type: 'int24', indexed: false }, ], }, { type: 'event', name: 'Swap', inputs: [ { name: 'id', type: 'bytes32', indexed: true }, { name: 'sender', type: 'address', indexed: true }, { name: 'amount0', type: 'int128', indexed: false }, { name: 'amount1', type: 'int128', indexed: false }, { name: 'sqrtPriceX96', type: 'uint160', indexed: false }, { name: 'liquidity', type: 'uint128', indexed: false }, { name: 'tick', type: 'int24', indexed: false }, { name: 'fee', type: 'uint24', indexed: false }, ], }, ] as const