|
@@ -0,0 +1,340 @@
|
|
|
|
|
+export const LB_PAIR_ABI = [
|
|
|
|
|
+ {
|
|
|
|
|
+ name: 'getActiveId',
|
|
|
|
|
+ type: 'function',
|
|
|
|
|
+ stateMutability: 'view',
|
|
|
|
|
+ inputs: [],
|
|
|
|
|
+ outputs: [{ name: 'activeId', type: 'uint24' }],
|
|
|
|
|
+ },
|
|
|
|
|
+ {
|
|
|
|
|
+ name: 'getBinStep',
|
|
|
|
|
+ type: 'function',
|
|
|
|
|
+ stateMutability: 'view',
|
|
|
|
|
+ inputs: [],
|
|
|
|
|
+ outputs: [{ name: 'binStep', type: 'uint16' }],
|
|
|
|
|
+ },
|
|
|
|
|
+ {
|
|
|
|
|
+ name: 'getReserves',
|
|
|
|
|
+ type: 'function',
|
|
|
|
|
+ stateMutability: 'view',
|
|
|
|
|
+ inputs: [],
|
|
|
|
|
+ outputs: [
|
|
|
|
|
+ { name: 'reserveX', type: 'uint128' },
|
|
|
|
|
+ { name: 'reserveY', type: 'uint128' },
|
|
|
|
|
+ ],
|
|
|
|
|
+ },
|
|
|
|
|
+ {
|
|
|
|
|
+ name: 'getBin',
|
|
|
|
|
+ type: 'function',
|
|
|
|
|
+ stateMutability: 'view',
|
|
|
|
|
+ inputs: [{ name: 'id', type: 'uint24' }],
|
|
|
|
|
+ outputs: [
|
|
|
|
|
+ { name: 'binReserveX', type: 'uint128' },
|
|
|
|
|
+ { name: 'binReserveY', type: 'uint128' },
|
|
|
|
|
+ ],
|
|
|
|
|
+ },
|
|
|
|
|
+ {
|
|
|
|
|
+ name: 'balanceOf',
|
|
|
|
|
+ type: 'function',
|
|
|
|
|
+ stateMutability: 'view',
|
|
|
|
|
+ inputs: [
|
|
|
|
|
+ { name: 'account', type: 'address' },
|
|
|
|
|
+ { name: 'id', type: 'uint256' },
|
|
|
|
|
+ ],
|
|
|
|
|
+ outputs: [{ name: 'balance', type: 'uint256' }],
|
|
|
|
|
+ },
|
|
|
|
|
+ {
|
|
|
|
|
+ name: 'balanceOfBatch',
|
|
|
|
|
+ type: 'function',
|
|
|
|
|
+ stateMutability: 'view',
|
|
|
|
|
+ inputs: [
|
|
|
|
|
+ { name: 'accounts', type: 'address[]' },
|
|
|
|
|
+ { name: 'ids', type: 'uint256[]' },
|
|
|
|
|
+ ],
|
|
|
|
|
+ outputs: [{ name: 'balances', type: 'uint256[]' }],
|
|
|
|
|
+ },
|
|
|
|
|
+ {
|
|
|
|
|
+ name: 'approveForAll',
|
|
|
|
|
+ type: 'function',
|
|
|
|
|
+ stateMutability: 'nonpayable',
|
|
|
|
|
+ inputs: [
|
|
|
|
|
+ { name: 'spender', type: 'address' },
|
|
|
|
|
+ { name: 'approved', type: 'bool' },
|
|
|
|
|
+ ],
|
|
|
|
|
+ outputs: [],
|
|
|
|
|
+ },
|
|
|
|
|
+ {
|
|
|
|
|
+ name: 'isApprovedForAll',
|
|
|
|
|
+ type: 'function',
|
|
|
|
|
+ stateMutability: 'view',
|
|
|
|
|
+ inputs: [
|
|
|
|
|
+ { name: 'owner', type: 'address' },
|
|
|
|
|
+ { name: 'spender', type: 'address' },
|
|
|
|
|
+ ],
|
|
|
|
|
+ outputs: [{ name: 'approved', type: 'bool' }],
|
|
|
|
|
+ },
|
|
|
|
|
+ {
|
|
|
|
|
+ name: 'totalSupply',
|
|
|
|
|
+ type: 'function',
|
|
|
|
|
+ stateMutability: 'view',
|
|
|
|
|
+ inputs: [{ name: 'id', type: 'uint256' }],
|
|
|
|
|
+ outputs: [{ name: 'supply', type: 'uint256' }],
|
|
|
|
|
+ },
|
|
|
|
|
+ {
|
|
|
|
|
+ name: 'getTokenX',
|
|
|
|
|
+ type: 'function',
|
|
|
|
|
+ stateMutability: 'view',
|
|
|
|
|
+ inputs: [],
|
|
|
|
|
+ outputs: [{ name: 'tokenX', type: 'address' }],
|
|
|
|
|
+ },
|
|
|
|
|
+ {
|
|
|
|
|
+ name: 'getTokenY',
|
|
|
|
|
+ type: 'function',
|
|
|
|
|
+ stateMutability: 'view',
|
|
|
|
|
+ inputs: [],
|
|
|
|
|
+ outputs: [{ name: 'tokenY', type: 'address' }],
|
|
|
|
|
+ },
|
|
|
|
|
+] as const
|
|
|
|
|
+
|
|
|
|
|
+const liquidityParametersTuple = {
|
|
|
|
|
+ name: 'liquidityParameters',
|
|
|
|
|
+ type: 'tuple',
|
|
|
|
|
+ components: [
|
|
|
|
|
+ { name: 'tokenX', type: 'address' },
|
|
|
|
|
+ { name: 'tokenY', type: 'address' },
|
|
|
|
|
+ { name: 'binStep', type: 'uint256' },
|
|
|
|
|
+ { name: 'amountX', type: 'uint256' },
|
|
|
|
|
+ { name: 'amountY', type: 'uint256' },
|
|
|
|
|
+ { name: 'amountXMin', type: 'uint256' },
|
|
|
|
|
+ { name: 'amountYMin', type: 'uint256' },
|
|
|
|
|
+ { name: 'activeIdDesired', type: 'uint256' },
|
|
|
|
|
+ { name: 'idSlippage', type: 'uint256' },
|
|
|
|
|
+ { name: 'deltaIds', type: 'int256[]' },
|
|
|
|
|
+ { name: 'distributionX', type: 'uint256[]' },
|
|
|
|
|
+ { name: 'distributionY', type: 'uint256[]' },
|
|
|
|
|
+ { name: 'to', type: 'address' },
|
|
|
|
|
+ { name: 'refundTo', type: 'address' },
|
|
|
|
|
+ { name: 'deadline', type: 'uint256' },
|
|
|
|
|
+ ],
|
|
|
|
|
+} as const
|
|
|
|
|
+
|
|
|
|
|
+const liquidityOutputs = [
|
|
|
|
|
+ { name: 'amountXAdded', type: 'uint256' },
|
|
|
|
|
+ { name: 'amountYAdded', type: 'uint256' },
|
|
|
|
|
+ { name: 'amountXLeft', type: 'uint256' },
|
|
|
|
|
+ { name: 'amountYLeft', type: 'uint256' },
|
|
|
|
|
+ { name: 'depositIds', type: 'uint256[]' },
|
|
|
|
|
+ { name: 'liquidityMinted', type: 'uint256[]' },
|
|
|
|
|
+] as const
|
|
|
|
|
+
|
|
|
|
|
+const pathTuple = {
|
|
|
|
|
+ name: 'path',
|
|
|
|
|
+ type: 'tuple',
|
|
|
|
|
+ components: [
|
|
|
|
|
+ { name: 'pairBinSteps', type: 'uint256[]' },
|
|
|
|
|
+ { name: 'versions', type: 'uint8[]' },
|
|
|
|
|
+ { name: 'tokenPath', type: 'address[]' },
|
|
|
|
|
+ ],
|
|
|
|
|
+} as const
|
|
|
|
|
+
|
|
|
|
|
+export const LB_ROUTER_ABI = [
|
|
|
|
|
+ {
|
|
|
|
|
+ name: 'getFactory',
|
|
|
|
|
+ type: 'function',
|
|
|
|
|
+ stateMutability: 'view',
|
|
|
|
|
+ inputs: [],
|
|
|
|
|
+ outputs: [{ name: 'lbFactory', type: 'address' }],
|
|
|
|
|
+ },
|
|
|
|
|
+ {
|
|
|
|
|
+ name: 'getWNATIVE',
|
|
|
|
|
+ type: 'function',
|
|
|
|
|
+ stateMutability: 'view',
|
|
|
|
|
+ inputs: [],
|
|
|
|
|
+ outputs: [{ name: 'wnative', type: 'address' }],
|
|
|
|
|
+ },
|
|
|
|
|
+ {
|
|
|
|
|
+ name: 'getIdFromPrice',
|
|
|
|
|
+ type: 'function',
|
|
|
|
|
+ stateMutability: 'view',
|
|
|
|
|
+ inputs: [
|
|
|
|
|
+ { name: 'pair', type: 'address' },
|
|
|
|
|
+ { name: 'price', type: 'uint256' },
|
|
|
|
|
+ ],
|
|
|
|
|
+ outputs: [{ name: 'id', type: 'uint24' }],
|
|
|
|
|
+ },
|
|
|
|
|
+ {
|
|
|
|
|
+ name: 'getPriceFromId',
|
|
|
|
|
+ type: 'function',
|
|
|
|
|
+ stateMutability: 'view',
|
|
|
|
|
+ inputs: [
|
|
|
|
|
+ { name: 'pair', type: 'address' },
|
|
|
|
|
+ { name: 'id', type: 'uint24' },
|
|
|
|
|
+ ],
|
|
|
|
|
+ outputs: [{ name: 'price', type: 'uint256' }],
|
|
|
|
|
+ },
|
|
|
|
|
+ {
|
|
|
|
|
+ name: 'getSwapIn',
|
|
|
|
|
+ type: 'function',
|
|
|
|
|
+ stateMutability: 'view',
|
|
|
|
|
+ inputs: [
|
|
|
|
|
+ { name: 'pair', type: 'address' },
|
|
|
|
|
+ { name: 'amountOut', type: 'uint128' },
|
|
|
|
|
+ { name: 'swapForY', type: 'bool' },
|
|
|
|
|
+ ],
|
|
|
|
|
+ outputs: [
|
|
|
|
|
+ { name: 'amountIn', type: 'uint128' },
|
|
|
|
|
+ { name: 'amountOutLeft', type: 'uint128' },
|
|
|
|
|
+ { name: 'fee', type: 'uint128' },
|
|
|
|
|
+ ],
|
|
|
|
|
+ },
|
|
|
|
|
+ {
|
|
|
|
|
+ name: 'getSwapOut',
|
|
|
|
|
+ type: 'function',
|
|
|
|
|
+ stateMutability: 'view',
|
|
|
|
|
+ inputs: [
|
|
|
|
|
+ { name: 'pair', type: 'address' },
|
|
|
|
|
+ { name: 'amountIn', type: 'uint128' },
|
|
|
|
|
+ { name: 'swapForY', type: 'bool' },
|
|
|
|
|
+ ],
|
|
|
|
|
+ outputs: [
|
|
|
|
|
+ { name: 'amountInLeft', type: 'uint128' },
|
|
|
|
|
+ { name: 'amountOut', type: 'uint128' },
|
|
|
|
|
+ { name: 'fee', type: 'uint128' },
|
|
|
|
|
+ ],
|
|
|
|
|
+ },
|
|
|
|
|
+ {
|
|
|
|
|
+ name: 'addLiquidity',
|
|
|
|
|
+ type: 'function',
|
|
|
|
|
+ stateMutability: 'nonpayable',
|
|
|
|
|
+ inputs: [liquidityParametersTuple],
|
|
|
|
|
+ outputs: [...liquidityOutputs],
|
|
|
|
|
+ },
|
|
|
|
|
+ {
|
|
|
|
|
+ name: 'addLiquidityNATIVE',
|
|
|
|
|
+ type: 'function',
|
|
|
|
|
+ stateMutability: 'payable',
|
|
|
|
|
+ inputs: [liquidityParametersTuple],
|
|
|
|
|
+ outputs: [...liquidityOutputs],
|
|
|
|
|
+ },
|
|
|
|
|
+ {
|
|
|
|
|
+ name: 'removeLiquidity',
|
|
|
|
|
+ type: 'function',
|
|
|
|
|
+ stateMutability: 'nonpayable',
|
|
|
|
|
+ inputs: [
|
|
|
|
|
+ { name: 'tokenX', type: 'address' },
|
|
|
|
|
+ { name: 'tokenY', type: 'address' },
|
|
|
|
|
+ { name: 'binStep', type: 'uint16' },
|
|
|
|
|
+ { name: 'amountXMin', type: 'uint256' },
|
|
|
|
|
+ { name: 'amountYMin', type: 'uint256' },
|
|
|
|
|
+ { name: 'ids', type: 'uint256[]' },
|
|
|
|
|
+ { name: 'amounts', type: 'uint256[]' },
|
|
|
|
|
+ { name: 'to', type: 'address' },
|
|
|
|
|
+ { name: 'deadline', type: 'uint256' },
|
|
|
|
|
+ ],
|
|
|
|
|
+ outputs: [
|
|
|
|
|
+ { name: 'amountX', type: 'uint256' },
|
|
|
|
|
+ { name: 'amountY', type: 'uint256' },
|
|
|
|
|
+ ],
|
|
|
|
|
+ },
|
|
|
|
|
+ {
|
|
|
|
|
+ name: 'removeLiquidityNATIVE',
|
|
|
|
|
+ type: 'function',
|
|
|
|
|
+ stateMutability: 'nonpayable',
|
|
|
|
|
+ inputs: [
|
|
|
|
|
+ { name: 'token', type: 'address' },
|
|
|
|
|
+ { name: 'binStep', type: 'uint16' },
|
|
|
|
|
+ { name: 'amountTokenMin', type: 'uint256' },
|
|
|
|
|
+ { name: 'amountNATIVEMin', type: 'uint256' },
|
|
|
|
|
+ { name: 'ids', type: 'uint256[]' },
|
|
|
|
|
+ { name: 'amounts', type: 'uint256[]' },
|
|
|
|
|
+ { name: 'to', type: 'address' },
|
|
|
|
|
+ { name: 'deadline', type: 'uint256' },
|
|
|
|
|
+ ],
|
|
|
|
|
+ outputs: [
|
|
|
|
|
+ { name: 'amountToken', type: 'uint256' },
|
|
|
|
|
+ { name: 'amountNATIVE', type: 'uint256' },
|
|
|
|
|
+ ],
|
|
|
|
|
+ },
|
|
|
|
|
+ {
|
|
|
|
|
+ name: 'swapExactTokensForTokens',
|
|
|
|
|
+ type: 'function',
|
|
|
|
|
+ stateMutability: 'nonpayable',
|
|
|
|
|
+ inputs: [
|
|
|
|
|
+ { name: 'amountIn', type: 'uint256' },
|
|
|
|
|
+ { name: 'amountOutMin', type: 'uint256' },
|
|
|
|
|
+ pathTuple,
|
|
|
|
|
+ { name: 'to', type: 'address' },
|
|
|
|
|
+ { name: 'deadline', type: 'uint256' },
|
|
|
|
|
+ ],
|
|
|
|
|
+ outputs: [{ name: 'amountOut', type: 'uint256' }],
|
|
|
|
|
+ },
|
|
|
|
|
+ {
|
|
|
|
|
+ name: 'swapExactNATIVEForTokens',
|
|
|
|
|
+ type: 'function',
|
|
|
|
|
+ stateMutability: 'payable',
|
|
|
|
|
+ inputs: [
|
|
|
|
|
+ { name: 'amountOutMin', type: 'uint256' },
|
|
|
|
|
+ pathTuple,
|
|
|
|
|
+ { name: 'to', type: 'address' },
|
|
|
|
|
+ { name: 'deadline', type: 'uint256' },
|
|
|
|
|
+ ],
|
|
|
|
|
+ outputs: [{ name: 'amountOut', type: 'uint256' }],
|
|
|
|
|
+ },
|
|
|
|
|
+ {
|
|
|
|
|
+ name: 'swapExactTokensForNATIVE',
|
|
|
|
|
+ type: 'function',
|
|
|
|
|
+ stateMutability: 'nonpayable',
|
|
|
|
|
+ inputs: [
|
|
|
|
|
+ { name: 'amountIn', type: 'uint256' },
|
|
|
|
|
+ { name: 'amountOutMinNATIVE', type: 'uint256' },
|
|
|
|
|
+ pathTuple,
|
|
|
|
|
+ { name: 'to', type: 'address' },
|
|
|
|
|
+ { name: 'deadline', type: 'uint256' },
|
|
|
|
|
+ ],
|
|
|
|
|
+ outputs: [{ name: 'amountOut', type: 'uint256' }],
|
|
|
|
|
+ },
|
|
|
|
|
+] as const
|
|
|
|
|
+
|
|
|
|
|
+export const ERC20_ABI = [
|
|
|
|
|
+ {
|
|
|
|
|
+ name: 'approve',
|
|
|
|
|
+ type: 'function',
|
|
|
|
|
+ stateMutability: 'nonpayable',
|
|
|
|
|
+ inputs: [
|
|
|
|
|
+ { name: 'spender', type: 'address' },
|
|
|
|
|
+ { name: 'amount', type: 'uint256' },
|
|
|
|
|
+ ],
|
|
|
|
|
+ outputs: [{ name: 'success', type: 'bool' }],
|
|
|
|
|
+ },
|
|
|
|
|
+ {
|
|
|
|
|
+ name: 'allowance',
|
|
|
|
|
+ type: 'function',
|
|
|
|
|
+ stateMutability: 'view',
|
|
|
|
|
+ inputs: [
|
|
|
|
|
+ { name: 'owner', type: 'address' },
|
|
|
|
|
+ { name: 'spender', type: 'address' },
|
|
|
|
|
+ ],
|
|
|
|
|
+ outputs: [{ name: 'remaining', type: 'uint256' }],
|
|
|
|
|
+ },
|
|
|
|
|
+ {
|
|
|
|
|
+ name: 'balanceOf',
|
|
|
|
|
+ type: 'function',
|
|
|
|
|
+ stateMutability: 'view',
|
|
|
|
|
+ inputs: [{ name: 'account', type: 'address' }],
|
|
|
|
|
+ outputs: [{ name: 'balance', type: 'uint256' }],
|
|
|
|
|
+ },
|
|
|
|
|
+ {
|
|
|
|
|
+ name: 'decimals',
|
|
|
|
|
+ type: 'function',
|
|
|
|
|
+ stateMutability: 'view',
|
|
|
|
|
+ inputs: [],
|
|
|
|
|
+ outputs: [{ name: 'decimals', type: 'uint8' }],
|
|
|
|
|
+ },
|
|
|
|
|
+ {
|
|
|
|
|
+ name: 'symbol',
|
|
|
|
|
+ type: 'function',
|
|
|
|
|
+ stateMutability: 'view',
|
|
|
|
|
+ inputs: [],
|
|
|
|
|
+ outputs: [{ name: 'symbol', type: 'string' }],
|
|
|
|
|
+ },
|
|
|
|
|
+] as const
|