ZAMM.ts•15.2 kB
import type { Address } from "viem";
export const ZAMMAddress = "0x00000000000008882D72EfA6cCE4B6a40b24C860" as Address;
export const ZAMMAbi = [
{ inputs: [], stateMutability: "payable", type: "constructor" },
{ inputs: [], name: "Expired", type: "error" },
{ inputs: [], name: "InsufficientInputAmount", type: "error" },
{ inputs: [], name: "InsufficientLiquidity", type: "error" },
{ inputs: [], name: "InsufficientLiquidityMinted", type: "error" },
{ inputs: [], name: "InsufficientOutputAmount", type: "error" },
{ inputs: [], name: "InvalidMsgVal", type: "error" },
{ inputs: [], name: "InvalidPoolTokens", type: "error" },
{ inputs: [], name: "InvalidSwapFee", type: "error" },
{ inputs: [], name: "K", type: "error" },
{ inputs: [], name: "Overflow", type: "error" },
{ inputs: [], name: "Reentrancy", type: "error" },
{ inputs: [], name: "Unauthorized", type: "error" },
{
anonymous: false,
inputs: [
{
indexed: true,
internalType: "uint256",
name: "poolId",
type: "uint256",
},
{
indexed: true,
internalType: "address",
name: "sender",
type: "address",
},
{
indexed: false,
internalType: "uint256",
name: "amount0",
type: "uint256",
},
{
indexed: false,
internalType: "uint256",
name: "amount1",
type: "uint256",
},
{ indexed: true, internalType: "address", name: "to", type: "address" },
],
name: "Burn",
type: "event",
},
{
anonymous: false,
inputs: [
{
indexed: true,
internalType: "uint256",
name: "poolId",
type: "uint256",
},
{
indexed: true,
internalType: "address",
name: "sender",
type: "address",
},
{
indexed: false,
internalType: "uint256",
name: "amount0",
type: "uint256",
},
{
indexed: false,
internalType: "uint256",
name: "amount1",
type: "uint256",
},
],
name: "Mint",
type: "event",
},
{
anonymous: false,
inputs: [
{
indexed: true,
internalType: "uint256",
name: "poolId",
type: "uint256",
},
{
indexed: true,
internalType: "address",
name: "sender",
type: "address",
},
{
indexed: false,
internalType: "uint256",
name: "amount0In",
type: "uint256",
},
{
indexed: false,
internalType: "uint256",
name: "amount1In",
type: "uint256",
},
{
indexed: false,
internalType: "uint256",
name: "amount0Out",
type: "uint256",
},
{
indexed: false,
internalType: "uint256",
name: "amount1Out",
type: "uint256",
},
{ indexed: true, internalType: "address", name: "to", type: "address" },
],
name: "Swap",
type: "event",
},
{
anonymous: false,
inputs: [
{
indexed: true,
internalType: "uint256",
name: "poolId",
type: "uint256",
},
{
indexed: false,
internalType: "uint112",
name: "reserve0",
type: "uint112",
},
{
indexed: false,
internalType: "uint112",
name: "reserve1",
type: "uint112",
},
],
name: "Sync",
type: "event",
},
{
anonymous: false,
inputs: [
{ indexed: false, internalType: "string", name: "uri", type: "string" },
{
indexed: true,
internalType: "uint256",
name: "coinId",
type: "uint256",
},
],
name: "URI",
type: "event",
},
{ stateMutability: "payable", type: "fallback" },
{
inputs: [
{
components: [
{ internalType: "uint256", name: "id0", type: "uint256" },
{ internalType: "uint256", name: "id1", type: "uint256" },
{ internalType: "address", name: "token0", type: "address" },
{ internalType: "address", name: "token1", type: "address" },
{ internalType: "uint96", name: "swapFee", type: "uint96" },
],
internalType: "struct ZAMM.PoolKey",
name: "poolKey",
type: "tuple",
},
{ internalType: "uint256", name: "amount0Desired", type: "uint256" },
{ internalType: "uint256", name: "amount1Desired", type: "uint256" },
{ internalType: "uint256", name: "amount0Min", type: "uint256" },
{ internalType: "uint256", name: "amount1Min", type: "uint256" },
{ internalType: "address", name: "to", type: "address" },
{ internalType: "uint256", name: "deadline", type: "uint256" },
],
name: "addLiquidity",
outputs: [
{ internalType: "uint256", name: "amount0", type: "uint256" },
{ internalType: "uint256", name: "amount1", type: "uint256" },
{ internalType: "uint256", name: "liquidity", type: "uint256" },
],
stateMutability: "payable",
type: "function",
},
{
inputs: [
{ internalType: "address", name: "owner", type: "address" },
{ internalType: "address", name: "spender", type: "address" },
{ internalType: "uint256", name: "id", type: "uint256" },
],
name: "allowance",
outputs: [{ internalType: "uint256", name: "amount", type: "uint256" }],
stateMutability: "view",
type: "function",
},
{
inputs: [
{ internalType: "address", name: "spender", type: "address" },
{ internalType: "uint256", name: "id", type: "uint256" },
{ internalType: "uint256", name: "amount", type: "uint256" },
],
name: "approve",
outputs: [{ internalType: "bool", name: "", type: "bool" }],
stateMutability: "nonpayable",
type: "function",
},
{
inputs: [
{ internalType: "address", name: "owner", type: "address" },
{ internalType: "uint256", name: "id", type: "uint256" },
],
name: "balanceOf",
outputs: [{ internalType: "uint256", name: "amount", type: "uint256" }],
stateMutability: "view",
type: "function",
},
{
inputs: [
{ internalType: "address", name: "token", type: "address" },
{ internalType: "uint256", name: "id", type: "uint256" },
{ internalType: "uint256", name: "amount", type: "uint256" },
],
name: "deposit",
outputs: [],
stateMutability: "payable",
type: "function",
},
{
inputs: [
{ internalType: "address", name: "owner", type: "address" },
{ internalType: "address", name: "spender", type: "address" },
],
name: "isOperator",
outputs: [{ internalType: "bool", name: "status", type: "bool" }],
stateMutability: "view",
type: "function",
},
{
inputs: [
{ internalType: "address", name: "maker", type: "address" },
{ internalType: "uint256", name: "supply", type: "uint256" },
{ internalType: "string", name: "uri", type: "string" },
],
name: "make",
outputs: [{ internalType: "uint256", name: "coinId", type: "uint256" }],
stateMutability: "nonpayable",
type: "function",
},
{
inputs: [
{ internalType: "address", name: "maker", type: "address" },
{ internalType: "address", name: "liqTo", type: "address" },
{ internalType: "uint256", name: "mkrAmt", type: "uint256" },
{ internalType: "uint256", name: "liqAmt", type: "uint256" },
{ internalType: "uint256", name: "swapFee", type: "uint256" },
{ internalType: "string", name: "uri", type: "string" },
],
name: "makeLiquid",
outputs: [
{ internalType: "uint256", name: "coinId", type: "uint256" },
{ internalType: "uint256", name: "poolId", type: "uint256" },
{ internalType: "uint256", name: "liquidity", type: "uint256" },
],
stateMutability: "payable",
type: "function",
},
{
inputs: [{ internalType: "bytes[]", name: "data", type: "bytes[]" }],
name: "multicall",
outputs: [{ internalType: "bytes[]", name: "results", type: "bytes[]" }],
stateMutability: "nonpayable",
type: "function",
},
{
inputs: [{ internalType: "uint256", name: "poolId", type: "uint256" }],
name: "pools",
outputs: [
{ internalType: "uint112", name: "reserve0", type: "uint112" },
{ internalType: "uint112", name: "reserve1", type: "uint112" },
{ internalType: "uint32", name: "blockTimestampLast", type: "uint32" },
{
internalType: "uint256",
name: "price0CumulativeLast",
type: "uint256",
},
{
internalType: "uint256",
name: "price1CumulativeLast",
type: "uint256",
},
{ internalType: "uint256", name: "kLast", type: "uint256" },
{ internalType: "uint256", name: "supply", type: "uint256" },
],
stateMutability: "view",
type: "function",
},
{
inputs: [
{ internalType: "address", name: "token", type: "address" },
{ internalType: "uint256", name: "id", type: "uint256" },
{ internalType: "address", name: "to", type: "address" },
],
name: "recoverTransientBalance",
outputs: [{ internalType: "uint256", name: "amount", type: "uint256" }],
stateMutability: "nonpayable",
type: "function",
},
{
inputs: [
{
components: [
{ internalType: "uint256", name: "id0", type: "uint256" },
{ internalType: "uint256", name: "id1", type: "uint256" },
{ internalType: "address", name: "token0", type: "address" },
{ internalType: "address", name: "token1", type: "address" },
{ internalType: "uint96", name: "swapFee", type: "uint96" },
],
internalType: "struct ZAMM.PoolKey",
name: "poolKey",
type: "tuple",
},
{ internalType: "uint256", name: "liquidity", type: "uint256" },
{ internalType: "uint256", name: "amount0Min", type: "uint256" },
{ internalType: "uint256", name: "amount1Min", type: "uint256" },
{ internalType: "address", name: "to", type: "address" },
{ internalType: "uint256", name: "deadline", type: "uint256" },
],
name: "removeLiquidity",
outputs: [
{ internalType: "uint256", name: "amount0", type: "uint256" },
{ internalType: "uint256", name: "amount1", type: "uint256" },
],
stateMutability: "nonpayable",
type: "function",
},
{
inputs: [{ internalType: "address", name: "feeTo", type: "address" }],
name: "setFeeTo",
outputs: [],
stateMutability: "payable",
type: "function",
},
{
inputs: [{ internalType: "address", name: "feeToSetter", type: "address" }],
name: "setFeeToSetter",
outputs: [],
stateMutability: "payable",
type: "function",
},
{
inputs: [
{ internalType: "address", name: "operator", type: "address" },
{ internalType: "bool", name: "approved", type: "bool" },
],
name: "setOperator",
outputs: [{ internalType: "bool", name: "", type: "bool" }],
stateMutability: "nonpayable",
type: "function",
},
{
inputs: [{ internalType: "bytes4", name: "interfaceId", type: "bytes4" }],
name: "supportsInterface",
outputs: [{ internalType: "bool", name: "result", type: "bool" }],
stateMutability: "pure",
type: "function",
},
{
inputs: [
{
components: [
{ internalType: "uint256", name: "id0", type: "uint256" },
{ internalType: "uint256", name: "id1", type: "uint256" },
{ internalType: "address", name: "token0", type: "address" },
{ internalType: "address", name: "token1", type: "address" },
{ internalType: "uint96", name: "swapFee", type: "uint96" },
],
internalType: "struct ZAMM.PoolKey",
name: "poolKey",
type: "tuple",
},
{ internalType: "uint256", name: "amount0Out", type: "uint256" },
{ internalType: "uint256", name: "amount1Out", type: "uint256" },
{ internalType: "address", name: "to", type: "address" },
{ internalType: "bytes", name: "data", type: "bytes" },
],
name: "swap",
outputs: [],
stateMutability: "nonpayable",
type: "function",
},
{
inputs: [
{
components: [
{ internalType: "uint256", name: "id0", type: "uint256" },
{ internalType: "uint256", name: "id1", type: "uint256" },
{ internalType: "address", name: "token0", type: "address" },
{ internalType: "address", name: "token1", type: "address" },
{ internalType: "uint96", name: "swapFee", type: "uint96" },
],
internalType: "struct ZAMM.PoolKey",
name: "poolKey",
type: "tuple",
},
{ internalType: "uint256", name: "amountIn", type: "uint256" },
{ internalType: "uint256", name: "amountOutMin", type: "uint256" },
{ internalType: "bool", name: "zeroForOne", type: "bool" },
{ internalType: "address", name: "to", type: "address" },
{ internalType: "uint256", name: "deadline", type: "uint256" },
],
name: "swapExactIn",
outputs: [{ internalType: "uint256", name: "amountOut", type: "uint256" }],
stateMutability: "payable",
type: "function",
},
{
inputs: [
{
components: [
{ internalType: "uint256", name: "id0", type: "uint256" },
{ internalType: "uint256", name: "id1", type: "uint256" },
{ internalType: "address", name: "token0", type: "address" },
{ internalType: "address", name: "token1", type: "address" },
{ internalType: "uint96", name: "swapFee", type: "uint96" },
],
internalType: "struct ZAMM.PoolKey",
name: "poolKey",
type: "tuple",
},
{ internalType: "uint256", name: "amountOut", type: "uint256" },
{ internalType: "uint256", name: "amountInMax", type: "uint256" },
{ internalType: "bool", name: "zeroForOne", type: "bool" },
{ internalType: "address", name: "to", type: "address" },
{ internalType: "uint256", name: "deadline", type: "uint256" },
],
name: "swapExactOut",
outputs: [{ internalType: "uint256", name: "amountIn", type: "uint256" }],
stateMutability: "payable",
type: "function",
},
{
inputs: [
{ internalType: "address", name: "to", type: "address" },
{ internalType: "uint256", name: "id", type: "uint256" },
{ internalType: "uint256", name: "amount", type: "uint256" },
],
name: "transfer",
outputs: [{ internalType: "bool", name: "", type: "bool" }],
stateMutability: "nonpayable",
type: "function",
},
{
inputs: [
{ internalType: "address", name: "from", type: "address" },
{ internalType: "address", name: "to", type: "address" },
{ internalType: "uint256", name: "id", type: "uint256" },
{ internalType: "uint256", name: "amount", type: "uint256" },
],
name: "transferFrom",
outputs: [{ internalType: "bool", name: "", type: "bool" }],
stateMutability: "nonpayable",
type: "function",
},
{ stateMutability: "payable", type: "receive" },
] as const;