@pickhooks/sdk 0.4.0 → 0.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +32 -2
- package/dist/abis/index.d.ts +1 -0
- package/dist/abis/index.js +1 -0
- package/dist/abis/sticky3.d.ts +2292 -0
- package/dist/abis/sticky3.js +8 -0
- package/dist/addresses.d.ts +11 -0
- package/dist/addresses.js +12 -0
- package/dist/errors.js +28 -0
- package/dist/index.d.ts +26 -2
- package/dist/index.js +45 -1
- package/dist/modes-catalog.d.ts +59 -0
- package/dist/modes-catalog.js +77 -0
- package/dist/modes.d.ts +71 -0
- package/dist/modes.js +86 -0
- package/dist/simulate.d.ts +75 -0
- package/dist/simulate.js +225 -0
- package/dist/sticky.d.ts +21 -2
- package/dist/sticky.js +119 -9
- package/dist/text-launch.d.ts +52 -0
- package/dist/text-launch.js +178 -0
- package/dist/tlock.d.ts +10 -0
- package/dist/tlock.js +16 -0
- package/package.json +3 -2
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
// Generated from out-sticky3 (src/sticky3: the coin with a mode, its factory, lens, drand beacon and the modes). Do not edit by hand: node scripts/gen-abis.mjs
|
|
2
|
+
export const sticky3FactoryAbi = [{ "type": "function", "name": "FEE", "inputs": [], "outputs": [{ "name": "", "type": "uint24" }], "stateMutability": "view" }, { "type": "function", "name": "MAX_ALLOCATION_BPS", "inputs": [], "outputs": [{ "name": "", "type": "uint256" }], "stateMutability": "view" }, { "type": "function", "name": "MAX_OUT_BPS", "inputs": [], "outputs": [{ "name": "", "type": "uint256" }], "stateMutability": "view" }, { "type": "function", "name": "NPM", "inputs": [], "outputs": [{ "name": "", "type": "address" }], "stateMutability": "view" }, { "type": "function", "name": "ROUTER", "inputs": [], "outputs": [{ "name": "", "type": "address" }], "stateMutability": "view" }, { "type": "function", "name": "V2", "inputs": [], "outputs": [{ "name": "", "type": "address" }], "stateMutability": "view" }, { "type": "function", "name": "WBNB", "inputs": [], "outputs": [{ "name": "", "type": "address" }], "stateMutability": "view" }, { "type": "function", "name": "coinCount", "inputs": [], "outputs": [{ "name": "", "type": "uint256" }], "stateMutability": "view" }, { "type": "function", "name": "coins", "inputs": [{ "name": "", "type": "uint256" }], "outputs": [{ "name": "", "type": "address" }], "stateMutability": "view" }, { "type": "function", "name": "creatorBps", "inputs": [], "outputs": [{ "name": "", "type": "uint16" }], "stateMutability": "view" }, { "type": "function", "name": "custom", "inputs": [], "outputs": [{ "name": "", "type": "bool" }], "stateMutability": "view" }, { "type": "function", "name": "deployer", "inputs": [], "outputs": [{ "name": "", "type": "address" }], "stateMutability": "view" }, { "type": "function", "name": "isCoin", "inputs": [{ "name": "", "type": "address" }], "outputs": [{ "name": "", "type": "bool" }], "stateMutability": "view" }, { "type": "function", "name": "launch", "inputs": [{ "name": "a", "type": "tuple", "components": [{ "name": "name", "type": "string" }, { "name": "symbol", "type": "string" }, { "name": "metadata", "type": "string" }, { "name": "rows", "type": "uint256[]" }, { "name": "release", "type": "uint32" }, { "name": "salt", "type": "bytes32" }, { "name": "keepBps", "type": "uint16" }, { "name": "minCreatorBps", "type": "uint16" }, { "name": "switcher", "type": "address" }, { "name": "switchMask", "type": "uint8" }, { "name": "mode", "type": "address" }, { "name": "modeData", "type": "bytes" }] }], "outputs": [{ "name": "token", "type": "address" }], "stateMutability": "payable" }, { "type": "function", "name": "launchAt", "inputs": [{ "name": "creator", "type": "address" }, { "name": "a", "type": "tuple", "components": [{ "name": "name", "type": "string" }, { "name": "symbol", "type": "string" }, { "name": "metadata", "type": "string" }, { "name": "rows", "type": "uint256[]" }, { "name": "release", "type": "uint32" }, { "name": "salt", "type": "bytes32" }, { "name": "keepBps", "type": "uint16" }, { "name": "minCreatorBps", "type": "uint16" }, { "name": "switcher", "type": "address" }, { "name": "switchMask", "type": "uint8" }, { "name": "mode", "type": "address" }, { "name": "modeData", "type": "bytes" }] }, { "name": "tick", "type": "int24" }, { "name": "allocation", "type": "uint256" }], "outputs": [{ "name": "token", "type": "address" }], "stateMutability": "payable" }, { "type": "function", "name": "launchFor", "inputs": [{ "name": "creator", "type": "address" }, { "name": "a", "type": "tuple", "components": [{ "name": "name", "type": "string" }, { "name": "symbol", "type": "string" }, { "name": "metadata", "type": "string" }, { "name": "rows", "type": "uint256[]" }, { "name": "release", "type": "uint32" }, { "name": "salt", "type": "bytes32" }, { "name": "keepBps", "type": "uint16" }, { "name": "minCreatorBps", "type": "uint16" }, { "name": "switcher", "type": "address" }, { "name": "switchMask", "type": "uint8" }, { "name": "mode", "type": "address" }, { "name": "modeData", "type": "bytes" }] }], "outputs": [{ "name": "token", "type": "address" }], "stateMutability": "payable" }, { "type": "function", "name": "launchers", "inputs": [{ "name": "", "type": "address" }], "outputs": [{ "name": "", "type": "bool" }], "stateMutability": "view" }, { "type": "function", "name": "locker", "inputs": [], "outputs": [{ "name": "", "type": "address" }], "stateMutability": "view" }, { "type": "function", "name": "modes", "inputs": [{ "name": "", "type": "address" }], "outputs": [{ "name": "", "type": "bool" }], "stateMutability": "view" }, { "type": "function", "name": "owner", "inputs": [], "outputs": [{ "name": "", "type": "address" }], "stateMutability": "view" }, { "type": "function", "name": "platformWallet", "inputs": [], "outputs": [{ "name": "", "type": "address" }], "stateMutability": "view" }, { "type": "function", "name": "seedBnb", "inputs": [], "outputs": [{ "name": "", "type": "uint256" }], "stateMutability": "view" }, { "type": "function", "name": "setCustom", "inputs": [{ "name": "on", "type": "bool" }], "outputs": [], "stateMutability": "nonpayable" }, { "type": "function", "name": "setLauncher", "inputs": [{ "name": "who", "type": "address" }, { "name": "on", "type": "bool" }], "outputs": [], "stateMutability": "nonpayable" }, { "type": "function", "name": "setMode", "inputs": [{ "name": "m", "type": "address" }, { "name": "on", "type": "bool" }], "outputs": [], "stateMutability": "nonpayable" }, { "type": "function", "name": "setOwner", "inputs": [{ "name": "o", "type": "address" }], "outputs": [], "stateMutability": "nonpayable" }, { "type": "function", "name": "setPlatform", "inputs": [{ "name": "wallet", "type": "address" }, { "name": "creatorBps_", "type": "uint16" }], "outputs": [], "stateMutability": "nonpayable" }, { "type": "function", "name": "setSeed", "inputs": [{ "name": "seedBnb_", "type": "uint256" }], "outputs": [], "stateMutability": "nonpayable" }, { "type": "function", "name": "setStartPrice", "inputs": [{ "name": "sp0", "type": "uint160" }, { "name": "tl0", "type": "int24" }, { "name": "sp1", "type": "uint160" }, { "name": "tu1", "type": "int24" }, { "name": "startFdv_", "type": "uint256" }], "outputs": [], "stateMutability": "nonpayable" }, { "type": "function", "name": "setSwitcher", "inputs": [{ "name": "who", "type": "address" }, { "name": "on", "type": "bool" }], "outputs": [], "stateMutability": "nonpayable" }, { "type": "function", "name": "sqrtPrice0", "inputs": [], "outputs": [{ "name": "", "type": "uint160" }], "stateMutability": "view" }, { "type": "function", "name": "sqrtPrice1", "inputs": [], "outputs": [{ "name": "", "type": "uint160" }], "stateMutability": "view" }, { "type": "function", "name": "startFdv", "inputs": [], "outputs": [{ "name": "", "type": "uint256" }], "stateMutability": "view" }, { "type": "function", "name": "switchers", "inputs": [{ "name": "", "type": "address" }], "outputs": [{ "name": "", "type": "bool" }], "stateMutability": "view" }, { "type": "function", "name": "tickLower0", "inputs": [], "outputs": [{ "name": "", "type": "int24" }], "stateMutability": "view" }, { "type": "function", "name": "tickUpper1", "inputs": [], "outputs": [{ "name": "", "type": "int24" }], "stateMutability": "view" }, { "type": "function", "name": "validator", "inputs": [], "outputs": [{ "name": "", "type": "address" }], "stateMutability": "view" }, { "type": "event", "name": "Launched", "inputs": [{ "name": "token", "type": "address", "indexed": true }, { "name": "creator", "type": "address", "indexed": true }, { "name": "pool", "type": "address", "indexed": false }, { "name": "pair", "type": "address", "indexed": false }, { "name": "tokenId", "type": "uint256", "indexed": false }, { "name": "mask", "type": "uint64", "indexed": false }], "anonymous": false }, { "type": "event", "name": "LaunchedBy", "inputs": [{ "name": "token", "type": "address", "indexed": true }, { "name": "launcher", "type": "address", "indexed": true }, { "name": "switcher", "type": "address", "indexed": false }, { "name": "switchMask", "type": "uint8", "indexed": false }, { "name": "tick", "type": "int24", "indexed": false }, { "name": "allocation", "type": "uint256", "indexed": false }], "anonymous": false }, { "type": "event", "name": "LauncherSet", "inputs": [{ "name": "launcher", "type": "address", "indexed": true }, { "name": "on", "type": "bool", "indexed": false }], "anonymous": false }, { "type": "event", "name": "ModeLaunched", "inputs": [{ "name": "token", "type": "address", "indexed": true }, { "name": "mode", "type": "address", "indexed": true }, { "name": "gameBps", "type": "uint16", "indexed": false }, { "name": "data", "type": "bytes", "indexed": false }], "anonymous": false }, { "type": "event", "name": "ModeSet", "inputs": [{ "name": "mode", "type": "address", "indexed": true }, { "name": "on", "type": "bool", "indexed": false }], "anonymous": false }, { "type": "event", "name": "Script", "inputs": [{ "name": "token", "type": "address", "indexed": true }, { "name": "rows", "type": "uint256[]", "indexed": false }, { "name": "release", "type": "uint32", "indexed": false }], "anonymous": false }, { "type": "event", "name": "SwitcherSet", "inputs": [{ "name": "switcher", "type": "address", "indexed": true }, { "name": "on", "type": "bool", "indexed": false }], "anonymous": false }, { "type": "error", "name": "Bad", "inputs": [{ "name": "what", "type": "string" }] }, { "type": "error", "name": "InvalidTick", "inputs": [{ "name": "tick", "type": "int24" }] }, { "type": "error", "name": "NotLauncher", "inputs": [] }, { "type": "error", "name": "NotOwner", "inputs": [] }, { "type": "error", "name": "PoolPrice", "inputs": [] }];
|
|
3
|
+
export const sticky3TokenAbi = [{ "type": "function", "name": "EXIT", "inputs": [], "outputs": [{ "name": "", "type": "uint256" }], "stateMutability": "view" }, { "type": "function", "name": "MAX_HOLD", "inputs": [], "outputs": [{ "name": "", "type": "uint256" }], "stateMutability": "view" }, { "type": "function", "name": "MAX_LAUNCH_HOLD", "inputs": [], "outputs": [{ "name": "", "type": "uint256" }], "stateMutability": "view" }, { "type": "function", "name": "MODE_GAS", "inputs": [], "outputs": [{ "name": "", "type": "uint256" }], "stateMutability": "view" }, { "type": "function", "name": "activate", "inputs": [{ "name": "pool_", "type": "address" }, { "name": "pool2_", "type": "address" }, { "name": "locker_", "type": "address" }, { "name": "curveSupply_", "type": "uint256" }, { "name": "alloc", "type": "address" }], "outputs": [], "stateMutability": "nonpayable" }, { "type": "function", "name": "active", "inputs": [], "outputs": [{ "name": "", "type": "uint8" }], "stateMutability": "view" }, { "type": "function", "name": "aged", "inputs": [{ "name": "who", "type": "address" }, { "name": "before", "type": "uint256" }, { "name": "skip", "type": "uint8" }], "outputs": [{ "name": "total", "type": "uint256" }], "stateMutability": "view" }, { "type": "function", "name": "allowance", "inputs": [{ "name": "", "type": "address" }, { "name": "", "type": "address" }], "outputs": [{ "name": "", "type": "uint256" }], "stateMutability": "view" }, { "type": "function", "name": "approve", "inputs": [{ "name": "spender", "type": "address" }, { "name": "amount", "type": "uint256" }], "outputs": [{ "name": "", "type": "bool" }], "stateMutability": "nonpayable" }, { "type": "function", "name": "balanceOf", "inputs": [{ "name": "", "type": "address" }], "outputs": [{ "name": "", "type": "uint256" }], "stateMutability": "view" }, { "type": "function", "name": "check", "inputs": [{ "name": "kind", "type": "uint8" }, { "name": "from", "type": "address" }, { "name": "to", "type": "address" }, { "name": "amount", "type": "uint256" }], "outputs": [{ "name": "", "type": "uint8" }], "stateMutability": "view" }, { "type": "function", "name": "creator", "inputs": [], "outputs": [{ "name": "", "type": "address" }], "stateMutability": "view" }, { "type": "function", "name": "curveSupply", "inputs": [], "outputs": [{ "name": "", "type": "uint256" }], "stateMutability": "view" }, { "type": "function", "name": "custody", "inputs": [{ "name": "", "type": "address" }], "outputs": [{ "name": "until", "type": "uint40" }, { "name": "since", "type": "uint40" }], "stateMutability": "view" }, { "type": "function", "name": "decimals", "inputs": [], "outputs": [{ "name": "", "type": "uint8" }], "stateMutability": "view" }, { "type": "function", "name": "dev", "inputs": [], "outputs": [{ "name": "bought", "type": "uint128" }, { "name": "sold", "type": "uint128" }, { "name": "sniperSold", "type": "uint96" }, { "name": "at10", "type": "uint40" }, { "name": "at25", "type": "uint40" }, { "name": "at50", "type": "uint40" }, { "name": "at100", "type": "uint40" }], "stateMutability": "view" }, { "type": "function", "name": "factory", "inputs": [], "outputs": [{ "name": "", "type": "address" }], "stateMutability": "view" }, { "type": "function", "name": "gameBps", "inputs": [], "outputs": [{ "name": "", "type": "uint16" }], "stateMutability": "view" }, { "type": "function", "name": "gamePot", "inputs": [], "outputs": [{ "name": "", "type": "uint128" }], "stateMutability": "view" }, { "type": "function", "name": "heldOf", "inputs": [{ "name": "who", "type": "address" }], "outputs": [{ "name": "amount", "type": "uint256" }, { "name": "devAmount", "type": "uint256" }, { "name": "until", "type": "uint40" }, { "name": "since", "type": "uint40" }], "stateMutability": "view" }, { "type": "function", "name": "lift", "inputs": [{ "name": "i", "type": "uint8" }], "outputs": [], "stateMutability": "nonpayable" }, { "type": "function", "name": "locker", "inputs": [], "outputs": [{ "name": "", "type": "address" }], "stateMutability": "view" }, { "type": "function", "name": "lotCount", "inputs": [{ "name": "", "type": "address" }], "outputs": [{ "name": "", "type": "uint8" }], "stateMutability": "view" }, { "type": "function", "name": "lotsRaw", "inputs": [{ "name": "a", "type": "address" }], "outputs": [{ "name": "ls", "type": "uint256[]" }], "stateMutability": "view" }, { "type": "function", "name": "metadata", "inputs": [], "outputs": [{ "name": "", "type": "string" }], "stateMutability": "view" }, { "type": "function", "name": "mode", "inputs": [], "outputs": [{ "name": "", "type": "address" }], "stateMutability": "view" }, { "type": "function", "name": "name", "inputs": [], "outputs": [{ "name": "", "type": "string" }], "stateMutability": "view" }, { "type": "function", "name": "off", "inputs": [], "outputs": [{ "name": "", "type": "uint8" }], "stateMutability": "view" }, { "type": "function", "name": "play", "inputs": [{ "name": "data", "type": "bytes" }], "outputs": [], "stateMutability": "nonpayable" }, { "type": "function", "name": "poke", "inputs": [{ "name": "data", "type": "bytes" }], "outputs": [], "stateMutability": "nonpayable" }, { "type": "function", "name": "pool", "inputs": [], "outputs": [{ "name": "", "type": "address" }], "stateMutability": "view" }, { "type": "function", "name": "pool2", "inputs": [], "outputs": [{ "name": "", "type": "address" }], "stateMutability": "view" }, { "type": "function", "name": "pot", "inputs": [], "outputs": [{ "name": "", "type": "uint256" }], "stateMutability": "view" }, { "type": "function", "name": "release", "inputs": [], "outputs": [{ "name": "", "type": "uint32" }], "stateMutability": "view" }, { "type": "function", "name": "releaseHeld", "inputs": [{ "name": "who", "type": "address" }], "outputs": [], "stateMutability": "nonpayable" }, { "type": "function", "name": "rowCount", "inputs": [], "outputs": [{ "name": "", "type": "uint8" }], "stateMutability": "view" }, { "type": "function", "name": "script", "inputs": [], "outputs": [{ "name": "rows", "type": "uint256[]" }, { "name": "release_", "type": "uint32" }, { "name": "off_", "type": "uint8" }], "stateMutability": "view" }, { "type": "function", "name": "setSwitch", "inputs": [{ "name": "i", "type": "uint8" }], "outputs": [], "stateMutability": "nonpayable" }, { "type": "function", "name": "shadow", "inputs": [{ "name": "who", "type": "address" }], "outputs": [{ "name": "", "type": "address" }], "stateMutability": "pure" }, { "type": "function", "name": "start", "inputs": [], "outputs": [{ "name": "", "type": "uint40" }], "stateMutability": "view" }, { "type": "function", "name": "startBlock", "inputs": [], "outputs": [{ "name": "", "type": "uint64" }], "stateMutability": "view" }, { "type": "function", "name": "stats", "inputs": [], "outputs": [{ "name": "holders", "type": "uint32" }, { "name": "buys", "type": "uint32" }, { "name": "sells", "type": "uint32" }, { "name": "highAt", "type": "uint40" }, { "name": "lastBuy", "type": "uint40" }, { "name": "volume", "type": "uint128" }, { "name": "net", "type": "uint128" }, { "name": "peak", "type": "uint128" }, { "name": "high", "type": "uint128" }], "stateMutability": "view" }, { "type": "function", "name": "switchMask", "inputs": [], "outputs": [{ "name": "", "type": "uint8" }], "stateMutability": "view" }, { "type": "function", "name": "switcher", "inputs": [], "outputs": [{ "name": "", "type": "address" }], "stateMutability": "view" }, { "type": "function", "name": "symbol", "inputs": [], "outputs": [{ "name": "", "type": "string" }], "stateMutability": "view" }, { "type": "function", "name": "totalSupply", "inputs": [], "outputs": [{ "name": "", "type": "uint256" }], "stateMutability": "view" }, { "type": "function", "name": "transfer", "inputs": [{ "name": "to", "type": "address" }, { "name": "amount", "type": "uint256" }], "outputs": [{ "name": "", "type": "bool" }], "stateMutability": "nonpayable" }, { "type": "function", "name": "transferFrom", "inputs": [{ "name": "from", "type": "address" }, { "name": "to", "type": "address" }, { "name": "amount", "type": "uint256" }], "outputs": [{ "name": "", "type": "bool" }], "stateMutability": "nonpayable" }, { "type": "event", "name": "Activated", "inputs": [{ "name": "pool", "type": "address", "indexed": false }, { "name": "pool2", "type": "address", "indexed": false }, { "name": "locker", "type": "address", "indexed": false }, { "name": "curveSupply", "type": "uint256", "indexed": false }], "anonymous": false }, { "type": "event", "name": "Approval", "inputs": [{ "name": "owner", "type": "address", "indexed": true }, { "name": "spender", "type": "address", "indexed": true }, { "name": "value", "type": "uint256", "indexed": false }], "anonymous": false }, { "type": "event", "name": "DevSold", "inputs": [{ "name": "pct", "type": "uint8", "indexed": true }, { "name": "sold", "type": "uint256", "indexed": false }, { "name": "bought", "type": "uint256", "indexed": false }], "anonymous": false }, { "type": "event", "name": "Held", "inputs": [{ "name": "who", "type": "address", "indexed": true }, { "name": "amount", "type": "uint256", "indexed": false }, { "name": "until", "type": "uint40", "indexed": false }], "anonymous": false }, { "type": "event", "name": "ModeSkipped", "inputs": [{ "name": "kind", "type": "uint8", "indexed": false }], "anonymous": false }, { "type": "event", "name": "RowLifted", "inputs": [{ "name": "row", "type": "uint8", "indexed": true }], "anonymous": false }, { "type": "event", "name": "Switched", "inputs": [{ "name": "row", "type": "uint8", "indexed": true }], "anonymous": false }, { "type": "event", "name": "Transfer", "inputs": [{ "name": "from", "type": "address", "indexed": true }, { "name": "to", "type": "address", "indexed": true }, { "name": "value", "type": "uint256", "indexed": false }], "anonymous": false }, { "type": "error", "name": "BadOrder", "inputs": [{ "name": "i", "type": "uint256" }] }, { "type": "error", "name": "Blocked", "inputs": [{ "name": "row", "type": "uint8" }] }, { "type": "error", "name": "Busy", "inputs": [] }, { "type": "error", "name": "LowGas", "inputs": [] }, { "type": "error", "name": "NoMode", "inputs": [] }, { "type": "error", "name": "Nope", "inputs": [] }, { "type": "error", "name": "NotCreator", "inputs": [] }, { "type": "error", "name": "NotFactory", "inputs": [] }, { "type": "error", "name": "NotSwitcher", "inputs": [] }];
|
|
4
|
+
export const sticky3ValidatorAbi = [{ "type": "function", "name": "MAX_AGE", "inputs": [], "outputs": [{ "name": "", "type": "uint256" }], "stateMutability": "view" }, { "type": "function", "name": "MAX_BLOCKS", "inputs": [], "outputs": [{ "name": "", "type": "uint256" }], "stateMutability": "view" }, { "type": "function", "name": "MAX_EVERY", "inputs": [], "outputs": [{ "name": "", "type": "uint256" }], "stateMutability": "view" }, { "type": "function", "name": "MAX_HOLD_BLOCKS", "inputs": [], "outputs": [{ "name": "", "type": "uint256" }], "stateMutability": "view" }, { "type": "function", "name": "MAX_PERIOD", "inputs": [], "outputs": [{ "name": "", "type": "uint256" }], "stateMutability": "view" }, { "type": "function", "name": "MAX_SWITCH_ROWS", "inputs": [], "outputs": [{ "name": "", "type": "uint256" }], "stateMutability": "view" }, { "type": "function", "name": "MIN_OPEN", "inputs": [], "outputs": [{ "name": "", "type": "uint256" }], "stateMutability": "view" }, { "type": "function", "name": "MIN_RELEASE", "inputs": [], "outputs": [{ "name": "", "type": "uint256" }], "stateMutability": "view" }, { "type": "function", "name": "MIN_SELL_CAP", "inputs": [], "outputs": [{ "name": "", "type": "uint256" }], "stateMutability": "view" }, { "type": "function", "name": "game", "inputs": [{ "name": "rows", "type": "uint256[]" }, { "name": "gameBps", "type": "uint16" }], "outputs": [], "stateMutability": "pure" }, { "type": "function", "name": "isTemplate", "inputs": [{ "name": "", "type": "uint256" }], "outputs": [{ "name": "", "type": "bool" }], "stateMutability": "view" }, { "type": "function", "name": "switchRows", "inputs": [{ "name": "rows", "type": "uint256[]" }, { "name": "mask", "type": "uint8" }], "outputs": [], "stateMutability": "pure" }, { "type": "function", "name": "templates", "inputs": [], "outputs": [{ "name": "", "type": "uint256[]" }], "stateMutability": "view" }, { "type": "function", "name": "validate", "inputs": [{ "name": "rows", "type": "uint256[]" }, { "name": "release", "type": "uint32" }, { "name": "custom", "type": "bool" }], "outputs": [], "stateMutability": "view" }, { "type": "error", "name": "Bad", "inputs": [{ "name": "what", "type": "string" }] }];
|
|
5
|
+
export const sticky3LensAbi = [{ "type": "function", "name": "custodyOf", "inputs": [{ "name": "coin", "type": "address" }, { "name": "holder", "type": "address" }], "outputs": [{ "name": "amount", "type": "uint256" }, { "name": "devAmount", "type": "uint256" }, { "name": "until", "type": "uint40" }, { "name": "since", "type": "uint40" }, { "name": "at", "type": "address" }], "stateMutability": "view" }, { "type": "function", "name": "devSold", "inputs": [{ "name": "coin", "type": "address" }], "outputs": [{ "name": "bps", "type": "uint256" }, { "name": "at10", "type": "uint40" }, { "name": "at25", "type": "uint40" }, { "name": "at50", "type": "uint40" }, { "name": "at100", "type": "uint40" }], "stateMutability": "view" }, { "type": "function", "name": "game", "inputs": [{ "name": "coin", "type": "address" }], "outputs": [{ "name": "mode", "type": "address" }, { "name": "gameBps", "type": "uint16" }, { "name": "gamePot", "type": "uint256" }, { "name": "rowPot", "type": "uint256" }], "stateMutability": "view" }, { "type": "function", "name": "lotsOf", "inputs": [{ "name": "coin", "type": "address" }, { "name": "holder", "type": "address" }], "outputs": [{ "name": "r", "type": "tuple", "components": [{ "name": "amount", "type": "uint256[]" }, { "name": "locked", "type": "uint256[]" }, { "name": "since", "type": "uint40[]" }, { "name": "flags", "type": "uint8[]" }, { "name": "open", "type": "bool[]" }] }], "stateMutability": "view" }, { "type": "function", "name": "sellable", "inputs": [{ "name": "coin", "type": "address" }, { "name": "holder", "type": "address" }], "outputs": [{ "name": "total", "type": "uint256" }], "stateMutability": "view" }, { "type": "function", "name": "soldBps", "inputs": [{ "name": "coin", "type": "address" }], "outputs": [{ "name": "", "type": "uint256" }], "stateMutability": "view" }];
|
|
6
|
+
export const drandBeaconAbi = [{ "type": "function", "name": "CHAIN_HASH", "inputs": [], "outputs": [{ "name": "", "type": "bytes32" }], "stateMutability": "view" }, { "type": "function", "name": "GENESIS", "inputs": [], "outputs": [{ "name": "", "type": "uint256" }], "stateMutability": "view" }, { "type": "function", "name": "PERIOD", "inputs": [], "outputs": [{ "name": "", "type": "uint256" }], "stateMutability": "view" }, { "type": "function", "name": "hashToPoint", "inputs": [{ "name": "round", "type": "uint64" }], "outputs": [{ "name": "", "type": "bytes" }], "stateMutability": "view" }, { "type": "function", "name": "randomness", "inputs": [{ "name": "", "type": "uint64" }], "outputs": [{ "name": "", "type": "bytes32" }], "stateMutability": "view" }, { "type": "function", "name": "roundAt", "inputs": [{ "name": "t", "type": "uint256" }], "outputs": [{ "name": "", "type": "uint64" }], "stateMutability": "pure" }, { "type": "function", "name": "submit", "inputs": [{ "name": "round", "type": "uint64" }, { "name": "sig", "type": "bytes" }], "outputs": [{ "name": "r", "type": "bytes32" }], "stateMutability": "nonpayable" }, { "type": "function", "name": "timeOf", "inputs": [{ "name": "round", "type": "uint64" }], "outputs": [{ "name": "", "type": "uint256" }], "stateMutability": "pure" }, { "type": "function", "name": "verify", "inputs": [{ "name": "round", "type": "uint64" }, { "name": "sig", "type": "bytes" }], "outputs": [{ "name": "", "type": "bool" }], "stateMutability": "view" }, { "type": "event", "name": "Beacon", "inputs": [{ "name": "round", "type": "uint64", "indexed": true }, { "name": "randomness", "type": "bytes32", "indexed": false }], "anonymous": false }, { "type": "error", "name": "BadSignature", "inputs": [] }, { "type": "error", "name": "Precompile", "inputs": [] }];
|
|
7
|
+
export const comboModeAbi = [{ "type": "function", "name": "creatorOf", "inputs": [{ "name": "", "type": "address" }], "outputs": [{ "name": "", "type": "address" }], "stateMutability": "view" }, { "type": "function", "name": "factory", "inputs": [], "outputs": [{ "name": "", "type": "address" }], "stateMutability": "view" }, { "type": "function", "name": "games", "inputs": [{ "name": "", "type": "address" }], "outputs": [{ "name": "combo", "type": "uint32" }, { "name": "best", "type": "uint32" }, { "name": "hits", "type": "uint32" }, { "name": "bps", "type": "uint16" }, { "name": "minPpm", "type": "uint32" }, { "name": "breaker", "type": "address" }, { "name": "brokeAt", "type": "uint40" }], "stateMutability": "view" }, { "type": "function", "name": "name", "inputs": [], "outputs": [{ "name": "", "type": "string" }], "stateMutability": "pure" }, { "type": "function", "name": "nextAt", "inputs": [{ "name": "c", "type": "uint256" }], "outputs": [{ "name": "", "type": "uint256" }], "stateMutability": "pure" }, { "type": "function", "name": "onPlay", "inputs": [{ "name": "player", "type": "address" }, { "name": "data", "type": "bytes" }], "outputs": [{ "name": "", "type": "uint256[]" }], "stateMutability": "nonpayable" }, { "type": "function", "name": "onPoke", "inputs": [{ "name": "caller", "type": "address" }, { "name": "data", "type": "bytes" }], "outputs": [{ "name": "", "type": "uint256[]" }], "stateMutability": "nonpayable" }, { "type": "function", "name": "onTrade", "inputs": [{ "name": "t", "type": "tuple", "components": [{ "name": "kind", "type": "uint8" }, { "name": "from", "type": "address" }, { "name": "to", "type": "address" }, { "name": "who", "type": "address" }, { "name": "amount", "type": "uint256" }, { "name": "got", "type": "uint256" }, { "name": "dev", "type": "uint256" }, { "name": "sniper", "type": "uint256" }, { "name": "pot", "type": "uint256" }, { "name": "buys", "type": "uint256" }] }], "outputs": [{ "name": "", "type": "uint256[]" }], "stateMutability": "nonpayable" }, { "type": "function", "name": "quote", "inputs": [{ "name": "", "type": "address" }, { "name": "data", "type": "bytes" }], "outputs": [{ "name": "", "type": "uint16" }], "stateMutability": "pure" }, { "type": "function", "name": "register", "inputs": [{ "name": "coin", "type": "address" }, { "name": "creator", "type": "address" }, { "name": "data", "type": "bytes" }], "outputs": [], "stateMutability": "nonpayable" }, { "type": "function", "name": "shareAt", "inputs": [{ "name": "c", "type": "uint256" }], "outputs": [{ "name": "", "type": "uint256" }], "stateMutability": "pure" }, { "type": "event", "name": "ComboBroken", "inputs": [{ "name": "coin", "type": "address", "indexed": true }, { "name": "seller", "type": "address", "indexed": true }, { "name": "combo", "type": "uint32", "indexed": false }], "anonymous": false }, { "type": "event", "name": "ComboHit", "inputs": [{ "name": "coin", "type": "address", "indexed": true }, { "name": "buyer", "type": "address", "indexed": true }, { "name": "combo", "type": "uint32", "indexed": false }, { "name": "paid", "type": "uint256", "indexed": false }], "anonymous": false }, { "type": "event", "name": "ComboUp", "inputs": [{ "name": "coin", "type": "address", "indexed": true }, { "name": "buyer", "type": "address", "indexed": true }, { "name": "combo", "type": "uint32", "indexed": false }], "anonymous": false }, { "type": "event", "name": "Registered", "inputs": [{ "name": "coin", "type": "address", "indexed": true }, { "name": "creator", "type": "address", "indexed": true }, { "name": "data", "type": "bytes", "indexed": false }], "anonymous": false }, { "type": "error", "name": "Bad", "inputs": [{ "name": "what", "type": "string" }] }, { "type": "error", "name": "NotCoin", "inputs": [] }, { "type": "error", "name": "NotFactory", "inputs": [] }];
|
|
8
|
+
export const forwardModeAbi = [{ "type": "function", "name": "creatorOf", "inputs": [{ "name": "", "type": "address" }], "outputs": [{ "name": "", "type": "address" }], "stateMutability": "view" }, { "type": "function", "name": "factory", "inputs": [], "outputs": [{ "name": "", "type": "address" }], "stateMutability": "view" }, { "type": "function", "name": "games", "inputs": [{ "name": "", "type": "address" }], "outputs": [{ "name": "last", "type": "address" }, { "name": "lastGot", "type": "uint96" }, { "name": "bps", "type": "uint16" }, { "name": "minPpm", "type": "uint32" }, { "name": "forwards", "type": "uint32" }], "stateMutability": "view" }, { "type": "function", "name": "name", "inputs": [], "outputs": [{ "name": "", "type": "string" }], "stateMutability": "pure" }, { "type": "function", "name": "onPlay", "inputs": [{ "name": "player", "type": "address" }, { "name": "data", "type": "bytes" }], "outputs": [{ "name": "", "type": "uint256[]" }], "stateMutability": "nonpayable" }, { "type": "function", "name": "onPoke", "inputs": [{ "name": "caller", "type": "address" }, { "name": "data", "type": "bytes" }], "outputs": [{ "name": "", "type": "uint256[]" }], "stateMutability": "nonpayable" }, { "type": "function", "name": "onTrade", "inputs": [{ "name": "t", "type": "tuple", "components": [{ "name": "kind", "type": "uint8" }, { "name": "from", "type": "address" }, { "name": "to", "type": "address" }, { "name": "who", "type": "address" }, { "name": "amount", "type": "uint256" }, { "name": "got", "type": "uint256" }, { "name": "dev", "type": "uint256" }, { "name": "sniper", "type": "uint256" }, { "name": "pot", "type": "uint256" }, { "name": "buys", "type": "uint256" }] }], "outputs": [{ "name": "", "type": "uint256[]" }], "stateMutability": "nonpayable" }, { "type": "function", "name": "quote", "inputs": [{ "name": "", "type": "address" }, { "name": "data", "type": "bytes" }], "outputs": [{ "name": "", "type": "uint16" }], "stateMutability": "pure" }, { "type": "function", "name": "register", "inputs": [{ "name": "coin", "type": "address" }, { "name": "creator", "type": "address" }, { "name": "data", "type": "bytes" }], "outputs": [], "stateMutability": "nonpayable" }, { "type": "event", "name": "Forwarded", "inputs": [{ "name": "coin", "type": "address", "indexed": true }, { "name": "buyer", "type": "address", "indexed": true }, { "name": "paid", "type": "address", "indexed": true }, { "name": "amount", "type": "uint256", "indexed": false }, { "name": "burned", "type": "uint256", "indexed": false }], "anonymous": false }, { "type": "event", "name": "Registered", "inputs": [{ "name": "coin", "type": "address", "indexed": true }, { "name": "creator", "type": "address", "indexed": true }, { "name": "data", "type": "bytes", "indexed": false }], "anonymous": false }, { "type": "error", "name": "Bad", "inputs": [{ "name": "what", "type": "string" }] }, { "type": "error", "name": "NotCoin", "inputs": [] }, { "type": "error", "name": "NotFactory", "inputs": [] }];
|
package/dist/addresses.d.ts
CHANGED
|
@@ -1,4 +1,7 @@
|
|
|
1
1
|
import type { Address } from "viem";
|
|
2
|
+
/** The modes of sticky 3, by the name the SDK and the site use. */
|
|
3
|
+
export type ModeName = "combo" | "forward";
|
|
4
|
+
export declare const MODE_NAMES: readonly ModeName[];
|
|
2
5
|
/**
|
|
3
6
|
* The contracts on BNB Chain (chain id 56). pickhooks' own contracts are verified on BscScan; the PancakeSwap ones are
|
|
4
7
|
* PancakeSwap's. Pass `addresses` to createPickhooks to point the SDK at another deployment (a fork, a new factory).
|
|
@@ -42,6 +45,14 @@ export type Addresses = {
|
|
|
42
45
|
ruleAuction: Address;
|
|
43
46
|
darkRound: Address;
|
|
44
47
|
launchDesk: Address;
|
|
48
|
+
/** sticky 3: coins with a mode (a game), fixed at launch; the lens reads what the coin leaves out; the drand beacon checks
|
|
49
|
+
* drand signatures for the modes that draw. Not on mainnet yet: the zero address switches each off */
|
|
50
|
+
sticky3Factory: Address;
|
|
51
|
+
sticky3Lens: Address;
|
|
52
|
+
sticky3StartBlock: bigint;
|
|
53
|
+
drandBeacon: Address;
|
|
54
|
+
/** the modes of sticky 3 by name (the zero address: not deployed) */
|
|
55
|
+
modes: Record<ModeName, Address>;
|
|
45
56
|
/** find the dev and CZ mode: v2 coins launched through these boxes (their coins trade like any v2 coin) */
|
|
46
57
|
hideBox: Address;
|
|
47
58
|
czBox: Address;
|
package/dist/addresses.js
CHANGED
|
@@ -1,3 +1,7 @@
|
|
|
1
|
+
export const MODE_NAMES = [
|
|
2
|
+
"combo",
|
|
3
|
+
"forward",
|
|
4
|
+
];
|
|
1
5
|
export const BSC_MAINNET = {
|
|
2
6
|
anyFactory: "0x1662668Ab8FaA612A7F615F1AccB90ceC20be117",
|
|
3
7
|
anyHook: "0x49892253A5E71f5DF0Fbc118bd7c15acAF55F767",
|
|
@@ -24,6 +28,14 @@ export const BSC_MAINNET = {
|
|
|
24
28
|
ruleAuction: "0x874CA64571774f2ae0A3fFa0A578B046910aDb35",
|
|
25
29
|
darkRound: "0x304c6604e96627FDdc7a94b7a691A0673A80F765",
|
|
26
30
|
launchDesk: "0x81508f3fCc535c29a49226E61D39188b6D479d61",
|
|
31
|
+
sticky3Factory: "0x4b41a3Ee8C80C568aE6Da7C5572867D5640C0574",
|
|
32
|
+
sticky3Lens: "0x7cc832E9EBd25fAC2852587935B6BbF06814B9e0",
|
|
33
|
+
sticky3StartBlock: 127371715n,
|
|
34
|
+
drandBeacon: "0x9c264D2934B2027Bad622417b6747E558EC465CC",
|
|
35
|
+
modes: {
|
|
36
|
+
combo: "0xEC0b3180c6D76F250Fa1d0155d03e2494F9ea03F",
|
|
37
|
+
forward: "0x09b8D80bC6c48387C7b7302AE85eDa46b713603d",
|
|
38
|
+
},
|
|
27
39
|
hideBox: "0x5d540b727E28D00E1F627305739E8Fcdda4450C5",
|
|
28
40
|
czBox: "0x9EDA1d134CE325001FB65381d80B85822D1DAe13",
|
|
29
41
|
agentsFactory: "0x5965e2D2128248ac2CB4FFf312CFB098a1eDA232",
|
package/dist/errors.js
CHANGED
|
@@ -11,6 +11,7 @@ import { lever2EngineAbi, lever2FactoryAbi, lever2HookAbi } from "./abis/lever2.
|
|
|
11
11
|
import { poolsFactoryAbi, poolsHookAbi } from "./abis/pools.js";
|
|
12
12
|
import { stickyFactoryAbi, stickyTokenAbi, stickyValidatorAbi } from "./abis/sticky.js";
|
|
13
13
|
import { coverDeskAbi, darkRoundAbi, launchDeskAbi, ruleAuctionAbi, sticky2FactoryAbi, sticky2TokenAbi, sticky2ValidatorAbi } from "./abis/sticky2.js";
|
|
14
|
+
import { comboModeAbi, drandBeaconAbi, forwardModeAbi, sticky3FactoryAbi, sticky3TokenAbi, sticky3ValidatorAbi, } from "./abis/sticky3.js";
|
|
14
15
|
import { v1FactoryAbi, v1TokenAbi } from "./abis/v1.js";
|
|
15
16
|
import { arenaAbi, floorVaultAbi, payrollBoxAbi, v2FactoryAbi, v2TokenAbi, voteBoxAbi } from "./abis/v2.js";
|
|
16
17
|
/** sticky: what token.check() answers when no row stops a trade but the coins are not unlocked yet */
|
|
@@ -83,6 +84,21 @@ const BAD = {
|
|
|
83
84
|
"pot needs a drop": "A pot needs a drop row that pays it out.",
|
|
84
85
|
every: "Every n-th buy: n from 2 to 1,000,000.",
|
|
85
86
|
idle: "Time since the last buy: at most 30 days.",
|
|
87
|
+
// sticky 3: the factory, the validator, the modes
|
|
88
|
+
mode: "That mode is not open for launches (or it launches another way).",
|
|
89
|
+
"mode data": "Settings for a mode, but no mode.",
|
|
90
|
+
"game take": "The rows' burns and pots and the mode's share are over 10 % of a buy together.",
|
|
91
|
+
bps: "The mode's share of buys is outside its bounds.",
|
|
92
|
+
min: "The mode's minimum size is outside its bounds (0.001 to 0.1 % of the supply).",
|
|
93
|
+
registered: "This coin is registered with the mode already.",
|
|
94
|
+
"no play": "This mode has nothing to play.",
|
|
95
|
+
"no poke": "This mode has nothing to nudge.",
|
|
96
|
+
"no action": "Say what to do (the action first).",
|
|
97
|
+
action: "This mode does not know that action.",
|
|
98
|
+
player: "The creator (and the coin's pools) cannot play this.",
|
|
99
|
+
"too small": "Too small: below the mode's minimum.",
|
|
100
|
+
size: "A size is out of its bounds.",
|
|
101
|
+
"not yet": "Not yet: the reveal round is not out.",
|
|
86
102
|
};
|
|
87
103
|
/** every other error of the pickhooks contracts, by name */
|
|
88
104
|
const BY_NAME = {
|
|
@@ -233,6 +249,12 @@ const BY_NAME = {
|
|
|
233
249
|
NothingToProtect: "No coins arrived to protect.",
|
|
234
250
|
Swap: "The swap through PancakeSwap failed.",
|
|
235
251
|
Target: "The executor only calls PancakeSwap's own routers.",
|
|
252
|
+
// sticky 3: the coin
|
|
253
|
+
Busy: "The coin is busy with its mode. Try again.",
|
|
254
|
+
NoMode: "This coin has no mode.",
|
|
255
|
+
LowGas: "Too little gas for the coin's mode: send it with more gas (estimate again).",
|
|
256
|
+
BadOrder: "The mode answered with an order the coin refuses.",
|
|
257
|
+
BadSignature: "That is not drand's signature on this round.",
|
|
236
258
|
};
|
|
237
259
|
/** PancakeSwap's own errors that a trade can run into */
|
|
238
260
|
const PANCAKE = [
|
|
@@ -285,6 +307,12 @@ const ABIS = [
|
|
|
285
307
|
agentsFactoryAbi,
|
|
286
308
|
agentsHookAbi,
|
|
287
309
|
agentsDeskAbi,
|
|
310
|
+
sticky3FactoryAbi,
|
|
311
|
+
sticky3ValidatorAbi,
|
|
312
|
+
sticky3TokenAbi,
|
|
313
|
+
drandBeaconAbi,
|
|
314
|
+
comboModeAbi,
|
|
315
|
+
forwardModeAbi,
|
|
288
316
|
];
|
|
289
317
|
/** every error selector the pickhooks ABIs know, for errors that PancakeSwap wraps (WrappedError, the quoter's revert) */
|
|
290
318
|
const SELECTORS = ABIS.flatMap((abi) => abi.filter((x) => x.type === "error").map((x) => ({ sel: toFunctionSelector(formatAbiItem(x)).slice(2).toLowerCase(), abi })));
|
package/dist/index.d.ts
CHANGED
|
@@ -10,7 +10,10 @@ import { type DipsModule } from "./dips.js";
|
|
|
10
10
|
import { type InfraModule } from "./infra.js";
|
|
11
11
|
import { type Lever2Module, type LeverModule } from "./lever.js";
|
|
12
12
|
import { type CallsModule, type PoolsModule } from "./pools.js";
|
|
13
|
-
import { type StickyModule } from "./sticky.js";
|
|
13
|
+
import { type StickyModule, type StickyLaunch } from "./sticky.js";
|
|
14
|
+
import { type ModesModule } from "./modes.js";
|
|
15
|
+
import { type SimulateModule } from "./simulate.js";
|
|
16
|
+
import { type TextRead, understandLaunch } from "./text-launch.js";
|
|
14
17
|
import { type PickhooksOptions, type SendOptions, type Sent, type TxRequest } from "./tx.js";
|
|
15
18
|
import { type WalletModule } from "./wallet.js";
|
|
16
19
|
import { type WatchModule } from "./watch.js";
|
|
@@ -23,6 +26,23 @@ export type Pickhooks = {
|
|
|
23
26
|
sticky: StickyModule;
|
|
24
27
|
/** sticky 2: the same coins from the second factory, plus what the creator sold and the switch rows (off until it is on mainnet) */
|
|
25
28
|
sticky2: StickyModule & Pick<DesksModule, "devCounters" | "switches">;
|
|
29
|
+
/**
|
|
30
|
+
* sticky 3: the sticky 2 coin with a mode (a game, like combo), fixed at launch: launch with `mode` and
|
|
31
|
+
* `modeSettings`; fromText reads a sentence into a launch. Off until the factory is on mainnet (the zero address).
|
|
32
|
+
*/
|
|
33
|
+
sticky3: StickyModule & {
|
|
34
|
+
fromText: (text: string, o?: {
|
|
35
|
+
reader?: Parameters<typeof understandLaunch>[1];
|
|
36
|
+
metadata?: string;
|
|
37
|
+
}) => Promise<TextRead & {
|
|
38
|
+
by: "parser" | "reader" | null;
|
|
39
|
+
launch: StickyLaunch | null;
|
|
40
|
+
}>;
|
|
41
|
+
};
|
|
42
|
+
/** the games of sticky 3 coins: each mode's state and actions, custody, the catalog */
|
|
43
|
+
modes: ModesModule;
|
|
44
|
+
/** every buy, sell, send or play tried first against the chain as it is (eth_simulateV1): what arrives, burns, pays, or which rule stops it */
|
|
45
|
+
simulate: SimulateModule;
|
|
26
46
|
/** dev cover and dev bond: cover against the creator selling, paid out of the desk when the creator's sold share reaches the mark */
|
|
27
47
|
cover: DesksModule["cover"];
|
|
28
48
|
/** the rule auction: holders burn coins to pick the game of the next round */
|
|
@@ -79,7 +99,7 @@ export type Pickhooks = {
|
|
|
79
99
|
* const r = await ph.any.buy({ pool, bnbIn: parseEther("0.05") });
|
|
80
100
|
*/
|
|
81
101
|
export declare function createPickhooks(options?: PickhooksOptions): Pickhooks;
|
|
82
|
-
export { BSC_MAINNET, LIMITS, NATIVE, ZERO_ADDRESS, type Addresses } from "./addresses.js";
|
|
102
|
+
export { BSC_MAINNET, LIMITS, MODE_NAMES, NATIVE, ZERO_ADDRESS, type Addresses, type ModeName } from "./addresses.js";
|
|
83
103
|
export { CHECK_TEXT, PickhooksError, decodeRevert, errorText, explain, findRevertData } from "./errors.js";
|
|
84
104
|
export { DEFAULT_RPC, deadlineIn, minusBps, type PickhooksOptions, type SendOptions, type Sent, type TxRequest } from "./tx.js";
|
|
85
105
|
export { blockedKind, buildInfiSwap, infiPriceBnb, infiQuote, infiSwapInput, permit2Approvals, poolIdOf, toKey, type PoolKey } from "./infinity.js";
|
|
@@ -88,6 +108,10 @@ export { type Venue, bestVenue, buildV2Buy, buildV2Sell, v2Quote, v2RouterAbi }
|
|
|
88
108
|
export { MAX_TICK, MIN_TICK, TAX_QUOTE_MARK, afterTax, depthNeeds, fitLadder, partnerLink, rangeFor, tickOf, type AnyLine, type AnyModule, type AnyPool, type AnyQuote, type CoinCheck, type Earnings, type OpenOptions, type OpenParams, type PoolConfig, type PoolPosition, type PoolRef, type RangeKind, type Recapture, type TaxLive, type TradeResult, } from "./any.js";
|
|
89
109
|
export { describeRows, stickyTable, stickyTestRun, testRunText, type StickyTestRun, type StickyCheck, type StickyCoin, type StickyLaunch, type StickyLot, type StickyModule, type StickyRow, type StickyTerms, } from "./sticky.js";
|
|
90
110
|
export { CURVE, SUPPLY, simulate, type SimReport } from "./sticky-sim.js";
|
|
111
|
+
export { MODES, MODE_LIST, encodeModeData, modeBps, type ModeAction, type ModeInfo, type ModeSettings } from "./modes-catalog.js";
|
|
112
|
+
export { type Custody, type ModesModule } from "./modes.js";
|
|
113
|
+
export { eventText, shadowOf, type SimResult, type SimulateModule } from "./simulate.js";
|
|
114
|
+
export { NOT_POSSIBLE, readLaunch, understandLaunch, type TextDraft, type TextPick, type TextRead } from "./text-launch.js";
|
|
91
115
|
export { ruleText, type CoinRule, type CoinsModule, type RuleCheck, type RuleCoin, type RuleCoinVersion, type RuleLaunch } from "./coins.js";
|
|
92
116
|
export { type CallRow, type CallStep, type CallsModule, type HookCoin, type HookLaunch, type PoolsModule } from "./pools.js";
|
|
93
117
|
export { LEVER2_REASON, type Lever2CloseQuote, type Lever2Module, type Lever2OpenQuote, type Lever2Row, type Lever2State, type LeverCoin, type LeverMarket, type LeverModule, type LeverPosition, } from "./lever.js";
|
package/dist/index.js
CHANGED
|
@@ -9,6 +9,10 @@ import { infraModule } from "./infra.js";
|
|
|
9
9
|
import { lever2Module, leverModule } from "./lever.js";
|
|
10
10
|
import { callsModule, poolsModule } from "./pools.js";
|
|
11
11
|
import { stickyModule } from "./sticky.js";
|
|
12
|
+
import { modesModule } from "./modes.js";
|
|
13
|
+
import { simulateModule } from "./simulate.js";
|
|
14
|
+
import { understandLaunch } from "./text-launch.js";
|
|
15
|
+
import { PickhooksError } from "./errors.js";
|
|
12
16
|
import { makeCtx, sendAll, sendTx } from "./tx.js";
|
|
13
17
|
import { walletModule } from "./wallet.js";
|
|
14
18
|
import { watchModule } from "./watch.js";
|
|
@@ -33,6 +37,7 @@ export function createPickhooks(options = {}) {
|
|
|
33
37
|
const d = desksModule(ctx);
|
|
34
38
|
const sticky = stickyModule(ctx);
|
|
35
39
|
const sticky2 = stickyModule(ctx, true);
|
|
40
|
+
const sticky3 = stickyModule(ctx, 3);
|
|
36
41
|
const coins = coinsModule(ctx);
|
|
37
42
|
const pools = poolsModule(ctx);
|
|
38
43
|
const calls = callsModule(ctx);
|
|
@@ -46,6 +51,41 @@ export function createPickhooks(options = {}) {
|
|
|
46
51
|
any,
|
|
47
52
|
sticky,
|
|
48
53
|
sticky2: { ...sticky2, devCounters: d.devCounters, switches: d.switches },
|
|
54
|
+
sticky3: {
|
|
55
|
+
...sticky3,
|
|
56
|
+
/**
|
|
57
|
+
* A sentence ("CAT Cat, combo, dev lock 7 days, sniper jail, dev buy 0.05") read into a sticky 3 launch. `launch` is
|
|
58
|
+
* ready for ph.sticky3.launch once there are no unknown clauses (add `metadata`); the factory and the mode check it
|
|
59
|
+
* again on chain. Pass a reader (your model, your key) for what the parser does not understand.
|
|
60
|
+
*/
|
|
61
|
+
fromText: async (text, o = {}) => {
|
|
62
|
+
const r = await understandLaunch(text, o.reader);
|
|
63
|
+
const d = r.draft;
|
|
64
|
+
if (!d || r.unknown.length || r.refusals.length)
|
|
65
|
+
return { ...r, launch: null };
|
|
66
|
+
const launch = {
|
|
67
|
+
name: d.name,
|
|
68
|
+
symbol: d.symbol,
|
|
69
|
+
metadata: o.metadata ?? "",
|
|
70
|
+
picks: d.picks,
|
|
71
|
+
devBuy: BigInt(Math.round(d.devBuyBnb * 1e6)) * 10n ** 12n,
|
|
72
|
+
...(d.mode ? { mode: d.mode, modeSettings: d.modeSettings } : {}),
|
|
73
|
+
};
|
|
74
|
+
const table = (() => {
|
|
75
|
+
try {
|
|
76
|
+
return sticky3.table(launch);
|
|
77
|
+
}
|
|
78
|
+
catch (e) {
|
|
79
|
+
return e instanceof PickhooksError ? e.message : String(e);
|
|
80
|
+
}
|
|
81
|
+
})();
|
|
82
|
+
if (typeof table === "string")
|
|
83
|
+
return { ...r, notes: [...r.notes, table], launch: null };
|
|
84
|
+
return { ...r, launch };
|
|
85
|
+
},
|
|
86
|
+
},
|
|
87
|
+
modes: modesModule(ctx),
|
|
88
|
+
simulate: simulateModule(ctx),
|
|
49
89
|
cover: d.cover,
|
|
50
90
|
auction: d.auction,
|
|
51
91
|
dark: d.dark,
|
|
@@ -66,7 +106,7 @@ export function createPickhooks(options = {}) {
|
|
|
66
106
|
sendAll: (txs, o) => sendAll(ctx, txs, o),
|
|
67
107
|
};
|
|
68
108
|
}
|
|
69
|
-
export { BSC_MAINNET, LIMITS, NATIVE, ZERO_ADDRESS } from "./addresses.js";
|
|
109
|
+
export { BSC_MAINNET, LIMITS, MODE_NAMES, NATIVE, ZERO_ADDRESS } from "./addresses.js";
|
|
70
110
|
export { CHECK_TEXT, PickhooksError, decodeRevert, errorText, explain, findRevertData } from "./errors.js";
|
|
71
111
|
export { DEFAULT_RPC, deadlineIn, minusBps } from "./tx.js";
|
|
72
112
|
export { blockedKind, buildInfiSwap, infiPriceBnb, infiQuote, infiSwapInput, permit2Approvals, poolIdOf, toKey } from "./infinity.js";
|
|
@@ -75,6 +115,10 @@ export { bestVenue, buildV2Buy, buildV2Sell, v2Quote, v2RouterAbi } from "./v2.j
|
|
|
75
115
|
export { MAX_TICK, MIN_TICK, TAX_QUOTE_MARK, afterTax, depthNeeds, fitLadder, partnerLink, rangeFor, tickOf, } from "./any.js";
|
|
76
116
|
export { describeRows, stickyTable, stickyTestRun, testRunText, } from "./sticky.js";
|
|
77
117
|
export { CURVE, SUPPLY, simulate } from "./sticky-sim.js";
|
|
118
|
+
export { MODES, MODE_LIST, encodeModeData, modeBps } from "./modes-catalog.js";
|
|
119
|
+
export {} from "./modes.js";
|
|
120
|
+
export { eventText, shadowOf } from "./simulate.js";
|
|
121
|
+
export { NOT_POSSIBLE, readLaunch, understandLaunch } from "./text-launch.js";
|
|
78
122
|
export { ruleText } from "./coins.js";
|
|
79
123
|
export {} from "./pools.js";
|
|
80
124
|
export { LEVER2_REASON, } from "./lever.js";
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import { type Hex } from "viem";
|
|
2
|
+
import type { ModeName } from "./addresses.js";
|
|
3
|
+
/**
|
|
4
|
+
* The modes of sticky 3, offline: what each one is, its line, its share of buys and the bounds of its settings, the
|
|
5
|
+
* actions holders play, and whether it draws with drand. The chain is the truth: a mode's own quote() refuses settings
|
|
6
|
+
* outside its bounds, and the coin's guardrails hold whatever a mode does.
|
|
7
|
+
*/
|
|
8
|
+
export type ModeSettings = {
|
|
9
|
+
/** the mode's share of every buy into the game pot, basis points */
|
|
10
|
+
bps?: number;
|
|
11
|
+
/** the smallest trade (or bid, try, join) that counts, millionths of the supply */
|
|
12
|
+
minPpm?: number;
|
|
13
|
+
};
|
|
14
|
+
export type ModeAction = {
|
|
15
|
+
name: string;
|
|
16
|
+
who: "holder" | "creator" | "anyone" | "dev";
|
|
17
|
+
text: string;
|
|
18
|
+
};
|
|
19
|
+
export type ModeInfo = {
|
|
20
|
+
name: ModeName;
|
|
21
|
+
title: string;
|
|
22
|
+
/** the line as the launcher and the posts say it */
|
|
23
|
+
line: string;
|
|
24
|
+
/** how it plays, sentence by sentence */
|
|
25
|
+
how: string[];
|
|
26
|
+
/** the share of every buy into the game pot, basis points: default and bounds (0: the mode takes nothing) */
|
|
27
|
+
bps: {
|
|
28
|
+
default: number;
|
|
29
|
+
min: number;
|
|
30
|
+
max: number;
|
|
31
|
+
};
|
|
32
|
+
/** the smallest trade that counts, millionths of the supply (null: the mode has no minimum setting) */
|
|
33
|
+
minPpm: {
|
|
34
|
+
default: number;
|
|
35
|
+
min: number;
|
|
36
|
+
max: number;
|
|
37
|
+
} | null;
|
|
38
|
+
/** the settings the launcher offers */
|
|
39
|
+
settings: (keyof ModeSettings)[];
|
|
40
|
+
actions: ModeAction[];
|
|
41
|
+
/** it waits for drand rounds (the keeper hands them in) */
|
|
42
|
+
drand: boolean;
|
|
43
|
+
/** coins can sit in custody in this mode (never more than 7 days; 14 for a dev bag locked at the launch) */
|
|
44
|
+
custody: boolean;
|
|
45
|
+
/** the keeper's part: what it settles, opens or drops */
|
|
46
|
+
keeper: string | null;
|
|
47
|
+
/** said plainly: what can look odd or be gamed, and the cap that holds it */
|
|
48
|
+
notes: string[];
|
|
49
|
+
};
|
|
50
|
+
export declare const MODES: Record<ModeName, ModeInfo>;
|
|
51
|
+
/** The modes in the launcher's order. */
|
|
52
|
+
export declare const MODE_LIST: ModeInfo[];
|
|
53
|
+
/**
|
|
54
|
+
* A mode's settings as the factory passes them on (abi encoded; zeros mean the defaults, empty means all defaults). Throws
|
|
55
|
+
* for settings the mode does not have, or outside its bounds.
|
|
56
|
+
*/
|
|
57
|
+
export declare function encodeModeData(name: ModeName, s?: ModeSettings): Hex;
|
|
58
|
+
/** The share of buys a mode takes with these settings (offline; the mode's quote() on chain is the truth). */
|
|
59
|
+
export declare function modeBps(name: ModeName, s?: ModeSettings): number;
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
import { encodeAbiParameters } from "viem";
|
|
2
|
+
import { PickhooksError } from "./errors.js";
|
|
3
|
+
const MIN = { default: 100, min: 10, max: 1000 };
|
|
4
|
+
export const MODES = {
|
|
5
|
+
combo: {
|
|
6
|
+
name: "combo",
|
|
7
|
+
title: "combo",
|
|
8
|
+
line: "Buys build the combo. One sell breaks it.",
|
|
9
|
+
how: [
|
|
10
|
+
"Every buy of at least the minimum size adds one to the combo; every sell of that size breaks it to zero.",
|
|
11
|
+
"The buy that brings the combo to 10, 25 or 50 wins 10, 25 or 50 % of the pot, then every 25 more win 25 %.",
|
|
12
|
+
"A win is never more coins than the winning buy itself brings, and never goes to the creator.",
|
|
13
|
+
],
|
|
14
|
+
bps: { default: 200, min: 100, max: 300 },
|
|
15
|
+
minPpm: MIN,
|
|
16
|
+
settings: ["bps", "minPpm"],
|
|
17
|
+
actions: [],
|
|
18
|
+
drand: false,
|
|
19
|
+
custody: false,
|
|
20
|
+
keeper: null,
|
|
21
|
+
notes: ["A bot can aim for the 10th buy: it buys, and the win stops at its own buy."],
|
|
22
|
+
},
|
|
23
|
+
forward: {
|
|
24
|
+
name: "forward",
|
|
25
|
+
title: "pay it forward",
|
|
26
|
+
line: "Your buy pays the last buyer. The next buy pays you.",
|
|
27
|
+
how: [
|
|
28
|
+
"A share of every buy (3 % by default) goes straight to the wallet that bought before, as fresh coins.",
|
|
29
|
+
"Never the same wallet twice in a row, never the creator, never more than that wallet's own buy brought.",
|
|
30
|
+
"What is not forwarded is burned: the mode keeps no pot.",
|
|
31
|
+
],
|
|
32
|
+
bps: { default: 300, min: 100, max: 500 },
|
|
33
|
+
minPpm: MIN,
|
|
34
|
+
settings: ["bps", "minPpm"],
|
|
35
|
+
actions: [],
|
|
36
|
+
drand: false,
|
|
37
|
+
custody: false,
|
|
38
|
+
keeper: null,
|
|
39
|
+
notes: ["A game with a fixed share, not a return: two own wallets pay each other and lose the price and the fees."],
|
|
40
|
+
},
|
|
41
|
+
};
|
|
42
|
+
/** The modes in the launcher's order. */
|
|
43
|
+
export const MODE_LIST = [
|
|
44
|
+
MODES.combo,
|
|
45
|
+
MODES.forward,
|
|
46
|
+
];
|
|
47
|
+
const u = (x) => BigInt(typeof x === "boolean" ? (x ? 1 : 0) : Math.round(x ?? 0));
|
|
48
|
+
/**
|
|
49
|
+
* A mode's settings as the factory passes them on (abi encoded; zeros mean the defaults, empty means all defaults). Throws
|
|
50
|
+
* for settings the mode does not have, or outside its bounds.
|
|
51
|
+
*/
|
|
52
|
+
export function encodeModeData(name, s) {
|
|
53
|
+
const info = MODES[name];
|
|
54
|
+
if (!info)
|
|
55
|
+
throw new PickhooksError(`There is no mode "${name}".`, { code: "input" });
|
|
56
|
+
if (!s || Object.values(s).every((x) => x === undefined))
|
|
57
|
+
return "0x";
|
|
58
|
+
for (const k of Object.keys(s)) {
|
|
59
|
+
if (s[k] !== undefined && !info.settings.includes(k))
|
|
60
|
+
throw new PickhooksError(`${info.title} has no setting "${k}".`, { code: "input" });
|
|
61
|
+
}
|
|
62
|
+
if (s.bps !== undefined && (s.bps < info.bps.min || s.bps > info.bps.max)) {
|
|
63
|
+
throw new PickhooksError(`${info.title}: the share of buys is ${info.bps.min / 100} to ${info.bps.max / 100} %.`, { code: "input" });
|
|
64
|
+
}
|
|
65
|
+
if (s.minPpm !== undefined && info.minPpm && (s.minPpm < info.minPpm.min || s.minPpm > info.minPpm.max)) {
|
|
66
|
+
throw new PickhooksError(`${info.title}: the minimum size is ${info.minPpm.min / 1e4} to ${info.minPpm.max / 1e4} % of the supply.`, { code: "input" });
|
|
67
|
+
}
|
|
68
|
+
const two = [{ type: "uint256" }, { type: "uint256" }];
|
|
69
|
+
switch (name) {
|
|
70
|
+
default:
|
|
71
|
+
return encodeAbiParameters(two, [u(s.bps), u(s.minPpm)]);
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
/** The share of buys a mode takes with these settings (offline; the mode's quote() on chain is the truth). */
|
|
75
|
+
export function modeBps(name, s) {
|
|
76
|
+
return s?.bps ?? MODES[name].bps.default;
|
|
77
|
+
}
|
package/dist/modes.d.ts
ADDED
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
import { type Address, type Hex } from "viem";
|
|
2
|
+
import { type ModeName } from "./addresses.js";
|
|
3
|
+
import { type ModeInfo, encodeModeData, modeBps } from "./modes-catalog.js";
|
|
4
|
+
import { type Ctx, type SendOptions, type TxRequest } from "./tx.js";
|
|
5
|
+
/**
|
|
6
|
+
* ph.modes: the games of sticky 3 coins. Every coin has one mode, fixed at launch; holders play it through the coin
|
|
7
|
+
* (`coin.play`), anyone nudges it (`coin.poke`), and the coin carries out what the mode answers inside its guardrails.
|
|
8
|
+
* Each mode here has its state (what the page shows) and its actions (build: the TxRequest; the plain name sends it).
|
|
9
|
+
* The modes that draw fetch drand's signature themselves (@pickhooks/sdk/tlock is loaded only then).
|
|
10
|
+
*/
|
|
11
|
+
export type Custody = {
|
|
12
|
+
amount: bigint;
|
|
13
|
+
dev: bigint;
|
|
14
|
+
until: number;
|
|
15
|
+
since: number;
|
|
16
|
+
shadow: Address;
|
|
17
|
+
releasable: boolean;
|
|
18
|
+
};
|
|
19
|
+
export declare function modesModule(ctx: Ctx): {
|
|
20
|
+
/** the modes: line, how they play, share of buys and bounds, actions (offline) */
|
|
21
|
+
catalog: Record<ModeName, ModeInfo>;
|
|
22
|
+
list: ModeInfo[];
|
|
23
|
+
info: (n: ModeName) => ModeInfo;
|
|
24
|
+
/** a mode's settings encoded for the launch (zeros: defaults) */
|
|
25
|
+
encode: typeof encodeModeData;
|
|
26
|
+
/** the share of buys a mode takes with these settings */
|
|
27
|
+
bps: typeof modeBps;
|
|
28
|
+
/** is the mode open for launches on the factory now */
|
|
29
|
+
listed: (n: ModeName) => Promise<boolean>;
|
|
30
|
+
of: (coin: Address) => Promise<{
|
|
31
|
+
name: ModeName | "other" | null;
|
|
32
|
+
address: Address;
|
|
33
|
+
gameBps: number;
|
|
34
|
+
gamePot: bigint;
|
|
35
|
+
info: ModeInfo | null;
|
|
36
|
+
}>;
|
|
37
|
+
custody: (coin: Address, who: Address) => Promise<Custody>;
|
|
38
|
+
build: {
|
|
39
|
+
release: (coin: Address, who: Address) => TxRequest;
|
|
40
|
+
play: (coin: Address, data: Hex, label: string) => TxRequest;
|
|
41
|
+
poke: (coin: Address, data: Hex, label: string) => TxRequest;
|
|
42
|
+
};
|
|
43
|
+
/** anyone: a holder's custody back to the wallet once its time is up */
|
|
44
|
+
release: (coin: Address, who: Address, s?: SendOptions) => Promise<import("./tx.js").Sent>;
|
|
45
|
+
/** a raw play or poke (data: abi.encode(action, ...)) for modes the SDK does not know */
|
|
46
|
+
play: (coin: Address, data: Hex, s?: SendOptions) => Promise<import("./tx.js").Sent>;
|
|
47
|
+
poke: (coin: Address, data: Hex, s?: SendOptions) => Promise<import("./tx.js").Sent>;
|
|
48
|
+
combo: {
|
|
49
|
+
state(coin: Address): Promise<{
|
|
50
|
+
combo: number;
|
|
51
|
+
best: number;
|
|
52
|
+
hits: number;
|
|
53
|
+
bps: number;
|
|
54
|
+
minPpm: number;
|
|
55
|
+
breaker: `0x${string}`;
|
|
56
|
+
brokeAt: number;
|
|
57
|
+
next: number;
|
|
58
|
+
nextSharePct: number;
|
|
59
|
+
}>;
|
|
60
|
+
};
|
|
61
|
+
forward: {
|
|
62
|
+
state(coin: Address): Promise<{
|
|
63
|
+
last: `0x${string}`;
|
|
64
|
+
lastGot: bigint;
|
|
65
|
+
bps: number;
|
|
66
|
+
minPpm: number;
|
|
67
|
+
forwards: number;
|
|
68
|
+
}>;
|
|
69
|
+
};
|
|
70
|
+
};
|
|
71
|
+
export type ModesModule = ReturnType<typeof modesModule>;
|