@pickhooks/sdk 0.0.0-stage → 0.2.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.
Files changed (65) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +309 -3
  3. package/dist/abis/any3.d.ts +2123 -0
  4. package/dist/abis/any3.js +3 -0
  5. package/dist/abis/anytax.d.ts +1786 -0
  6. package/dist/abis/anytax.js +3 -0
  7. package/dist/abis/calls.d.ts +2515 -0
  8. package/dist/abis/calls.js +4 -0
  9. package/dist/abis/common.d.ts +449 -0
  10. package/dist/abis/common.js +91 -0
  11. package/dist/abis/dips.d.ts +897 -0
  12. package/dist/abis/dips.js +2 -0
  13. package/dist/abis/index.d.ts +12 -0
  14. package/dist/abis/index.js +12 -0
  15. package/dist/abis/infra.d.ts +701 -0
  16. package/dist/abis/infra.js +4 -0
  17. package/dist/abis/lever.d.ts +1710 -0
  18. package/dist/abis/lever.js +5 -0
  19. package/dist/abis/lever2.d.ts +2710 -0
  20. package/dist/abis/lever2.js +5 -0
  21. package/dist/abis/pools.d.ts +1898 -0
  22. package/dist/abis/pools.js +4 -0
  23. package/dist/abis/sticky.d.ts +953 -0
  24. package/dist/abis/sticky.js +4 -0
  25. package/dist/abis/v1.d.ts +1627 -0
  26. package/dist/abis/v1.js +5 -0
  27. package/dist/abis/v2.d.ts +3264 -0
  28. package/dist/abis/v2.js +8 -0
  29. package/dist/addresses.d.ts +87 -0
  30. package/dist/addresses.js +62 -0
  31. package/dist/any.d.ts +447 -0
  32. package/dist/any.js +729 -0
  33. package/dist/api.d.ts +62 -0
  34. package/dist/api.js +30 -0
  35. package/dist/blocks.d.ts +107 -0
  36. package/dist/blocks.js +126 -0
  37. package/dist/coin-rules-config.d.ts +8 -0
  38. package/dist/coin-rules-config.js +13 -0
  39. package/dist/coin-rules.d.ts +383 -0
  40. package/dist/coin-rules.js +878 -0
  41. package/dist/coins.d.ts +217 -0
  42. package/dist/coins.js +520 -0
  43. package/dist/dips.d.ts +133 -0
  44. package/dist/dips.js +148 -0
  45. package/dist/errors.d.ts +35 -0
  46. package/dist/errors.js +347 -0
  47. package/dist/index.d.ts +73 -0
  48. package/dist/index.js +58 -0
  49. package/dist/infinity.d.ts +63 -0
  50. package/dist/infinity.js +96 -0
  51. package/dist/infra.d.ts +112 -0
  52. package/dist/infra.js +114 -0
  53. package/dist/lever.d.ts +391 -0
  54. package/dist/lever.js +419 -0
  55. package/dist/pools.d.ts +274 -0
  56. package/dist/pools.js +405 -0
  57. package/dist/sticky-rules.d.ts +179 -0
  58. package/dist/sticky-rules.js +580 -0
  59. package/dist/sticky.d.ts +216 -0
  60. package/dist/sticky.js +292 -0
  61. package/dist/tx.d.ts +70 -0
  62. package/dist/tx.js +69 -0
  63. package/dist/v3.d.ts +42 -0
  64. package/dist/v3.js +98 -0
  65. package/package.json +58 -4
