clanker-sdk
Version:
SDK for deploying tokens on Base using Clanker
2,959 lines • 89.6 kB
JavaScript
// src/v4/extensions/airdrop.ts
import { StandardMerkleTree } from "@openzeppelin/merkle-tree";
import { isAddressEqual, stringify } from "viem";
import * as z2 from "zod/v4";
// src/abi/v4/ClankerAirdrop.ts
var ClankerAirdrop_v4_abi = [
{
inputs: [{ internalType: "address", name: "factory_", type: "address" }],
stateMutability: "nonpayable",
type: "constructor"
},
{ inputs: [], name: "AirdropAlreadyExists", type: "error" },
{ inputs: [], name: "AirdropLockupDurationTooShort", type: "error" },
{ inputs: [], name: "AirdropNotUnlocked", type: "error" },
{ inputs: [], name: "InvalidAirdropPercentage", type: "error" },
{ inputs: [], name: "InvalidMerkleRoot", type: "error" },
{ inputs: [], name: "InvalidMsgValue", type: "error" },
{ inputs: [], name: "InvalidProof", type: "error" },
{ inputs: [], name: "ReentrancyGuardReentrantCall", type: "error" },
{ inputs: [], name: "TotalMaxClaimed", type: "error" },
{ inputs: [], name: "Unauthorized", type: "error" },
{ inputs: [], name: "UserMaxClaimed", type: "error" },
{ inputs: [], name: "ZeroClaim", type: "error" },
{ inputs: [], name: "ZeroToClaim", type: "error" },
{
anonymous: false,
inputs: [
{ indexed: true, internalType: "address", name: "token", type: "address" },
{ indexed: true, internalType: "address", name: "user", type: "address" },
{ indexed: false, internalType: "uint256", name: "totalUserAmountClaimed", type: "uint256" },
{ indexed: false, internalType: "uint256", name: "userAmountStillLocked", type: "uint256" }
],
name: "AirdropClaimed",
type: "event"
},
{
anonymous: false,
inputs: [
{ indexed: true, internalType: "address", name: "token", type: "address" },
{ indexed: false, internalType: "bytes32", name: "merkleRoot", type: "bytes32" },
{ indexed: false, internalType: "uint256", name: "supply", type: "uint256" },
{ indexed: false, internalType: "uint256", name: "lockupDuration", type: "uint256" },
{ indexed: false, internalType: "uint256", name: "vestingDuration", type: "uint256" }
],
name: "AirdropCreated",
type: "event"
},
{
inputs: [],
name: "MIN_LOCKUP_DURATION",
outputs: [{ internalType: "uint256", name: "", type: "uint256" }],
stateMutability: "view",
type: "function"
},
{
inputs: [{ internalType: "address", name: "token", type: "address" }],
name: "airdrops",
outputs: [
{ internalType: "bytes32", name: "merkleRoot", type: "bytes32" },
{ internalType: "uint256", name: "totalSupply", type: "uint256" },
{ internalType: "uint256", name: "totalClaimed", type: "uint256" },
{ internalType: "uint256", name: "lockupEndTime", type: "uint256" },
{ internalType: "uint256", name: "vestingEndTime", type: "uint256" }
],
stateMutability: "view",
type: "function"
},
{
inputs: [
{ internalType: "address", name: "token", type: "address" },
{ internalType: "address", name: "recipient", type: "address" },
{ internalType: "uint256", name: "allocatedAmount", type: "uint256" }
],
name: "amountAvailableToClaim",
outputs: [{ internalType: "uint256", name: "", type: "uint256" }],
stateMutability: "view",
type: "function"
},
{
inputs: [
{ internalType: "address", name: "token", type: "address" },
{ internalType: "address", name: "recipient", type: "address" },
{ internalType: "uint256", name: "allocatedAmount", type: "uint256" },
{ internalType: "bytes32[]", name: "proof", type: "bytes32[]" }
],
name: "claim",
outputs: [],
stateMutability: "nonpayable",
type: "function"
},
{
inputs: [],
name: "factory",
outputs: [{ internalType: "address", name: "", type: "address" }],
stateMutability: "view",
type: "function"
},
{
inputs: [
{
components: [
{
components: [
{ internalType: "address", name: "tokenAdmin", type: "address" },
{ internalType: "string", name: "name", type: "string" },
{ internalType: "string", name: "symbol", type: "string" },
{ internalType: "bytes32", name: "salt", type: "bytes32" },
{ internalType: "string", name: "image", type: "string" },
{ internalType: "string", name: "metadata", type: "string" },
{ internalType: "string", name: "context", type: "string" },
{ internalType: "uint256", name: "originatingChainId", type: "uint256" }
],
internalType: "struct IClanker.TokenConfig",
name: "tokenConfig",
type: "tuple"
},
{
components: [
{ internalType: "address", name: "hook", type: "address" },
{ internalType: "address", name: "pairedToken", type: "address" },
{ internalType: "int24", name: "tickIfToken0IsClanker", type: "int24" },
{ internalType: "int24", name: "tickSpacing", type: "int24" },
{ internalType: "bytes", name: "poolData", type: "bytes" }
],
internalType: "struct IClanker.PoolConfig",
name: "poolConfig",
type: "tuple"
},
{
components: [
{ internalType: "address", name: "locker", type: "address" },
{ internalType: "address[]", name: "rewardAdmins", type: "address[]" },
{ internalType: "address[]", name: "rewardRecipients", type: "address[]" },
{ internalType: "uint16[]", name: "rewardBps", type: "uint16[]" },
{ internalType: "int24[]", name: "tickLower", type: "int24[]" },
{ internalType: "int24[]", name: "tickUpper", type: "int24[]" },
{ internalType: "uint16[]", name: "positionBps", type: "uint16[]" },
{ internalType: "bytes", name: "lockerData", type: "bytes" }
],
internalType: "struct IClanker.LockerConfig",
name: "lockerConfig",
type: "tuple"
},
{
components: [
{ internalType: "address", name: "mevModule", type: "address" },
{ internalType: "bytes", name: "mevModuleData", type: "bytes" }
],
internalType: "struct IClanker.MevModuleConfig",
name: "mevModuleConfig",
type: "tuple"
},
{
components: [
{ internalType: "address", name: "extension", type: "address" },
{ internalType: "uint256", name: "msgValue", type: "uint256" },
{ internalType: "uint16", name: "extensionBps", type: "uint16" },
{ internalType: "bytes", name: "extensionData", type: "bytes" }
],
internalType: "struct IClanker.ExtensionConfig[]",
name: "extensionConfigs",
type: "tuple[]"
}
],
internalType: "struct IClanker.DeploymentConfig",
name: "deploymentConfig",
type: "tuple"
},
{
components: [
{ internalType: "Currency", name: "currency0", type: "address" },
{ internalType: "Currency", name: "currency1", type: "address" },
{ internalType: "uint24", name: "fee", type: "uint24" },
{ internalType: "int24", name: "tickSpacing", type: "int24" },
{ internalType: "contract IHooks", name: "hooks", type: "address" }
],
internalType: "struct PoolKey",
name: "",
type: "tuple"
},
{ internalType: "address", name: "token", type: "address" },
{ internalType: "uint256", name: "extensionSupply", type: "uint256" },
{ internalType: "uint256", name: "extensionIndex", type: "uint256" }
],
name: "receiveTokens",
outputs: [],
stateMutability: "payable",
type: "function"
},
{
inputs: [{ internalType: "bytes4", name: "interfaceId", type: "bytes4" }],
name: "supportsInterface",
outputs: [{ internalType: "bool", name: "", type: "bool" }],
stateMutability: "pure",
type: "function"
}
];
// src/utils/clankers.ts
import { arbitrum, base, baseSepolia, monadTestnet, unichain } from "viem/chains";
// src/abi/v0/Clanker.ts
var Clanker_v0_abi = [
{
inputs: [
{ internalType: "address", name: "taxCollector_", type: "address" },
{ internalType: "address", name: "weth_", type: "address" },
{ internalType: "address", name: "locker_", type: "address" },
{
internalType: "address",
name: "uniswapV3Factory_",
type: "address"
},
{
internalType: "address",
name: "positionManager_",
type: "address"
},
{
internalType: "uint64",
name: "defaultLockingPeriod_",
type: "uint64"
},
{ internalType: "address", name: "swapRouter_", type: "address" }
],
stateMutability: "nonpayable",
type: "constructor"
},
{
inputs: [{ internalType: "address", name: "owner", type: "address" }],
name: "OwnableInvalidOwner",
type: "error"
},
{
inputs: [{ internalType: "address", name: "account", type: "address" }],
name: "OwnableUnauthorizedAccount",
type: "error"
},
{
anonymous: false,
inputs: [
{
indexed: true,
internalType: "address",
name: "previousOwner",
type: "address"
},
{
indexed: true,
internalType: "address",
name: "newOwner",
type: "address"
}
],
name: "OwnershipTransferred",
type: "event"
},
{
anonymous: false,
inputs: [
{
indexed: false,
internalType: "address",
name: "tokenAddress",
type: "address"
},
{
indexed: false,
internalType: "uint256",
name: "lpNftId",
type: "uint256"
},
{
indexed: false,
internalType: "address",
name: "deployer",
type: "address"
},
{
indexed: false,
internalType: "string",
name: "name",
type: "string"
},
{
indexed: false,
internalType: "string",
name: "symbol",
type: "string"
},
{
indexed: false,
internalType: "uint256",
name: "supply",
type: "uint256"
},
{
indexed: false,
internalType: "uint256",
name: "_supply",
type: "uint256"
},
{
indexed: false,
internalType: "address",
name: "lockerAddress",
type: "address"
}
],
name: "TokenCreated",
type: "event"
},
{
inputs: [],
name: "defaultLockingPeriod",
outputs: [{ internalType: "uint64", name: "", type: "uint64" }],
stateMutability: "view",
type: "function"
},
{
inputs: [
{ internalType: "string", name: "_name", type: "string" },
{ internalType: "string", name: "_symbol", type: "string" },
{ internalType: "uint256", name: "_supply", type: "uint256" },
{ internalType: "int24", name: "_initialTick", type: "int24" },
{ internalType: "uint24", name: "_fee", type: "uint24" },
{ internalType: "bytes32", name: "_salt", type: "bytes32" },
{ internalType: "address", name: "_deployer", type: "address" }
],
name: "deployToken",
outputs: [
{ internalType: "contract Token", name: "token", type: "address" },
{ internalType: "uint256", name: "tokenId", type: "uint256" }
],
stateMutability: "payable",
type: "function"
},
{
inputs: [
{ internalType: "address", name: "deployer", type: "address" },
{ internalType: "string", name: "name", type: "string" },
{ internalType: "string", name: "symbol", type: "string" },
{ internalType: "uint256", name: "supply", type: "uint256" }
],
name: "generateSalt",
outputs: [
{ internalType: "bytes32", name: "salt", type: "bytes32" },
{ internalType: "address", name: "token", type: "address" }
],
stateMutability: "view",
type: "function"
},
{
inputs: [
{ internalType: "address", name: "token", type: "address" },
{ internalType: "uint24", name: "_fee", type: "uint24" }
],
name: "initialSwapTokens",
outputs: [],
stateMutability: "payable",
type: "function"
},
{
inputs: [],
name: "liquidityLocker",
outputs: [
{
internalType: "contract ILockerFactory",
name: "",
type: "address"
}
],
stateMutability: "view",
type: "function"
},
{
inputs: [],
name: "lpFeesCut",
outputs: [{ internalType: "uint8", name: "", type: "uint8" }],
stateMutability: "view",
type: "function"
},
{
inputs: [],
name: "owner",
outputs: [{ internalType: "address", name: "", type: "address" }],
stateMutability: "view",
type: "function"
},
{
inputs: [],
name: "positionManager",
outputs: [
{
internalType: "contract INonfungiblePositionManager",
name: "",
type: "address"
}
],
stateMutability: "view",
type: "function"
},
{
inputs: [
{ internalType: "address", name: "deployer", type: "address" },
{ internalType: "string", name: "name", type: "string" },
{ internalType: "string", name: "symbol", type: "string" },
{ internalType: "uint256", name: "supply", type: "uint256" },
{ internalType: "bytes32", name: "salt", type: "bytes32" }
],
name: "predictToken",
outputs: [{ internalType: "address", name: "", type: "address" }],
stateMutability: "view",
type: "function"
},
{
inputs: [],
name: "protocolCut",
outputs: [{ internalType: "uint8", name: "", type: "uint8" }],
stateMutability: "view",
type: "function"
},
{
inputs: [],
name: "renounceOwnership",
outputs: [],
stateMutability: "nonpayable",
type: "function"
},
{
inputs: [],
name: "swapRouter",
outputs: [{ internalType: "address", name: "", type: "address" }],
stateMutability: "view",
type: "function"
},
{
inputs: [],
name: "taxCollector",
outputs: [{ internalType: "address", name: "", type: "address" }],
stateMutability: "view",
type: "function"
},
{
inputs: [],
name: "taxRate",
outputs: [{ internalType: "uint8", name: "", type: "uint8" }],
stateMutability: "view",
type: "function"
},
{
inputs: [{ internalType: "address", name: "newOwner", type: "address" }],
name: "transferOwnership",
outputs: [],
stateMutability: "nonpayable",
type: "function"
},
{
inputs: [],
name: "uniswapV3Factory",
outputs: [
{
internalType: "contract IUniswapV3Factory",
name: "",
type: "address"
}
],
stateMutability: "view",
type: "function"
},
{
inputs: [{ internalType: "uint64", name: "newPeriod", type: "uint64" }],
name: "updateDefaultLockingPeriod",
outputs: [],
stateMutability: "nonpayable",
type: "function"
},
{
inputs: [{ internalType: "address", name: "newLocker", type: "address" }],
name: "updateLiquidityLocker",
outputs: [],
stateMutability: "nonpayable",
type: "function"
},
{
inputs: [{ internalType: "uint8", name: "newFee", type: "uint8" }],
name: "updateProtocolFees",
outputs: [],
stateMutability: "nonpayable",
type: "function"
},
{
inputs: [{ internalType: "address", name: "newCollector", type: "address" }],
name: "updateTaxCollector",
outputs: [],
stateMutability: "nonpayable",
type: "function"
},
{
inputs: [{ internalType: "uint8", name: "newRate", type: "uint8" }],
name: "updateTaxRate",
outputs: [],
stateMutability: "nonpayable",
type: "function"
},
{
inputs: [],
name: "weth",
outputs: [{ internalType: "address", name: "", type: "address" }],
stateMutability: "view",
type: "function"
}
];
// src/abi/v1/Clanker.ts
var Clanker_v1_abi = [
{
inputs: [
{ internalType: "address", name: "taxCollector_", type: "address" },
{ internalType: "address", name: "weth_", type: "address" },
{ internalType: "address", name: "locker_", type: "address" },
{ internalType: "address", name: "uniswapV3Factory_", type: "address" },
{ internalType: "address", name: "positionManager_", type: "address" },
{ internalType: "uint64", name: "defaultLockingPeriod_", type: "uint64" },
{ internalType: "address", name: "swapRouter_", type: "address" },
{ internalType: "address", name: "owner_", type: "address" }
],
stateMutability: "nonpayable",
type: "constructor"
},
{ inputs: [], name: "Deprecated", type: "error" },
{
inputs: [{ internalType: "address", name: "owner", type: "address" }],
name: "OwnableInvalidOwner",
type: "error"
},
{
inputs: [{ internalType: "address", name: "account", type: "address" }],
name: "OwnableUnauthorizedAccount",
type: "error"
},
{
anonymous: false,
inputs: [
{
indexed: true,
internalType: "address",
name: "previousOwner",
type: "address"
},
{
indexed: true,
internalType: "address",
name: "newOwner",
type: "address"
}
],
name: "OwnershipTransferred",
type: "event"
},
{
anonymous: false,
inputs: [
{
indexed: false,
internalType: "address",
name: "tokenAddress",
type: "address"
},
{
indexed: false,
internalType: "uint256",
name: "lpNftId",
type: "uint256"
},
{
indexed: false,
internalType: "address",
name: "deployer",
type: "address"
},
{ indexed: false, internalType: "uint256", name: "fid", type: "uint256" },
{ indexed: false, internalType: "string", name: "name", type: "string" },
{
indexed: false,
internalType: "string",
name: "symbol",
type: "string"
},
{
indexed: false,
internalType: "uint256",
name: "supply",
type: "uint256"
},
{
indexed: false,
internalType: "address",
name: "lockerAddress",
type: "address"
},
{
indexed: false,
internalType: "string",
name: "castHash",
type: "string"
}
],
name: "TokenCreated",
type: "event"
},
{
inputs: [],
name: "bundleFeeSwitch",
outputs: [{ internalType: "bool", name: "", type: "bool" }],
stateMutability: "view",
type: "function"
},
{
inputs: [],
name: "defaultLockingPeriod",
outputs: [{ internalType: "uint64", name: "", type: "uint64" }],
stateMutability: "view",
type: "function"
},
{
inputs: [
{ internalType: "string", name: "_name", type: "string" },
{ internalType: "string", name: "_symbol", type: "string" },
{ internalType: "uint256", name: "_supply", type: "uint256" },
{ internalType: "int24", name: "_initialTick", type: "int24" },
{ internalType: "uint24", name: "_fee", type: "uint24" },
{ internalType: "bytes32", name: "_salt", type: "bytes32" },
{ internalType: "address", name: "_deployer", type: "address" },
{ internalType: "uint256", name: "_fid", type: "uint256" },
{ internalType: "string", name: "_image", type: "string" },
{ internalType: "string", name: "_castHash", type: "string" }
],
name: "deployToken",
outputs: [
{ internalType: "contract Token", name: "token", type: "address" },
{ internalType: "uint256", name: "tokenId", type: "uint256" }
],
stateMutability: "payable",
type: "function"
},
{
inputs: [],
name: "deprecated",
outputs: [{ internalType: "bool", name: "", type: "bool" }],
stateMutability: "view",
type: "function"
},
{
inputs: [
{ internalType: "address", name: "deployer", type: "address" },
{ internalType: "uint256", name: "fid", type: "uint256" },
{ internalType: "string", name: "name", type: "string" },
{ internalType: "string", name: "symbol", type: "string" },
{ internalType: "string", name: "image", type: "string" },
{ internalType: "string", name: "castHash", type: "string" },
{ internalType: "uint256", name: "supply", type: "uint256" }
],
name: "generateSalt",
outputs: [
{ internalType: "bytes32", name: "salt", type: "bytes32" },
{ internalType: "address", name: "token", type: "address" }
],
stateMutability: "view",
type: "function"
},
{
inputs: [
{ internalType: "address", name: "token", type: "address" },
{ internalType: "uint24", name: "_fee", type: "uint24" }
],
name: "initialSwapTokens",
outputs: [],
stateMutability: "payable",
type: "function"
},
{
inputs: [],
name: "liquidityLocker",
outputs: [{ internalType: "contract ILockerFactory", name: "", type: "address" }],
stateMutability: "view",
type: "function"
},
{
inputs: [],
name: "lpFeesCut",
outputs: [{ internalType: "uint8", name: "", type: "uint8" }],
stateMutability: "view",
type: "function"
},
{
inputs: [],
name: "owner",
outputs: [{ internalType: "address", name: "", type: "address" }],
stateMutability: "view",
type: "function"
},
{
inputs: [],
name: "positionManager",
outputs: [
{
internalType: "contract INonfungiblePositionManager",
name: "",
type: "address"
}
],
stateMutability: "view",
type: "function"
},
{
inputs: [
{ internalType: "address", name: "deployer", type: "address" },
{ internalType: "uint256", name: "fid", type: "uint256" },
{ internalType: "string", name: "name", type: "string" },
{ internalType: "string", name: "symbol", type: "string" },
{ internalType: "string", name: "image", type: "string" },
{ internalType: "string", name: "castHash", type: "string" },
{ internalType: "uint256", name: "supply", type: "uint256" },
{ internalType: "bytes32", name: "salt", type: "bytes32" }
],
name: "predictToken",
outputs: [{ internalType: "address", name: "", type: "address" }],
stateMutability: "view",
type: "function"
},
{
inputs: [],
name: "protocolCut",
outputs: [{ internalType: "uint8", name: "", type: "uint8" }],
stateMutability: "view",
type: "function"
},
{
inputs: [],
name: "renounceOwnership",
outputs: [],
stateMutability: "nonpayable",
type: "function"
},
{
inputs: [{ internalType: "bool", name: "_deprecated", type: "bool" }],
name: "setDeprecated",
outputs: [],
stateMutability: "nonpayable",
type: "function"
},
{
inputs: [],
name: "swapRouter",
outputs: [{ internalType: "address", name: "", type: "address" }],
stateMutability: "view",
type: "function"
},
{
inputs: [],
name: "taxCollector",
outputs: [{ internalType: "address", name: "", type: "address" }],
stateMutability: "view",
type: "function"
},
{
inputs: [],
name: "taxRate",
outputs: [{ internalType: "uint8", name: "", type: "uint8" }],
stateMutability: "view",
type: "function"
},
{
inputs: [{ internalType: "bool", name: "_enabled", type: "bool" }],
name: "toggleBundleFeeSwitch",
outputs: [],
stateMutability: "nonpayable",
type: "function"
},
{
inputs: [{ internalType: "address", name: "newOwner", type: "address" }],
name: "transferOwnership",
outputs: [],
stateMutability: "nonpayable",
type: "function"
},
{
inputs: [],
name: "uniswapV3Factory",
outputs: [{ internalType: "contract IUniswapV3Factory", name: "", type: "address" }],
stateMutability: "view",
type: "function"
},
{
inputs: [{ internalType: "uint64", name: "newPeriod", type: "uint64" }],
name: "updateDefaultLockingPeriod",
outputs: [],
stateMutability: "nonpayable",
type: "function"
},
{
inputs: [{ internalType: "address", name: "newLocker", type: "address" }],
name: "updateLiquidityLocker",
outputs: [],
stateMutability: "nonpayable",
type: "function"
},
{
inputs: [{ internalType: "uint8", name: "newFee", type: "uint8" }],
name: "updateProtocolFees",
outputs: [],
stateMutability: "nonpayable",
type: "function"
},
{
inputs: [{ internalType: "address", name: "newCollector", type: "address" }],
name: "updateTaxCollector",
outputs: [],
stateMutability: "nonpayable",
type: "function"
},
{
inputs: [{ internalType: "uint8", name: "newRate", type: "uint8" }],
name: "updateTaxRate",
outputs: [],
stateMutability: "nonpayable",
type: "function"
},
{
inputs: [],
name: "weth",
outputs: [{ internalType: "address", name: "", type: "address" }],
stateMutability: "view",
type: "function"
}
];
// src/abi/v2/Clanker.ts
var Clanker_v2_abi = [
{
inputs: [
{ internalType: "address", name: "locker_", type: "address" },
{ internalType: "address", name: "uniswapV3Factory_", type: "address" },
{ internalType: "address", name: "positionManager_", type: "address" },
{ internalType: "address", name: "swapRouter_", type: "address" },
{ internalType: "address", name: "owner_", type: "address" }
],
stateMutability: "nonpayable",
type: "constructor"
},
{ inputs: [], name: "Deprecated", type: "error" },
{ inputs: [], name: "InvalidConfig", type: "error" },
{
inputs: [{ internalType: "address", name: "user", type: "address" }],
name: "NotAdmin",
type: "error"
},
{
inputs: [{ internalType: "address", name: "token", type: "address" }],
name: "NotAllowedPairedToken",
type: "error"
},
{
inputs: [{ internalType: "address", name: "owner", type: "address" }],
name: "OwnableInvalidOwner",
type: "error"
},
{
inputs: [{ internalType: "address", name: "account", type: "address" }],
name: "OwnableUnauthorizedAccount",
type: "error"
},
{
inputs: [{ internalType: "address", name: "token", type: "address" }],
name: "TokenNotFound",
type: "error"
},
{
anonymous: false,
inputs: [
{
indexed: true,
internalType: "address",
name: "previousOwner",
type: "address"
},
{
indexed: true,
internalType: "address",
name: "newOwner",
type: "address"
}
],
name: "OwnershipTransferred",
type: "event"
},
{
anonymous: false,
inputs: [
{
indexed: false,
internalType: "address",
name: "tokenAddress",
type: "address"
},
{
indexed: false,
internalType: "uint256",
name: "positionId",
type: "uint256"
},
{
indexed: false,
internalType: "address",
name: "deployer",
type: "address"
},
{ indexed: false, internalType: "uint256", name: "fid", type: "uint256" },
{ indexed: false, internalType: "string", name: "name", type: "string" },
{
indexed: false,
internalType: "string",
name: "symbol",
type: "string"
},
{
indexed: false,
internalType: "uint256",
name: "supply",
type: "uint256"
},
{
indexed: false,
internalType: "address",
name: "lockerAddress",
type: "address"
},
{
indexed: false,
internalType: "string",
name: "castHash",
type: "string"
}
],
name: "TokenCreated",
type: "event"
},
{
inputs: [{ internalType: "address", name: "", type: "address" }],
name: "admins",
outputs: [{ internalType: "bool", name: "", type: "bool" }],
stateMutability: "view",
type: "function"
},
{
inputs: [{ internalType: "address", name: "", type: "address" }],
name: "allowedPairedTokens",
outputs: [{ internalType: "bool", name: "", type: "bool" }],
stateMutability: "view",
type: "function"
},
{
inputs: [{ internalType: "address", name: "token", type: "address" }],
name: "claimRewards",
outputs: [],
stateMutability: "nonpayable",
type: "function"
},
{
inputs: [
{ internalType: "string", name: "_name", type: "string" },
{ internalType: "string", name: "_symbol", type: "string" },
{ internalType: "uint256", name: "_supply", type: "uint256" },
{ internalType: "uint24", name: "_fee", type: "uint24" },
{ internalType: "bytes32", name: "_salt", type: "bytes32" },
{ internalType: "address", name: "_deployer", type: "address" },
{ internalType: "uint256", name: "_fid", type: "uint256" },
{ internalType: "string", name: "_image", type: "string" },
{ internalType: "string", name: "_castHash", type: "string" },
{
components: [
{ internalType: "int24", name: "tick", type: "int24" },
{ internalType: "address", name: "pairedToken", type: "address" },
{ internalType: "uint24", name: "devBuyFee", type: "uint24" }
],
internalType: "struct Clanker.PoolConfig",
name: "_poolConfig",
type: "tuple"
}
],
name: "deployToken",
outputs: [
{ internalType: "contract ClankerToken", name: "token", type: "address" },
{ internalType: "uint256", name: "positionId", type: "uint256" }
],
stateMutability: "payable",
type: "function"
},
{
inputs: [{ internalType: "address", name: "", type: "address" }],
name: "deploymentInfoForToken",
outputs: [
{ internalType: "address", name: "token", type: "address" },
{ internalType: "uint256", name: "positionId", type: "uint256" },
{ internalType: "address", name: "locker", type: "address" }
],
stateMutability: "view",
type: "function"
},
{
inputs: [],
name: "deprecated",
outputs: [{ internalType: "bool", name: "", type: "bool" }],
stateMutability: "view",
type: "function"
},
{
inputs: [{ internalType: "address", name: "user", type: "address" }],
name: "getTokensDeployedByUser",
outputs: [
{
components: [
{ internalType: "address", name: "token", type: "address" },
{ internalType: "uint256", name: "positionId", type: "uint256" },
{ internalType: "address", name: "locker", type: "address" }
],
internalType: "struct Clanker.DeploymentInfo[]",
name: "",
type: "tuple[]"
}
],
stateMutability: "view",
type: "function"
},
{
inputs: [],
name: "liquidityLocker",
outputs: [{ internalType: "contract LpLockerv2", name: "", type: "address" }],
stateMutability: "view",
type: "function"
},
{
inputs: [],
name: "owner",
outputs: [{ internalType: "address", name: "", type: "address" }],
stateMutability: "view",
type: "function"
},
{
inputs: [],
name: "positionManager",
outputs: [
{
internalType: "contract INonfungiblePositionManager",
name: "",
type: "address"
}
],
stateMutability: "view",
type: "function"
},
{
inputs: [],
name: "renounceOwnership",
outputs: [],
stateMutability: "nonpayable",
type: "function"
},
{
inputs: [
{ internalType: "address", name: "admin", type: "address" },
{ internalType: "bool", name: "isAdmin", type: "bool" }
],
name: "setAdmin",
outputs: [],
stateMutability: "nonpayable",
type: "function"
},
{
inputs: [{ internalType: "bool", name: "_deprecated", type: "bool" }],
name: "setDeprecated",
outputs: [],
stateMutability: "nonpayable",
type: "function"
},
{
inputs: [],
name: "swapRouter",
outputs: [{ internalType: "address", name: "", type: "address" }],
stateMutability: "view",
type: "function"
},
{
inputs: [
{ internalType: "address", name: "token", type: "address" },
{ internalType: "bool", name: "allowed", type: "bool" }
],
name: "toggleAllowedPairedToken",
outputs: [],
stateMutability: "nonpayable",
type: "function"
},
{
inputs: [
{ internalType: "address", name: "", type: "address" },
{ internalType: "uint256", name: "", type: "uint256" }
],
name: "tokensDeployedByUsers",
outputs: [
{ internalType: "address", name: "token", type: "address" },
{ internalType: "uint256", name: "positionId", type: "uint256" },
{ internalType: "address", name: "locker", type: "address" }
],
stateMutability: "view",
type: "function"
},
{
inputs: [{ internalType: "address", name: "newOwner", type: "address" }],
name: "transferOwnership",
outputs: [],
stateMutability: "nonpayable",
type: "function"
},
{
inputs: [],
name: "uniswapV3Factory",
outputs: [{ internalType: "contract IUniswapV3Factory", name: "", type: "address" }],
stateMutability: "view",
type: "function"
},
{
inputs: [{ internalType: "address", name: "newLocker", type: "address" }],
name: "updateLiquidityLocker",
outputs: [],
stateMutability: "nonpayable",
type: "function"
},
{
inputs: [],
name: "version",
outputs: [{ internalType: "string", name: "", type: "string" }],
stateMutability: "view",
type: "function"
},
{
inputs: [],
name: "weth",
outputs: [{ internalType: "address", name: "", type: "address" }],
stateMutability: "view",
type: "function"
}
];
// src/abi/v3/Clanker.ts
var Clanker_v3_abi = [
{
inputs: [
{ internalType: "address", name: "locker_", type: "address" },
{ internalType: "address", name: "uniswapV3Factory_", type: "address" },
{ internalType: "address", name: "positionManager_", type: "address" },
{ internalType: "address", name: "swapRouter_", type: "address" },
{ internalType: "address", name: "owner_", type: "address" }
],
stateMutability: "nonpayable",
type: "constructor"
},
{ inputs: [], name: "Invalid", type: "error" },
{ inputs: [], name: "NotFound", type: "error" },
{
inputs: [{ internalType: "address", name: "owner", type: "address" }],
name: "OwnableInvalidOwner",
type: "error"
},
{
inputs: [{ internalType: "address", name: "account", type: "address" }],
name: "OwnableUnauthorizedAccount",
type: "error"
},
{ inputs: [], name: "Unauthorized", type: "error" },
{
anonymous: false,
inputs: [
{
indexed: true,
internalType: "address",
name: "previousOwner",
type: "address"
},
{
indexed: true,
internalType: "address",
name: "newOwner",
type: "address"
}
],
name: "OwnershipTransferred",
type: "event"
},
{
anonymous: false,
inputs: [
{
indexed: false,
internalType: "address",
name: "tokenAddress",
type: "address"
},
{
indexed: false,
internalType: "uint256",
name: "positionId",
type: "uint256"
},
{
indexed: false,
internalType: "address",
name: "deployer",
type: "address"
},
{ indexed: false, internalType: "uint256", name: "fid", type: "uint256" },
{ indexed: false, internalType: "string", name: "name", type: "string" },
{
indexed: false,
internalType: "string",
name: "symbol",
type: "string"
},
{
indexed: false,
internalType: "uint256",
name: "supply",
type: "uint256"
},
{
indexed: false,
internalType: "string",
name: "castHash",
type: "string"
}
],
name: "TokenCreated",
type: "event"
},
{
inputs: [{ internalType: "address", name: "", type: "address" }],
name: "admins",
outputs: [{ internalType: "bool", name: "", type: "bool" }],
stateMutability: "view",
type: "function"
},
{
inputs: [{ internalType: "address", name: "token", type: "address" }],
name: "claimRewards",
outputs: [],
stateMutability: "nonpayable",
type: "function"
},
{
inputs: [
{
components: [
{ internalType: "string", name: "_name", type: "string" },
{ internalType: "string", name: "_symbol", type: "string" },
{ internalType: "uint256", name: "_supply", type: "uint256" },
{ internalType: "uint24", name: "_fee", type: "uint24" },
{ internalType: "bytes32", name: "_salt", type: "bytes32" },
{ internalType: "address", name: "_deployer", type: "address" },
{ internalType: "uint256", name: "_fid", type: "uint256" },
{ internalType: "string", name: "_image", type: "string" },
{ internalType: "string", name: "_castHash", type: "string" },
{
components: [
{ internalType: "int24", name: "tick", type: "int24" },
{ internalType: "address", name: "pairedToken", type: "address" },
{ internalType: "uint24", name: "devBuyFee", type: "uint24" }
],
internalType: "struct Clanker.PoolConfig",
name: "_poolConfig",
type: "tuple"
}
],
internalType: "struct Clanker.PreSaleTokenConfig",
name: "preSaleTokenConfig",
type: "tuple"
}
],
name: "deployToken",
outputs: [
{ internalType: "address", name: "token", type: "address" },
{ internalType: "uint256", name: "positionId", type: "uint256" }
],
stateMutability: "payable",
type: "function"
},
{
inputs: [
{
components: [
{ internalType: "string", name: "_name", type: "string" },
{ internalType: "string", name: "_symbol", type: "string" },
{ internalType: "uint256", name: "_supply", type: "uint256" },
{ internalType: "uint24", name: "_fee", type: "uint24" },
{ internalType: "bytes32", name: "_salt", type: "bytes32" },
{ internalType: "address", name: "_deployer", type: "address" },
{ internalType: "uint256", name: "_fid", type: "uint256" },
{ internalType: "string", name: "_image", type: "string" },
{ internalType: "string", name: "_castHash", type: "string" },
{
components: [
{ internalType: "int24", name: "tick", type: "int24" },
{ internalType: "address", name: "pairedToken", type: "address" },
{ internalType: "uint24", name: "devBuyFee", type: "uint24" }
],
internalType: "struct Clanker.PoolConfig",
name: "_poolConfig",
type: "tuple"
}
],
internalType: "struct Clanker.PreSaleTokenConfig",
name: "preSaleTokenConfig",
type: "tuple"
},
{ internalType: "uint256", name: "preSaleId", type: "uint256" },
{
components: [
{ internalType: "uint256", name: "bpsBought", type: "uint256" },
{ internalType: "address", name: "user", type: "address" }
],
internalType: "struct Clanker.PreSalePurchase[]",
name: "preSalePurchases",
type: "tuple[]"
},
{
components: [
{ internalType: "uint256", name: "bpsAvailable", type: "uint256" },
{ internalType: "uint256", name: "ethPerBps", type: "uint256" },
{ internalType: "uint256", name: "endTime", type: "uint256" },
{ internalType: "uint256", name: "bpsSold", type: "uint256" },
{ internalType: "address", name: "tokenAddress", type: "address" }
],
internalType: "struct Clanker.PreSaleConfig",
name: "preSaleConfig",
type: "tuple"
}
],
name: "deployToken",
outputs: [
{ internalType: "address", name: "token", type: "address" },
{ internalType: "uint256", name: "positionId", type: "uint256" }
],
stateMutability: "payable",
type: "function"
},
{
inputs: [{ internalType: "address", name: "", type: "address" }],
name: "deploymentInfoForToken",
outputs: [
{ internalType: "address", name: "token", type: "address" },
{ internalType: "uint256", name: "positionId", type: "uint256" },
{ internalType: "address", name: "locker", type: "address" }
],
stateMutability: "view",
type: "function"
},
{
inputs: [{ internalType: "address", name: "user", type: "address" }],
name: "getTokensDeployedByUser",
outputs: [
{
components: [
{ internalType: "address", name: "token", type: "address" },
{ internalType: "uint256", name: "positionId", type: "uint256" },
{ internalType: "address", name: "locker", type: "address" }
],
internalType: "struct Clanker.DeploymentInfo[]",
name: "",
type: "tuple[]"
}
],
stateMutability: "view",
type: "function"
},
{
inputs: [],
name: "liquidityLocker",
outputs: [{ internalType: "contract ILpLockerv2", name: "", type: "address" }],
stateMutability: "view",
type: "function"
},
{
inputs: [],
name: "owner",
outputs: [{ internalType: "address", name: "", type: "address" }],
stateMutability: "view",
type: "function"
},
{
inputs: [],
name: "positionManager",
outputs: [
{
internalType: "contract INonfungiblePositionManager",
name: "",
type: "address"
}
],
stateMutability: "view",
type: "function"
},
{
inputs: [],
name: "renounceOwnership",
outputs: [],
stateMutability: "nonpayable",
type: "function"
},
{
inputs: [
{ internalType: "address", name: "admin", type: "address" },
{ internalType: "bool", name: "isAdmin", type: "bool" }
],
name: "setAdmin",
outputs: [],
stateMutability: "nonpayable",
type: "function"
},
{
inputs: [],
name: "swapRouter",
outputs: [{ internalType: "address", name: "", type: "address" }],
stateMutability: "view",
type: "function"
},
{
inputs: [
{ internalType: "address", name: "", type: "address" },
{ internalType: "uint256", name: "", type: "uint256" }
],
name: "tokensDeployedByUsers",
outputs: [
{ internalType: "address", name: "token", type: "address" },
{ internalType: "uint256", name: "positionId", type: "uint256" },
{ internalType: "address", name: "locker", type: "address" }
],
stateMutability: "view",
type: "function"
},
{
inputs: [{ internalType: "address", name: "newOwner", type: "address" }],
name: "transferOwnership",
outputs: [],
stateMutability: "nonpayable",
type: "function"
},
{
inputs: [],
name: "uniswapV3Factory",
outputs: [{ internalType: "contract IUniswapV3Factory", name: "", type: "address" }],
stateMutability: "view",
type: "function"
},
{
inputs: [{ internalType: "address", name: "newLocker", type: "address" }],
name: "updateLiquidityLocker",
outputs: [],
stateMutability: "nonpayable",
type: "function"
},
{
inputs: [],
name: "weth",
outputs: [{ internalType: "address", name: "", type: "address" }],
stateMutability: "view",
type: "function"
}
];
// src/abi/v3.1/Clanker.ts
var Clanker_v3_1_abi = [
{
inputs: [{ internalType: "address", name: "owner_", type: "address" }],
stateMutability: "nonpayable",
type: "constructor"
},
{ inputs: [], name: "Deprecated", type: "error" },
{ inputs: [], name: "InvalidCreatorInfo", type: "error" },
{ inputs: [], name: "InvalidCreatorReward", type: "error" },
{ inputs: [], name: "InvalidInterfaceInfo", type: "error" },
{ inputs: [], name: "InvalidTick", type: "error" },
{ inputs: [], name: "InvalidVaultConfiguration", type: "error" },
{ inputs: [], name: "NotFound", type: "error" },
{ inputs: [], name: "OnlyNonOriginatingChains", type: "error" },
{ inputs: [], name: "OnlyOriginatingChain", type: "error" },
{
inputs: [{ internalType: "address", name: "owner", type: "address" }],
name: "OwnableInvalidOwner",
type: "error"
},
{
inputs: [{ internalType: "address", name: "account", type: "address" }],
name: "OwnableUnauthorizedAccount",
type: "error"
},
{ inputs: [], name: "ReentrancyGuardReentrantCall", type: "error" },
{ inputs: [], name: "Unauthorized", type: "error" },
{ inputs: [], name: "ZeroTeamRewardRecipient", type: "error" },
{
anonymous: false,
inputs: [
{
indexed: false,
internalType: "address",
name: "oldClankerDeployer",
type: "address"
},
{
indexed: false,
internalType: "address",
name: "newClankerDeployer",
type: "address"
}
],
name: "ClankerDeployerUpdated",
type: "event"
},
{
anonymous: false,
inputs: [
{
indexed: false,
internalType: "address",
name: "oldLocker",
type: "address"
},
{
indexed: false,
internalType: "address",
name: "newLocker",
type: "address"
}
],
name: "LiquidityLockerUpdated",
type: "event"
},
{
anonymous: false,
inputs: [
{
indexed: true,
internalType: "address",
name: "previousOwner",
type: "address"
},
{
indexed: true,
internalType: "address",
name: "newOwner",
type: "address"
}
],
name: "OwnershipTransferred",
type: "event"
},
{
anonymous: false,
inputs: [
{
indexed: false,
internalType: "address",
name: "admin",
type: "address"
},
{ indexed: false, internalType: "bool", name: "isAdmin", type: "bool" }
],
name: "SetAdmin",
type: "event"
},
{
anonymous: false,
inputs: [
{
indexed: false,
internalType: "bool",
name: "deprecated",
type: "bool"
}
],
name: "SetDeprecated",
type: "event"
},
{
anonymous: false,
inputs: [
{
indexed: true,
internalType: "address",
name: "tokenAddress",
type: "address"
},
{
indexed: true,
internalType: "address",
name: "creatorAdmin",
type: "address"
},
{
indexed: true,
internalType: "address",
name: "interfaceAdmin",
type: "address"
},
{
indexed: false,
internalType: "address",
name: "creatorRewardRecipient",
type: "address"
},
{
indexed: false,
internalType: "address",
name: "interfaceRewardRecipient",
type: "address"
},
{
indexed: false,
internalType: "uint256",
name: "positionId",
type: "uint256"
},
{ indexed: false, internalType: "string", name: "name", type: "string" },
{
indexed: false,
internalType: "string",
name: "symbol",
type: "string"
},
{
indexed: false,
internalType: "int24",
name: "startingTickIfToken0IsNewToken",
type: "int24"
},
{
indexed: false,
internalType: "string",
name: "metadata",
type: "string"
},
{
indexed: false,
internalType: "uint256",
name: "amountTokensBought",
type: "uint256"
},
{
indexed: false,
internalType: "uint256",
name: "vaultDuration",
type: "uint256"
},
{
indexed: false,
internalType: "uint8",
name: "vaultPercentage",
type: "uint8"
},
{
indexed: false,
internalType: "address",
name: "msgSender",
type: "address"
}
],
name: "TokenCreated",
type: "event"
},
{
anonymous: false,
inputs: [
{
indexed: false,
internalType: "address",
name: "oldVault",
type: "address"
},
{
indexed: false,
internalType: "address",
name: "newVault",
type: "address"
}
],
name: "VaultUpdated",
type: "event"
},
{
inputs: [],
name: "MAX_CREATOR_REWARD",
outputs: [{ internalType: "uint256", name: "", type: "uint256" }],
stateMutability: "view",
type: "function"
},
{
inputs: [],
name: "MAX_TICK",
outputs: [{ internalType: "int24", name: "", type: "int24" }],
stateMutability: "view",
type: "function"
},
{
inputs: [],
name: "MAX_VAULT_PERCENTAGE",
outputs: [{ internalType: "uint256", name: "", type: "uint256" }],
stateMutability: "view",
type: "function"
},
{
inputs: [],
name: "POOL_FEE",
outputs: [{ internalType: "uint24", name: "", type: "uint24" }],
stateMutability: "view",
type: "function"
},
{
inputs: [],
name: "TICK_SPACING",
outputs: [{ internalType: "int24", name: "", type: "int24" }],
stateMutability: "view",
type: "function"
},
{
inputs: [],
name: "TOKEN_SUPPLY",
outputs: [{ internalType: "uint256", name: "", type: "uint256" }],
stateMutability: "view",
type: "function"
},
{
inputs: [{ internalType: "address", name: "", type: "address" }],
name: "admins",
outputs: [{ internalType: "bool", name: "", type: "bool" }],
stateMutability: "view",
type: "function"
},
{
inputs: [{ internalType: "address", name: "token", type: "address" }],
name: "claimRewards",
outputs: [],
stateMutability: "nonpayable",
type: "function"
},
{
inputs: [
{
components: [
{
components: [
{ internalType: "string", name: "name", type: "string" },
{ internalType: "string", name: "symbol", type: "string" },
{ internalType: "bytes32", name: "salt", type: "bytes32" },
{ internalType: "string", name: "image", type: "string" },
{ internalType: "string", name: "metadata", type: "string" },
{ internalType: "string", name: "context", type: "string" },
{
internalType: "uint256",
name: "originatingChainId",
type: "uint256"
}
],
internalType: "struct IClanker.TokenConfig",
name: "tokenConfig",
type: "tuple"
},
{
components: [
{ internalType: "uint8", name: "vaultPercentage", type: "uint8" },
{
internalType: "uint256",
name: "vaultDuration",
type: "uint256"
}
],
internalType: "struct IClanker.VaultConfig",
name: "vaultConfig",
type: "tuple"
},
{
components: [
{ internalType: "address", name: "pairedToken", type: "address" },
{
internalType: "int24",
name: "tickIfToken0IsNewToken",
type: "int24"
}
],
internalType: "struct IClanker.PoolConfig",
name: "poolConfig",
type: "tuple"
},
{
components: [
{
internalType: "uint24",
name: "pairedTokenPoolFee",
type: "uint24"
},
{
internalType: "uint256",
name: "pairedTokenSwapAmountOutMinimum",
type: "uint256"
}
],
internalType: "struct IClanker.InitialBuyConfig",
name: "initialBuyConfig",
type: "tuple"
},
{
components: [
{
internalType: "uint256",
name: "creatorReward",
type: "uint256"
},
{
internalType: "address",
name: "creatorAdmin",
type: "address"
},
{
internalType: "address",
name: "creatorRewardRecipient",
type: "address"
},
{
internalType: "address",
name: "interfaceAdmin",
type: "address"
},
{
internalType: "address",
name: "interfaceRewardRecipient",
type: "address"
}
],
internalType: "struct IClanker.RewardsConfig",
name: "rewardsConfig",
type: "tuple"
}
],
internalType: "struct IClanker.DeploymentConfig",
name: "deploymentConfig",
type: "tuple"
}
],
name: "deployToken",
outputs: [
{ internalType: "address", name: "tokenAddress", type: "address" },
{ internalType: "uint256", name: "positionId", type: "uint256" }
],
stateMutability: "payable",
type: "function"
},
{
inputs: [
{
components: [
{
components: [
{ internalType: "string", name: "name", type: "string" },
{ internalType: "string", name: "symbol", type: "string" },
{ internalType: "bytes32", name: "salt", type: "bytes32" },
{ internalType: "string", name: "image", type: "string" },
{ internalType: "string", name: "metadata", type: "string" },
{ internalType: "string", name: "context", type: "string" },
{
internalType: "uint256",
name: "originatingChainId",
type: "uint256"
}
],
internalType: "struct IClanker.TokenConfig",
name: "tokenConfig",
type: "tuple"
},
{
components: [
{ internalType: "uint8", name: "vaultPercentage", type: "uint8" },
{
internalType: "uint256",
name: "vaultDuration",
type: "uint256"
}
],
internalType: "struct IClanker.VaultConfig",
name: "vaultConfig",
type: "tuple"
},
{
components: [
{ internalType: "address", name: "pairedToken", type: "address" },
{
internalType: "int24",
name: "tickIfToken0IsNewToken",
type: "int24"
}
],
internalType: "struct IClanker.PoolConfig",
name: "poolConfig",
type: "tuple"
},
{
components: [
{
internalType: "uint24",
name: "pairedTokenPoolFee",
type: "uint24"
},
{
internalType: "uint256",
name: "pairedTokenSwapAmountOutMinimum",
type: "uint256"
}
],
internalType: "struct IClanker.InitialBuyConfig",
name: "initialBuyConfig",
type: "tuple"
},
{
components: [
{
internalType: "uint256",
name: "creatorReward",
type: "uint256"
},
{
internalType: "address",
name: "creatorAdmin",
type: "address"
},
{
internalType: "address",
name: "creatorRewardRecipient",
type: "address"
},
{
internalType: "address",
name: "interfaceAdmin",
type: "address"
},
{
internalType: "address",
name: "interfaceRewardRecipient",
type: "address"
}
],
internalType: "struct IClanker.RewardsConfig",
name: "rewardsConfig",
type: "tuple"
}
],
internalType: "struct IClanker.DeploymentConfig",
name: "deploymentConfig",
type: "tuple"
},
{ internalType: "address", name: "teamRewardRecipient", type: "address" }
],
name: "deployTokenWithCustomTeamRewardRecipient",
outputs: [
{ internalType: "address", name: "tokenAddress", type: "address" },
{ internalType: "uint256", name: "positionId", type: "uint256" }
],
stateMutability: "payable",
type: "function"
},
{
inputs: [
{
components: [
{ internalType: "string", name: "name", type: "string" },
{ internalType: "string", name: "symbol", type: "string" },
{ internalType: "bytes32", name: "salt", type: "bytes32" },
{ internalType: "string", name: "image", type: "string" },
{ internalType: "string", name: "metadata", type: "string" },
{ internalType: "string", name: "context", type: "string" },
{
internalType: "uint256",
name: "originatingChainId",
type: "uint256"
}
],
internalType: "struct IClanker.TokenConfig",
name: "tokenConfig",
type: "tuple"
},
{ internalType: "address", name: "tokenAdmin", type: "address" }
],
name: "deployTokenZeroSupply",
outputs: [{ internalType: "address", name: "tokenAddress", type: "address" }],
stateMutability: "nonpayable",
type: "function"
},
{
inputs: [{ internalType: "address", name: "", type: "address" }],
name: "deploymentInfoForToken",
outputs: [
{ internalType: "address", name: "token", type: "address" },
{ internalType: "uint256", name: "positionId", type: "uint256" },
{ internalType: "address", name: "locker", type: "address" }
],
stateMutability: "view",
type: "function"
},
{
inputs: [],
name: "deprecated",
outputs: [{ internalType: "bool", name: "", type: "bool" }],
stateMutability: "view",
type: "function"
},
{
inputs: [{ internalType: "address", name: "user", type: "address" }],
name: "getTokensDeployedByUser",
outputs: [
{
components: [
{ internalType: "address", name: "token", type: "address" },
{ internalType: "uint256", name: "positionId", type: "uint256" },
{ internalType: "address", name: "locker", type: "address" }
],
internalType: "struct IClanker.DeploymentInfo[]",
name: "",
type: "tuple[]"
}
],
stateMutability: "view",
type: "function"
},
{
inputs: [
{ internalType: "address", name: "uniswapV3Factory_", type: "address" },
{ internalType: "address", name: "positionManager_", type: "address" },
{ internalType: "address", name: "swapRouter_", type: "address" },
{ internalType: "address", name: "weth_", type: "address" },
{ internalType: "address", name: "liquidityLocker_", type: "address" },
{ internalType: "address", name: "vault_", type: "address" }
],
name: "initialize",
outputs: [],
stateMutability: "nonpayable",
type: "function"
},
{
inputs: [],
name: "liquidityLocker",
outputs: [{ internalType: "contract ILpLockerv2", name: "", type: "address" }],
stateMutability: "view",
type: "function"
},
{
inputs: [],
name: "owner",
outputs: [{ internalType: "address", name: "", type: "address" }],
stateMutability: "view",
type: "function"
},
{
inputs: [],
name: "positionManager",
outputs: [
{
internalType: "contract INonfungiblePositionManager",
name: "",
type: "address"
}
],
stateMutability: "view",
type: "function"
},
{
inputs: [],
name: "renounceOwnership",
outputs: [],
stateMutability: "nonpayable",
type: "function"
},
{
inputs: [
{ internalType: "address", name: "admin", type: "address" },
{ internalType: "bool", name: "isAdmin", type: "bool" }
],
name: "setAdmin",
outputs: [],
stateMutability: "nonpayable",
type: "function"
},
{
inputs: [{ internalType: "bool", name: "deprecated_", type: "bool" }],
name: "setDeprecated",
outputs: [],
stateMutability: "nonpayable",
type: "function"
},
{
inputs: [],
name: "swapRouter",
outputs: [{ internalType: "contract ISwapRouter", name: "", type: "address" }],
stateMutability: "view",
type: "function"
},
{
inputs: [
{ internalType: "address", name: "", type: "address" },
{ internalType: "uint256", name: "", type: "uint256" }
],
name: "tokensDeployedByUsers",
outputs: [
{ internalType: "address", name: "token", type: "address" },
{ internalType: "uint256", name: "positionId", type: "uint256" },
{ internalType: "address", name: "locker", type: "address" }
],
stateMutability: "view",
type: "function"
},
{
inputs: [{ internalType: "address", name: "newOwner", type: "address" }],
name: "transferOwnership",
outputs: [],
stateMutability: "nonpayable",
type: "function"
},
{
inputs: [],
name: "uniswapV3Factory",
outputs: [{ internalType: "contract IUniswapV3Factory", name: "", type: "address" }],
stateMutability: "view",
type: "function"
},
{
inputs: [{ internalType: "address", name: "newLocker", type: "address" }],
name: "updateLiquidityLocker",
outputs: [],
stateMutability: "nonpayable",
type: "function"
},
{
inputs: [{ internalType: "address", name: "newVault", type: "address" }],
name: "updateVault",
outputs: [],
stateMutability: "nonpayable",
type: "function"
},
{
inputs: [],
name: "vault",
outputs: [{ internalType: "contract IClankerVault", name: "", type: "address" }],
stateMutability: "view",
type: "function"
},
{
inputs: [],
name: "weth",
outputs: [{ internalType: "address", name: "", type: "address" }],
stateMutability: "view",
type: "function"
}
];
// src/abi/v4/Clanker.ts
var Clanker_v4_abi = [
{
inputs: [{ internalType: "address", name: "owner_", type: "address" }],
stateMutability: "nonpayable",
type: "constructor"
},
{ inputs: [], name: "Deprecated", type: "error" },
{ inputs: [], name: "ExtensionMsgValueMismatch", type: "error" },
{ inputs: [], name: "ExtensionNotEnabled", type: "error" },
{ inputs: [], name: "HookNotEnabled", type: "error" },
{ inputs: [], name: "InvalidExtension", type: "error" },
{ inputs: [], name: "InvalidHook", type: "error" },
{ inputs: [], name: "InvalidLocker", type: "error" },
{ inputs: [], name: "InvalidMevModule", type: "error" },
{ inputs: [], name: "LockerNotEnabled", type: "error" },
{ inputs: [], name: "MaxExtensionBpsExceeded", type: "error" },
{ inputs: [], name: "MaxExtensionsExceeded", type: "error" },
{ inputs: [], name: "MevModuleNotEnabled", type: "error" },
{ inputs: [], name: "NotFound", type: "error" },
{ inputs: [], name: "OnlyNonOriginatingChains", type: "error" },
{ inputs: [], name: "OnlyOriginatingChain", type: "error" },
{
inputs: [{ internalType: "address", name: "owner", type: "address" }],
name: "OwnableInvalidOwner",
type: "error"
},
{
inputs: [{ internalType: "address", name: "account", type: "address" }],
name: "OwnableUnauthorizedAccount",
type: "error"
},
{ inputs: [], name: "ReentrancyGuardReentrantCall", type: "error" },
{ inputs: [], name: "Unauthorized", type: "error" },
{
anonymous: false,
inputs: [
{ indexed: true, internalType: "address", name: "token", type: "address" },
{ indexed: true, internalType: "address", name: "recipient", type: "address" },
{ indexed: false, internalType: "uint256", name: "amount", type: "uint256" }
],
name: "ClaimTeamFees",
type: "event"
},
{
anonymous: false,
inputs: [
{ indexed: false, internalType: "address", name: "extension", type: "address" },
{ indexed: false, internalType: "uint256", name: "extensionSupply", type: "uint256" },
{ indexed: false, internalType: "uint256", name: "msgValue", type: "uint256" }
],
name: "ExtensionTriggered",
type: "event"
},
{
anonymous: false,
inputs: [
{ indexed: true, internalType: "address", name: "previousOwner", type: "address" },
{ indexed: true, internalType: "address", name: "newOwner", type: "address" }
],
name: "OwnershipTransferred",
type: "event"
},
{
anonymous: false,
inputs: [
{ indexed: true, internalType: "address", name: "admin", type: "address" },
{ indexed: false, internalType: "bool", name: "enabled", type: "bool" }
],
name: "SetAdmin",
type: "event"
},
{
anonymous: false,
inputs: [{ indexed: false, internalType: "bool", name: "deprecated", type: "bool" }],
name: "SetDeprecated",
type: "event"
},
{
anonymous: false,
inputs: [
{ indexed: false, internalType: "address", name: "extension", type: "address" },
{ indexed: false, internalType: "bool", name: "enabled", type: "bool" }
],
name: "SetExtension",
type: "event"
},
{
anonymous: false,
inputs: [
{ indexed: false, internalType: "address", name: "hook", type: "address" },
{ indexed: false, internalType: "bool", name: "enabled", type: "bool" }
],
name: "SetHook",
type: "event"
},
{
anonymous: false,
inputs: [
{ indexed: false, internalType: "address", name: "locker", type: "address" },
{ indexed: false, internalType: "address", name: "pool", type: "address" },
{ indexed: false, internalType: "bool", name: "enabled", type: "bool" }
],
name: "SetLocker",
type: "event"
},
{
anonymous: false,
inputs: [
{ indexed: false, internalType: "address", name: "mevModule", type: "address" },
{ indexed: false, internalType: "bool", name: "enabled", type: "bool" }
],
name: "SetMevModule",
type: "event"
},
{
anonymous: false,
inputs: [
{ indexed: false, internalType: "address", name: "oldTeamFeeRecipient", type: "address" },
{ indexed: false, internalType: "address", name: "newTeamFeeRecipient", type: "address" }
],
name: "SetTeamFeeRecipient",
type: "event"
},
{
anonymous: false,
inputs: [
{ indexed: false, internalType: "address", name: "msgSender", type: "address" },
{ indexed: true, internalType: "address", name: "tokenAddress", type: "address" },
{ indexed: true, internalType: "address", name: "tokenAdmin", type: "address" },
{ indexed: false, internalType: "string", name: "tokenImage", type: "string" },
{ indexed: false, internalType: "string", name: "tokenName", type: "string" },
{ indexed: false, internalType: "string", name: "tokenSymbol", type: "string" },
{ indexed: false, internalType: "string", name: "tokenMetadata", type: "string" },
{ indexed: false, internalType: "string", name: "tokenContext", type: "string" },
{ indexed: false, internalType: "int24", name: "startingTick", type: "int24" },
{ indexed: false, internalType: "address", name: "poolHook", type: "address" },
{ indexed: false, internalType: "PoolId", name: "poolId", type: "bytes32" },
{ indexed: false, internalType: "address", name: "pairedToken", type: "address" },
{ indexed: false, internalType: "address", name: "locker", type: "address" },
{ indexed: false, internalType: "address", name: "mevModule", type: "address" },
{ indexed: false, internalType: "uint256", name: "extensionsSupply", type: "uint256" },
{ indexed: false, internalType: "address[]", name: "extensions", type: "address[]" }
],
name: "TokenCreated",
type: "event"
},
{
inputs: [],
name: "BPS",
outputs: [{ internalType: "uint256", name: "", type: "uint256" }],
stateMutability: "view",
type: "function"
},
{
inputs: [],
name: "MAX_EXTENSIONS",
outputs: [{ internalType: "uint256", name: "", type: "uint256" }],
stateMutability: "view",
type: "function"
},
{
inputs: [],
name: "MAX_EXTENSION_BPS",
outputs: [{ internalType: "uint16", name: "", type: "uint16" }],
stateMutability: "view",
type: "function"
},
{
inputs: [],
name: "TOKEN_SUPPLY",
outputs: [{ internalType: "uint256", name: "", type: "uint256" }],
stateMutability: "view",
type: "function"
},
{
inputs: [{ internalType: "address", name: "", type: "address" }],
name: "admins",
outputs: [{ internalType: "bool", name: "", type: "bool" }],
stateMutability: "view",
type: "function"
},
{
inputs: [{ internalType: "address", name: "token", type: "address" }],
name: "claimTeamFees",
outputs: [],
stateMutability: "nonpayable",
type: "function"
},
{
inputs: [
{
components: [
{
components: [
{ internalType: "address", name: "tokenAdmin", type: "address" },
{ internalType: "string", name: "name", type: "string" },
{ internalType: "string", name: "symbol", type: "string" },
{ internalType: "bytes32", name: "salt", type: "bytes32" },
{ internalType: "string", name: "image", type: "string" },
{ internalType: "string", name: "metadata", type: "string" },
{ internalType: "string", name: "context", type: "string" },
{ internalType: "uint256", name: "originatingChainId", type: "uint256" }
],
internalType: "struct IClanker.TokenConfig",
name: "tokenConfig",
type: "tuple"
},
{
components: [
{ internalType: "address", name: "hook", type: "address" },
{ internalType: "address", name: "pairedToken", type: "address" },
{ internalType: "int24", name: "tickIfToken0IsClanker", type: "int24" },
{ internalType: "int24", name: "tickSpacing", type: "int24" },
{ internalType: "bytes", name: "poolData", type: "bytes" }
],
internalType: "struct IClanker.PoolConfig",
name: "poolConfig",
type: "tuple"
},
{
components: [
{ internalType: "address", name: "locker", type: "address" },
{ internalType: "address[]", name: "rewardAdmins", type: "address[]" },
{ internalType: "address[]", name: "rewardRecipients", type: "address[]" },
{ internalType: "uint16[]", name: "rewardBps", type: "uint16[]" },
{ internalType: "int24[]", name: "tickLower", type: "int24[]" },
{ internalType: "int24[]", name: "tickUpper", type: "int24[]" },
{ internalType: "uint16[]", name: "positionBps", type: "uint16[]" },
{ internalType: "bytes", name: "lockerData", type: "bytes" }
],
internalType: "struct IClanker.LockerConfig",
name: "lockerConfig",
type: "tuple"
},
{
components: [
{ internalType: "address", name: "mevModule", type: "address" },
{ internalType: "bytes", name: "mevModuleData", type: "bytes" }
],
internalType: "struct IClanker.MevModuleConfig",
name: "mevModuleConfig",
type: "tuple"
},
{
components: [
{ internalType: "address", name: "extension", type: "address" },
{ internalType: "uint256", name: "msgValue", type: "uint256" },
{ internalType: "uint16", name: "extensionBps", type: "uint16" },
{ internalType: "bytes", name: "extensionData", type: "bytes" }
],
internalType: "struct IClanker.ExtensionConfig[]",
name: "extensionConfigs",
type: "tuple[]"
}
],
internalType: "struct IClanker.DeploymentConfig",
name: "deploymentConfig",
type: "tuple"
}
],
name: "deployToken",
outputs: [{ internalType: "address", name: "tokenAddress", type: "address" }],
stateMutability: "payable",
type: "function"
},
{
inputs: [
{
components: [
{ internalType: "address", name: "tokenAdmin", type: "address" },
{ internalType: "string", name: "name", type: "string" },
{ internalType: "string", name: "symbol", type: "string" },
{ internalType: "bytes32", name: "salt", type: "bytes32" },
{ internalType: "string", name: "image", type: "string" },
{ internalType: "string", name: "metadata", type: "string" },
{ internalType: "string", name: "context", type: "string" },
{ internalType: "uint256", name: "originatingChainId", type: "uint256" }
],
internalType: "struct IClanker.TokenConfig",
name: "tokenConfig",
type: "tuple"
}
],
name: "deployTokenZeroSupply",
outputs: [{ internalType: "address", name: "tokenAddress", type: "address" }],
stateMutability: "nonpayable",
type: "function"
},
{
inputs: [{ internalType: "address", name: "token", type: "address" }],
name: "deploymentInfoForToken",
outputs: [
{ internalType: "address", name: "token", type: "address" },
{ internalType: "address", name: "hook", type: "address" },
{ internalType: "address", name: "locker", type: "address" }
],
stateMutability: "view",
type: "function"
},
{
inputs: [],
name: "deprecated",
outputs: [{ internalType: "bool", name: "", type: "bool" }],
stateMutability: "view",
type: "function"
},
{
inputs: [
{ internalType: "address", name: "locker", type: "address" },
{ internalType: "address", name: "pool", type: "address" }
],
name: "enabledLockers",
outputs: [{ internalType: "bool", name: "enabled", type: "bool" }],
stateMutability: "view",
type: "function"
},
{
inputs: [{ internalType: "address", name: "teamFeeRecipient_", type: "address" }],
name: "initialize",
outputs: [],
stateMutability: "nonpayable",
type: "function"
},
{
inputs: [],
name: "owner",
outputs: [{ internalType: "address", name: "", type: "address" }],
stateMutability: "view",
type: "function"
},
{
inputs: [],
name: "renounceOwnership",
outputs: [],
stateMutability: "nonpayable",
type: "function"
},
{
inputs: [
{ internalType: "address", name: "admin", type: "address" },
{ internalType: "bool", name: "enabled", type: "bool" }
],
name: "setAdmin",
outputs: [],
stateMutability: "nonpayable",
type: "function"
},
{
inputs: [{ internalType: "bool", name: "deprecated_", type: "bool" }],
name: "setDeprecated",
outputs: [],
stateMutability: "nonpayable",
type: "function"
},
{
inputs: [
{ internalType: "address", name: "extension", type: "address" },
{ internalType: "bool", name: "enabled", type: "bool" }
],
name: "setExtension",
outputs: [],
stateMutability: "nonpayable",
type: "function"
},
{
inputs: [
{ internalType: "address", name: "hook", type: "address" },
{ internalType: "bool", name: "enabled", type: "bool" }
],
name: "setHook",
outputs: [],
stateMutability: "nonpayable",
type: "function"
},
{
inputs: [
{ internalType: "address", name: "locker", type: "address" },
{ internalType: "address", name: "pool", type: "address" },
{ internalType: "bool", name: "enabled", type: "bool" }
],
name: "setLocker",
outputs: [],
stateMutability: "nonpayable",
type: "function"
},
{
inputs: [
{ internalType: "address", name: "mevModule", type: "address" },
{ internalType: "bool", name: "enabled", type: "bool" }
],
name: "setMevModule",
outputs: [],
stateMutability: "nonpayable",
type: "function"
},
{
inputs: [{ internalType: "address", name: "teamFeeRecipient_", type: "address" }],
name: "setTeamFeeRecipient",
outputs: [],
stateMutability: "nonpayable",
type: "function"
},
{
inputs: [],
name: "teamFeeRecipient",
outputs: [{ internalType: "address", name: "", type: "address" }],
stateMutability: "view",
type: "function"
},
{
inputs: [{ internalType: "address", name: "token", type: "address" }],
name: "tokenDeploymentInfo",
outputs: [
{
components: [
{ internalType: "address", name: "token", type: "address" },
{ internalType: "address", name: "hook", type: "address" },
{ internalType: "address", name: "locker", type: "address" },
{ internalType: "address[]", name: "extensions", type: "address[]" }
],
internalType: "struct IClanker.DeploymentInfo",
name: "",
type: "tuple"
}
],
stateMutability: "view",
type: "function"
},
{
inputs: [{ internalType: "address", name: "newOwner", type: "address" }],
name: "transferOwnership",
outputs: [],
stateMutability: "nonpayable",
type: "function"
}
];
// src/utils/clankers.ts
var CLANKERS = {
clanker_v0: {
abi: Clanker_v0_abi,
chainId: base.id,
type: "proxy",
address: "0x250c9FB2b411B48273f69879007803790A6AeA47",
related: void 0
},
clanker_v1: {
abi: Clanker_v1_abi,
chainId: base.id,
type: "clanker",
address: "0x9B84fcE5Dcd9a38d2D01d5D72373F6b6b067c3e1",
related: void 0
},
clanker_v2: {
abi: Clanker_v2_abi,
chainId: base.id,
type: "clanker_v2",
address: "0x732560fa1d1A76350b1A500155BA978031B53833",
related: {
locker: "0x618A9840691334eE8d24445a4AdA4284Bf42417D"
}
},
clanker_v3: {
abi: Clanker_v3_abi,
chainId: base.id,
type: "clanker_v3",
address: "0x375C15db32D28cEcdcAB5C03Ab889bf15cbD2c5E",
related: {
locker: "0x5eC4f99F342038c67a312a166Ff56e6D70383D86"
}
},
clanker_v3_1: {
abi: Clanker_v3_1_abi,
chainId: base.id,
type: "clanker_v3_1",
address: "0x2A787b2362021cC3eEa3C24C4748a6cD5B687382",
related: {
locker: "0x33e2Eda238edcF470309b8c6D228986A1204c8f9",
vault: "0x42A95190B4088C88Dd904d930c79deC1158bF09D"
}
},
clanker_v3_1_monadTestnet: {
abi: Clanker_v3_1_abi,
chainId: monadTestnet.id,
type: "clanker_v3_1",
address: "0xA0C65813DD1Cde7092922a57548Ec1eD25994318",
related: {
locker: "0xcd89C55d36097a64f777066A6cc8F2c31B7541F7",
vault: "0x9505A57Bf782058890f078bE301575cD75045a9b"
}
},
clanker_v4: {
abi: Clanker_v4_abi,
chainId: base.id,
type: "clanker_v4",
address: "0xE85A59c628F7d27878ACeB4bf3b35733630083a9",
related: {
locker: "0x63D2DfEA64b3433F4071A98665bcD7Ca14d93496",
vault: "0x8E845EAd15737bF71904A30BdDD3aEE76d6ADF6C",
airdrop: "0x56Fa0Da89eD94822e46734e736d34Cab72dF344F",
devbuy: "0x1331f0788F9c08C8F38D52c7a1152250A9dE00be",
mevModule: "0xFdc013ce003980889cFfd66b0c8329545ae1d1E8",
feeLocker: "0xF3622742b1E446D92e45E22923Ef11C2fcD55D68",
feeStaticHook: "0xDd5EeaFf7BD481AD55Db083062b13a3cdf0A68CC",
feeDynamicHook: "0x34a45c6B61876d739400Bd71228CbcbD4F53E8cC"
}
},
clanker_v4_sepolia: {
abi: Clanker_v4_abi,
chainId: baseSepolia.id,
type: "clanker_v4",
address: "0xE85A59c628F7d27878ACeB4bf3b35733630083a9",
related: {
locker: "0x824bB048a5EC6e06a09aEd115E9eEA4618DC2c8f",
vault: "0xcC80d1226F899a78fC2E459a1500A13C373CE0A5",
airdrop: "0x29d17C1A8D851d7d4cA97FAe97AcAdb398D9cCE0",
devbuy: "0x691f97752E91feAcD7933F32a1FEdCeDae7bB59c",
mevModule: "0x261fE99C4D0D41EE8d0e594D11aec740E8354ab0",
feeLocker: "0x42A95190B4088C88Dd904d930c79deC1158bF09D",
feeStaticHook: "0xDFcCcfBeef7F3Fc8b16027Ce6feACb48024068cC",
feeDynamicHook: "0xE63b0A59100698f379F9B577441A561bAF9828cc"
}
},
clanker_v4_arbitrum: {
abi: Clanker_v4_abi,
chainId: arbitrum.id,
type: "clanker_v4",
address: "0xEb9D2A726Edffc887a574dC7f46b3a3638E8E44f",
related: {
locker: "0xF3622742b1E446D92e45E22923Ef11C2fcD55D68",
vault: "0xa1da0600Eb4A9F3D4a892feAa2c2caf80A4A2f14",
airdrop: "0x303470b6b6a35B06A5A05763A7caD776fbf27B71",
devbuy: "0x70aDdc06fE89a5cF9E533aea8D025dB06795e492",
mevModule: "0x4E35277306a83D00E13e8C8A4307C672FA31FC99",
feeLocker: "0x92C0DCbAba17b0F5f3a7537dA82c0F80520e4dF6",
feeStaticHook: "0xf7aC669593d2D9D01026Fa5B756DD5B4f7aAa8Cc",
feeDynamicHook: "0xFd213BE7883db36e1049dC42f5BD6A0ec66B68cC"
}
},
clanker_v4_unichain: {
abi: Clanker_v4_abi,
chainId: unichain.id,
type: "clanker_v4",
address: "0xE85A59c628F7d27878ACeB4bf3b35733630083a9",
related: {
locker: "0x691f97752E91feAcD7933F32a1FEdCeDae7bB59c",
vault: "0xA9C0a423f0092176fC48d7B50a1fCae8cf5BB441",
airdrop: "0x35bfE89d95F26674bF06bB8bFE55f8D73E9280D2",
devbuy: "0x267259e36914839Eb584e962558563760AE28862",
mevModule: "0x42A95190B4088C88Dd904d930c79deC1158bF09D",
feeLocker: "0x1d5A0F0BD3eA07F78FC14577f053de7A3FEc35B2",
feeStaticHook: "0xBc6e5aBDa425309c2534Bc2bC92562F5419ce8Cc",
feeDynamicHook: "0x9b37A43422D7bBD4C8B231be11E50AD1acE828CC"
}
}
};
var Chains = [...new Set(Object.values(CLANKERS).map(({ chainId }) => chainId))];
var ClankerDeployments = Object.values(CLANKERS).reduce(
(agg, cur) => {
if (!agg[cur.chainId]) agg[cur.chainId] = {};
agg[cur.chainId][cur.type] = cur;
return agg;
},
{}
);
var clankerConfigFor = (chainId, type) => {
return Object.values(CLANKERS).find((cfg) => cfg.chainId === chainId && cfg.type === type);
};
// src/utils/write-clanker-contracts.ts
import { estimateContractGas, simulateContract, writeContract } from "viem/actions";
// src/utils/errors.ts
import { BaseError, ContractFunctionRevertedError, InsufficientFundsError } from "viem";
var ClankerError = class _ClankerError extends Error {
constructor(error, data) {
super(data.label);
this.error = error;
this.data = data;
}
static unknown(e, name) {
return new _ClankerError(e, {
type: "unknown",
label: "Something went wrong",
rawName: name || "unknown"
});
}
};
var ErrorMapping = {
NoFeesToClaim: {
type: "state",
label: "No fees to claim",
rawName: "NoFeesToClaim"
},
InvalidVaultConfiguration: {
type: "caller",
label: "Invalid vault configuration",
rawName: "InvalidVault"
},
BaseFeeTooLow: {
type: "caller",
label: "Base fee is set too low",
rawName: "BaseFeeTooLow"
}
};
var understandError = (e) => {
if (!(e instanceof Error)) return ClankerError.unknown(new Error(`${e}`));
if (!(e instanceof BaseError)) return ClankerError.unknown(e);
const revertError = e.walk((e2) => e2 instanceof ContractFunctionRevertedError);
if (revertError instanceof ContractFunctionRevertedError) {
const errorName = revertError.data?.errorName ?? "";
const mapping = ErrorMapping[errorName];
if (!mapping) return ClankerError.unknown(e, errorName);
return new ClankerError(e, mapping);
}
const fundsError = e.walk((e2) => e2 instanceof InsufficientFundsError);
if (fundsError instanceof InsufficientFundsError) {
return new ClankerError(fundsError, {
type: "caller",
label: "Insufficient funds.",
rawName: "InsufficientFundsError"
});
}
return ClankerError.unknown(e);
};
// src/utils/write-clanker-contracts.ts
var simulateClankerContract = async (client, account, tx) => {
try {
const result = await simulateContract(client, {
...tx,
account
// biome-ignore lint: It's difficult to type tx correctly
});
return result;
} catch (e) {
return { error: understandError(e) };
}
};
var writeClankerContract = async (client, wallet, tx, options) => {
if (options?.simulate) {
const { error } = await simulateClankerContract(client, wallet.account, tx);
if (error) {
return { error };
}
}
try {
const txHash = await writeContract(wallet, tx);
return { txHash };
} catch (e) {
return { error: understandError(e) };
}
};
// src/utils/zod-onchain.ts
import { getAddress, isAddress, isHex } from "viem";
import * as z from "zod/v4";
var ClankerMetadataSchema = z.strictObject({
/** Description of the token or token project. */
description: z.string().optional(),
/** Socials for the token. These may be displayed on aggregators. */
socialMediaUrls: z.array(z.object({ platform: z.string(), url: z.string() })).optional(),
/** Audits for other contracts or services offered by the project. */
auditUrls: z.array(z.url()).optional()
});
var ClankerContextSchema = z.strictObject({
/** System the token was deployed via. Defaults to "SDK". */
interface: z.string().default("SDK"),
/** Social platform the token was deployed from. Used for provenance and will be verified by aggregators. */
platform: z.string().optional(),
/** Id of the message on the social platform the token was deployed from. Used for provenance and will be verified by aggregators. */
messageId: z.string().optional(),
/** User id of the poster on the social platform the token was deployed from. Used for provenance and will be verified by aggregators. */
id: z.string().optional()
});
var hexSchema = z.custom((val) => {
if (!(typeof val === "string")) return false;
if (!isHex(val)) return false;
return val;
}, "String must be valid hex.");
var addressSchema = z.custom((val) => {
if (!(typeof val === "string")) return false;
if (!isAddress(val)) return false;
return getAddress(val);
}, "String must be a valid address.");
// src/v4/extensions/airdrop.ts
var AirdropEntrySchema = z2.array(
z2.object({
account: addressSchema,
amount: z2.number()
})
);
function createAirdrop(recipients, options = { tokenDecimals: 18n }) {
const parsedEntries = AirdropEntrySchema.parse(recipients);
const values = parsedEntries.map(({ account, amount: amount2 }) => [
account,
(BigInt(amount2) * 10n ** options.tokenDecimals).toString()
]);
const amount = parsedEntries.reduce((agg, { amount: amount2 }) => amount2 + agg, 0);
const tree = StandardMerkleTree.of(values, ["address", "uint256"]);
tree.validate();
return {
tree,
airdrop: {
merkleRoot: tree.root,
amount
}
};
}
async function registerAirdrop(token, tree) {
const { success } = await fetch("https://www.clanker.world/api/airdrops", {
method: "POST",
body: stringify({
tokenAddress: token,
merkleRoot: tree.root,
tree: tree.dump()
})
}).then((r) => r.json());
return success;
}
function getAirdropProofs(tree, account) {
const indices = [];
for (const [i, entry] of tree.entries()) {
if (!isAddressEqual(entry[0], account)) continue;
indices.push({ i, entry });
}
if (indices.length === 0) return { proofs: [] };
return {
proofs: indices.map(({ i, entry }) => ({
proof: tree.getProof(i),
entry: {
account: entry[0],
amount: BigInt(entry[1])
}
}))
};
}
async function fetchAirdropProofs(token, account) {
const { proofs } = await fetch(
`https://www.clanker.world/api/airdrops/claim?tokenAddress=${token}&claimerAddress=${account}`
).then(
(r) => r.json()
);
return {
proofs: proofs.map(({ proof, entry: { account: account2, amount } }) => ({
proof,
entry: {
account: account2,
amount: BigInt(amount)
}
}))
};
}
function getClaimAirdropTransaction({
token,
recipient,
amount,
proof,
chainId
}) {
const config = clankerConfigFor(chainId, "clanker_v4");
if (!config) throw new Error(`Clanker is not ready on ${chainId}`);
return {
chainId,
address: config.related.airdrop,
abi: ClankerAirdrop_v4_abi,
functionName: "claim",
args: [token, recipient, amount, proof]
};
}
function claimAirdrop(data) {
if (!data.clanker.publicClient) throw new Error("Public client required on clanker");
if (!data.clanker.wallet) throw new Error("Wallet client required on clanker");
const tx = getClaimAirdropTransaction({
chainId: data.clanker.wallet.chain.id,
...data
});
return writeClankerContract(data.clanker.publicClient, data.clanker.wallet, tx);
}
export {
claimAirdrop,
createAirdrop,
fetchAirdropProofs,
getAirdropProofs,
getClaimAirdropTransaction,
registerAirdrop
};