@@ -0,0 +1,5 @@
1
+ // Generated from web/src/lib/lever2-abi.ts (the site's ABIs of the live contracts). Do not edit by hand: node scripts/gen-abis.mjs
2
+ export const lever2FactoryAbi = [{ "type": "function", "name": "MAX_CREATOR_BPS", "inputs": [], "outputs": [{ "name": "", "type": "uint16" }], "stateMutability": "view" }, { "type": "function", "name": "MAX_METADATA", "inputs": [], "outputs": [{ "name": "", "type": "uint256" }], "stateMutability": "view" }, { "type": "function", "name": "START_TICK", "inputs": [], "outputs": [{ "name": "", "type": "int24" }], "stateMutability": "view" }, { "type": "function", "name": "TICK_SPACING", "inputs": [], "outputs": [{ "name": "", "type": "int24" }], "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": "hook", "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": "name", "type": "string" }, { "name": "symbol", "type": "string" }, { "name": "metadata", "type": "string" }, { "name": "minSeedTokens", "type": "uint256" }], "outputs": [{ "name": "token", "type": "address" }], "stateMutability": "payable" }, { "type": "function", "name": "lockAcquired", "inputs": [{ "name": "data", "type": "bytes" }], "outputs": [{ "name": "", "type": "bytes" }], "stateMutability": "nonpayable" }, { "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": "poolKeyOf", "inputs": [{ "name": "token", "type": "address" }], "outputs": [{ "name": "", "type": "tuple", "components": [{ "name": "currency0", "type": "address" }, { "name": "currency1", "type": "address" }, { "name": "hooks", "type": "address" }, { "name": "poolManager", "type": "address" }, { "name": "fee", "type": "uint24" }, { "name": "parameters", "type": "bytes32" }] }], "stateMutability": "view" }, { "type": "function", "name": "poolManager", "inputs": [], "outputs": [{ "name": "", "type": "address" }], "stateMutability": "view" }, { "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": "vault", "inputs": [], "outputs": [{ "name": "", "type": "address" }], "stateMutability": "view" }, { "type": "function", "name": "wire", "inputs": [{ "name": "hook_", "type": "address" }], "outputs": [], "stateMutability": "nonpayable" }, { "type": "event", "name": "Launched", "inputs": [{ "name": "token", "type": "address", "indexed": true }, { "name": "creator", "type": "address", "indexed": true }, { "name": "poolId", "type": "bytes32", "indexed": true }, { "name": "seed", "type": "uint256", "indexed": false }, { "name": "bought", "type": "uint256", "indexed": false }], "anonymous": false }, { "type": "event", "name": "Wired", "inputs": [{ "name": "hook", "type": "address", "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": "NotOwner", "inputs": [] }, { "type": "error", "name": "NotVault", "inputs": [] }, { "type": "error", "name": "Reentry", "inputs": [] }];
3
+ export const lever2HookAbi = [{ "type": "function", "name": "BITMAP", "inputs": [], "outputs": [{ "name": "", "type": "uint16" }], "stateMutability": "view" }, { "type": "function", "name": "DUST_COINS", "inputs": [], "outputs": [{ "name": "", "type": "uint256" }], "stateMutability": "view" }, { "type": "function", "name": "FEE_BPS", "inputs": [], "outputs": [{ "name": "", "type": "uint256" }], "stateMutability": "view" }, { "type": "function", "name": "KIND_CLOSE_LONG", "inputs": [], "outputs": [{ "name": "", "type": "uint8" }], "stateMutability": "view" }, { "type": "function", "name": "KIND_CLOSE_SHORT", "inputs": [], "outputs": [{ "name": "", "type": "uint8" }], "stateMutability": "view" }, { "type": "function", "name": "KIND_CREATOR", "inputs": [], "outputs": [{ "name": "", "type": "uint8" }], "stateMutability": "view" }, { "type": "function", "name": "KIND_PLATFORM", "inputs": [], "outputs": [{ "name": "", "type": "uint8" }], "stateMutability": "view" }, { "type": "function", "name": "KIND_REFUND", "inputs": [], "outputs": [{ "name": "", "type": "uint8" }], "stateMutability": "view" }, { "type": "function", "name": "LAUNCH_DUST", "inputs": [], "outputs": [{ "name": "", "type": "uint256" }], "stateMutability": "view" }, { "type": "function", "name": "afterSwap", "inputs": [{ "name": "sender", "type": "address" }, { "name": "key", "type": "tuple", "components": [{ "name": "currency0", "type": "address" }, { "name": "currency1", "type": "address" }, { "name": "hooks", "type": "address" }, { "name": "poolManager", "type": "address" }, { "name": "fee", "type": "uint24" }, { "name": "parameters", "type": "bytes32" }] }, { "name": "p", "type": "tuple", "components": [{ "name": "zeroForOne", "type": "bool" }, { "name": "amountSpecified", "type": "int256" }, { "name": "sqrtPriceLimitX96", "type": "uint160" }] }, { "name": "delta", "type": "int256" }, { "name": "hookData", "type": "bytes" }], "outputs": [{ "name": "", "type": "bytes4" }, { "name": "", "type": "int128" }], "stateMutability": "nonpayable" }, { "type": "function", "name": "beforeAddLiquidity", "inputs": [{ "name": "", "type": "address" }, { "name": "", "type": "tuple", "components": [{ "name": "currency0", "type": "address" }, { "name": "currency1", "type": "address" }, { "name": "hooks", "type": "address" }, { "name": "poolManager", "type": "address" }, { "name": "fee", "type": "uint24" }, { "name": "parameters", "type": "bytes32" }] }, { "name": "", "type": "tuple", "components": [{ "name": "tickLower", "type": "int24" }, { "name": "tickUpper", "type": "int24" }, { "name": "liquidityDelta", "type": "int256" }, { "name": "salt", "type": "bytes32" }] }, { "name": "", "type": "bytes" }], "outputs": [{ "name": "", "type": "bytes4" }], "stateMutability": "view" }, { "type": "function", "name": "beforeDonate", "inputs": [{ "name": "", "type": "address" }, { "name": "", "type": "tuple", "components": [{ "name": "currency0", "type": "address" }, { "name": "currency1", "type": "address" }, { "name": "hooks", "type": "address" }, { "name": "poolManager", "type": "address" }, { "name": "fee", "type": "uint24" }, { "name": "parameters", "type": "bytes32" }] }, { "name": "", "type": "uint256" }, { "name": "", "type": "uint256" }, { "name": "", "type": "bytes" }], "outputs": [{ "name": "", "type": "bytes4" }], "stateMutability": "view" }, { "type": "function", "name": "beforeInitialize", "inputs": [{ "name": "sender", "type": "address" }, { "name": "key", "type": "tuple", "components": [{ "name": "currency0", "type": "address" }, { "name": "currency1", "type": "address" }, { "name": "hooks", "type": "address" }, { "name": "poolManager", "type": "address" }, { "name": "fee", "type": "uint24" }, { "name": "parameters", "type": "bytes32" }] }, { "name": "sqrtPriceX96", "type": "uint160" }], "outputs": [{ "name": "", "type": "bytes4" }], "stateMutability": "view" }, { "type": "function", "name": "beforeRemoveLiquidity", "inputs": [{ "name": "", "type": "address" }, { "name": "", "type": "tuple", "components": [{ "name": "currency0", "type": "address" }, { "name": "currency1", "type": "address" }, { "name": "hooks", "type": "address" }, { "name": "poolManager", "type": "address" }, { "name": "fee", "type": "uint24" }, { "name": "parameters", "type": "bytes32" }] }, { "name": "", "type": "tuple", "components": [{ "name": "tickLower", "type": "int24" }, { "name": "tickUpper", "type": "int24" }, { "name": "liquidityDelta", "type": "int256" }, { "name": "salt", "type": "bytes32" }] }, { "name": "", "type": "bytes" }], "outputs": [{ "name": "", "type": "bytes4" }], "stateMutability": "view" }, { "type": "function", "name": "beforeSwap", "inputs": [{ "name": "", "type": "address" }, { "name": "key", "type": "tuple", "components": [{ "name": "currency0", "type": "address" }, { "name": "currency1", "type": "address" }, { "name": "hooks", "type": "address" }, { "name": "poolManager", "type": "address" }, { "name": "fee", "type": "uint24" }, { "name": "parameters", "type": "bytes32" }] }, { "name": "p", "type": "tuple", "components": [{ "name": "zeroForOne", "type": "bool" }, { "name": "amountSpecified", "type": "int256" }, { "name": "sqrtPriceLimitX96", "type": "uint160" }] }, { "name": "", "type": "bytes" }], "outputs": [{ "name": "", "type": "bytes4" }, { "name": "", "type": "int256" }, { "name": "", "type": "uint24" }], "stateMutability": "nonpayable" }, { "type": "function", "name": "claim", "inputs": [{ "name": "token", "type": "address" }, { "name": "kind", "type": "uint8" }], "outputs": [{ "name": "", "type": "uint256" }], "stateMutability": "nonpayable" }, { "type": "function", "name": "closeExpired", "inputs": [{ "name": "token", "type": "address" }, { "name": "id", "type": "uint256" }, { "name": "short", "type": "bool" }, { "name": "minBnb", "type": "uint256" }], "outputs": [{ "name": "", "type": "uint256" }], "stateMutability": "nonpayable" }, { "type": "function", "name": "closeLong", "inputs": [{ "name": "token", "type": "address" }, { "name": "id", "type": "uint256" }, { "name": "minBnb", "type": "uint256" }, { "name": "deadline", "type": "uint256" }], "outputs": [{ "name": "amount", "type": "uint256" }], "stateMutability": "nonpayable" }, { "type": "function", "name": "closeShort", "inputs": [{ "name": "token", "type": "address" }, { "name": "id", "type": "uint256" }, { "name": "minBnb", "type": "uint256" }, { "name": "deadline", "type": "uint256" }], "outputs": [{ "name": "amount", "type": "uint256" }], "stateMutability": "nonpayable" }, { "type": "function", "name": "curveOf", "inputs": [{ "name": "token", "type": "address" }], "outputs": [{ "name": "", "type": "tuple", "components": [{ "name": "liquidity", "type": "uint128" }, { "name": "tS", "type": "int24" }, { "name": "dS", "type": "uint128" }, { "name": "tB", "type": "int24" }, { "name": "dB", "type": "uint128" }, { "name": "bnb", "type": "uint256" }, { "name": "coins", "type": "uint256" }] }], "stateMutability": "view" }, { "type": "function", "name": "engine", "inputs": [], "outputs": [{ "name": "", "type": "address" }], "stateMutability": "view" }, { "type": "function", "name": "factory", "inputs": [], "outputs": [{ "name": "", "type": "address" }], "stateMutability": "view" }, { "type": "function", "name": "getHooksRegistrationBitmap", "inputs": [], "outputs": [{ "name": "", "type": "uint16" }], "stateMutability": "pure" }, { "type": "function", "name": "lockAcquired", "inputs": [{ "name": "data", "type": "bytes" }], "outputs": [{ "name": "", "type": "bytes" }], "stateMutability": "nonpayable" }, { "type": "function", "name": "openLong", "inputs": [{ "name": "token", "type": "address" }, { "name": "leverage", "type": "uint8" }, { "name": "minTokens", "type": "uint256" }, { "name": "deadline", "type": "uint256" }], "outputs": [{ "name": "id", "type": "uint256" }, { "name": "tokens", "type": "uint256" }], "stateMutability": "payable" }, { "type": "function", "name": "openShort", "inputs": [{ "name": "token", "type": "address" }, { "name": "leverage", "type": "uint8" }, { "name": "maxCoins", "type": "uint256" }, { "name": "deadline", "type": "uint256" }], "outputs": [{ "name": "id", "type": "uint256" }, { "name": "coins", "type": "uint256" }], "stateMutability": "payable" }, { "type": "function", "name": "platform", "inputs": [], "outputs": [{ "name": "", "type": "address" }], "stateMutability": "view" }, { "type": "function", "name": "poolKeyOf", "inputs": [{ "name": "token", "type": "address" }], "outputs": [{ "name": "", "type": "tuple", "components": [{ "name": "currency0", "type": "address" }, { "name": "currency1", "type": "address" }, { "name": "hooks", "type": "address" }, { "name": "poolManager", "type": "address" }, { "name": "fee", "type": "uint24" }, { "name": "parameters", "type": "bytes32" }] }], "stateMutability": "view" }, { "type": "function", "name": "poolManager", "inputs": [], "outputs": [{ "name": "", "type": "address" }], "stateMutability": "view" }, { "type": "function", "name": "register", "inputs": [{ "name": "key", "type": "tuple", "components": [{ "name": "currency0", "type": "address" }, { "name": "currency1", "type": "address" }, { "name": "hooks", "type": "address" }, { "name": "poolManager", "type": "address" }, { "name": "fee", "type": "uint24" }, { "name": "parameters", "type": "bytes32" }] }, { "name": "creator", "type": "address" }, { "name": "creatorBps", "type": "uint16" }], "outputs": [], "stateMutability": "nonpayable" }, { "type": "function", "name": "seed", "inputs": [{ "name": "token", "type": "address" }], "outputs": [], "stateMutability": "payable" }, { "type": "function", "name": "tokenOf", "inputs": [{ "name": "", "type": "bytes32" }], "outputs": [{ "name": "", "type": "address" }], "stateMutability": "view" }, { "type": "function", "name": "vault", "inputs": [], "outputs": [{ "name": "", "type": "address" }], "stateMutability": "view" }, { "type": "event", "name": "Claimed", "inputs": [{ "name": "token", "type": "address", "indexed": true }, { "name": "recipient", "type": "address", "indexed": true }, { "name": "kind", "type": "uint8", "indexed": false }, { "name": "amount", "type": "uint256", "indexed": false }], "anonymous": false }, { "type": "event", "name": "HookSwap", "inputs": [{ "name": "token", "type": "address", "indexed": true }, { "name": "trader", "type": "address", "indexed": true }, { "name": "buy", "type": "bool", "indexed": false }, { "name": "bnb", "type": "uint256", "indexed": false }, { "name": "coins", "type": "uint256", "indexed": false }, { "name": "fee", "type": "uint256", "indexed": false }, { "name": "liquidations", "type": "uint256", "indexed": false }, { "name": "q", "type": "uint256", "indexed": false }, { "name": "r", "type": "uint256", "indexed": false }], "anonymous": false }, { "type": "error", "name": "AmountTooLarge", "inputs": [] }, { "type": "error", "name": "BandFull", "inputs": [] }, { "type": "error", "name": "Expired", "inputs": [] }, { "type": "error", "name": "InvalidMarket", "inputs": [] }, { "type": "error", "name": "InvalidSqrtRatio", "inputs": [{ "name": "sqrtPriceX96", "type": "uint160" }] }, { "type": "error", "name": "InvalidTick", "inputs": [{ "name": "tick", "type": "int24" }] }, { "type": "error", "name": "NoLiquidityPositions", "inputs": [] }, { "type": "error", "name": "NoPlatform", "inputs": [] }, { "type": "error", "name": "PartialFill", "inputs": [] }, { "type": "error", "name": "Reentry", "inputs": [] }, { "type": "error", "name": "Slippage", "inputs": [] }, { "type": "error", "name": "SwapNotFilled", "inputs": [] }, { "type": "error", "name": "Unauthorized", "inputs": [] }, { "type": "error", "name": "UnknownPool", "inputs": [] }];
4
+ export const lever2EngineAbi = [{ "type": "function", "name": "BY_ANYONE", "inputs": [], "outputs": [{ "name": "", "type": "uint8" }], "stateMutability": "view" }, { "type": "function", "name": "BY_KEEPER", "inputs": [], "outputs": [{ "name": "", "type": "uint8" }], "stateMutability": "view" }, { "type": "function", "name": "BY_OWNER", "inputs": [], "outputs": [{ "name": "", "type": "uint8" }], "stateMutability": "view" }, { "type": "function", "name": "CAP_DIVISOR", "inputs": [], "outputs": [{ "name": "", "type": "uint256" }], "stateMutability": "view" }, { "type": "function", "name": "CLOSE_FEE_BPS", "inputs": [], "outputs": [{ "name": "", "type": "uint256" }], "stateMutability": "view" }, { "type": "function", "name": "EARLY_LEVERAGE", "inputs": [], "outputs": [{ "name": "", "type": "uint8" }], "stateMutability": "view" }, { "type": "function", "name": "EARLY_SECONDS", "inputs": [], "outputs": [{ "name": "", "type": "uint256" }], "stateMutability": "view" }, { "type": "function", "name": "EXPIRY_GRACE", "inputs": [], "outputs": [{ "name": "", "type": "uint256" }], "stateMutability": "view" }, { "type": "function", "name": "MAX_HOLD", "inputs": [], "outputs": [{ "name": "", "type": "uint256" }], "stateMutability": "view" }, { "type": "function", "name": "MAX_LEVERAGE", "inputs": [], "outputs": [{ "name": "", "type": "uint8" }], "stateMutability": "view" }, { "type": "function", "name": "MAX_POSITIONS", "inputs": [], "outputs": [{ "name": "", "type": "uint256" }], "stateMutability": "view" }, { "type": "function", "name": "MIN_MARGIN", "inputs": [], "outputs": [{ "name": "", "type": "uint256" }], "stateMutability": "view" }, { "type": "function", "name": "OPEN_FEE_BPS", "inputs": [], "outputs": [{ "name": "", "type": "uint256" }], "stateMutability": "view" }, { "type": "function", "name": "anchor", "inputs": [{ "name": "token", "type": "address" }], "outputs": [], "stateMutability": "nonpayable" }, { "type": "function", "name": "claimCreator", "inputs": [{ "name": "token", "type": "address" }, { "name": "caller", "type": "address" }], "outputs": [{ "name": "amount", "type": "uint256" }], "stateMutability": "nonpayable" }, { "type": "function", "name": "claimRefund", "inputs": [{ "name": "token", "type": "address" }, { "name": "owner", "type": "address" }], "outputs": [{ "name": "amount", "type": "uint256" }], "stateMutability": "nonpayable" }, { "type": "function", "name": "closeLong", "inputs": [{ "name": "token", "type": "address" }, { "name": "id", "type": "uint256" }, { "name": "proceeds", "type": "uint256" }, { "name": "expiry", "type": "bool" }], "outputs": [{ "name": "owner", "type": "address" }, { "name": "net", "type": "uint256" }, { "name": "debtTotal", "type": "uint256" }], "stateMutability": "nonpayable" }, { "type": "function", "name": "closeShort", "inputs": [{ "name": "token", "type": "address" }, { "name": "id", "type": "uint256" }, { "name": "cost", "type": "uint256" }, { "name": "expiry", "type": "bool" }], "outputs": [{ "name": "owner", "type": "address" }, { "name": "net", "type": "uint256" }, { "name": "lentTotal", "type": "uint256" }], "stateMutability": "nonpayable" }, { "type": "function", "name": "collectPlatform", "inputs": [{ "name": "token", "type": "address" }], "outputs": [{ "name": "amount", "type": "uint256" }], "stateMutability": "nonpayable" }, { "type": "function", "name": "curveOf", "inputs": [{ "name": "token", "type": "address" }], "outputs": [{ "name": "q", "type": "uint256" }, { "name": "r", "type": "uint256" }, { "name": "curveBnb", "type": "uint256" }, { "name": "longRoom", "type": "uint256" }, { "name": "shortRoom", "type": "uint256" }], "stateMutability": "view" }, { "type": "function", "name": "hook", "inputs": [], "outputs": [{ "name": "", "type": "address" }], "stateMutability": "view" }, { "type": "function", "name": "liabilities", "inputs": [{ "name": "token", "type": "address" }], "outputs": [{ "name": "", "type": "uint256" }], "stateMutability": "view" }, { "type": "function", "name": "liquidateLong", "inputs": [{ "name": "token", "type": "address" }, { "name": "id", "type": "uint256" }, { "name": "proceeds", "type": "uint256" }], "outputs": [{ "name": "debtTotal", "type": "uint256" }], "stateMutability": "nonpayable" }, { "type": "function", "name": "liquidateShort", "inputs": [{ "name": "token", "type": "address" }, { "name": "id", "type": "uint256" }, { "name": "cost", "type": "uint256" }], "outputs": [{ "name": "lentTotal", "type": "uint256" }], "stateMutability": "nonpayable" }, { "type": "function", "name": "longIdsOf", "inputs": [{ "name": "token", "type": "address" }], "outputs": [{ "name": "", "type": "uint256[]" }], "stateMutability": "view" }, { "type": "function", "name": "longOf", "inputs": [{ "name": "token", "type": "address" }, { "name": "id", "type": "uint256" }], "outputs": [{ "name": "", "type": "tuple", "components": [{ "name": "owner", "type": "address" }, { "name": "opened", "type": "uint40" }, { "name": "margin", "type": "uint256" }, { "name": "debt", "type": "uint256" }, { "name": "tokens", "type": "uint256" }, { "name": "safe", "type": "uint256" }] }], "stateMutability": "view" }, { "type": "function", "name": "longsOf", "inputs": [{ "name": "token", "type": "address" }], "outputs": [{ "name": "ids", "type": "uint256[]" }, { "name": "ps", "type": "tuple[]", "components": [{ "name": "owner", "type": "address" }, { "name": "opened", "type": "uint40" }, { "name": "margin", "type": "uint256" }, { "name": "debt", "type": "uint256" }, { "name": "tokens", "type": "uint256" }, { "name": "safe", "type": "uint256" }] }, { "name": "triggers", "type": "uint256[]" }], "stateMutability": "view" }, { "type": "function", "name": "marketOf", "inputs": [{ "name": "token", "type": "address" }], "outputs": [{ "name": "", "type": "tuple", "components": [{ "name": "creator", "type": "address" }, { "name": "creatorBps", "type": "uint16" }, { "name": "start", "type": "uint40" }, { "name": "liquidity", "type": "uint128" }, { "name": "id", "type": "bytes32" }, { "name": "v", "type": "uint256" }, { "name": "debt", "type": "uint256" }, { "name": "locked", "type": "uint256" }, { "name": "lent", "type": "uint256" }, { "name": "notional", "type": "uint256" }, { "name": "collateral", "type": "uint256" }, { "name": "creatorOwed", "type": "uint256" }, { "name": "platformOwed", "type": "uint256" }, { "name": "refunds", "type": "uint256" }] }], "stateMutability": "view" }, { "type": "function", "name": "openLong", "inputs": [{ "name": "token", "type": "address" }, { "name": "owner", "type": "address" }, { "name": "margin", "type": "uint256" }, { "name": "debt", "type": "uint256" }, { "name": "fee", "type": "uint256" }, { "name": "tokens", "type": "uint256" }], "outputs": [{ "name": "id", "type": "uint256" }, { "name": "debtTotal", "type": "uint256" }], "stateMutability": "nonpayable" }, { "type": "function", "name": "openShort", "inputs": [{ "name": "token", "type": "address" }, { "name": "owner", "type": "address" }, { "name": "margin", "type": "uint256" }, { "name": "notional", "type": "uint256" }, { "name": "fee", "type": "uint256" }, { "name": "coins", "type": "uint256" }], "outputs": [{ "name": "id", "type": "uint256" }, { "name": "lentTotal", "type": "uint256" }], "stateMutability": "nonpayable" }, { "type": "function", "name": "planBuy", "inputs": [{ "name": "token", "type": "address" }, { "name": "amount", "type": "uint256" }, { "name": "exactOutCoins", "type": "bool" }, { "name": "skip", "type": "uint256" }], "outputs": [{ "name": "ids", "type": "uint256[]" }, { "name": "amounts", "type": "uint256[]" }, { "name": "n", "type": "uint256" }], "stateMutability": "view" }, { "type": "function", "name": "planFloor", "inputs": [{ "name": "token", "type": "address" }, { "name": "amount", "type": "uint256" }, { "name": "exactOutBnb", "type": "bool" }], "outputs": [{ "name": "ids", "type": "uint256[]" }, { "name": "amounts", "type": "uint256[]" }, { "name": "n", "type": "uint256" }, { "name": "fits", "type": "bool" }], "stateMutability": "view" }, { "type": "function", "name": "planSell", "inputs": [{ "name": "token", "type": "address" }, { "name": "amount", "type": "uint256" }, { "name": "exactOutBnb", "type": "bool" }, { "name": "skip", "type": "uint256" }], "outputs": [{ "name": "ids", "type": "uint256[]" }, { "name": "amounts", "type": "uint256[]" }, { "name": "n", "type": "uint256" }], "stateMutability": "view" }, { "type": "function", "name": "poolManager", "inputs": [], "outputs": [{ "name": "", "type": "address" }], "stateMutability": "view" }, { "type": "function", "name": "prepareCloseLong", "inputs": [{ "name": "token", "type": "address" }, { "name": "id", "type": "uint256" }, { "name": "caller", "type": "address" }, { "name": "mode", "type": "uint8" }], "outputs": [{ "name": "tokens", "type": "uint256" }], "stateMutability": "view" }, { "type": "function", "name": "prepareCloseShort", "inputs": [{ "name": "token", "type": "address" }, { "name": "id", "type": "uint256" }, { "name": "caller", "type": "address" }, { "name": "mode", "type": "uint8" }], "outputs": [{ "name": "coins", "type": "uint256" }], "stateMutability": "view" }, { "type": "function", "name": "prepareLong", "inputs": [{ "name": "token", "type": "address" }, { "name": "gross", "type": "uint256" }, { "name": "leverage", "type": "uint8" }], "outputs": [{ "name": "margin", "type": "uint256" }, { "name": "debt", "type": "uint256" }, { "name": "fee", "type": "uint256" }, { "name": "bump", "type": "uint256" }], "stateMutability": "view" }, { "type": "function", "name": "prepareShort", "inputs": [{ "name": "token", "type": "address" }, { "name": "gross", "type": "uint256" }, { "name": "leverage", "type": "uint8" }], "outputs": [{ "name": "margin", "type": "uint256" }, { "name": "notional", "type": "uint256" }, { "name": "fee", "type": "uint256" }, { "name": "bump", "type": "uint256" }], "stateMutability": "view" }, { "type": "function", "name": "refundOwed", "inputs": [{ "name": "", "type": "address" }, { "name": "", "type": "address" }], "outputs": [{ "name": "", "type": "uint256" }], "stateMutability": "view" }, { "type": "function", "name": "register", "inputs": [{ "name": "token", "type": "address" }, { "name": "creator", "type": "address" }, { "name": "creatorBps", "type": "uint16" }, { "name": "id", "type": "bytes32" }, { "name": "liquidity", "type": "uint128" }], "outputs": [], "stateMutability": "nonpayable" }, { "type": "function", "name": "shortIdsOf", "inputs": [{ "name": "token", "type": "address" }], "outputs": [{ "name": "", "type": "uint256[]" }], "stateMutability": "view" }, { "type": "function", "name": "shortOf", "inputs": [{ "name": "token", "type": "address" }, { "name": "id", "type": "uint256" }], "outputs": [{ "name": "", "type": "tuple", "components": [{ "name": "owner", "type": "address" }, { "name": "opened", "type": "uint40" }, { "name": "margin", "type": "uint256" }, { "name": "notional", "type": "uint256" }, { "name": "coins", "type": "uint256" }, { "name": "collateral", "type": "uint256" }, { "name": "safe", "type": "uint256" }] }], "stateMutability": "view" }, { "type": "function", "name": "shortsOf", "inputs": [{ "name": "token", "type": "address" }], "outputs": [{ "name": "ids", "type": "uint256[]" }, { "name": "ss", "type": "tuple[]", "components": [{ "name": "owner", "type": "address" }, { "name": "opened", "type": "uint40" }, { "name": "margin", "type": "uint256" }, { "name": "notional", "type": "uint256" }, { "name": "coins", "type": "uint256" }, { "name": "collateral", "type": "uint256" }, { "name": "safe", "type": "uint256" }] }, { "name": "triggers", "type": "uint256[]" }], "stateMutability": "view" }, { "type": "function", "name": "spotFee", "inputs": [{ "name": "token", "type": "address" }, { "name": "fee", "type": "uint256" }], "outputs": [], "stateMutability": "nonpayable" }, { "type": "event", "name": "LongClosed", "inputs": [{ "name": "token", "type": "address", "indexed": true }, { "name": "id", "type": "uint256", "indexed": true }, { "name": "owner", "type": "address", "indexed": true }, { "name": "proceeds", "type": "uint256", "indexed": false }, { "name": "payout", "type": "uint256", "indexed": false }, { "name": "fundingFee", "type": "uint256", "indexed": false }, { "name": "closeFee", "type": "uint256", "indexed": false }, { "name": "expired", "type": "bool", "indexed": false }], "anonymous": false }, { "type": "event", "name": "LongLiquidated", "inputs": [{ "name": "token", "type": "address", "indexed": true }, { "name": "id", "type": "uint256", "indexed": true }, { "name": "owner", "type": "address", "indexed": true }, { "name": "tokens", "type": "uint256", "indexed": false }, { "name": "proceeds", "type": "uint256", "indexed": false }, { "name": "penalty", "type": "uint256", "indexed": false }, { "name": "fundingFee", "type": "uint256", "indexed": false }, { "name": "refund", "type": "uint256", "indexed": false }], "anonymous": false }, { "type": "event", "name": "LongOpened", "inputs": [{ "name": "token", "type": "address", "indexed": true }, { "name": "id", "type": "uint256", "indexed": true }, { "name": "owner", "type": "address", "indexed": true }, { "name": "margin", "type": "uint256", "indexed": false }, { "name": "tokens", "type": "uint256", "indexed": false }, { "name": "debt", "type": "uint256", "indexed": false }, { "name": "fee", "type": "uint256", "indexed": false }], "anonymous": false }, { "type": "event", "name": "Registered", "inputs": [{ "name": "token", "type": "address", "indexed": true }, { "name": "creator", "type": "address", "indexed": true }, { "name": "liquidity", "type": "uint256", "indexed": false }, { "name": "virtualBnb", "type": "uint256", "indexed": false }, { "name": "creatorBps", "type": "uint16", "indexed": false }], "anonymous": false }, { "type": "event", "name": "ShortClosed", "inputs": [{ "name": "token", "type": "address", "indexed": true }, { "name": "id", "type": "uint256", "indexed": true }, { "name": "owner", "type": "address", "indexed": true }, { "name": "cost", "type": "uint256", "indexed": false }, { "name": "payout", "type": "uint256", "indexed": false }, { "name": "fundingFee", "type": "uint256", "indexed": false }, { "name": "closeFee", "type": "uint256", "indexed": false }, { "name": "expired", "type": "bool", "indexed": false }], "anonymous": false }, { "type": "event", "name": "ShortLiquidated", "inputs": [{ "name": "token", "type": "address", "indexed": true }, { "name": "id", "type": "uint256", "indexed": true }, { "name": "owner", "type": "address", "indexed": true }, { "name": "coins", "type": "uint256", "indexed": false }, { "name": "cost", "type": "uint256", "indexed": false }, { "name": "penalty", "type": "uint256", "indexed": false }, { "name": "fundingFee", "type": "uint256", "indexed": false }, { "name": "refund", "type": "uint256", "indexed": false }], "anonymous": false }, { "type": "event", "name": "ShortOpened", "inputs": [{ "name": "token", "type": "address", "indexed": true }, { "name": "id", "type": "uint256", "indexed": true }, { "name": "owner", "type": "address", "indexed": true }, { "name": "margin", "type": "uint256", "indexed": false }, { "name": "coins", "type": "uint256", "indexed": false }, { "name": "notional", "type": "uint256", "indexed": false }, { "name": "fee", "type": "uint256", "indexed": false }], "anonymous": false }, { "type": "error", "name": "BadDebt", "inputs": [] }, { "type": "error", "name": "InactivePosition", "inputs": [] }, { "type": "error", "name": "InvalidLeverage", "inputs": [] }, { "type": "error", "name": "InvalidMarket", "inputs": [] }, { "type": "error", "name": "InvalidSqrtRatio", "inputs": [{ "name": "sqrtPriceX96", "type": "uint160" }] }, { "type": "error", "name": "InvalidTick", "inputs": [{ "name": "tick", "type": "int24" }] }, { "type": "error", "name": "LongsFull", "inputs": [{ "name": "curveBnb", "type": "uint256" }, { "name": "room", "type": "uint256" }, { "name": "wanted", "type": "uint256" }] }, { "type": "error", "name": "MarginTooSmall", "inputs": [] }, { "type": "error", "name": "NotExpired", "inputs": [] }, { "type": "error", "name": "NotOwner", "inputs": [] }, { "type": "error", "name": "OnlyHook", "inputs": [] }, { "type": "error", "name": "Pushed", "inputs": [{ "name": "trigger", "type": "uint256" }] }, { "type": "error", "name": "ShortsFull", "inputs": [{ "name": "curveBnb", "type": "uint256" }, { "name": "room", "type": "uint256" }, { "name": "wanted", "type": "uint256" }] }, { "type": "error", "name": "TooManyPositions", "inputs": [{ "name": "bumpFrom", "type": "uint256" }] }, { "type": "error", "name": "TooSoon", "inputs": [] }, { "type": "error", "name": "UnknownMarket", "inputs": [] }, { "type": "error", "name": "Unsafe", "inputs": [{ "name": "long", "type": "bool" }, { "name": "id", "type": "uint256" }, { "name": "q", "type": "uint256" }, { "name": "trigger", "type": "uint256" }] }];
5
+ export const lever2LensAbi = [{ "type": "function", "name": "BAD_LEVERAGE", "inputs": [], "outputs": [{ "name": "", "type": "uint8" }], "stateMutability": "view" }, { "type": "function", "name": "MARGIN_TOO_SMALL", "inputs": [], "outputs": [{ "name": "", "type": "uint8" }], "stateMutability": "view" }, { "type": "function", "name": "NO_SLOT", "inputs": [], "outputs": [{ "name": "", "type": "uint8" }], "stateMutability": "view" }, { "type": "function", "name": "OK", "inputs": [], "outputs": [{ "name": "", "type": "uint8" }], "stateMutability": "view" }, { "type": "function", "name": "PUSHED", "inputs": [], "outputs": [{ "name": "", "type": "uint8" }], "stateMutability": "view" }, { "type": "function", "name": "SIDE_FULL", "inputs": [], "outputs": [{ "name": "", "type": "uint8" }], "stateMutability": "view" }, { "type": "function", "name": "UNKNOWN", "inputs": [], "outputs": [{ "name": "", "type": "uint8" }], "stateMutability": "view" }, { "type": "function", "name": "UNSAFE_OTHER", "inputs": [], "outputs": [{ "name": "", "type": "uint8" }], "stateMutability": "view" }, { "type": "function", "name": "UNSAFE_SELF", "inputs": [], "outputs": [{ "name": "", "type": "uint8" }], "stateMutability": "view" }, { "type": "function", "name": "engine", "inputs": [], "outputs": [{ "name": "", "type": "address" }], "stateMutability": "view" }, { "type": "function", "name": "hook", "inputs": [], "outputs": [{ "name": "", "type": "address" }], "stateMutability": "view" }, { "type": "function", "name": "longsOf", "inputs": [{ "name": "token", "type": "address" }], "outputs": [{ "name": "rows", "type": "tuple[]", "components": [{ "name": "id", "type": "uint256" }, { "name": "owner", "type": "address" }, { "name": "opened", "type": "uint40" }, { "name": "margin", "type": "uint256" }, { "name": "borrowed", "type": "uint256" }, { "name": "amount", "type": "uint256" }, { "name": "trigger", "type": "uint256" }, { "name": "triggerPrice", "type": "uint256" }, { "name": "closeNet", "type": "uint256" }, { "name": "expired", "type": "bool" }] }], "stateMutability": "view" }, { "type": "function", "name": "quoteCloseLong", "inputs": [{ "name": "token", "type": "address" }, { "name": "id", "type": "uint256" }], "outputs": [{ "name": "c", "type": "tuple", "components": [{ "name": "net", "type": "uint256" }, { "name": "gross", "type": "uint256" }, { "name": "fundingFee", "type": "uint256" }, { "name": "closeFee", "type": "uint256" }, { "name": "liquidations", "type": "uint256" }, { "name": "pushed", "type": "bool" }] }], "stateMutability": "view" }, { "type": "function", "name": "quoteCloseShort", "inputs": [{ "name": "token", "type": "address" }, { "name": "id", "type": "uint256" }], "outputs": [{ "name": "c", "type": "tuple", "components": [{ "name": "net", "type": "uint256" }, { "name": "gross", "type": "uint256" }, { "name": "fundingFee", "type": "uint256" }, { "name": "closeFee", "type": "uint256" }, { "name": "liquidations", "type": "uint256" }, { "name": "pushed", "type": "bool" }] }], "stateMutability": "view" }, { "type": "function", "name": "quoteOpenLong", "inputs": [{ "name": "token", "type": "address" }, { "name": "gross", "type": "uint256" }, { "name": "leverage", "type": "uint8" }], "outputs": [{ "name": "o", "type": "tuple", "components": [{ "name": "reason", "type": "uint8" }, { "name": "margin", "type": "uint256" }, { "name": "borrowed", "type": "uint256" }, { "name": "fee", "type": "uint256" }, { "name": "amount", "type": "uint256" }, { "name": "trigger", "type": "uint256" }, { "name": "triggerPrice", "type": "uint256" }, { "name": "entryPrice", "type": "uint256" }, { "name": "curveBnb", "type": "uint256" }, { "name": "room", "type": "uint256" }, { "name": "liquidations", "type": "uint256" }, { "name": "bump", "type": "uint256" }, { "name": "bumpFrom", "type": "uint256" }] }], "stateMutability": "view" }, { "type": "function", "name": "quoteOpenShort", "inputs": [{ "name": "token", "type": "address" }, { "name": "gross", "type": "uint256" }, { "name": "leverage", "type": "uint8" }], "outputs": [{ "name": "o", "type": "tuple", "components": [{ "name": "reason", "type": "uint8" }, { "name": "margin", "type": "uint256" }, { "name": "borrowed", "type": "uint256" }, { "name": "fee", "type": "uint256" }, { "name": "amount", "type": "uint256" }, { "name": "trigger", "type": "uint256" }, { "name": "triggerPrice", "type": "uint256" }, { "name": "entryPrice", "type": "uint256" }, { "name": "curveBnb", "type": "uint256" }, { "name": "room", "type": "uint256" }, { "name": "liquidations", "type": "uint256" }, { "name": "bump", "type": "uint256" }, { "name": "bumpFrom", "type": "uint256" }] }], "stateMutability": "view" }, { "type": "function", "name": "shortsOf", "inputs": [{ "name": "token", "type": "address" }], "outputs": [{ "name": "rows", "type": "tuple[]", "components": [{ "name": "id", "type": "uint256" }, { "name": "owner", "type": "address" }, { "name": "opened", "type": "uint40" }, { "name": "margin", "type": "uint256" }, { "name": "borrowed", "type": "uint256" }, { "name": "amount", "type": "uint256" }, { "name": "trigger", "type": "uint256" }, { "name": "triggerPrice", "type": "uint256" }, { "name": "closeNet", "type": "uint256" }, { "name": "expired", "type": "bool" }] }], "stateMutability": "view" }, { "type": "function", "name": "stateOf", "inputs": [{ "name": "token", "type": "address" }], "outputs": [{ "name": "s", "type": "tuple", "components": [{ "name": "q", "type": "uint256" }, { "name": "r", "type": "uint256" }, { "name": "price", "type": "uint256" }, { "name": "curveBnb", "type": "uint256" }, { "name": "longRoom", "type": "uint256" }, { "name": "shortRoom", "type": "uint256" }, { "name": "debt", "type": "uint256" }, { "name": "locked", "type": "uint256" }, { "name": "lent", "type": "uint256" }, { "name": "notional", "type": "uint256" }, { "name": "longs", "type": "uint256" }, { "name": "shorts", "type": "uint256" }, { "name": "tS", "type": "int24" }, { "name": "tB", "type": "int24" }, { "name": "sellRoom", "type": "uint256" }] }], "stateMutability": "view" }, { "type": "error", "name": "InvalidSqrtRatio", "inputs": [{ "name": "sqrtPriceX96", "type": "uint160" }] }, { "type": "error", "name": "InvalidTick", "inputs": [{ "name": "tick", "type": "int24" }] }];