@oakagentkit/core 0.2.7 → 0.3.1
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/build/dist/api/addresses.d.ts +9 -0
- package/build/dist/api/addresses.js +1 -1
- package/build/dist/api/chain.d.ts +4 -0
- package/build/dist/api/chain.js +1 -1
- package/build/dist/api/history.js +1 -1
- package/build/dist/api/identity-link.js +1 -1
- package/build/dist/api/metadata.js +1 -1
- package/build/dist/api/modules/beefy/boosts.js +1 -1
- package/build/dist/api/modules/beefy/clm.d.ts +9 -0
- package/build/dist/api/modules/beefy/clm.js +1 -1
- package/build/dist/api/modules/beefy/guard.js +1 -1
- package/build/dist/api/modules/beefy/index.js +1 -1
- package/build/dist/api/modules/beefy/liquidity.js +1 -1
- package/build/dist/api/modules/beefy/management.js +1 -1
- package/build/dist/api/modules/beefy/vaults.js +1 -1
- package/build/dist/api/modules/borro/abi.d.ts +54 -0
- package/build/dist/api/modules/borro/abi.js +1 -1
- package/build/dist/api/modules/borro/actions.d.ts +14 -1
- package/build/dist/api/modules/borro/actions.js +1 -1
- package/build/dist/api/modules/borro/checks.js +1 -1
- package/build/dist/api/modules/borro/copy.d.ts +10 -2
- package/build/dist/api/modules/borro/copy.js +1 -1
- package/build/dist/api/modules/borro/index.js +1 -1
- package/build/dist/api/modules/borro/liquidity.js +1 -1
- package/build/dist/api/modules/borro/pins.d.ts +30 -14
- package/build/dist/api/modules/borro/pins.js +1 -1
- package/build/dist/api/modules/borro/positions.js +1 -1
- package/build/dist/api/modules/borro/reader.js +1 -1
- package/build/dist/api/modules/borro/types.d.ts +1 -0
- package/build/dist/api/modules/chop/actions.js +1 -1
- package/build/dist/api/modules/chop/checks.js +1 -1
- package/build/dist/api/modules/chop/copy.js +1 -1
- package/build/dist/api/modules/chop/guard.js +1 -1
- package/build/dist/api/modules/chop/index.js +1 -1
- package/build/dist/api/modules/chop/pins.d.ts +13 -0
- package/build/dist/api/modules/chop/pins.js +1 -1
- package/build/dist/api/modules/chop/positions.js +1 -1
- package/build/dist/api/modules/chop/reader.js +1 -1
- package/build/dist/api/modules/clanker/extensions.js +1 -1
- package/build/dist/api/modules/clanker/index.js +1 -1
- package/build/dist/api/modules/clanker/manage.js +1 -1
- package/build/dist/api/modules/clanker/pool-config.js +1 -1
- package/build/dist/api/modules/clanker/protocol.js +1 -1
- package/build/dist/api/modules/clanker/state.js +1 -1
- package/build/dist/api/modules/earn/copy.d.ts +6 -6
- package/build/dist/api/modules/earn/copy.js +1 -1
- package/build/dist/api/modules/earn/cost.d.ts +1 -1
- package/build/dist/api/modules/earn/cost.js +1 -1
- package/build/dist/api/modules/earn/index.js +1 -1
- package/build/dist/api/modules/earn/lp.js +1 -1
- package/build/dist/api/modules/earn/options.js +1 -1
- package/build/dist/api/modules/erc8004/common.js +1 -1
- package/build/dist/api/modules/erc8004/domain.js +1 -1
- package/build/dist/api/modules/erc8004/index.js +1 -1
- package/build/dist/api/modules/erc8004/management.js +1 -1
- package/build/dist/api/modules/erc8004/reputation.js +1 -1
- package/build/dist/api/modules/erc8004/services.js +1 -1
- package/build/dist/api/modules/erc8004/thesis.d.ts +61 -0
- package/build/dist/api/modules/erc8004/thesis.js +1 -0
- package/build/dist/api/modules/erc8004/validation.js +1 -1
- package/build/dist/api/modules/fobo/client.d.ts +9 -0
- package/build/dist/api/modules/fobo/client.js +1 -0
- package/build/dist/api/modules/fobo/index.d.ts +16 -0
- package/build/dist/api/modules/fobo/index.js +1 -0
- package/build/dist/api/modules/fobo/intent.d.ts +243 -0
- package/build/dist/api/modules/fobo/intent.js +1 -0
- package/build/dist/api/modules/fobo/pins.d.ts +178 -0
- package/build/dist/api/modules/fobo/pins.js +1 -0
- package/build/dist/api/modules/fobo/steps.d.ts +25 -0
- package/build/dist/api/modules/fobo/steps.js +1 -0
- package/build/dist/api/modules/fobo/verify.d.ts +89 -0
- package/build/dist/api/modules/fobo/verify.js +1 -0
- package/build/dist/api/modules/gloam/copy.d.ts +1 -1
- package/build/dist/api/modules/gloam/copy.js +1 -1
- package/build/dist/api/modules/gloam/index.js +1 -1
- package/build/dist/api/modules/grove/index.js +1 -1
- package/build/dist/api/modules/heyresearch/builder-feed.js +1 -1
- package/build/dist/api/modules/heyresearch/index.js +1 -1
- package/build/dist/api/modules/heyresearch/public-reads.js +1 -1
- package/build/dist/api/modules/heyresearch/token-facts.js +1 -1
- package/build/dist/api/modules/hoodag/chain-reads.js +1 -1
- package/build/dist/api/modules/hoodag/index.d.ts +12 -1
- package/build/dist/api/modules/hoodag/index.js +1 -1
- package/build/dist/api/modules/hoodag/management.js +1 -1
- package/build/dist/api/modules/hoodag/public-reads.js +1 -1
- package/build/dist/api/modules/hoodag/reconstruct.d.ts +14 -0
- package/build/dist/api/modules/hoodag/reconstruct.js +1 -1
- package/build/dist/api/modules/hoodlock/airdrop.js +1 -1
- package/build/dist/api/modules/hoodlock/buyback.js +1 -1
- package/build/dist/api/modules/hoodlock/commerce.js +1 -1
- package/build/dist/api/modules/hoodlock/fee.js +1 -1
- package/build/dist/api/modules/hoodlock/guard.js +1 -1
- package/build/dist/api/modules/hoodlock/index.js +1 -1
- package/build/dist/api/modules/hoodlock/lifecycle.js +1 -1
- package/build/dist/api/modules/hoodlock/locks-burn.js +1 -1
- package/build/dist/api/modules/hoodlock/public.js +1 -1
- package/build/dist/api/modules/hookr/actions.js +1 -1
- package/build/dist/api/modules/hookr/addons.js +1 -1
- package/build/dist/api/modules/hookr/agent-gate.js +1 -1
- package/build/dist/api/modules/hookr/contracts.js +1 -1
- package/build/dist/api/modules/hookr/create-cancel.js +1 -1
- package/build/dist/api/modules/hookr/discovery.js +1 -1
- package/build/dist/api/modules/hookr/fill-bounty.js +1 -1
- package/build/dist/api/modules/hookr/index.js +1 -1
- package/build/dist/api/modules/hookr/launch-options.js +1 -1
- package/build/dist/api/modules/hookr/launch-receipt.js +1 -1
- package/build/dist/api/modules/hookr/launch.js +1 -1
- package/build/dist/api/modules/hookr/liquidity.js +1 -1
- package/build/dist/api/modules/hookr/lp-positions.js +1 -1
- package/build/dist/api/modules/hookr/lp-reads.js +1 -1
- package/build/dist/api/modules/hookr/lp-receipt.js +1 -1
- package/build/dist/api/modules/hookr/lp-state.js +1 -1
- package/build/dist/api/modules/hookr/public-reads.js +1 -1
- package/build/dist/api/modules/hookr/read-utils.js +1 -1
- package/build/dist/api/modules/hookr/relay.js +1 -1
- package/build/dist/api/modules/hookr/revenue.js +1 -1
- package/build/dist/api/modules/kyberswap/index.d.ts +2 -1
- package/build/dist/api/modules/kyberswap/index.js +1 -1
- package/build/dist/api/modules/kyberswap/source-pools.js +1 -1
- package/build/dist/api/modules/layerbank/abi.js +1 -1
- package/build/dist/api/modules/layerbank/actions.js +1 -1
- package/build/dist/api/modules/layerbank/checks.js +1 -1
- package/build/dist/api/modules/layerbank/index.js +1 -1
- package/build/dist/api/modules/layerbank/merkl.js +1 -1
- package/build/dist/api/modules/layerbank/reader.js +1 -1
- package/build/dist/api/modules/layerbank/reserve.js +1 -1
- package/build/dist/api/modules/lighter/index.js +1 -1
- package/build/dist/api/modules/longbow/administration.js +1 -1
- package/build/dist/api/modules/longbow/analytics.js +1 -1
- package/build/dist/api/modules/longbow/fixed.js +1 -1
- package/build/dist/api/modules/longbow/index.js +1 -1
- package/build/dist/api/modules/longbow/nft.js +1 -1
- package/build/dist/api/modules/longbow/rebates.js +1 -1
- package/build/dist/api/modules/longbow/staking.js +1 -1
- package/build/dist/api/modules/meridian/index.js +1 -1
- package/build/dist/api/modules/meridian/markets.js +1 -1
- package/build/dist/api/modules/meridian/predict-read.js +1 -1
- package/build/dist/api/modules/meridian/rfq.js +1 -1
- package/build/dist/api/modules/merkl/discovery.js +1 -1
- package/build/dist/api/modules/merkl/index.js +1 -1
- package/build/dist/api/modules/merkl/manage.js +1 -1
- package/build/dist/api/modules/merkl/protocol.js +1 -1
- package/build/dist/api/modules/morpho/allocator.js +1 -1
- package/build/dist/api/modules/morpho/bundles.js +1 -1
- package/build/dist/api/modules/morpho/in-kind.js +1 -1
- package/build/dist/api/modules/morpho/index.js +1 -1
- package/build/dist/api/modules/morpho/local-guard.d.ts +2 -1
- package/build/dist/api/modules/morpho/local-guard.js +1 -1
- package/build/dist/api/modules/morpho/midnight.js +1 -1
- package/build/dist/api/modules/morpho/protocol.js +1 -1
- package/build/dist/api/modules/morpho/surface.js +1 -1
- package/build/dist/api/modules/morpho/vault-management.js +1 -1
- package/build/dist/api/modules/morpho/vault-tools.js +1 -1
- package/build/dist/api/modules/morpho/vault-v2.js +1 -1
- package/build/dist/api/modules/netnet/card-plan.js +1 -1
- package/build/dist/api/modules/netnet/card-policy.d.ts +1 -0
- package/build/dist/api/modules/netnet/card-policy.js +1 -1
- package/build/dist/api/modules/netnet/card-read.js +1 -1
- package/build/dist/api/modules/netnet/card-recovery.js +1 -1
- package/build/dist/api/modules/netnet/desk-action.js +1 -1
- package/build/dist/api/modules/netnet/desk-read.js +1 -1
- package/build/dist/api/modules/netnet/financial.js +1 -1
- package/build/dist/api/modules/netnet/index.js +1 -1
- package/build/dist/api/modules/netnet/staking.js +1 -1
- package/build/dist/api/modules/orbio/index.d.ts +6 -0
- package/build/dist/api/modules/orbio/index.js +1 -1
- package/build/dist/api/modules/orbio/positions.js +1 -1
- package/build/dist/api/modules/pendle/costs.js +1 -1
- package/build/dist/api/modules/pendle/index.js +1 -1
- package/build/dist/api/modules/pendle/markets.js +1 -1
- package/build/dist/api/modules/pendle/positions.js +1 -1
- package/build/dist/api/modules/pendle/pricecheck.js +1 -1
- package/build/dist/api/modules/pendle/reader.js +1 -1
- package/build/dist/api/modules/pendle/redeem.js +1 -1
- package/build/dist/api/modules/pendle/trade.js +1 -1
- package/build/dist/api/modules/pendle/validate.js +1 -1
- package/build/dist/api/modules/pendle/verify.js +1 -1
- package/build/dist/api/modules/pons/claim.js +1 -1
- package/build/dist/api/modules/pons/index.js +1 -1
- package/build/dist/api/modules/pons/launch-status.js +1 -1
- package/build/dist/api/modules/pons/prices.js +1 -1
- package/build/dist/api/modules/pons/reads.js +1 -1
- package/build/dist/api/modules/pons/swap-terms.d.ts +2 -8
- package/build/dist/api/modules/pons/swap-terms.js +1 -1
- package/build/dist/api/modules/pons/trade.js +1 -1
- package/build/dist/api/modules/poolstrade/index.js +1 -1
- package/build/dist/api/modules/priors/coverage.js +1 -1
- package/build/dist/api/modules/priors/discovery.js +1 -1
- package/build/dist/api/modules/priors/features.js +1 -1
- package/build/dist/api/modules/priors/holdings.js +1 -1
- package/build/dist/api/modules/priors/index.js +1 -1
- package/build/dist/api/modules/priors/integration.js +1 -1
- package/build/dist/api/modules/priors/market.js +1 -1
- package/build/dist/api/modules/priors/pt.js +1 -1
- package/build/dist/api/modules/priors/savings-exit.js +1 -1
- package/build/dist/api/modules/priors/starter-line.js +1 -1
- package/build/dist/api/modules/priors/stock-swap.js +1 -1
- package/build/dist/api/modules/relay/api.js +1 -1
- package/build/dist/api/modules/relay/bootstrap.js +1 -1
- package/build/dist/api/modules/relay/discovery.js +1 -1
- package/build/dist/api/modules/relay/inbound.js +1 -1
- package/build/dist/api/modules/relay/index.js +1 -1
- package/build/dist/api/modules/relay/order.js +1 -1
- package/build/dist/api/modules/relay/outbound-status.js +1 -1
- package/build/dist/api/modules/relay/readiness.js +1 -1
- package/build/dist/api/modules/relay/reads.js +1 -1
- package/build/dist/api/modules/relay/vaults.js +1 -1
- package/build/dist/api/modules/spark/actions.js +1 -1
- package/build/dist/api/modules/spark/details.js +1 -1
- package/build/dist/api/modules/spark/index.js +1 -1
- package/build/dist/api/modules/spark/management.js +1 -1
- package/build/dist/api/modules/steakhouse/analytics.js +1 -1
- package/build/dist/api/modules/steakhouse/erc4626.js +1 -1
- package/build/dist/api/modules/steakhouse/index.js +1 -1
- package/build/dist/api/modules/steakhouse/local-guard.js +1 -1
- package/build/dist/api/modules/steakhouse/management.js +1 -1
- package/build/dist/api/modules/steakhouse/v2-exit.js +1 -1
- package/build/dist/api/modules/tickerspring/basket-routes.js +1 -1
- package/build/dist/api/modules/tickerspring/contract-reads.js +1 -1
- package/build/dist/api/modules/tickerspring/discovery.js +1 -1
- package/build/dist/api/modules/tickerspring/exit-preview.js +1 -1
- package/build/dist/api/modules/tickerspring/guards.js +1 -1
- package/build/dist/api/modules/tickerspring/index.js +1 -1
- package/build/dist/api/modules/tickerspring/journeys.js +1 -1
- package/build/dist/api/modules/tickerspring/ladder.js +1 -1
- package/build/dist/api/modules/tickerspring/maker.js +1 -1
- package/build/dist/api/modules/tickerspring/order-accounting.js +1 -1
- package/build/dist/api/modules/tickerspring/research.js +1 -1
- package/build/dist/api/modules/tickerspring/strategies.js +1 -1
- package/build/dist/api/modules/uniswap/auction-create.js +1 -1
- package/build/dist/api/modules/uniswap/auction.js +1 -1
- package/build/dist/api/modules/uniswap/batch.js +1 -1
- package/build/dist/api/modules/uniswap/common.js +1 -1
- package/build/dist/api/modules/uniswap/fees.js +1 -1
- package/build/dist/api/modules/uniswap/index.js +1 -1
- package/build/dist/api/modules/uniswap/local-guard.js +1 -1
- package/build/dist/api/modules/uniswap/oracle.js +1 -1
- package/build/dist/api/modules/uniswap/pool-math.js +1 -1
- package/build/dist/api/modules/uniswap/pools.js +1 -1
- package/build/dist/api/modules/uniswap/position.js +1 -1
- package/build/dist/api/modules/uniswap/protocol.js +1 -1
- package/build/dist/api/modules/uniswap/quote-guard.js +1 -1
- package/build/dist/api/modules/uniswap/token-jar.js +1 -1
- package/build/dist/api/modules/uniswap/trade-batch.js +1 -1
- package/build/dist/api/modules/uniswap/trade.js +1 -1
- package/build/dist/api/modules/uniswap/v2.js +1 -1
- package/build/dist/api/modules/uniswap/v3.js +1 -1
- package/build/dist/api/modules/uniswap/v4.js +1 -1
- package/build/dist/api/modules/uniswap/wrap.js +1 -1
- package/build/dist/api/modules/upoch/copy.d.ts +5 -0
- package/build/dist/api/modules/upoch/copy.js +1 -0
- package/build/dist/api/modules/upoch/index.d.ts +8 -0
- package/build/dist/api/modules/upoch/index.js +1 -0
- package/build/dist/api/modules/upoch/pins.d.ts +8 -0
- package/build/dist/api/modules/upoch/pins.js +1 -0
- package/build/dist/api/modules/upoch/reads.d.ts +509 -0
- package/build/dist/api/modules/upoch/reads.js +1 -0
- package/build/dist/api/modules/velora/claims.js +1 -1
- package/build/dist/api/modules/velora/delta-reads.js +1 -1
- package/build/dist/api/modules/velora/index.js +1 -1
- package/build/dist/api/modules/wormhole/index.js +1 -1
- package/build/dist/api/modules/wormhole/x402-client.d.ts +17 -1
- package/build/dist/api/modules/wormhole/x402-client.js +1 -1
- package/build/dist/api/positions.js +1 -1
- package/build/dist/api/pricenote.js +1 -1
- package/build/dist/api/prices.d.ts +5 -0
- package/build/dist/api/prices.js +1 -1
- package/build/dist/api/pricing.js +1 -1
- package/build/dist/api/rpc.js +1 -1
- package/build/dist/api/secret-fields.d.ts +2 -0
- package/build/dist/api/secret-fields.js +1 -1
- package/build/dist/api/send.js +1 -1
- package/build/dist/api/signing-registry.js +1 -1
- package/build/dist/api/signing.js +1 -1
- package/build/dist/api/simulate.js +1 -1
- package/build/dist/api/swap.d.ts +1 -0
- package/build/dist/api/swap.js +1 -1
- package/build/dist/api/tokens.js +1 -1
- package/build/dist/api/tool-policy.d.ts +1 -0
- package/build/dist/api/tool-policy.js +1 -1
- package/build/dist/api/universal-router.d.ts +45 -0
- package/build/dist/api/universal-router.js +1 -0
- package/build/dist/api/usd-estimate.js +1 -1
- package/build/dist/chunks/{ZOMFHTB2.js → 22TU5PFT.js} +1 -1
- package/build/dist/chunks/23HNDJ76.js +2 -0
- package/build/dist/chunks/{ZFU65MB4.js → 257N7343.js} +1 -1
- package/build/dist/chunks/{F3VDVTMS.js → 27PVS6BU.js} +1 -1
- package/build/dist/chunks/{N245WC5R.js → 2JWAFLJU.js} +1 -1
- package/build/dist/chunks/{GQYV4TFO.js → 2OVJ2BTJ.js} +1 -1
- package/build/dist/chunks/{JS53DQVT.js → 35LXCSHY.js} +1 -1
- package/build/dist/chunks/{V37L4DU4.js → 3A2IKFTV.js} +1 -1
- package/build/dist/chunks/{OYPAVXGQ.js → 3BMM3V4P.js} +1 -1
- package/build/dist/chunks/{ZKZUS3QU.js → 3FU6XP6S.js} +1 -1
- package/build/dist/chunks/{BB765L75.js → 3PHJUFU2.js} +1 -1
- package/build/dist/chunks/{FWIFTPSE.js → 3PU2SD3U.js} +1 -1
- package/build/dist/chunks/{SBY4RJ7I.js → 3ZH5SOC2.js} +1 -1
- package/build/dist/chunks/43BG2JRB.js +1 -0
- package/build/dist/chunks/{YTLH4M4Y.js → 47HSRR7G.js} +1 -1
- package/build/dist/chunks/4NBXBKOX.js +2 -0
- package/build/dist/chunks/{EZZM2GQT.js → 4NDIYRH5.js} +1 -1
- package/build/dist/chunks/{FOKEFXGP.js → 4PLLS6CT.js} +1 -1
- package/build/dist/chunks/4RCYYN6O.js +1 -0
- package/build/dist/chunks/{XHYFISVV.js → 4Z3IGMU6.js} +1 -1
- package/build/dist/chunks/4ZD5D2UP.js +1 -0
- package/build/dist/chunks/{CSDN4MYP.js → 5GQJVKVY.js} +1 -1
- package/build/dist/chunks/{QFSBDPLN.js → 65OITTDL.js} +1 -1
- package/build/dist/chunks/{4FPV4CRC.js → 6D3XNCOX.js} +1 -1
- package/build/dist/chunks/{DSTMEY5F.js → 6F527FLN.js} +1 -1
- package/build/dist/chunks/{O3JWCJIF.js → 6GWXPQZ6.js} +1 -1
- package/build/dist/chunks/{32RXFUOH.js → 73BZPPRS.js} +1 -1
- package/build/dist/chunks/75SULXNT.js +1 -0
- package/build/dist/chunks/{WU7XIAXB.js → 7EACRKFV.js} +1 -1
- package/build/dist/chunks/{SKEKXEUU.js → 7FIEBJOZ.js} +1 -1
- package/build/dist/chunks/{4GNUXN4K.js → 7FZXSYFD.js} +1 -1
- package/build/dist/chunks/{ZP36DSOD.js → 7TSIF3F4.js} +1 -1
- package/build/dist/chunks/{AMTRDPVO.js → 7U62MMUQ.js} +1 -1
- package/build/dist/chunks/{DW4V5PUY.js → 7VH6JQ2H.js} +1 -1
- package/build/dist/chunks/A3BJSQ23.js +1 -0
- package/build/dist/chunks/{YSMWCKIX.js → ADIPEGNN.js} +1 -1
- package/build/dist/chunks/AG2G7BHH.js +6 -0
- package/build/dist/chunks/AIYNFIG6.js +1 -0
- package/build/dist/chunks/ANIF3JMV.js +4 -0
- package/build/dist/chunks/{4JTTA3BX.js → AWV24X7F.js} +1 -1
- package/build/dist/chunks/{7QKYDNF6.js → AXHFNE6L.js} +1 -1
- package/build/dist/chunks/{WOGWLFAL.js → BGVC5NI6.js} +1 -1
- package/build/dist/chunks/BJK75C7G.js +1 -0
- package/build/dist/chunks/BSX4LFYI.js +1 -0
- package/build/dist/chunks/{OYJFXEDU.js → BZPFPQ2I.js} +1 -1
- package/build/dist/chunks/{5PI57UC2.js → C76D54YG.js} +1 -1
- package/build/dist/chunks/{TDZTC5WR.js → DBOGRUPS.js} +1 -1
- package/build/dist/chunks/{HHO5ISMM.js → DCGNVMKG.js} +1 -1
- package/build/dist/chunks/{Y77EVVT4.js → DGDMRATN.js} +1 -1
- package/build/dist/chunks/{EGZREEG2.js → DLNA5272.js} +1 -1
- package/build/dist/chunks/{TM7Z5SA4.js → DMDOSHV7.js} +1 -1
- package/build/dist/chunks/{WHVZ372B.js → DRLBTB4E.js} +1 -1
- package/build/dist/chunks/DXAPKN7H.js +1 -0
- package/build/dist/chunks/{FZ6IJZZM.js → E76Z2TT4.js} +1 -1
- package/build/dist/chunks/{67BWOVET.js → EHGH646D.js} +1 -1
- package/build/dist/chunks/{KKPMOAVI.js → ELHRXA5U.js} +1 -1
- package/build/dist/chunks/{PZEF5LBL.js → ETMD747Y.js} +1 -1
- package/build/dist/chunks/{XCKTE4ON.js → F7MGYRPU.js} +1 -1
- package/build/dist/chunks/{MRMR4QHA.js → FAH7FKUT.js} +1 -1
- package/build/dist/chunks/FXOFR432.js +1 -0
- package/build/dist/chunks/{VHV6WQ5F.js → G2AA73ZE.js} +1 -1
- package/build/dist/chunks/{JWR5XVP2.js → GBIBRYOV.js} +1 -1
- package/build/dist/chunks/{FNGIJKMZ.js → GDOHHXNH.js} +1 -1
- package/build/dist/chunks/{BZ34ZR65.js → GGMVT5A6.js} +1 -1
- package/build/dist/chunks/GK3D7OKG.js +1 -0
- package/build/dist/chunks/{2OKYXT25.js → GQITAJVF.js} +1 -1
- package/build/dist/chunks/GYPMUYB5.js +1 -0
- package/build/dist/chunks/H3E7UD2X.js +1 -0
- package/build/dist/chunks/{GDRQ2ANN.js → H64QC4QR.js} +1 -1
- package/build/dist/chunks/HFVXNKA5.js +1 -0
- package/build/dist/chunks/HHYE42JG.js +21 -0
- package/build/dist/chunks/{U363GQTF.js → HIG7JY3J.js} +1 -1
- package/build/dist/chunks/{XWKK75TO.js → HOBIXKGO.js} +1 -1
- package/build/dist/chunks/HQIS3QI7.js +3 -0
- package/build/dist/chunks/{UOCRYXAB.js → HRAHGYNK.js} +1 -1
- package/build/dist/chunks/{GLF7WEY2.js → HUKDISRE.js} +1 -1
- package/build/dist/chunks/{GSFHM5L3.js → HZSYMGJ2.js} +1 -1
- package/build/dist/chunks/{FJLJ7ZQ5.js → I4473OC6.js} +1 -1
- package/build/dist/chunks/IBL6TL2Q.js +1 -0
- package/build/dist/chunks/{3DNJTJ2X.js → IJ4HZIDG.js} +1 -1
- package/build/dist/chunks/{OARVU3RC.js → IPU656WB.js} +1 -1
- package/build/dist/chunks/{HCBX4NFM.js → IT2JLILU.js} +1 -1
- package/build/dist/chunks/{REWXG6X6.js → JDSSYT6R.js} +1 -1
- package/build/dist/chunks/{XRDXFHIK.js → JFWJBZ7M.js} +1 -1
- package/build/dist/chunks/{TPEKCXVE.js → JTPHZCO3.js} +1 -1
- package/build/dist/chunks/{CSOO4SW7.js → K4GUZ5QS.js} +1 -1
- package/build/dist/chunks/{BAIY32AV.js → KLEJ3W4T.js} +1 -1
- package/build/dist/chunks/{ACH4BSME.js → KOKLM63Q.js} +1 -1
- package/build/dist/chunks/{7D73A6KS.js → KVVBT43U.js} +1 -1
- package/build/dist/chunks/{CO4GCF4L.js → KXX7ZBFY.js} +1 -1
- package/build/dist/chunks/{I6PQW2JI.js → L2AE32SL.js} +1 -1
- package/build/dist/chunks/{WUT7TZYM.js → LCH6F5HT.js} +1 -1
- package/build/dist/chunks/LEV5SNNC.js +3 -0
- package/build/dist/chunks/{SPRVVJXI.js → LFSJDFMY.js} +1 -1
- package/build/dist/chunks/{6UVGQYZ3.js → LGLWEGPY.js} +1 -1
- package/build/dist/chunks/{PV4AK32X.js → LQSPWRHN.js} +1 -1
- package/build/dist/chunks/{C3WBHFLX.js → LTDF2LNP.js} +1 -1
- package/build/dist/chunks/{5HIHUYA4.js → M4AGEGWW.js} +1 -1
- package/build/dist/chunks/{ARI72OYT.js → M6SQPOOL.js} +1 -1
- package/build/dist/chunks/{SOTYQGPT.js → M7CQPTRK.js} +1 -1
- package/build/dist/chunks/{XPEDQBLI.js → MGVX5EUH.js} +1 -1
- package/build/dist/chunks/{C5ZZAYXD.js → MI5HZDMH.js} +1 -1
- package/build/dist/chunks/{APHNOGNS.js → MQ37QX6U.js} +1 -1
- package/build/dist/chunks/MQ5F2VOK.js +1 -0
- package/build/dist/chunks/{JKD2B6OX.js → MSRCJ2BS.js} +1 -1
- package/build/dist/chunks/{JKRBGAX2.js → NAO7VWZF.js} +1 -1
- package/build/dist/chunks/{RLMVA575.js → NDSNE6PS.js} +1 -1
- package/build/dist/chunks/{RT7IU6TI.js → NMJVQX5M.js} +1 -1
- package/build/dist/chunks/NQ4MTIU3.js +1 -0
- package/build/dist/chunks/{IEG6GLFR.js → NTUXDIY6.js} +1 -1
- package/build/dist/chunks/{F4UQEPJT.js → NUERUFH7.js} +1 -1
- package/build/dist/chunks/NV6FDIYT.js +1 -0
- package/build/dist/chunks/O2J5I4VA.js +1 -0
- package/build/dist/chunks/{XVJ7ILKK.js → O3CC5SRM.js} +1 -1
- package/build/dist/chunks/{2SUHQWND.js → O4S6XAYV.js} +1 -1
- package/build/dist/chunks/{TAEZTP4L.js → O5QTITN6.js} +1 -1
- package/build/dist/chunks/{NA424YAL.js → OB7BFDOV.js} +1 -1
- package/build/dist/chunks/{523ZIR3J.js → ODV3XT5U.js} +1 -1
- package/build/dist/chunks/{GW5IXLKU.js → OI3N4EW4.js} +1 -1
- package/build/dist/chunks/{FL5SSHUL.js → OIQTZOBN.js} +1 -1
- package/build/dist/chunks/OLDQV43V.js +1 -0
- package/build/dist/chunks/OOPMZIG7.js +1 -0
- package/build/dist/chunks/{XYPGLG6A.js → OSMOBKRQ.js} +1 -1
- package/build/dist/chunks/{OZ5MDUD2.js → OVM4QIET.js} +1 -1
- package/build/dist/chunks/{N4XNNXOJ.js → OY5W7ZSL.js} +1 -1
- package/build/dist/chunks/{GRSXWQWD.js → PDGYM2WG.js} +1 -1
- package/build/dist/chunks/{UQEEF5W5.js → PDPTJMTJ.js} +1 -1
- package/build/dist/chunks/PEHXHQVA.js +1 -0
- package/build/dist/chunks/{JOKL5L6X.js → PKYQ3XVA.js} +1 -1
- package/build/dist/chunks/PMFR47H3.js +1 -0
- package/build/dist/chunks/{N6GIC7HJ.js → PWJVC2FV.js} +1 -1
- package/build/dist/chunks/{753HZZTY.js → QBYV7NXH.js} +1 -1
- package/build/dist/chunks/QHV5GORV.js +1 -0
- package/build/dist/chunks/{2LWBN35N.js → QIB6OMQV.js} +1 -1
- package/build/dist/chunks/{TK55VASJ.js → QMNUB2GM.js} +1 -1
- package/build/dist/chunks/{HKVQ646Q.js → QN45T4N3.js} +1 -1
- package/build/dist/chunks/{J73ATSEQ.js → QPY6UTLU.js} +1 -1
- package/build/dist/chunks/{YUHNPUNK.js → R73R4KN3.js} +1 -1
- package/build/dist/chunks/{RLI4JDOL.js → RA7DOR7F.js} +1 -1
- package/build/dist/chunks/{VR344DAZ.js → RN3WUJIO.js} +1 -1
- package/build/dist/chunks/RUSXMQSJ.js +1 -0
- package/build/dist/chunks/{D742AYEV.js → RUTSEGGD.js} +1 -1
- package/build/dist/chunks/{4Q2ZBZXM.js → RXP7ZUPY.js} +1 -1
- package/build/dist/chunks/{TFDPEAVZ.js → S4JUFCT4.js} +1 -1
- package/build/dist/chunks/{DYYEA5HB.js → SMKO7GKX.js} +1 -1
- package/build/dist/chunks/{C75MT5SD.js → SNCV6HV7.js} +1 -1
- package/build/dist/chunks/{HIX5N25Z.js → SOJHYMD7.js} +1 -1
- package/build/dist/chunks/{JLRHM2DQ.js → SUNTJ6IU.js} +1 -1
- package/build/dist/chunks/{4JRXEN7C.js → THL4TMQW.js} +2 -2
- package/build/dist/chunks/TI727O2H.js +1 -0
- package/build/dist/chunks/{PV5FDT6O.js → TXGZ6NWN.js} +1 -1
- package/build/dist/chunks/{Q2ACLVWR.js → UBI3HBXD.js} +1 -1
- package/build/dist/chunks/{YMV5TL5C.js → UEHN2IDF.js} +1 -1
- package/build/dist/chunks/{ZF2VPDRQ.js → UHIJMDD2.js} +1 -1
- package/build/dist/chunks/UJQYOTO5.js +1 -0
- package/build/dist/chunks/{VTPT5544.js → USEF3QKG.js} +1 -1
- package/build/dist/chunks/{LR4XTZ37.js → UYULQHZJ.js} +1 -1
- package/build/dist/chunks/{YWZQJJYY.js → V4UJMUIB.js} +1 -1
- package/build/dist/chunks/{7VC53B5X.js → V5YSJKRH.js} +13 -13
- package/build/dist/chunks/{INOYMBWE.js → VC5ZCQYZ.js} +1 -1
- package/build/dist/chunks/{M7ZXDLKM.js → VDJPDIBV.js} +1 -1
- package/build/dist/chunks/{2FHELZ7Y.js → VFM2BICB.js} +1 -1
- package/build/dist/chunks/{TE6D3OIX.js → VOJULRNU.js} +1 -1
- package/build/dist/chunks/{UEDGYZOC.js → VVAM3EAK.js} +1 -1
- package/build/dist/chunks/VVJO6OYK.js +1 -0
- package/build/dist/chunks/{JESMX2UC.js → VXCGMALF.js} +1 -1
- package/build/dist/chunks/{NUFZUKYS.js → W32UECOL.js} +1 -1
- package/build/dist/chunks/{UUID2E22.js → W3DGFMQE.js} +1 -1
- package/build/dist/chunks/W7OCS4AM.js +6 -0
- package/build/dist/chunks/{DNNFKDZR.js → W7QNSNOH.js} +1 -1
- package/build/dist/chunks/{2MZXTOZU.js → WAKZWSHB.js} +1 -1
- package/build/dist/chunks/{HM72DH4V.js → WRUTW6CG.js} +1 -1
- package/build/dist/chunks/{VYYSL557.js → WSILNJS2.js} +1 -1
- package/build/dist/chunks/{L646YWDP.js → X24YTJST.js} +1 -1
- package/build/dist/chunks/{FOD34G2H.js → XL3W7DAQ.js} +1 -1
- package/build/dist/chunks/{2E4I7CJ7.js → XRDLMTBJ.js} +1 -1
- package/build/dist/chunks/{GG24LO2R.js → XVOW6UCI.js} +1 -1
- package/build/dist/chunks/XW3VGWXK.js +1 -0
- package/build/dist/chunks/{6WD4HHID.js → Y2QADJOB.js} +1 -1
- package/build/dist/chunks/Y64GFBTA.js +1 -0
- package/build/dist/chunks/Y7HBFQYG.js +1 -0
- package/build/dist/chunks/{ARLGF5MU.js → YGW4ODAP.js} +1 -1
- package/build/dist/chunks/YRSAZTTC.js +7 -0
- package/build/dist/chunks/YW4W3LPQ.js +1 -0
- package/build/dist/chunks/{3VBIRLU3.js → YXXK6EPI.js} +1 -1
- package/build/dist/chunks/{EH5G4O3U.js → Z2QV6EZY.js} +1 -1
- package/build/dist/chunks/Z3IBPCY4.js +2 -0
- package/build/dist/chunks/{H5DY7CNB.js → Z7FGEWO2.js} +1 -1
- package/build/dist/chunks/{KDGSYNOP.js → ZDCCFEVL.js} +1 -1
- package/build/dist/chunks/{4RQAOOO2.js → ZOLHVZDK.js} +1 -1
- package/build/dist/chunks/{AI3VAPA3.js → ZSVAGOF2.js} +1 -1
- package/build/dist/chunks/{EVBHQQQG.js → ZTKT3ZQK.js} +1 -1
- package/build/dist/chunks/{4BVP652W.js → ZZ6FZGHF.js} +1 -1
- package/package.json +1 -1
- package/build/dist/chunks/3K2N5VFH.js +0 -1
- package/build/dist/chunks/3ZABD6ZF.js +0 -2
- package/build/dist/chunks/44MB6SA6.js +0 -1
- package/build/dist/chunks/4D4ZRZUW.js +0 -1
- package/build/dist/chunks/4OVIMYNH.js +0 -2
- package/build/dist/chunks/6NUNCD5J.js +0 -1
- package/build/dist/chunks/6PZGDVHV.js +0 -1
- package/build/dist/chunks/7MBVTNLU.js +0 -1
- package/build/dist/chunks/7VNO46LV.js +0 -1
- package/build/dist/chunks/CAWTAR5V.js +0 -1
- package/build/dist/chunks/DPE7SPW7.js +0 -1
- package/build/dist/chunks/E3RACZUY.js +0 -1
- package/build/dist/chunks/EI6GGPDS.js +0 -20
- package/build/dist/chunks/FV4WZOTD.js +0 -1
- package/build/dist/chunks/FWD4L3CJ.js +0 -1
- package/build/dist/chunks/JBTOZ6IH.js +0 -1
- package/build/dist/chunks/KREBNL2D.js +0 -1
- package/build/dist/chunks/MVD3KWPP.js +0 -1
- package/build/dist/chunks/P6OMKZMR.js +0 -3
- package/build/dist/chunks/PXVREXCS.js +0 -1
- package/build/dist/chunks/QJNLLI6N.js +0 -1
- package/build/dist/chunks/RPB46QAC.js +0 -1
- package/build/dist/chunks/TID4C2KC.js +0 -1
- package/build/dist/chunks/U2YCQWZK.js +0 -1
- package/build/dist/chunks/UWBKAWX3.js +0 -7
- package/build/dist/chunks/V6SDKPZS.js +0 -1
- package/build/dist/chunks/WHTRPRRD.js +0 -1
- package/build/dist/chunks/WLMWWEP7.js +0 -2
- package/build/dist/chunks/XQ24RSEI.js +0 -1
- package/build/dist/chunks/YDNTY67T.js +0 -1
- package/build/dist/chunks/ZQAFFWDK.js +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
import{m as J,n as Z}from"./WLMWWEP7.js";import{a as x}from"./G2LAO23N.js";import{a as V}from"./66F5ZH34.js";import{b as K,c as X,g as C}from"./NWNYJ26T.js";import{a as f}from"./FWD4L3CJ.js";import{a as u}from"./XSD5NL7J.js";import{encodeFunctionData as G,getAddress as b,hashTypedData as T,parseAbi as A,recoverTypedDataAddress as ie}from"viem";var oe={pool:b("0x281210097f0de7A8FB6F87310AF0f089c9C8DE21"),registry:b("0x8004A169FB4a3325136EB29fA0ceB6D2e539a432"),usdg:b("0x5fc5360D0400a0Fd4f2af552ADD042D716F1d168"),priors:b("0xeDBf91223639800BCd5756815CAf908Df3b890bE"),stock:b("0xbEcd07EC689988e16b870C121756C4c2C8cb02B6"),backing:b("0xC999014C6218EC41f0aE412d49AE8f2aA4c539fD"),treasury:b("0xFe8fdf43c4b0443aCF8E8CD8facD62F1B770e267"),bond:b("0x346d3360B7258a18E8a2a55fe20E0F467113a53A"),autopay:b("0x72B510AF4e66e5960aB9b975e0BdCf80239e83A0"),savings:b("0xBeEff033F34C046626B8D0A041844C5d1A5409dd"),market:b("0x6a4583242B8313313E684d02aB7dc6bFf8749670"),market1:b("0xe5C8b3FacD7802099C1DfB88c0C818Cd0ebA7B19"),bidSpender:b("0x0dbd031a3e8cc91C2b0A3Bf6BD1d14c7AeD92878"),seats3:b("0x59D155C42A9263fA7596867b992bB3e84dF680a9"),seats4:b("0xb1c3a04496238D62E3c93118C297163855e22192")},c=oe,$="(uint256 agentId,uint256 sponsorId,address owner,uint256 maxPremiumBps,uint256 nonce,uint256 deadline)",ne=A(["function ownerOf(uint256) view returns (address)","function getAgentWallet(uint256) view returns (address)"]),z=A(["function nonces(uint256) view returns (uint256)"]),re=A(["function isValidSignature(bytes32,bytes) view returns (bytes4)"]),ae="0x0000000000000000000000000000000000000000",O="Owner stake is collateral, not a return. A default burns 75% of owner stake (50% of other backing); pending and leaving stake remains at risk until released. New backing waits 24 hours. Exit mode 0 holds, 1 returns PRIORS, 2 requests USDG through the guarded exit queue; no immediate payout is promised.",e=(t,i,n,r,a={})=>({name:`priors_${t}`,contract:i,signature:`function ${n}`,fields:r,note:"",...a}),o=["agentId","id"],v=["amount","uint"],Q=["on","bool"],_=["generation","uint32"],D=["day","uint32"],P=["layer","uint8"],s={read:!0},te=[e("set_delegate","pool","setDelegate(uint256,address)",[o,["delegate","address"]],{owner:"agentId",note:"Owner only. Delegate controls borrowing/repayment, not transfer of identity; clear with the zero address."}),e("root_enroll","pool","enrollRoot(uint256,uint256)",[o,v],{owner:"agentId",approval:"usdg",note:"Owner only. Locks USDG pool shares behind this sponsor root; active delegated lines and fees constrain withdrawals."}),e("root_add_stake","pool","addStake(uint256,uint256)",[o,v],{approval:"usdg",note:"Anyone may add USDG; only the root owner can withdraw it. This may give funds to another owner."}),e("root_unlock","pool","unlock(uint256,uint256,address)",[o,["shares","uint"]],{owner:"agentId",args:["agentId","shares","$wallet"],note:"Owner only. Withdraw root pool shares to this wallet, subject to delegated backing and fee locks."}),e("root_retire","pool","retireRoot(uint256)",[o],{owner:"agentId",note:"Owner only; requires no remaining stake or delegated lines."}),e("root_vouch","pool","vouch(uint256,uint256,uint256)",[["sponsorId","id"],o,v],{owner:"sponsorId",note:"Owner of sponsor only. Adds the exact USDG amount of undrawn backing to an existing sponsored line."}),e("root_unvouch","pool","unvouch(uint256,uint256,uint256)",[["sponsorId","id"],o,v],{owner:"sponsorId",note:"Owner of sponsor only. Recalls undrawn backing; outstanding debt remains backed."}),e("root_freeze","pool","freeze(uint256,bool)",[o,["frozen","bool"]],{note:"Current sponsor owner only; freeze/unfreeze the agent line. Contract checks sponsor ownership."}),e("root_set_premium","pool","setPremium(uint256,uint256)",[o,["premiumBps","uint"]],{note:"Current sponsor owner only. Future loan premium cannot exceed the owner-consented cap."}),e("root_claim_fees","pool","claimSponsorFees(uint256,address)",[o],{owner:"agentId",args:["agentId","$wallet"],note:"Owner only; claim sponsor USDG fees to this wallet."}),e("root_set_hook","pool","setHook(uint256,address)",[o,["hook","address"]],{owner:"agentId",note:"Owner only. Changes root lending policy hook; pool enforces the delay while backing is committed."}),e("root_apply_hook","pool","applyHook(uint256)",[o],{note:"Apply a previously scheduled root hook after its on-chain delay."}),e("mark_default","pool","markDefault(uint256)",[["loanId","id"]],{note:"Irreversible: mark a past-grace unpaid loan defaulted, burn sponsor backing and mark the owner. Preview and confirm deliberately."}),e("import_history","pool","importFromV1(uint256)",[o],{note:"Import the v1 record, including defaults; this never imports unbacked capacity."}),e("fund_reserve","pool","fundReserve(uint256)",[v],{approval:"usdg",note:"Donate USDG to the pool reserve; receives no redeemable shares."}),e("root_shares","pool","rootShares(uint256) view returns (uint256)",[o],s),e("root_fee_locked","pool","feeLocked(uint256) view returns (uint256)",[o],s),e("root_fees_owed","pool","sponsorFees(uint256) view returns (uint256)",[o],s),e("root_backing","pool","backing(uint256) view returns (uint256)",[o],s),e("root_free_backing","pool","freeBacking(uint256) view returns (uint256)",[o],s),e("pool_parameters","pool","getParams() view returns ((uint256 minLoan,uint256 maxLoan,uint64 minTerm,uint64 maxTerm,uint64 grace,uint64 minScoreTerm,uint256 feeBps,uint256 sponsorFeeBps,uint256 protocolFeeBps,uint256 minStake,uint256 maxUtilizationBps,uint256 keeperBounty))",[],s),e("bond_deposit","bond","deposit(uint256)",[o],{owner:"agentId",approval:"bond",note:"Owner only. V2 treasury bond remains locked while any line or loan is open; it may replace and refund a former owner bond. Leave and release the legacy bond before Treasury V5 migration."}),e("bond_release","bond","release(uint256)",[o],{note:"Return V2 bond to its original depositor, not necessarily this wallet; contract enforces no line, no loan and age."}),e("bond_slash","bond","slash(uint256)",[o],{note:"Irreversible: send defaulted agent V2 bond to the configured beneficiary."}),e("bond_status","bond","bonds(uint256) view returns ((address depositor,uint64 at,uint256 amount))",[o],s),e("bond_releasable","bond","releasable(uint256) view returns (bool)",[o],s),e("bond_release_at","bond","unusedReleaseAt(uint256) view returns (uint256)",[o],s),e("treasury_move","treasury",`move(uint256,${$},bytes)`,[o],{owner:"agentId",consentRoot:8793n,externalConsent:!0,args:["agentId","$consent","$signature"],note:"Move a former Treasury V4 line to V5, no loan open. Close old line, release legacy bond, deposit V2 bond first. V4 record and current-owner V2 bond are required."}),e("treasury_raise","treasury","raise(uint256)",[o],{note:"Raise an eligible Treasury V5 line using its current rules, score, history, age, weekly room and free backing. No unbacked credit."}),e("treasury_reclaim","treasury","reclaim(uint256)",[o],{note:"Reclaim an idle treasury line under on-chain rules; this ends borrowing access."}),e("treasury_first_line","treasury",`firstLine(uint256,uint64,bytes,${$},bytes)`,[o,["expiry","uint"],["invite","bytes"]],{owner:"agentId",consentRoot:8793n,externalConsent:!0,args:["agentId","expiry","invite","$consent","$signature"],note:"Redeem an already-issued Treasury V5 invite with V5 pool consent. Requires a valid V5 inviter signature; the current owner V2 bond is needed before borrowing. V4 invites cannot be reused."}),e("treasury_raise_room","treasury","raiseRoom() view returns (uint256)",[],s),e("treasury_first_lined","treasury","firstLined(uint256) view returns (bool)",[o],s),e("treasury_eligible_raise","treasury","eligibleForRaise(uint256) view returns (bool)",[o],s),e("treasury_room","treasury","epochRoom() view returns (uint256)",[],s),e("treasury_rules","treasury","rules() view returns (uint256 reserveBps,uint256 firstLine,uint256 secondLine,uint256 epochCap,uint64 epochLength,uint64 minSeasoning,uint256 minQualified,uint256 minScore,uint64 idleAfter)",[],s),e("stock_open","stock",`open(uint256,address,uint256,${$},bytes) returns (uint256)`,[o,["token","address"],v],{owner:"agentId",consentRoot:6424n,externalConsent:!0,approval:"stock",args:["agentId","token","amount","$consent","$signature"],note:"Owner or on-chain controller with a supplied owner consent posts exact collateral. Token must be accepted and usable; live price, LTV, line cap and backing determine the line. Default seizes debt plus buffer; issuer restrictions and burns may reduce returned collateral."}),e("stock_add","stock","addCollateral(uint256,uint256)",[o,v],{approval:"stock",note:"Depositor only. Adds exact position token collateral; contract decides resulting draw room."}),e("stock_close","stock","close(uint256)",[o],{note:"Depositor or controller closes/freezes the line; collateral pays its depositor after the last loan, subject to default and issuer shortfalls."}),e("stock_expire","stock","expire(uint256)",[o],{note:"Expire idle stock line after on-chain idle rules; may close borrowing access."}),e("stock_reconcile","stock","reconcile(uint256,uint256)",[o,["maxLoans","uint"]],{note:"Reconcile the collateral debt walk against pool loans; contract ignores maxLoans in this implementation."}),e("stock_settle","stock","settle(uint256,uint256)",[o,["loanId","id"]],{note:"Reconcile stock collateral after a default or missed hook; may seize collateral according to the loan."}),e("stock_record_feed","stock","record(address,uint256) returns (uint80)",[["feed","address"],["maxRounds","uint"]],{note:"Advance public oracle price tape; may unblock new stock lines and default settlement."}),e("stock_reclaim","stock","reclaim(uint256)",[o],{note:"Reclaim a written-off stock position after it is no longer backed; return remains subject to vault token shortfall."}),e("stock_state","stock","getPosition(uint256) view returns ((address depositor,address owner,address token,uint64 openedAt,bool closing,uint8 status,uint128 line,uint256 amount))",[o],s),e("stock_borrow_room","stock","borrowRoom(uint256) view returns (uint256)",[o],s),e("stock_asset_state","stock","assets(address) view returns (address feed,uint64 maxAge,uint8 tokenDecimals,uint8 feedDecimals,bool enabled,uint16 ltvBps,uint128 lineCap)",[["token","address"]],s),e("stock_lending_status","stock","lendStatus(address) view returns (uint8)",[["token","address"]],s),e("stock_value","stock","valueOf(address,uint256) view returns (bool ok,uint256 value)",[["token","address"],v],s),e("stock_ltv","stock","ltvOf(uint256,address) view returns (uint256)",[o,["token","address"]],s),e("backing_open","backing",`open(uint256,uint256,bool,${$},bytes)`,[o,v,["autoAdd","bool"]],{owner:"agentId",consentRoot:8762n,approval:"priors",args:["agentId","amount","autoAdd","$consent","$signature"],note:O}),e("backing_open_with_usdg","backing",`openWithUsdg(uint256,uint256,uint256,uint256,uint256,bool,${$},bytes)`,[o,["priorsIn","uint"],["usdgIn","uint"],["minOut","uint"],["deadline","uint"],["autoAdd","bool"]],{owner:"agentId",consentRoot:8762n,approval:"mixed",args:["agentId","priorsIn","usdgIn","minOut","deadline","autoAdd","$consent","$signature"],note:O}),e("backing_add","backing","back(uint256,uint256,bool)",[o,v,["autoAdd","bool"]],{approval:"priors",note:O+" Owner-only at launch; other backers require both global and individual permission."}),e("backing_add_with_usdg","backing","backWithUsdg(uint256,uint256,uint256,uint256,uint256,bool)",[o,["priorsIn","uint"],["usdgIn","uint"],["minOut","uint"],["deadline","uint"],["autoAdd","bool"]],{approval:"mixed",note:O}),e("backing_leave","backing","leave(uint256,uint256,uint8)",[o,v,["exitMode","uint8"]],{note:O}),e("backing_close","backing","close(uint256,uint8)",[o,["exitMode","uint8"]],{note:O}),...["refresh","promote","expire","sync","pokeFees","recordRepay","noteDelegate"].map(t=>e(`backing_${t.replace(/[A-Z]/g,i=>`_${i.toLowerCase()}`)}`,"backing",`${t}(uint256)`,[o],{note:"Reconcile this V5 book against current pool, owner, record, tier and backing rules; no payout is promised."})),...["setAutoAdd","setProtocolBacking","setOthersBacking"].map(t=>e(`backing_${t.replace(/[A-Z]/g,i=>`_${i.toLowerCase()}`)}`,"backing",`${t}(uint256,bool)`,[o,Q],{note:"Change this V5 book setting under the contract ownership/holder rules. Auto-add can compound rewards into stake at risk."})),e("backing_reconsent","backing",`reconsent(uint256,${$},bytes)`,[o],{owner:"agentId",consentRoot:8762n,args:["agentId","$consent","$signature"],note:"Owner only. Renew the pool consent for V5 backing."}),e("backing_release","backing","release(uint256,uint32,uint32,uint256,uint256)",[o,_,D,["minUsdgOut","uint"],["deadline","uint"]],{note:"Release caller day bucket after its release rule. Zero minUsdgOut returns PRIORS; positive requests a guarded sale. Stake stays burnable until release. Read generation/day from chain events."}),e("backing_release_for","backing","releaseFor(uint256,uint32,address,uint32)",[o,_,["holder","address"],D],{note:"Return eligible PRIORS to its holder under generation/day release rules, never redirect proceeds."}),e("backing_finish_close","backing","finishClose(uint256,uint32)",[o,_],{note:"Finish an eligible generation close; pays the bound owner under its release rules."}),e("backing_claim_settled","backing","claimSettled(uint256,uint32,address)",[o,_,["holder","address"]],{note:"Pay settled generation stake to the named holder, after any default burn."}),e("backing_claim_record","backing","claimSettled(uint256,uint32,address,uint8,uint32)",[o,_,["holder","address"],P,D],{note:"Pay settled day record to its holder after any default burn."}),e("backing_queue_exit","backing","queueExit(uint256,uint32,address,uint8,uint32)",[o,_,["holder","address"],P,D],{note:"Holder/keeper queues ready USDG-mode stake; minimum and queue window apply. A queue entry is not a fill or payout."}),e("backing_settle","backing","settle(uint256,uint32,uint256)",[o,_,["loanId","id"]],{note:"Reconcile V5 generation with a pool loan/default after a missed hook."}),e("backing_record_loan","backing","recordLoan(uint256)",[["loanId","id"]],{note:"Record current pool loan in V5 book."}),e("backing_record_default","backing","recordDefault(uint256)",[["loanId","id"]],{note:"Reconcile a marked pool default and its stake burn."}),e("backing_collect","backing","collect(uint256[],uint32[]) returns (uint256)",[["agentIds","ids"],["generations","gens"]],{note:"Collect caller fees for explicitly selected generations; auto-add settings may retain stake."}),e("backing_fund","backing","fund(uint256)",[v],{approval:"usdg",note:"Donate USDG to V5 root backing; donor receives no withdrawable claim."}),e("backing_book","backing","getGen(uint256,uint32) view returns ((address owner,uint64 openedAt,uint8 status,bool ownerChanged,bool optOut,bool othersOff,bool pointsVoid,bool openRoomCharged,bool closedByOwner,bool movePending,bool splitPending,uint64 movePendingAt,uint8 tier,uint8 countedAtTier,uint8 listLen,uint32 tierStep,uint64 tierSince,uint64 lastLateAt,uint64 closedMark,uint64 lastRaiseAt,uint64 promoEpoch,uint64 stakeEpoch,uint64 placeEpoch,uint160 movePendingSqrt,uint256 roomLine,uint256 openLine,uint256 promoCredit,uint256 stakeRaised,uint256 placed,uint256 index,uint256 divisor,uint256 defaultProof,uint256 cLive,uint256 cUnits,uint256[3] list,uint256[3] counted,uint256[3] pendingTok,uint256[3] leavingLive,uint256[3] tokens,uint64[3] layerEnd,uint160[3] endSqrt,uint8[3] ownerEndMode,uint32[2][3] liveDay,uint32[3] leaveHead,(uint64 epoch,uint192 points)[5] points))",[o,_],s),e("backing_generation","backing","latestGen(uint256) view returns (uint32)",[o],s),e("backing_line","backing","lineOf(uint256) view returns (uint256)",[o],s),e("backing_quote","backing","needed(uint256,uint256,bool) view returns ((uint256 minA,uint256 fullLine,uint256 capA,uint160 sqrtP,uint8 k,uint8 kCached,bool depthGuard,uint256 line,uint256 ownerA,uint256 ownBacking,uint256 roomB,uint256 lineIfAdded,uint256 weekAfter))",[o,["tokens","uint"],["asOwner","bool"]],s),e("backing_position","backing","position(uint256,uint32,uint8,address) view returns ((uint256 counted,uint256 checkpoint,uint256 a0,uint256 a1,uint32 d0,uint32 d1,bool autoAdd))",[o,_,P,["holder","address"]],s),e("backing_record","backing","record(uint256,uint32,uint8,uint32,address) view returns ((uint256 counted,uint256 uncounted,uint256 creditedTo,uint160 sqrtLeave,uint8 mode,uint64 entry))",[o,_,P,D,["holder","address"]],s),e("backing_bucket","backing","leavingBucket(uint256,uint32,uint8,uint32) view returns ((bool exists,bool retired,uint64 latestLeave,uint64 releasableAt,uint256 loanCount,uint256 counted,uint256 uncounted,uint256 retireIndex))",[o,_,P,D],s),e("backing_settings","backing","settings() view returns (bool openBacking,uint256 premiumCap,uint256 maxSwapUsdg,uint256 openRoom,uint256 raiseRoom,uint256 vouchCap,uint8 minDrawK,bool premiumCheck,uint64 pausedUntil)",[],s),e("backing_reopen_at","backing","reopenAt(uint256) view returns (uint64)",[o],s),e("backing_sync_prices","backing","sync()",[],{note:"Update global V5 price/guard observations."}),e("backing_exit_service_open","backing","exitServiceOpen() view returns (bool)",[],s),e("backing_usdg_path","backing","usdgPathOpen(uint256) view returns (bool,uint8)",[["usdgIn","uint"]],s),e("backing_entry_rule","backing","entryRule() view returns (uint8 minEntryLoans,uint32 minEntryDays)",[],s),e("backing_target_premium","backing","targetPremiumBps(uint256) view returns (uint256)",[o],s),e("backing_price_cache","backing","priceCache() view returns (uint160 sqrtMedian,uint64 obsAt,uint160 sqrtWeekLow,uint160 sqrtObservation)",[],s),e("backing_pending_bucket","backing","pendingBucket(uint256,uint32,uint8,uint32) view returns ((uint128 amount,uint64 lastDeposit,bool merged,bool dead,uint256 mergeIndex))",[o,_,P,D],s),e("backing_exit_head","backing","exitHead() view returns (uint256 entryId,address holder,uint256 rest,uint160 sqrtPLeave,uint64 joinedAt)",[],s),e("backing_exit_entry","backing","entry(uint256) view returns ((uint256 id,uint32 gen,uint8 layer,uint32 day,address holder,uint64 joinedAt,uint64 prev,uint64 next))",[["entryId","uint"]],s),e("backing_flush","backing","flush()",[],{note:"Reconcile V5 fees and backing buffers; no payout to caller is promised."}),e("backing_claimable","backing","claimable(address) view returns (uint256)",[],{...s,args:["$wallet"]}),e("autopay_hold","autopay","hold(bool)",[Q],{note:"Hold/resume future autopay attempts for this wallet; allowances remain until explicitly revoked."}),e("autopay_max_cap","autopay","MAX_CAP() view returns (uint256)",[],s),e("autopay_window","autopay","WINDOW() view returns (uint64)",[],s),e("autopay_paused_until","autopay","pausedUntil() view returns (uint64)",[],s),e("autopay_plan","autopay","planOf(address,uint256) view returns (uint32 cap,address owner,bool on,bool useSavings,bool late,uint32 epoch)",[o],{...s,args:["$wallet","agentId"]}),e("autopay_check","autopay","check(uint256) view returns ((uint8 status,uint256 agentId,uint256 due,uint64 opens,uint64 closes,address wallet,uint256 fromWallet,uint256 fromWalletSavings,address owner,uint256 fromOwner,uint256 fromOwnerSavings))",[["loanId","id"]],s),e("autopay_epoch","autopay","epochOf(uint256) view returns (uint32 epoch,bool stale)",[o],s),e("autopay_held","autopay","held(address) view returns (bool)",[],{...s,args:["$wallet"]}),e("savings_deposit","savings","deposit(uint256,address) returns (uint256)",[v],{approval:"usdg",args:["amount","$wallet"],note:"Deposit own USDG into Priors default external Morpho savings vault; vault/allocator risk and withdrawal liquidity apply."}),e("savings_withdraw","savings","withdraw(uint256,address,address) returns (uint256)",[v],{args:["amount","$wallet","$wallet"],note:"Withdraw exact USDG amount from own savings. Insufficient liquidity fails the preview; no immediate exit is promised."}),e("savings_redeem","savings","redeem(uint256,address,address) returns (uint256)",[["shares","uint"]],{args:["shares","$wallet","$wallet"],note:"Redeem exact own savings shares to this wallet; liquidity and rounding apply."}),e("savings_balance","savings","balanceOf(address) view returns (uint256)",[],{...s,args:["$wallet"]}),e("savings_value","savings","previewRedeem(uint256) view returns (uint256)",[["shares","uint"]],s),...["market","market1"].flatMap((t,i)=>[e(`market_v${i===0?2:1}_listing`,t,"listingOf(uint256) view returns ((address seller,uint256 price,uint64 expiry,uint256 nonce,bytes32 uriHash,uint256 loansRepaid))",[o],s),e(`market_v${i===0?2:1}_record_hash`,t,"recordHash(uint256) view returns (bytes32)",[o],s),e(`market_v${i===0?2:1}_list`,t,"list(uint256,uint256,uint64)",[o,["price","uint"],["expiry","uint"]],{owner:"agentId",approval:"nft",note:"Owner sells this ERC-8004 NFT, its record and any followed treasury line. This does not transfer code, keys or servers. Approves only this NFT; confirm the sale terms and contract-enforced hold/line rules."}),e(`market_v${i===0?2:1}_cancel`,t,"cancel(uint256)",[o],{note:"Cancel the standing listing; NFT approval can remain until explicitly cleared."}),e(`market_v${i===0?2:1}_buy`,t,"buy(uint256,uint256,uint256,bytes32,bytes32)",[o,["maxPrice","uint"],["nonce","uint"],["uriHash","bytes32"],["recordHash","bytes32"]],{approval:"market",note:"Buy an ERC-8004 NFT to this wallet with exact live asking-price approval and pinned listing nonce, tokenURI and current credit record. A followed line still needs the new owner bond before borrowing. No keys/code/servers are included."})]),e("market_bid","market","bid(uint256,uint256,uint64,bytes32,uint256,uint256) returns (uint256)",[o,["price","uint"],["expiry","uint"],["uriHash","bytes32"],["minRepaid","uint"],["minLine","uint"],["reserveBudget","uint"]],{args:["agentId","price","expiry","uriHash","minRepaid","minLine"],approval:"bid",note:"Standing future purchase authority: another owner can fill this bid later without a new click. Exact reserveBudget USDG allowance is shared by all this wallet bids and replaces the old allowance. Cancel bid and clear unused budget deliberately."}),e("market_bid_any","market","bidAny(bytes32,uint256,uint256,uint64,uint256,uint256) returns (uint256)",[["root","bytes32"],["count","uint"],["price","uint"],["expiry","uint"],["minRepaid","uint"],["minLine","uint"],["reserveBudget","uint"]],{args:["root","count","price","expiry","minRepaid","minLine"],approval:"bid",note:"Standing future authority to buy count identities committed by the explicit Merkle root; shared exact reserveBudget USDG allowance. Inspect the committed ID list before authorizing. No code, keys or servers transfer."}),e("market_cancel_bid","market","cancelBid(uint256)",[["bidId","id"]],{note:"Cancel this bid; shared USDG allowance is unchanged so other bids can still fill."}),e("market_accept_bid","market","acceptBid(uint256,uint256,bytes32[],uint256)",[["bidId","id"],o,["proof","proof"],["minNet","uint"]],{owner:"agentId",approval:"nft",note:"Sell only this NFT into a currently valid bid; minNet pins seller USDG proceeds. Merkle proof and current bid rules are checked on chain during preview."}),e("market_bid_state","market","bidOf(uint256) view returns ((address maker,uint64 expiry,uint16 left,bool any,uint96 price,uint96 minLine,uint64 minRepaid,bytes32 target,bytes32 uriHash))",[["bidId","id"]],s),e("market_builder","market","builderOf(uint256) view returns ((address to,uint16 bps))",[o],s),e("market_set_builder","market","setBuilder(uint256,address,uint256)",[o,["to","address"],["bps","uint"]],{owner:"agentId",note:"Owner-only attribution before first sale; assigns future sale revenue share to to. Contract enforces enabled switch, no listing, and maximum 500 bps."}),e("market_change_builder","market","changeBuilder(uint256,address,uint256)",[o,["to","address"],["bps","uint"]],{note:"Current builder only; may lower or redirect own revenue share, never increase it."}),e("market_sale_split","market","saleSplit(uint256) view returns (uint256 fee,uint256 share,uint256 net)",[o],s),...["seats3","seats4"].flatMap((t,i)=>[e(`legacy_v${i+3}_close`,t,"close(uint256)",[o],{note:"Existing seat only. Close/freeze and return stake to original staker after final loan; default burn still applies. No new seats are opened."}),e(`legacy_v${i+3}_withdraw_offer`,t,"withdrawOffer(uint256,address)",[o],{args:["agentId","$wallet"],note:"Withdraw caller unaccepted offer; PRIORS returns to the staker."}),e(`legacy_v${i+3}_expire`,t,"expire(uint256)",[o],{note:"Expire idle seat under current contract rules."}),e(`legacy_v${i+3}_settle`,t,"settle(uint256,uint256)",[o,["loanId","id"]],{note:"Reconcile existing seat against pool loan/default after a missed hook."}),e(`legacy_v${i+3}_claim`,t,"claim(address) returns (uint256)",[],{args:["$wallet"],note:"Claim caller legacy seat USDG fees to this wallet."}),e(`legacy_v${i+3}_seat`,t,"getSeat(uint256) view returns ((address staker,uint64 openedAt,bool closing,uint8 status,uint128 line,uint128 burnBps,uint256 amount,uint256 feeMark,address owner))",[o],s),e(`legacy_v${i+3}_pending_fees`,t,"pendingFees(uint256) view returns (uint256)",[o],s),e(`legacy_v${i+3}_fees`,t,"feesOwed(address) view returns (uint256)",[],{...s,args:["$wallet"]}),e(`legacy_v${i+3}_offer`,t,"offers(uint256,address) view returns (uint256)",[o],{...s,args:["agentId","$wallet"]})])];function Y(t){return JSON.parse(JSON.stringify(t,(i,n)=>typeof n=="bigint"?n.toString():n))}function l(t,i,n=256){if(typeof t!="string"||!/^[0-9]+$/.test(t)||BigInt(t)>=1n<<BigInt(n))throw new u(`${i} must be a decimal base-unit string fitting uint${n}.`);return BigInt(t)}function se(t,[i,n]){let r=t[i];if(n==="address"){if(typeof r!="string"||!K.test(r))throw new u(`${i} must be a token or wallet address.`);return b(r)}if(n==="bool"){if(typeof r!="boolean")throw new u(`${i} must be true or false.`);return r}if(n==="bytes32"){if(typeof r!="string"||!/^0x[0-9a-fA-F]{64}$/.test(r))throw new u(`${i} must be bytes32.`);return r}if(n==="proof"){if(!Array.isArray(r)||r.length>32||!r.every(d=>typeof d=="string"&&/^0x[0-9a-fA-F]{64}$/.test(d)))throw new u("proof needs at most 32 bytes32 hashes.");return r}if(n==="bytes"){if(typeof r!="string"||!/^0x(?:[0-9a-fA-F]{2})*$/.test(r)||r.length>32770)throw new u(`${i} must be bounded hexadecimal bytes.`);return r}if(n==="ids"||n==="gens"){if(!Array.isArray(r)||r.length===0||r.length>100)throw new u(`${i} needs 1 to 100 decimal strings.`);return r.map(d=>l(d,i,n==="gens"?32:256))}let a=l(r,i,n==="uint8"?8:n==="uint32"?32:256);if(n==="id"&&a===0n)throw new u(`${i} must be positive.`);if(i==="exitMode"&&a>2n)throw new u("exitMode must be 0 (hold), 1 (PRIORS), or 2 (USDG queue).");if(i==="layer"&&a>2n)throw new u("layer must be 0, 1, or 2.");return a}var R=x.amount("USDG",6,"1000000"),L=x.amount("PRIORS",18,"1000000000000000000"),H='Amount of the stock token in base units (read its decimals with priors_stock_asset_state). Example: "1000000000000000000" = 1 token at 18 decimals.',ue={priors_root_enroll:R,priors_root_add_stake:R,priors_root_vouch:R,priors_root_unvouch:R,priors_root_offer:R,priors_fund_reserve:R,priors_backing_fund:R,priors_savings_deposit:R,priors_savings_withdraw:R,priors_stock_open:H,priors_stock_add:H,priors_stock_value:H,priors_backing_open:L,priors_backing_add:L,priors_backing_leave:L},B={agentId:'ERC-8004 agent ID, as a decimal string. Example: "437".',sponsorId:'ERC-8004 ID of the sponsor root, as a decimal string. Example: "6228".',loanId:x.id("Priors pool loan"),bidId:x.id("AgentMarket V2 bid"),entryId:x.id("V5 exit-queue entry"),delegate:"Address to appoint as pool delegate (borrow and repay only, never identity transfer); the zero address clears it.",frozen:"true freezes the agent line; false unfreezes it.",premiumBps:"Loan premium in basis points (50 = 0.5%); at most the owner-consented cap.",maxPremiumBps:'Owner-consented maximum sponsor premium in basis points (50 = 0.5%), at most 200. Default "0".',hook:"Address of the root lending-policy hook contract (0x followed by 40 hex digits).",expiry:"Expiry in Unix seconds. Market listings and bids allow at most 30 days ahead; a V5 invite uses its issued expiry.",invite:"Treasury V5 inviter signature bytes as 0x hex, exactly as issued.",token:"Address of the stock token (0x followed by 40 hex digits); it must be an accepted Priors stock collateral.",maxLoans:"Loan count bound passed to reconcile, as a decimal string; this contract version ignores it.",feed:"Address of the public oracle price feed to record (0x followed by 40 hex digits).",maxRounds:"Maximum oracle rounds to record in this call, as a decimal string.",autoAdd:"true compounds rewards into the stake at risk; false leaves them out.",priorsIn:x.amount("PRIORS",18,"1000000000000000000"),usdgIn:x.amount("USDG",6,"1000000"),minOut:"Minimum PRIORS received from the USDG conversion, in base units (PRIORS has 18 decimals); must be positive when usdgIn is.",deadline:"Deadline in Unix seconds, within the next hour. Example: 1800000000.",exitMode:x.enumValues({0:"hold",1:"return PRIORS",2:"request USDG through the guarded exit queue"}),generation:"V5 book generation number, as a decimal string; read it from priors_backing_generation or chain events.",day:"Day bucket number, as a decimal string, read from chain events; never guess it.",layer:'Backing layer "0", "1" or "2", as recorded in chain events.',holder:"Address of the stake holder; any payout goes only to this holder.",minUsdgOut:'"0" returns PRIORS; a positive value requests a guarded USDG sale with this minimum, in USDG base units (6 decimals).',agentIds:"ERC-8004 agent IDs as decimal strings, paired by position with generations (1 to 100).",generations:"Generation numbers as decimal strings, paired by position with agentIds.",tokens:'PRIORS amount in base units (PRIORS has 18 decimals) passed to the contract needed() quote. Example: "0".',asOwner:"true quotes as the agent owner; false as another backer.",price:'Price per identity in USDG base units (6 decimals); minimum "5000000" = 5 USDG.',maxPrice:"Highest asking price you accept, in USDG base units (6 decimals); read the listing first.",nonce:"Listing nonce from the listing read, as a decimal string; it pins the exact listing.",uriHash:"bytes32 hash of the agent tokenURI (0x followed by 64 hex digits), from the listing or priors_market_pins.",recordHash:"bytes32 hash of the agent credit record (0x followed by 64 hex digits), from priors_market_v1/v2_record_hash.",minRepaid:"Minimum repaid-loan count in the agent record for the bid to fill, as a decimal string.",minLine:"Minimum credit line the agent must carry for the bid to fill, in USDG base units (6 decimals).",reserveBudget:"Exact USDG allowance shared by all bids of this wallet, in base units (6 decimals); must cover price times count.",root:"Merkle root (bytes32) committing the agent ID list; rebuild it with priors_market_origin.",count:"Number of identities to buy from the committed list, 1 to 20, as a decimal string.",proof:"Merkle proof for this agent in the bid root: at most 32 bytes32 hashes.",minNet:"Minimum seller USDG proceeds, in base units (USDG has 6 decimals).",to:x.recipient("builder sale share recipient"),bps:"Builder sale share in basis points (50 = 0.5%); at most 500.",on:"true turns this setting on; false turns it off.",cap:'Per-loan repayment cap in USDG base units (USDG has 6 decimals), at most the contract MAX_CAP. Example: "5000000" = 5 USDG.',budget:"Total USDG allowance for AutoRepay in base units (6 decimals); at least cap, and shared by all plans of this wallet.",savingsShares:'Savings vault share allowance in base units (read the vault decimals); "0" disables savings use.',late:"AutoRepay late flag stored in the plan (true or false); read priors_autopay_plan to confirm it.",continuation:"Opaque state from the previous step; pass it back unchanged. Never build it by hand.",signature:"Local signature for the confirmed step, as 0x hex; the bridge supplies it. Never a key."},de={priors_root_unlock:"Root pool shares to withdraw, in pool share base units (read root_shares); not USDG.",priors_savings_redeem:"Savings vault shares to redeem, in base units (read the vault decimals); not USDG.",priors_savings_value:"Savings vault shares to value, in base units (read the vault decimals); not USDG."};function le(t,i){return i==="amount"?ue[t]:i==="shares"?de[t]:t==="priors_autopay_hold"&&i==="on"?"true holds future autopay attempts; false resumes them.":B[i]}function ce(t,i,n){let r=le(t,i);return r===void 0?n:{...n,description:r}}function F(t,i,n={}){return{type:"object",additionalProperties:!1,required:i.map(([r])=>r),properties:Object.fromEntries([...i.map(([r,a])=>[r,ce(t,r,a==="bool"?{type:"boolean"}:a==="address"?X:a==="proof"?{type:"array",maxItems:32,items:{type:"string",pattern:"^0x[0-9a-fA-F]{64}$"}}:a==="ids"||a==="gens"?{type:"array",maxItems:100,items:V()}:{type:"string",...a==="bytes32"?{pattern:"^0x[0-9a-fA-F]{64}$"}:a!=="bytes"?{pattern:"^[0-9]+$"}:{}})]),...Object.entries(n)])}}async function I(t,i,n,r=[]){let a=[`function ${n}`],d=A(a);return t.clientFor(f).readContract({address:i,abi:d,functionName:d[0].name,args:r})}async function U(t,i){return b(await t.clientFor(f).readContract({address:c.registry,abi:ne,functionName:"ownerOf",args:[i]}))}function E(t){if(t.network==="testnet")throw new u("Priors ecosystem features are configured only on chain 4663.")}function M(t,i,n,r,a,d="0"){return{domain:Z(),types:{Consent:[...J.Consent]},primaryType:"Consent",message:{agentId:t,sponsorId:i,owner:b(n),nonce:r,deadline:a,maxPremiumBps:d}}}async function j(t,i,n){if(!i||!i.request||T(i.request)!==T(n)||typeof i.signature!="string"||!/^0x(?:[a-fA-F0-9]{2}){1,4096}$/.test(i.signature))throw new u("Consent differs from this agent, sponsor, owner, premium cap, nonce or deadline.");let r=n.message.owner,a=await t.clientFor(f).getCode({address:r});if(a&&a!=="0x"){if(await t.clientFor(f).readContract({address:r,abi:re,functionName:"isValidSignature",args:[T(n),i.signature]})!=="0x1626ba7e")throw new u("The owner contract rejected the consent signature.")}else if(!C(await ie({...n,signature:i.signature}),r))throw new u("The consent signature is not from the current agent owner.")}function pe(t,i,n,r,a,d){let g=te.find(k=>k.name===t),p=t==="priors_sign_consent"?l(i.sponsorId,"sponsorId"):g?.consentRoot;if(!p||a.stage!=="priors_consent"||a.tool!==t||a.wallet!==b(n)||a.chainId!==f||a.agentId!==i.agentId||r.length!==1||r[0]?.kind!=="typedData")throw new u("Unexpected Priors consent continuation.");let w=l(a.nonce,"nonce").toString(),h=l(a.deadline,"deadline");if(h<=BigInt(d)||h>BigInt(d+3600))throw new u("Priors consent expired or exceeds its one-hour window.");let y=M(String(i.agentId),p.toString(),n,w,h.toString(),String(i.maxPremiumBps??"0"));if(!r[0].request||T(r[0].request)!==T(y))throw new u("Priors consent differs from the requested agent, root, owner or premium.")}async function ee(t,i,n,r,a){let d=l(n.agentId,"agentId");if(!C(await U(t,d),r))throw new u("This operation requires the current identity owner wallet; a delegate cannot consent. Use the owner wallet.");let g=await t.clientFor(f).readContract({address:c.pool,abi:z,functionName:"nonces",args:[d]}),p=n.continuation,w=p?l(p.deadline,"deadline"):BigInt(Math.floor(Date.now()/1e3)+1800),h=l(n.maxPremiumBps??"0","maxPremiumBps");if(n.signature!==void 0&&!n.continuation)throw new u("A signature needs its locally confirmed Priors consent continuation.");if(h>200n)throw new u("maxPremiumBps exceeds the pool maximum of 200.");let y=M(d.toString(),a.toString(),r,g.toString(),w.toString(),h.toString());if(!p)return{steps:[{kind:"typedData",request:y}],continuation:{stage:"priors_consent",tool:i,wallet:r,chainId:f,agentId:d.toString(),nonce:g.toString(),deadline:w.toString()},summary:`Owner consent to sponsor #${a} for agent #${d}, premium cap ${h} bps; expires ${w}. No funds move from this signature. The local bridge must confirm the exact EIP-712 fields.`};if(pe(i,n,r,[{kind:"typedData",request:y}],p,Math.floor(Date.now()/1e3)),String(p.nonce)!==g.toString())throw new u("Priors consent nonce changed. Start the action again.");let k={request:y,signature:n.signature};return await j(t,k,y),{signedConsent:k}}async function ge(t,i,n,r){let a=c[i.contract],d=(p,w)=>w>0n?[t.approval(p,a,w.toString(),f)]:[];if(i.approval==="nft"){let p=l(n.agentId,"agentId"),w=await Promise.all([c.market,c.market1].map(h=>I(t,h,"listingOf(uint256) view returns ((address seller,uint256 price,uint64 expiry,uint256 nonce,bytes32 uriHash,uint256 loansRepaid))",[p])));for(let h of w){if(!h||typeof h!="object"||!("seller"in h)||typeof h.seller!="string")throw new u("Could not verify standing listings on both Priors markets; no NFT approval was built.");if(C(h.seller,r))throw new u("A standing listing in Priors market V1 or V2 could reactivate when NFT approval mines. Cancel it with priors_market_v1_cancel or priors_market_v2_cancel, verify both listings are cleared, then retry. No approval was built.")}return[t.approval(c.registry,a,p.toString(),f)]}if(i.approval==="market"){let p=await I(t,a,"listingOf(uint256) view returns ((address seller,uint256 price,uint64 expiry,uint256 nonce,bytes32 uriHash,uint256 loansRepaid))",[l(n.agentId,"agentId")]);if(p.price<=0n||p.price>l(n.maxPrice,"maxPrice")||p.nonce!==l(n.nonce,"nonce")||!C(p.uriHash,String(n.uriHash)))throw new u("Listing price, nonce or URI changed; read the listing again.");return d(c.usdg,p.price)}if(i.approval==="bid"){let p=l(n.reserveBudget,"reserveBudget");if(p>=1n<<128n||p<l(n.price,"price")*l(n.count??"1","count"))throw new u("Provide a finite exact bid reserve covering price times count.");return[t.approval(c.usdg,c.bidSpender,p.toString(),f)]}if(i.approval==="bond")return d(c.usdg,BigInt(await I(t,c.bond,"amount() view returns (uint256)")));if(i.approval==="mixed"){let p=l(n.priorsIn,"priorsIn"),w=l(n.usdgIn,"usdgIn");if(p+w===0n)throw new u("Provide a positive PRIORS or USDG input.");if(w>0n&&l(n.minOut,"minOut")===0n)throw new u("USDG conversion requires a positive minimum PRIORS output.");return[...d(c.priors,p),...d(c.usdg,w)]}if(!i.approval)return[];let g=l(n.amount,"amount");if(g===0n)throw new u("amount must be positive.");if(i.approval==="stock"){let p=i.name==="priors_stock_open"?b(String(n.token)):b((await I(t,c.stock,"getPosition(uint256) view returns ((address depositor,address owner,address token,uint64 openedAt,bool closing,uint8 status,uint128 line,uint256 amount))",[l(n.agentId,"agentId")])).token);if(p===ae)throw new u("No stock collateral position exists.");return d(p,g)}return d(c[i.approval],g)}function _e(t){let i=te.map(n=>({name:n.name,inputSchema:{...F(n.name,n.fields,n.consentRoot?{maxPremiumBps:V(B.maxPremiumBps),continuation:{type:"object",description:B.continuation},signature:{type:"string",pattern:"^0x([a-fA-F0-9]{2})+$",description:B.signature},...n.externalConsent?{signedConsent:{type:"object",description:"Optional public owner signature from priors_sign_consent; controller may supply collateral. Never pass a key."}}:{}}:{}),description:n.note||"Read current Priors contract state. All amounts are token base-unit decimal strings."},async execute(r,a){E(t),a=b(a);let d=Object.fromEntries(n.fields.map(m=>[m[0],se(r,m)]));if(n.owner&&!(n.externalConsent&&r.signedConsent)&&!C(await U(t,d[n.owner]),a))throw new u("Owner-only feature: call from the current identity owner wallet. Nothing was signed.");if(n.contract==="savings"&&b(String(await I(t,c.savings,"asset() view returns (address)")))!==c.usdg)throw new u("The savings vault asset is not USDG. Nothing was signed.");if(n.contract==="autopay"&&await I(t,c.autopay,"VERSION() view returns (uint256)")!==2n)throw new u("AutoRepay VERSION is not 2. Nothing was signed.");if(n.contract==="market"||n.contract==="market1"){if(r.expiry!==void 0){let m=l(r.expiry,"expiry",64),S=BigInt(Math.floor(Date.now()/1e3));if(m<=S||m>S+2592000n)throw new u("Market expiry must be within 30 days.")}if(r.price!==void 0&&l(r.price,"price")<5000000n)throw new u("Market price minimum is 5 USDG.");if(r.count!==void 0&&(l(r.count,"count")<1n||l(r.count,"count")>20n))throw new u("Bid count must be 1 to 20.")}if(n.name==="priors_treasury_first_line"&&l(r.expiry,"expiry",64)<=BigInt(Math.floor(Date.now()/1e3)))throw new u("Treasury V5 invite expired.");if(r.deadline!==void 0){let m=l(r.deadline,"deadline"),S=BigInt(Math.floor(Date.now()/1e3));if(m<=S||m>S+3600n)throw new u("deadline must be in the next hour.")}if(r.agentIds&&r.agentIds.length!==r.generations.length)throw new u("agentIds and generations must have equal length.");let g;if(n.consentRoot)if(n.externalConsent&&r.signedConsent){if(g=r.signedConsent,!g.request?.message)throw new u("Provide the public signedConsent from the current identity owner.");let m=l(r.agentId,"agentId"),S=await U(t,m),q=await t.clientFor(f).readContract({address:c.pool,abi:z,functionName:"nonces",args:[m]}),N=l(g.request.message.deadline,"consent deadline");if(N<=BigInt(Math.floor(Date.now()/1e3)))throw new u("Owner consent expired.");let W=l(r.maxPremiumBps??"0","maxPremiumBps");if(W>200n)throw new u("maxPremiumBps exceeds the pool cap.");await j(t,g,M(m.toString(),n.consentRoot.toString(),S,q.toString(),N.toString(),W.toString()))}else{let m=await ee(t,n.name,r,a,n.consentRoot);if("steps"in m)return m;g=m.signedConsent}let p=(n.args??n.fields.map(([m])=>m)).map(m=>m==="$wallet"?a:m==="$consent"?g.request.message:m==="$signature"?g.signature:d[m]),w=A([n.signature]),h=w[0].name;if(n.read)return{chainId:f,contract:c[n.contract],units:"Base units; USDG 6 decimals, PRIORS 18 decimals; stock/savings scales come from token metadata.",value:Y(await t.clientFor(f).readContract({address:c[n.contract],abi:w,functionName:h,args:p}))};let y=[...await ge(t,n,r,a),t.unsignedTx({to:c[n.contract],data:G({abi:w,functionName:h,args:p}),value:"0",chainId:f,description:`${n.name}: ${n.note}`})],k=await t.preview(y,a);return{txs:y,summary:`${n.note} Inputs (base units): ${JSON.stringify(Y(d))}. ${k.summary}`}}}));return i.push({name:"priors_sign_consent",inputSchema:F("priors_sign_consent",[o,["sponsorId","id"],["maxPremiumBps","uint"]],{continuation:{type:"object",description:B.continuation},signature:{type:"string",pattern:"^0x([a-fA-F0-9]{2})+$",description:B.signature}}),async execute(n,r){return E(t),ee(t,"priors_sign_consent",n,b(r),l(n.sponsorId,"sponsorId"))}}),i.push({name:"priors_root_offer",inputSchema:F("priors_root_offer",[["sponsorId","id"],o,v,["premiumBps","uint"]],{signedConsent:{type:"object",description:"The current agent owner output of priors_sign_consent. This is public signed authorization, never a private key."}}),async execute(n,r){E(t),r=b(r);let a=l(n.sponsorId,"sponsorId"),d=l(n.agentId,"agentId");if(!C(await U(t,a),r))throw new u("Only the sponsor root owner can send this offer.");let g=n.signedConsent;if(!g?.request?.message)throw new u("Ask the current agent owner to run priors_sign_consent from their wallet first.");let p=g.request.message,w=await t.clientFor(f).readContract({address:c.pool,abi:z,functionName:"nonces",args:[d]}),h=l(p.deadline,"consent deadline");if(h<=BigInt(Math.floor(Date.now()/1e3)))throw new u("Owner consent expired; request a fresh consent.");let y=l(n.premiumBps,"premiumBps"),k=l(p.maxPremiumBps,"maxPremiumBps");if(y>k||k>200n)throw new u("premiumBps exceeds the owner consent or pool cap.");let m=M(d.toString(),a.toString(),await U(t,d),w.toString(),h.toString(),k.toString());await j(t,g,m);let S=A([`function vouchWithConsent(uint256,uint256,uint256,uint256,${$},bytes)`]),q=[t.unsignedTx({to:c.pool,data:G({abi:S,functionName:"vouchWithConsent",args:[a,d,l(n.amount,"amount"),y,m.message,g.signature]}),value:"0",chainId:f,description:"Sponsor-owned backing handoff with exact current-owner consent."})],N=await t.preview(q,r);return{txs:q,summary:`Vouch ${n.amount} USDG base units from sponsor #${a} to agent #${d}; ${y} bps premium (cap ${k}). Replaces its old sponsor only with no loan open. ${N.summary}`}}}),i.push(...me(t)),{tools:i}}function me(t){return[{name:"priors_autopay_on",inputSchema:F("priors_autopay_on",[o,["cap","uint"],["budget","uint"],["savingsShares","uint"],["late","bool"]]),async execute(i,n){E(t),n=b(n);let r=l(i.agentId,"agentId"),a=l(i.cap,"cap"),d=l(i.budget,"budget"),g=l(i.savingsShares,"savingsShares");if(typeof i.late!="boolean")throw new u("late must be true or false.");if(await I(t,c.autopay,"VERSION() view returns (uint256)")!==2n)throw new u("AutoRepay VERSION is not 2.");let p=await I(t,c.autopay,"MAX_CAP() view returns (uint256)");if(a===0n||a>p||a>=1n<<32n||d<a||d===(1n<<256n)-1n||g===(1n<<256n)-1n)throw new u("Provide a positive supported per-loan cap and explicit finite budget at least cap; unlimited approvals are refused.");let w=await t.clientFor(f).readContract({address:c.registry,abi:ne,functionName:"getAgentWallet",args:[r]});if(b(w)!==n)throw new u("Autopay enrollment requires the ERC-8004 declared agent wallet, not just its owner or pool delegate.");if(g>0n&&b(String(await I(t,c.savings,"asset() view returns (address)")))!==c.usdg)throw new u("Savings asset is not USDG.");let h=g>0n?await I(t,c.savings,"previewRedeem(uint256) view returns (uint256)",[g]):0n,y=A(["function enroll(uint256,uint256,bool,bool)"]),k=[t.approval(c.usdg,c.autopay,d.toString(),f),t.approval(c.savings,c.autopay,g.toString(),f),t.unsignedTx({to:c.autopay,data:G({abi:y,functionName:"enroll",args:[r,a,g>0n,i.late]}),value:"0",chainId:f,description:"Enroll future autopay with explicit finite USDG and savings share budgets."})],m=await t.preview(k,n);return{txs:k,summary:`Persistent future spending authorization: AutoRepay v2 can repay agent #${r} loans without a confirmation per loan, at most ${a} USDG base units per loan; exact total wallet allowance ${d} USDG base units and ${g} savings shares (currently ${h} USDG base units). These two allowances replace the budgets shared by ALL this wallet autopay plans, including setting savings allowance to zero when disabled. late=${i.late}; savings=${g>0n}. Revoke with priors_autopay_off, which also clears both allowances. ${m.summary}`}}},{name:"priors_autopay_off",inputSchema:F("priors_autopay_off",[o]),async execute(i,n){E(t),n=b(n);let r=A(["function revoke(uint256)"]),a=[t.unsignedTx({to:c.autopay,data:G({abi:r,functionName:"revoke",args:[l(i.agentId,"agentId")]}),value:"0",chainId:f,description:"Revoke own autopay plan."}),t.approval(c.usdg,c.autopay,"0",f),t.approval(c.savings,c.autopay,"0",f)],d=await t.preview(a,n);return{txs:a,summary:`Revoke this wallet autopay plan and zero both shared AutoRepay allowances. This also stops funding other plans using this wallet. ${d.summary}`}}}]}export{oe as a,O as b,te as c,Y as d,l as e,M as f,pe as g,_e as h};
|
|
1
|
+
import{m as J,n as Z}from"./4NBXBKOX.js";import{a as x}from"./G2LAO23N.js";import{a as V}from"./66F5ZH34.js";import{b as K,c as X,g as C}from"./NWNYJ26T.js";import{b as f}from"./TI727O2H.js";import{a as u}from"./XSD5NL7J.js";import{encodeFunctionData as G,getAddress as b,hashTypedData as T,parseAbi as A,recoverTypedDataAddress as ie}from"viem";var oe={pool:b("0x281210097f0de7A8FB6F87310AF0f089c9C8DE21"),registry:b("0x8004A169FB4a3325136EB29fA0ceB6D2e539a432"),usdg:b("0x5fc5360D0400a0Fd4f2af552ADD042D716F1d168"),priors:b("0xeDBf91223639800BCd5756815CAf908Df3b890bE"),stock:b("0xbEcd07EC689988e16b870C121756C4c2C8cb02B6"),backing:b("0xC999014C6218EC41f0aE412d49AE8f2aA4c539fD"),treasury:b("0xFe8fdf43c4b0443aCF8E8CD8facD62F1B770e267"),bond:b("0x346d3360B7258a18E8a2a55fe20E0F467113a53A"),autopay:b("0x72B510AF4e66e5960aB9b975e0BdCf80239e83A0"),savings:b("0xBeEff033F34C046626B8D0A041844C5d1A5409dd"),market:b("0x6a4583242B8313313E684d02aB7dc6bFf8749670"),market1:b("0xe5C8b3FacD7802099C1DfB88c0C818Cd0ebA7B19"),bidSpender:b("0x0dbd031a3e8cc91C2b0A3Bf6BD1d14c7AeD92878"),seats3:b("0x59D155C42A9263fA7596867b992bB3e84dF680a9"),seats4:b("0xb1c3a04496238D62E3c93118C297163855e22192")},c=oe,$="(uint256 agentId,uint256 sponsorId,address owner,uint256 maxPremiumBps,uint256 nonce,uint256 deadline)",ne=A(["function ownerOf(uint256) view returns (address)","function getAgentWallet(uint256) view returns (address)"]),z=A(["function nonces(uint256) view returns (uint256)"]),re=A(["function isValidSignature(bytes32,bytes) view returns (bytes4)"]),ae="0x0000000000000000000000000000000000000000",O="Owner stake is collateral, not a return. A default burns 75% of owner stake (50% of other backing); pending and leaving stake remains at risk until released. New backing waits 24 hours. Exit mode 0 holds, 1 returns PRIORS, 2 requests USDG through the guarded exit queue; no immediate payout is promised.",e=(t,i,n,r,a={})=>({name:`priors_${t}`,contract:i,signature:`function ${n}`,fields:r,note:"",...a}),o=["agentId","id"],v=["amount","uint"],Q=["on","bool"],_=["generation","uint32"],D=["day","uint32"],P=["layer","uint8"],s={read:!0},te=[e("set_delegate","pool","setDelegate(uint256,address)",[o,["delegate","address"]],{owner:"agentId",note:"Owner only. Delegate controls borrowing/repayment, not transfer of identity; clear with the zero address."}),e("root_enroll","pool","enrollRoot(uint256,uint256)",[o,v],{owner:"agentId",approval:"usdg",note:"Owner only. Locks USDG pool shares behind this sponsor root; active delegated lines and fees constrain withdrawals."}),e("root_add_stake","pool","addStake(uint256,uint256)",[o,v],{approval:"usdg",note:"Anyone may add USDG; only the root owner can withdraw it. This may give funds to another owner."}),e("root_unlock","pool","unlock(uint256,uint256,address)",[o,["shares","uint"]],{owner:"agentId",args:["agentId","shares","$wallet"],note:"Owner only. Withdraw root pool shares to this wallet, subject to delegated backing and fee locks."}),e("root_retire","pool","retireRoot(uint256)",[o],{owner:"agentId",note:"Owner only; requires no remaining stake or delegated lines."}),e("root_vouch","pool","vouch(uint256,uint256,uint256)",[["sponsorId","id"],o,v],{owner:"sponsorId",note:"Owner of sponsor only. Adds the exact USDG amount of undrawn backing to an existing sponsored line."}),e("root_unvouch","pool","unvouch(uint256,uint256,uint256)",[["sponsorId","id"],o,v],{owner:"sponsorId",note:"Owner of sponsor only. Recalls undrawn backing; outstanding debt remains backed."}),e("root_freeze","pool","freeze(uint256,bool)",[o,["frozen","bool"]],{note:"Current sponsor owner only; freeze/unfreeze the agent line. Contract checks sponsor ownership."}),e("root_set_premium","pool","setPremium(uint256,uint256)",[o,["premiumBps","uint"]],{note:"Current sponsor owner only. Future loan premium cannot exceed the owner-consented cap."}),e("root_claim_fees","pool","claimSponsorFees(uint256,address)",[o],{owner:"agentId",args:["agentId","$wallet"],note:"Owner only; claim sponsor USDG fees to this wallet."}),e("root_set_hook","pool","setHook(uint256,address)",[o,["hook","address"]],{owner:"agentId",note:"Owner only. Changes root lending policy hook; pool enforces the delay while backing is committed."}),e("root_apply_hook","pool","applyHook(uint256)",[o],{note:"Apply a previously scheduled root hook after its on-chain delay."}),e("mark_default","pool","markDefault(uint256)",[["loanId","id"]],{note:"Irreversible: mark a past-grace unpaid loan defaulted, burn sponsor backing and mark the owner. Preview and confirm deliberately."}),e("import_history","pool","importFromV1(uint256)",[o],{note:"Import the v1 record, including defaults; this never imports unbacked capacity."}),e("fund_reserve","pool","fundReserve(uint256)",[v],{approval:"usdg",note:"Donate USDG to the pool reserve; receives no redeemable shares."}),e("root_shares","pool","rootShares(uint256) view returns (uint256)",[o],s),e("root_fee_locked","pool","feeLocked(uint256) view returns (uint256)",[o],s),e("root_fees_owed","pool","sponsorFees(uint256) view returns (uint256)",[o],s),e("root_backing","pool","backing(uint256) view returns (uint256)",[o],s),e("root_free_backing","pool","freeBacking(uint256) view returns (uint256)",[o],s),e("pool_parameters","pool","getParams() view returns ((uint256 minLoan,uint256 maxLoan,uint64 minTerm,uint64 maxTerm,uint64 grace,uint64 minScoreTerm,uint256 feeBps,uint256 sponsorFeeBps,uint256 protocolFeeBps,uint256 minStake,uint256 maxUtilizationBps,uint256 keeperBounty))",[],s),e("bond_deposit","bond","deposit(uint256)",[o],{owner:"agentId",approval:"bond",note:"Owner only. V2 treasury bond remains locked while any line or loan is open; it may replace and refund a former owner bond. Leave and release the legacy bond before Treasury V5 migration."}),e("bond_release","bond","release(uint256)",[o],{note:"Return V2 bond to its original depositor, not necessarily this wallet; contract enforces no line, no loan and age."}),e("bond_slash","bond","slash(uint256)",[o],{note:"Irreversible: send defaulted agent V2 bond to the configured beneficiary."}),e("bond_status","bond","bonds(uint256) view returns ((address depositor,uint64 at,uint256 amount))",[o],s),e("bond_releasable","bond","releasable(uint256) view returns (bool)",[o],s),e("bond_release_at","bond","unusedReleaseAt(uint256) view returns (uint256)",[o],s),e("treasury_move","treasury",`move(uint256,${$},bytes)`,[o],{owner:"agentId",consentRoot:8793n,externalConsent:!0,args:["agentId","$consent","$signature"],note:"Move a former Treasury V4 line to V5, no loan open. Close old line, release legacy bond, deposit V2 bond first. V4 record and current-owner V2 bond are required."}),e("treasury_raise","treasury","raise(uint256)",[o],{note:"Raise an eligible Treasury V5 line using its current rules, score, history, age, weekly room and free backing. No unbacked credit."}),e("treasury_reclaim","treasury","reclaim(uint256)",[o],{note:"Reclaim an idle treasury line under on-chain rules; this ends borrowing access."}),e("treasury_first_line","treasury",`firstLine(uint256,uint64,bytes,${$},bytes)`,[o,["expiry","uint"],["invite","bytes"]],{owner:"agentId",consentRoot:8793n,externalConsent:!0,args:["agentId","expiry","invite","$consent","$signature"],note:"Redeem an already-issued Treasury V5 invite with V5 pool consent. Requires a valid V5 inviter signature; the current owner V2 bond is needed before borrowing. V4 invites cannot be reused."}),e("treasury_raise_room","treasury","raiseRoom() view returns (uint256)",[],s),e("treasury_first_lined","treasury","firstLined(uint256) view returns (bool)",[o],s),e("treasury_eligible_raise","treasury","eligibleForRaise(uint256) view returns (bool)",[o],s),e("treasury_room","treasury","epochRoom() view returns (uint256)",[],s),e("treasury_rules","treasury","rules() view returns (uint256 reserveBps,uint256 firstLine,uint256 secondLine,uint256 epochCap,uint64 epochLength,uint64 minSeasoning,uint256 minQualified,uint256 minScore,uint64 idleAfter)",[],s),e("stock_open","stock",`open(uint256,address,uint256,${$},bytes) returns (uint256)`,[o,["token","address"],v],{owner:"agentId",consentRoot:6424n,externalConsent:!0,approval:"stock",args:["agentId","token","amount","$consent","$signature"],note:"Owner or on-chain controller with a supplied owner consent posts exact collateral. Token must be accepted and usable; live price, LTV, line cap and backing determine the line. Default seizes debt plus buffer; issuer restrictions and burns may reduce returned collateral."}),e("stock_add","stock","addCollateral(uint256,uint256)",[o,v],{approval:"stock",note:"Depositor only. Adds exact position token collateral; contract decides resulting draw room."}),e("stock_close","stock","close(uint256)",[o],{note:"Depositor or controller closes/freezes the line; collateral pays its depositor after the last loan, subject to default and issuer shortfalls."}),e("stock_expire","stock","expire(uint256)",[o],{note:"Expire idle stock line after on-chain idle rules; may close borrowing access."}),e("stock_reconcile","stock","reconcile(uint256,uint256)",[o,["maxLoans","uint"]],{note:"Reconcile the collateral debt walk against pool loans; contract ignores maxLoans in this implementation."}),e("stock_settle","stock","settle(uint256,uint256)",[o,["loanId","id"]],{note:"Reconcile stock collateral after a default or missed hook; may seize collateral according to the loan."}),e("stock_record_feed","stock","record(address,uint256) returns (uint80)",[["feed","address"],["maxRounds","uint"]],{note:"Advance public oracle price tape; may unblock new stock lines and default settlement."}),e("stock_reclaim","stock","reclaim(uint256)",[o],{note:"Reclaim a written-off stock position after it is no longer backed; return remains subject to vault token shortfall."}),e("stock_state","stock","getPosition(uint256) view returns ((address depositor,address owner,address token,uint64 openedAt,bool closing,uint8 status,uint128 line,uint256 amount))",[o],s),e("stock_borrow_room","stock","borrowRoom(uint256) view returns (uint256)",[o],s),e("stock_asset_state","stock","assets(address) view returns (address feed,uint64 maxAge,uint8 tokenDecimals,uint8 feedDecimals,bool enabled,uint16 ltvBps,uint128 lineCap)",[["token","address"]],s),e("stock_lending_status","stock","lendStatus(address) view returns (uint8)",[["token","address"]],s),e("stock_value","stock","valueOf(address,uint256) view returns (bool ok,uint256 value)",[["token","address"],v],s),e("stock_ltv","stock","ltvOf(uint256,address) view returns (uint256)",[o,["token","address"]],s),e("backing_open","backing",`open(uint256,uint256,bool,${$},bytes)`,[o,v,["autoAdd","bool"]],{owner:"agentId",consentRoot:8762n,approval:"priors",args:["agentId","amount","autoAdd","$consent","$signature"],note:O}),e("backing_open_with_usdg","backing",`openWithUsdg(uint256,uint256,uint256,uint256,uint256,bool,${$},bytes)`,[o,["priorsIn","uint"],["usdgIn","uint"],["minOut","uint"],["deadline","uint"],["autoAdd","bool"]],{owner:"agentId",consentRoot:8762n,approval:"mixed",args:["agentId","priorsIn","usdgIn","minOut","deadline","autoAdd","$consent","$signature"],note:O}),e("backing_add","backing","back(uint256,uint256,bool)",[o,v,["autoAdd","bool"]],{approval:"priors",note:O+" Owner-only at launch; other backers require both global and individual permission."}),e("backing_add_with_usdg","backing","backWithUsdg(uint256,uint256,uint256,uint256,uint256,bool)",[o,["priorsIn","uint"],["usdgIn","uint"],["minOut","uint"],["deadline","uint"],["autoAdd","bool"]],{approval:"mixed",note:O}),e("backing_leave","backing","leave(uint256,uint256,uint8)",[o,v,["exitMode","uint8"]],{note:O}),e("backing_close","backing","close(uint256,uint8)",[o,["exitMode","uint8"]],{note:O}),...["refresh","promote","expire","sync","pokeFees","recordRepay","noteDelegate"].map(t=>e(`backing_${t.replace(/[A-Z]/g,i=>`_${i.toLowerCase()}`)}`,"backing",`${t}(uint256)`,[o],{note:"Reconcile this V5 book against current pool, owner, record, tier and backing rules; no payout is promised."})),...["setAutoAdd","setProtocolBacking","setOthersBacking"].map(t=>e(`backing_${t.replace(/[A-Z]/g,i=>`_${i.toLowerCase()}`)}`,"backing",`${t}(uint256,bool)`,[o,Q],{note:"Change this V5 book setting under the contract ownership/holder rules. Auto-add can compound rewards into stake at risk."})),e("backing_reconsent","backing",`reconsent(uint256,${$},bytes)`,[o],{owner:"agentId",consentRoot:8762n,args:["agentId","$consent","$signature"],note:"Owner only. Renew the pool consent for V5 backing."}),e("backing_release","backing","release(uint256,uint32,uint32,uint256,uint256)",[o,_,D,["minUsdgOut","uint"],["deadline","uint"]],{note:"Release caller day bucket after its release rule. Zero minUsdgOut returns PRIORS; positive requests a guarded sale. Stake stays burnable until release. Read generation/day from chain events."}),e("backing_release_for","backing","releaseFor(uint256,uint32,address,uint32)",[o,_,["holder","address"],D],{note:"Return eligible PRIORS to its holder under generation/day release rules, never redirect proceeds."}),e("backing_finish_close","backing","finishClose(uint256,uint32)",[o,_],{note:"Finish an eligible generation close; pays the bound owner under its release rules."}),e("backing_claim_settled","backing","claimSettled(uint256,uint32,address)",[o,_,["holder","address"]],{note:"Pay settled generation stake to the named holder, after any default burn."}),e("backing_claim_record","backing","claimSettled(uint256,uint32,address,uint8,uint32)",[o,_,["holder","address"],P,D],{note:"Pay settled day record to its holder after any default burn."}),e("backing_queue_exit","backing","queueExit(uint256,uint32,address,uint8,uint32)",[o,_,["holder","address"],P,D],{note:"Holder/keeper queues ready USDG-mode stake; minimum and queue window apply. A queue entry is not a fill or payout."}),e("backing_settle","backing","settle(uint256,uint32,uint256)",[o,_,["loanId","id"]],{note:"Reconcile V5 generation with a pool loan/default after a missed hook."}),e("backing_record_loan","backing","recordLoan(uint256)",[["loanId","id"]],{note:"Record current pool loan in V5 book."}),e("backing_record_default","backing","recordDefault(uint256)",[["loanId","id"]],{note:"Reconcile a marked pool default and its stake burn."}),e("backing_collect","backing","collect(uint256[],uint32[]) returns (uint256)",[["agentIds","ids"],["generations","gens"]],{note:"Collect caller fees for explicitly selected generations; auto-add settings may retain stake."}),e("backing_fund","backing","fund(uint256)",[v],{approval:"usdg",note:"Donate USDG to V5 root backing; donor receives no withdrawable claim."}),e("backing_book","backing","getGen(uint256,uint32) view returns ((address owner,uint64 openedAt,uint8 status,bool ownerChanged,bool optOut,bool othersOff,bool pointsVoid,bool openRoomCharged,bool closedByOwner,bool movePending,bool splitPending,uint64 movePendingAt,uint8 tier,uint8 countedAtTier,uint8 listLen,uint32 tierStep,uint64 tierSince,uint64 lastLateAt,uint64 closedMark,uint64 lastRaiseAt,uint64 promoEpoch,uint64 stakeEpoch,uint64 placeEpoch,uint160 movePendingSqrt,uint256 roomLine,uint256 openLine,uint256 promoCredit,uint256 stakeRaised,uint256 placed,uint256 index,uint256 divisor,uint256 defaultProof,uint256 cLive,uint256 cUnits,uint256[3] list,uint256[3] counted,uint256[3] pendingTok,uint256[3] leavingLive,uint256[3] tokens,uint64[3] layerEnd,uint160[3] endSqrt,uint8[3] ownerEndMode,uint32[2][3] liveDay,uint32[3] leaveHead,(uint64 epoch,uint192 points)[5] points))",[o,_],s),e("backing_generation","backing","latestGen(uint256) view returns (uint32)",[o],s),e("backing_line","backing","lineOf(uint256) view returns (uint256)",[o],s),e("backing_quote","backing","needed(uint256,uint256,bool) view returns ((uint256 minA,uint256 fullLine,uint256 capA,uint160 sqrtP,uint8 k,uint8 kCached,bool depthGuard,uint256 line,uint256 ownerA,uint256 ownBacking,uint256 roomB,uint256 lineIfAdded,uint256 weekAfter))",[o,["tokens","uint"],["asOwner","bool"]],s),e("backing_position","backing","position(uint256,uint32,uint8,address) view returns ((uint256 counted,uint256 checkpoint,uint256 a0,uint256 a1,uint32 d0,uint32 d1,bool autoAdd))",[o,_,P,["holder","address"]],s),e("backing_record","backing","record(uint256,uint32,uint8,uint32,address) view returns ((uint256 counted,uint256 uncounted,uint256 creditedTo,uint160 sqrtLeave,uint8 mode,uint64 entry))",[o,_,P,D,["holder","address"]],s),e("backing_bucket","backing","leavingBucket(uint256,uint32,uint8,uint32) view returns ((bool exists,bool retired,uint64 latestLeave,uint64 releasableAt,uint256 loanCount,uint256 counted,uint256 uncounted,uint256 retireIndex))",[o,_,P,D],s),e("backing_settings","backing","settings() view returns (bool openBacking,uint256 premiumCap,uint256 maxSwapUsdg,uint256 openRoom,uint256 raiseRoom,uint256 vouchCap,uint8 minDrawK,bool premiumCheck,uint64 pausedUntil)",[],s),e("backing_reopen_at","backing","reopenAt(uint256) view returns (uint64)",[o],s),e("backing_sync_prices","backing","sync()",[],{note:"Update global V5 price/guard observations."}),e("backing_exit_service_open","backing","exitServiceOpen() view returns (bool)",[],s),e("backing_usdg_path","backing","usdgPathOpen(uint256) view returns (bool,uint8)",[["usdgIn","uint"]],s),e("backing_entry_rule","backing","entryRule() view returns (uint8 minEntryLoans,uint32 minEntryDays)",[],s),e("backing_target_premium","backing","targetPremiumBps(uint256) view returns (uint256)",[o],s),e("backing_price_cache","backing","priceCache() view returns (uint160 sqrtMedian,uint64 obsAt,uint160 sqrtWeekLow,uint160 sqrtObservation)",[],s),e("backing_pending_bucket","backing","pendingBucket(uint256,uint32,uint8,uint32) view returns ((uint128 amount,uint64 lastDeposit,bool merged,bool dead,uint256 mergeIndex))",[o,_,P,D],s),e("backing_exit_head","backing","exitHead() view returns (uint256 entryId,address holder,uint256 rest,uint160 sqrtPLeave,uint64 joinedAt)",[],s),e("backing_exit_entry","backing","entry(uint256) view returns ((uint256 id,uint32 gen,uint8 layer,uint32 day,address holder,uint64 joinedAt,uint64 prev,uint64 next))",[["entryId","uint"]],s),e("backing_flush","backing","flush()",[],{note:"Reconcile V5 fees and backing buffers; no payout to caller is promised."}),e("backing_claimable","backing","claimable(address) view returns (uint256)",[],{...s,args:["$wallet"]}),e("autopay_hold","autopay","hold(bool)",[Q],{note:"Hold/resume future autopay attempts for this wallet; allowances remain until explicitly revoked."}),e("autopay_max_cap","autopay","MAX_CAP() view returns (uint256)",[],s),e("autopay_window","autopay","WINDOW() view returns (uint64)",[],s),e("autopay_paused_until","autopay","pausedUntil() view returns (uint64)",[],s),e("autopay_plan","autopay","planOf(address,uint256) view returns (uint32 cap,address owner,bool on,bool useSavings,bool late,uint32 epoch)",[o],{...s,args:["$wallet","agentId"]}),e("autopay_check","autopay","check(uint256) view returns ((uint8 status,uint256 agentId,uint256 due,uint64 opens,uint64 closes,address wallet,uint256 fromWallet,uint256 fromWalletSavings,address owner,uint256 fromOwner,uint256 fromOwnerSavings))",[["loanId","id"]],s),e("autopay_epoch","autopay","epochOf(uint256) view returns (uint32 epoch,bool stale)",[o],s),e("autopay_held","autopay","held(address) view returns (bool)",[],{...s,args:["$wallet"]}),e("savings_deposit","savings","deposit(uint256,address) returns (uint256)",[v],{approval:"usdg",args:["amount","$wallet"],note:"Deposit own USDG into Priors default external Morpho savings vault; vault/allocator risk and withdrawal liquidity apply."}),e("savings_withdraw","savings","withdraw(uint256,address,address) returns (uint256)",[v],{args:["amount","$wallet","$wallet"],note:"Withdraw exact USDG amount from own savings. Insufficient liquidity fails the preview; no immediate exit is promised."}),e("savings_redeem","savings","redeem(uint256,address,address) returns (uint256)",[["shares","uint"]],{args:["shares","$wallet","$wallet"],note:"Redeem exact own savings shares to this wallet; liquidity and rounding apply."}),e("savings_balance","savings","balanceOf(address) view returns (uint256)",[],{...s,args:["$wallet"]}),e("savings_value","savings","previewRedeem(uint256) view returns (uint256)",[["shares","uint"]],s),...["market","market1"].flatMap((t,i)=>[e(`market_v${i===0?2:1}_listing`,t,"listingOf(uint256) view returns ((address seller,uint256 price,uint64 expiry,uint256 nonce,bytes32 uriHash,uint256 loansRepaid))",[o],s),e(`market_v${i===0?2:1}_record_hash`,t,"recordHash(uint256) view returns (bytes32)",[o],s),e(`market_v${i===0?2:1}_list`,t,"list(uint256,uint256,uint64)",[o,["price","uint"],["expiry","uint"]],{owner:"agentId",approval:"nft",note:"Owner sells this ERC-8004 NFT, its record and any followed treasury line. This does not transfer code, keys or servers. Approves only this NFT; confirm the sale terms and contract-enforced hold/line rules."}),e(`market_v${i===0?2:1}_cancel`,t,"cancel(uint256)",[o],{note:"Cancel the standing listing; NFT approval can remain until explicitly cleared."}),e(`market_v${i===0?2:1}_buy`,t,"buy(uint256,uint256,uint256,bytes32,bytes32)",[o,["maxPrice","uint"],["nonce","uint"],["uriHash","bytes32"],["recordHash","bytes32"]],{approval:"market",note:"Buy an ERC-8004 NFT to this wallet with exact live asking-price approval and pinned listing nonce, tokenURI and current credit record. A followed line still needs the new owner bond before borrowing. No keys/code/servers are included."})]),e("market_bid","market","bid(uint256,uint256,uint64,bytes32,uint256,uint256) returns (uint256)",[o,["price","uint"],["expiry","uint"],["uriHash","bytes32"],["minRepaid","uint"],["minLine","uint"],["reserveBudget","uint"]],{args:["agentId","price","expiry","uriHash","minRepaid","minLine"],approval:"bid",note:"Standing future purchase authority: another owner can fill this bid later without a new click. Exact reserveBudget USDG allowance is shared by all this wallet bids and replaces the old allowance. Cancel bid and clear unused budget deliberately."}),e("market_bid_any","market","bidAny(bytes32,uint256,uint256,uint64,uint256,uint256) returns (uint256)",[["root","bytes32"],["count","uint"],["price","uint"],["expiry","uint"],["minRepaid","uint"],["minLine","uint"],["reserveBudget","uint"]],{args:["root","count","price","expiry","minRepaid","minLine"],approval:"bid",note:"Standing future authority to buy count identities committed by the explicit Merkle root; shared exact reserveBudget USDG allowance. Inspect the committed ID list before authorizing. No code, keys or servers transfer."}),e("market_cancel_bid","market","cancelBid(uint256)",[["bidId","id"]],{note:"Cancel this bid; shared USDG allowance is unchanged so other bids can still fill."}),e("market_accept_bid","market","acceptBid(uint256,uint256,bytes32[],uint256)",[["bidId","id"],o,["proof","proof"],["minNet","uint"]],{owner:"agentId",approval:"nft",note:"Sell only this NFT into a currently valid bid; minNet pins seller USDG proceeds. Merkle proof and current bid rules are checked on chain during preview."}),e("market_bid_state","market","bidOf(uint256) view returns ((address maker,uint64 expiry,uint16 left,bool any,uint96 price,uint96 minLine,uint64 minRepaid,bytes32 target,bytes32 uriHash))",[["bidId","id"]],s),e("market_builder","market","builderOf(uint256) view returns ((address to,uint16 bps))",[o],s),e("market_set_builder","market","setBuilder(uint256,address,uint256)",[o,["to","address"],["bps","uint"]],{owner:"agentId",note:"Owner-only attribution before first sale; assigns future sale revenue share to to. Contract enforces enabled switch, no listing, and maximum 500 bps."}),e("market_change_builder","market","changeBuilder(uint256,address,uint256)",[o,["to","address"],["bps","uint"]],{note:"Current builder only; may lower or redirect own revenue share, never increase it."}),e("market_sale_split","market","saleSplit(uint256) view returns (uint256 fee,uint256 share,uint256 net)",[o],s),...["seats3","seats4"].flatMap((t,i)=>[e(`legacy_v${i+3}_close`,t,"close(uint256)",[o],{note:"Existing seat only. Close/freeze and return stake to original staker after final loan; default burn still applies. No new seats are opened."}),e(`legacy_v${i+3}_withdraw_offer`,t,"withdrawOffer(uint256,address)",[o],{args:["agentId","$wallet"],note:"Withdraw caller unaccepted offer; PRIORS returns to the staker."}),e(`legacy_v${i+3}_expire`,t,"expire(uint256)",[o],{note:"Expire idle seat under current contract rules."}),e(`legacy_v${i+3}_settle`,t,"settle(uint256,uint256)",[o,["loanId","id"]],{note:"Reconcile existing seat against pool loan/default after a missed hook."}),e(`legacy_v${i+3}_claim`,t,"claim(address) returns (uint256)",[],{args:["$wallet"],note:"Claim caller legacy seat USDG fees to this wallet."}),e(`legacy_v${i+3}_seat`,t,"getSeat(uint256) view returns ((address staker,uint64 openedAt,bool closing,uint8 status,uint128 line,uint128 burnBps,uint256 amount,uint256 feeMark,address owner))",[o],s),e(`legacy_v${i+3}_pending_fees`,t,"pendingFees(uint256) view returns (uint256)",[o],s),e(`legacy_v${i+3}_fees`,t,"feesOwed(address) view returns (uint256)",[],{...s,args:["$wallet"]}),e(`legacy_v${i+3}_offer`,t,"offers(uint256,address) view returns (uint256)",[o],{...s,args:["agentId","$wallet"]})])];function Y(t){return JSON.parse(JSON.stringify(t,(i,n)=>typeof n=="bigint"?n.toString():n))}function l(t,i,n=256){if(typeof t!="string"||!/^[0-9]+$/.test(t)||BigInt(t)>=1n<<BigInt(n))throw new u(`${i} must be a decimal base-unit string fitting uint${n}.`);return BigInt(t)}function se(t,[i,n]){let r=t[i];if(n==="address"){if(typeof r!="string"||!K.test(r))throw new u(`${i} must be a token or wallet address.`);return b(r)}if(n==="bool"){if(typeof r!="boolean")throw new u(`${i} must be true or false.`);return r}if(n==="bytes32"){if(typeof r!="string"||!/^0x[0-9a-fA-F]{64}$/.test(r))throw new u(`${i} must be bytes32.`);return r}if(n==="proof"){if(!Array.isArray(r)||r.length>32||!r.every(d=>typeof d=="string"&&/^0x[0-9a-fA-F]{64}$/.test(d)))throw new u("proof needs at most 32 bytes32 hashes.");return r}if(n==="bytes"){if(typeof r!="string"||!/^0x(?:[0-9a-fA-F]{2})*$/.test(r)||r.length>32770)throw new u(`${i} must be bounded hexadecimal bytes.`);return r}if(n==="ids"||n==="gens"){if(!Array.isArray(r)||r.length===0||r.length>100)throw new u(`${i} needs 1 to 100 decimal strings.`);return r.map(d=>l(d,i,n==="gens"?32:256))}let a=l(r,i,n==="uint8"?8:n==="uint32"?32:256);if(n==="id"&&a===0n)throw new u(`${i} must be positive.`);if(i==="exitMode"&&a>2n)throw new u("exitMode must be 0 (hold), 1 (PRIORS), or 2 (USDG queue).");if(i==="layer"&&a>2n)throw new u("layer must be 0, 1, or 2.");return a}var R=x.amount("USDG",6,"1000000"),L=x.amount("PRIORS",18,"1000000000000000000"),H='Amount of the stock token in base units (read its decimals with priors_stock_asset_state). Example: "1000000000000000000" = 1 token at 18 decimals.',ue={priors_root_enroll:R,priors_root_add_stake:R,priors_root_vouch:R,priors_root_unvouch:R,priors_root_offer:R,priors_fund_reserve:R,priors_backing_fund:R,priors_savings_deposit:R,priors_savings_withdraw:R,priors_stock_open:H,priors_stock_add:H,priors_stock_value:H,priors_backing_open:L,priors_backing_add:L,priors_backing_leave:L},B={agentId:'ERC-8004 agent ID, as a decimal string. Example: "437".',sponsorId:'ERC-8004 ID of the sponsor root, as a decimal string. Example: "6228".',loanId:x.id("Priors pool loan"),bidId:x.id("AgentMarket V2 bid"),entryId:x.id("V5 exit-queue entry"),delegate:"Address to appoint as pool delegate (borrow and repay only, never identity transfer); the zero address clears it.",frozen:"true freezes the agent line; false unfreezes it.",premiumBps:"Loan premium in basis points (50 = 0.5%); at most the owner-consented cap.",maxPremiumBps:'Owner-consented maximum sponsor premium in basis points (50 = 0.5%), at most 200. Default "0".',hook:"Address of the root lending-policy hook contract (0x followed by 40 hex digits).",expiry:"Expiry in Unix seconds. Market listings and bids allow at most 30 days ahead; a V5 invite uses its issued expiry.",invite:"Treasury V5 inviter signature bytes as 0x hex, exactly as issued.",token:"Address of the stock token (0x followed by 40 hex digits); it must be an accepted Priors stock collateral.",maxLoans:"Loan count bound passed to reconcile, as a decimal string; this contract version ignores it.",feed:"Address of the public oracle price feed to record (0x followed by 40 hex digits).",maxRounds:"Maximum oracle rounds to record in this call, as a decimal string.",autoAdd:"true compounds rewards into the stake at risk; false leaves them out.",priorsIn:x.amount("PRIORS",18,"1000000000000000000"),usdgIn:x.amount("USDG",6,"1000000"),minOut:"Minimum PRIORS received from the USDG conversion, in base units (PRIORS has 18 decimals); must be positive when usdgIn is.",deadline:"Deadline in Unix seconds, within the next hour. Example: 1800000000.",exitMode:x.enumValues({0:"hold",1:"return PRIORS",2:"request USDG through the guarded exit queue"}),generation:"V5 book generation number, as a decimal string; read it from priors_backing_generation or chain events.",day:"Day bucket number, as a decimal string, read from chain events; never guess it.",layer:'Backing layer "0", "1" or "2", as recorded in chain events.',holder:"Address of the stake holder; any payout goes only to this holder.",minUsdgOut:'"0" returns PRIORS; a positive value requests a guarded USDG sale with this minimum, in USDG base units (6 decimals).',agentIds:"ERC-8004 agent IDs as decimal strings, paired by position with generations (1 to 100).",generations:"Generation numbers as decimal strings, paired by position with agentIds.",tokens:'PRIORS amount in base units (PRIORS has 18 decimals) passed to the contract needed() quote. Example: "0".',asOwner:"true quotes as the agent owner; false as another backer.",price:'Price per identity in USDG base units (6 decimals); minimum "5000000" = 5 USDG.',maxPrice:"Highest asking price you accept, in USDG base units (6 decimals); read the listing first.",nonce:"Listing nonce from the listing read, as a decimal string; it pins the exact listing.",uriHash:"bytes32 hash of the agent tokenURI (0x followed by 64 hex digits), from the listing or priors_market_pins.",recordHash:"bytes32 hash of the agent credit record (0x followed by 64 hex digits), from priors_market_v1/v2_record_hash.",minRepaid:"Minimum repaid-loan count in the agent record for the bid to fill, as a decimal string.",minLine:"Minimum credit line the agent must carry for the bid to fill, in USDG base units (6 decimals).",reserveBudget:"Exact USDG allowance shared by all bids of this wallet, in base units (6 decimals); must cover price times count.",root:"Merkle root (bytes32) committing the agent ID list; rebuild it with priors_market_origin.",count:"Number of identities to buy from the committed list, 1 to 20, as a decimal string.",proof:"Merkle proof for this agent in the bid root: at most 32 bytes32 hashes.",minNet:"Minimum seller USDG proceeds, in base units (USDG has 6 decimals).",to:x.recipient("builder sale share recipient"),bps:"Builder sale share in basis points (50 = 0.5%); at most 500.",on:"true turns this setting on; false turns it off.",cap:'Per-loan repayment cap in USDG base units (USDG has 6 decimals), at most the contract MAX_CAP. Example: "5000000" = 5 USDG.',budget:"Total USDG allowance for AutoRepay in base units (6 decimals); at least cap, and shared by all plans of this wallet.",savingsShares:'Savings vault share allowance in base units (read the vault decimals); "0" disables savings use.',late:"AutoRepay late flag stored in the plan (true or false); read priors_autopay_plan to confirm it.",continuation:"Opaque state from the previous step; pass it back unchanged. Never build it by hand.",signature:"Local signature for the confirmed step, as 0x hex; the bridge supplies it. Never a key."},de={priors_root_unlock:"Root pool shares to withdraw, in pool share base units (read root_shares); not USDG.",priors_savings_redeem:"Savings vault shares to redeem, in base units (read the vault decimals); not USDG.",priors_savings_value:"Savings vault shares to value, in base units (read the vault decimals); not USDG."};function le(t,i){return i==="amount"?ue[t]:i==="shares"?de[t]:t==="priors_autopay_hold"&&i==="on"?"true holds future autopay attempts; false resumes them.":B[i]}function ce(t,i,n){let r=le(t,i);return r===void 0?n:{...n,description:r}}function F(t,i,n={}){return{type:"object",additionalProperties:!1,required:i.map(([r])=>r),properties:Object.fromEntries([...i.map(([r,a])=>[r,ce(t,r,a==="bool"?{type:"boolean"}:a==="address"?X:a==="proof"?{type:"array",maxItems:32,items:{type:"string",pattern:"^0x[0-9a-fA-F]{64}$"}}:a==="ids"||a==="gens"?{type:"array",maxItems:100,items:V()}:{type:"string",...a==="bytes32"?{pattern:"^0x[0-9a-fA-F]{64}$"}:a!=="bytes"?{pattern:"^[0-9]+$"}:{}})]),...Object.entries(n)])}}async function I(t,i,n,r=[]){let a=[`function ${n}`],d=A(a);return t.clientFor(f).readContract({address:i,abi:d,functionName:d[0].name,args:r})}async function U(t,i){return b(await t.clientFor(f).readContract({address:c.registry,abi:ne,functionName:"ownerOf",args:[i]}))}function E(t){if(t.network==="testnet")throw new u("Priors ecosystem features are configured only on chain 4663.")}function M(t,i,n,r,a,d="0"){return{domain:Z(),types:{Consent:[...J.Consent]},primaryType:"Consent",message:{agentId:t,sponsorId:i,owner:b(n),nonce:r,deadline:a,maxPremiumBps:d}}}async function j(t,i,n){if(!i||!i.request||T(i.request)!==T(n)||typeof i.signature!="string"||!/^0x(?:[a-fA-F0-9]{2}){1,4096}$/.test(i.signature))throw new u("Consent differs from this agent, sponsor, owner, premium cap, nonce or deadline.");let r=n.message.owner,a=await t.clientFor(f).getCode({address:r});if(a&&a!=="0x"){if(await t.clientFor(f).readContract({address:r,abi:re,functionName:"isValidSignature",args:[T(n),i.signature]})!=="0x1626ba7e")throw new u("The owner contract rejected the consent signature.")}else if(!C(await ie({...n,signature:i.signature}),r))throw new u("The consent signature is not from the current agent owner.")}function pe(t,i,n,r,a,d){let g=te.find(k=>k.name===t),p=t==="priors_sign_consent"?l(i.sponsorId,"sponsorId"):g?.consentRoot;if(!p||a.stage!=="priors_consent"||a.tool!==t||a.wallet!==b(n)||a.chainId!==f||a.agentId!==i.agentId||r.length!==1||r[0]?.kind!=="typedData")throw new u("Unexpected Priors consent continuation.");let w=l(a.nonce,"nonce").toString(),h=l(a.deadline,"deadline");if(h<=BigInt(d)||h>BigInt(d+3600))throw new u("Priors consent expired or exceeds its one-hour window.");let y=M(String(i.agentId),p.toString(),n,w,h.toString(),String(i.maxPremiumBps??"0"));if(!r[0].request||T(r[0].request)!==T(y))throw new u("Priors consent differs from the requested agent, root, owner or premium.")}async function ee(t,i,n,r,a){let d=l(n.agentId,"agentId");if(!C(await U(t,d),r))throw new u("This operation requires the current identity owner wallet; a delegate cannot consent. Use the owner wallet.");let g=await t.clientFor(f).readContract({address:c.pool,abi:z,functionName:"nonces",args:[d]}),p=n.continuation,w=p?l(p.deadline,"deadline"):BigInt(Math.floor(Date.now()/1e3)+1800),h=l(n.maxPremiumBps??"0","maxPremiumBps");if(n.signature!==void 0&&!n.continuation)throw new u("A signature needs its locally confirmed Priors consent continuation.");if(h>200n)throw new u("maxPremiumBps exceeds the pool maximum of 200.");let y=M(d.toString(),a.toString(),r,g.toString(),w.toString(),h.toString());if(!p)return{steps:[{kind:"typedData",request:y}],continuation:{stage:"priors_consent",tool:i,wallet:r,chainId:f,agentId:d.toString(),nonce:g.toString(),deadline:w.toString()},summary:`Owner consent to sponsor #${a} for agent #${d}, premium cap ${h} bps; expires ${w}. No funds move from this signature. The local bridge must confirm the exact EIP-712 fields.`};if(pe(i,n,r,[{kind:"typedData",request:y}],p,Math.floor(Date.now()/1e3)),String(p.nonce)!==g.toString())throw new u("Priors consent nonce changed. Start the action again.");let k={request:y,signature:n.signature};return await j(t,k,y),{signedConsent:k}}async function ge(t,i,n,r){let a=c[i.contract],d=(p,w)=>w>0n?[t.approval(p,a,w.toString(),f)]:[];if(i.approval==="nft"){let p=l(n.agentId,"agentId"),w=await Promise.all([c.market,c.market1].map(h=>I(t,h,"listingOf(uint256) view returns ((address seller,uint256 price,uint64 expiry,uint256 nonce,bytes32 uriHash,uint256 loansRepaid))",[p])));for(let h of w){if(!h||typeof h!="object"||!("seller"in h)||typeof h.seller!="string")throw new u("Could not verify standing listings on both Priors markets; no NFT approval was built.");if(C(h.seller,r))throw new u("A standing listing in Priors market V1 or V2 could reactivate when NFT approval mines. Cancel it with priors_market_v1_cancel or priors_market_v2_cancel, verify both listings are cleared, then retry. No approval was built.")}return[t.approval(c.registry,a,p.toString(),f)]}if(i.approval==="market"){let p=await I(t,a,"listingOf(uint256) view returns ((address seller,uint256 price,uint64 expiry,uint256 nonce,bytes32 uriHash,uint256 loansRepaid))",[l(n.agentId,"agentId")]);if(p.price<=0n||p.price>l(n.maxPrice,"maxPrice")||p.nonce!==l(n.nonce,"nonce")||!C(p.uriHash,String(n.uriHash)))throw new u("Listing price, nonce or URI changed; read the listing again.");return d(c.usdg,p.price)}if(i.approval==="bid"){let p=l(n.reserveBudget,"reserveBudget");if(p>=1n<<128n||p<l(n.price,"price")*l(n.count??"1","count"))throw new u("Provide a finite exact bid reserve covering price times count.");return[t.approval(c.usdg,c.bidSpender,p.toString(),f)]}if(i.approval==="bond")return d(c.usdg,BigInt(await I(t,c.bond,"amount() view returns (uint256)")));if(i.approval==="mixed"){let p=l(n.priorsIn,"priorsIn"),w=l(n.usdgIn,"usdgIn");if(p+w===0n)throw new u("Provide a positive PRIORS or USDG input.");if(w>0n&&l(n.minOut,"minOut")===0n)throw new u("USDG conversion requires a positive minimum PRIORS output.");return[...d(c.priors,p),...d(c.usdg,w)]}if(!i.approval)return[];let g=l(n.amount,"amount");if(g===0n)throw new u("amount must be positive.");if(i.approval==="stock"){let p=i.name==="priors_stock_open"?b(String(n.token)):b((await I(t,c.stock,"getPosition(uint256) view returns ((address depositor,address owner,address token,uint64 openedAt,bool closing,uint8 status,uint128 line,uint256 amount))",[l(n.agentId,"agentId")])).token);if(p===ae)throw new u("No stock collateral position exists.");return d(p,g)}return d(c[i.approval],g)}function _e(t){let i=te.map(n=>({name:n.name,inputSchema:{...F(n.name,n.fields,n.consentRoot?{maxPremiumBps:V(B.maxPremiumBps),continuation:{type:"object",description:B.continuation},signature:{type:"string",pattern:"^0x([a-fA-F0-9]{2})+$",description:B.signature},...n.externalConsent?{signedConsent:{type:"object",description:"Optional public owner signature from priors_sign_consent; controller may supply collateral. Never pass a key."}}:{}}:{}),description:n.note||"Read current Priors contract state. All amounts are token base-unit decimal strings."},async execute(r,a){E(t),a=b(a);let d=Object.fromEntries(n.fields.map(m=>[m[0],se(r,m)]));if(n.owner&&!(n.externalConsent&&r.signedConsent)&&!C(await U(t,d[n.owner]),a))throw new u("Owner-only feature: call from the current identity owner wallet. Nothing was signed.");if(n.contract==="savings"&&b(String(await I(t,c.savings,"asset() view returns (address)")))!==c.usdg)throw new u("The savings vault asset is not USDG. Nothing was signed.");if(n.contract==="autopay"&&await I(t,c.autopay,"VERSION() view returns (uint256)")!==2n)throw new u("AutoRepay VERSION is not 2. Nothing was signed.");if(n.contract==="market"||n.contract==="market1"){if(r.expiry!==void 0){let m=l(r.expiry,"expiry",64),S=BigInt(Math.floor(Date.now()/1e3));if(m<=S||m>S+2592000n)throw new u("Market expiry must be within 30 days.")}if(r.price!==void 0&&l(r.price,"price")<5000000n)throw new u("Market price minimum is 5 USDG.");if(r.count!==void 0&&(l(r.count,"count")<1n||l(r.count,"count")>20n))throw new u("Bid count must be 1 to 20.")}if(n.name==="priors_treasury_first_line"&&l(r.expiry,"expiry",64)<=BigInt(Math.floor(Date.now()/1e3)))throw new u("Treasury V5 invite expired.");if(r.deadline!==void 0){let m=l(r.deadline,"deadline"),S=BigInt(Math.floor(Date.now()/1e3));if(m<=S||m>S+3600n)throw new u("deadline must be in the next hour.")}if(r.agentIds&&r.agentIds.length!==r.generations.length)throw new u("agentIds and generations must have equal length.");let g;if(n.consentRoot)if(n.externalConsent&&r.signedConsent){if(g=r.signedConsent,!g.request?.message)throw new u("Provide the public signedConsent from the current identity owner.");let m=l(r.agentId,"agentId"),S=await U(t,m),q=await t.clientFor(f).readContract({address:c.pool,abi:z,functionName:"nonces",args:[m]}),N=l(g.request.message.deadline,"consent deadline");if(N<=BigInt(Math.floor(Date.now()/1e3)))throw new u("Owner consent expired.");let W=l(r.maxPremiumBps??"0","maxPremiumBps");if(W>200n)throw new u("maxPremiumBps exceeds the pool cap.");await j(t,g,M(m.toString(),n.consentRoot.toString(),S,q.toString(),N.toString(),W.toString()))}else{let m=await ee(t,n.name,r,a,n.consentRoot);if("steps"in m)return m;g=m.signedConsent}let p=(n.args??n.fields.map(([m])=>m)).map(m=>m==="$wallet"?a:m==="$consent"?g.request.message:m==="$signature"?g.signature:d[m]),w=A([n.signature]),h=w[0].name;if(n.read)return{chainId:f,contract:c[n.contract],units:"Base units; USDG 6 decimals, PRIORS 18 decimals; stock/savings scales come from token metadata.",value:Y(await t.clientFor(f).readContract({address:c[n.contract],abi:w,functionName:h,args:p}))};let y=[...await ge(t,n,r,a),t.unsignedTx({to:c[n.contract],data:G({abi:w,functionName:h,args:p}),value:"0",chainId:f,description:`${n.name}: ${n.note}`})],k=await t.preview(y,a);return{txs:y,summary:`${n.note} Inputs (base units): ${JSON.stringify(Y(d))}. ${k.summary}`}}}));return i.push({name:"priors_sign_consent",inputSchema:F("priors_sign_consent",[o,["sponsorId","id"],["maxPremiumBps","uint"]],{continuation:{type:"object",description:B.continuation},signature:{type:"string",pattern:"^0x([a-fA-F0-9]{2})+$",description:B.signature}}),async execute(n,r){return E(t),ee(t,"priors_sign_consent",n,b(r),l(n.sponsorId,"sponsorId"))}}),i.push({name:"priors_root_offer",inputSchema:F("priors_root_offer",[["sponsorId","id"],o,v,["premiumBps","uint"]],{signedConsent:{type:"object",description:"The current agent owner output of priors_sign_consent. This is public signed authorization, never a private key."}}),async execute(n,r){E(t),r=b(r);let a=l(n.sponsorId,"sponsorId"),d=l(n.agentId,"agentId");if(!C(await U(t,a),r))throw new u("Only the sponsor root owner can send this offer.");let g=n.signedConsent;if(!g?.request?.message)throw new u("Ask the current agent owner to run priors_sign_consent from their wallet first.");let p=g.request.message,w=await t.clientFor(f).readContract({address:c.pool,abi:z,functionName:"nonces",args:[d]}),h=l(p.deadline,"consent deadline");if(h<=BigInt(Math.floor(Date.now()/1e3)))throw new u("Owner consent expired; request a fresh consent.");let y=l(n.premiumBps,"premiumBps"),k=l(p.maxPremiumBps,"maxPremiumBps");if(y>k||k>200n)throw new u("premiumBps exceeds the owner consent or pool cap.");let m=M(d.toString(),a.toString(),await U(t,d),w.toString(),h.toString(),k.toString());await j(t,g,m);let S=A([`function vouchWithConsent(uint256,uint256,uint256,uint256,${$},bytes)`]),q=[t.unsignedTx({to:c.pool,data:G({abi:S,functionName:"vouchWithConsent",args:[a,d,l(n.amount,"amount"),y,m.message,g.signature]}),value:"0",chainId:f,description:"Sponsor-owned backing handoff with exact current-owner consent."})],N=await t.preview(q,r);return{txs:q,summary:`Vouch ${n.amount} USDG base units from sponsor #${a} to agent #${d}; ${y} bps premium (cap ${k}). Replaces its old sponsor only with no loan open. ${N.summary}`}}}),i.push(...me(t)),{tools:i}}function me(t){return[{name:"priors_autopay_on",inputSchema:F("priors_autopay_on",[o,["cap","uint"],["budget","uint"],["savingsShares","uint"],["late","bool"]]),async execute(i,n){E(t),n=b(n);let r=l(i.agentId,"agentId"),a=l(i.cap,"cap"),d=l(i.budget,"budget"),g=l(i.savingsShares,"savingsShares");if(typeof i.late!="boolean")throw new u("late must be true or false.");if(await I(t,c.autopay,"VERSION() view returns (uint256)")!==2n)throw new u("AutoRepay VERSION is not 2.");let p=await I(t,c.autopay,"MAX_CAP() view returns (uint256)");if(a===0n||a>p||a>=1n<<32n||d<a||d===(1n<<256n)-1n||g===(1n<<256n)-1n)throw new u("Provide a positive supported per-loan cap and explicit finite budget at least cap; unlimited approvals are refused.");let w=await t.clientFor(f).readContract({address:c.registry,abi:ne,functionName:"getAgentWallet",args:[r]});if(b(w)!==n)throw new u("Autopay enrollment requires the ERC-8004 declared agent wallet, not just its owner or pool delegate.");if(g>0n&&b(String(await I(t,c.savings,"asset() view returns (address)")))!==c.usdg)throw new u("Savings asset is not USDG.");let h=g>0n?await I(t,c.savings,"previewRedeem(uint256) view returns (uint256)",[g]):0n,y=A(["function enroll(uint256,uint256,bool,bool)"]),k=[t.approval(c.usdg,c.autopay,d.toString(),f),t.approval(c.savings,c.autopay,g.toString(),f),t.unsignedTx({to:c.autopay,data:G({abi:y,functionName:"enroll",args:[r,a,g>0n,i.late]}),value:"0",chainId:f,description:"Enroll future autopay with explicit finite USDG and savings share budgets."})],m=await t.preview(k,n);return{txs:k,summary:`Persistent future spending authorization: AutoRepay v2 can repay agent #${r} loans without a confirmation per loan, at most ${a} USDG base units per loan; exact total wallet allowance ${d} USDG base units and ${g} savings shares (currently ${h} USDG base units). These two allowances replace the budgets shared by ALL this wallet autopay plans, including setting savings allowance to zero when disabled. late=${i.late}; savings=${g>0n}. Revoke with priors_autopay_off, which also clears both allowances. ${m.summary}`}}},{name:"priors_autopay_off",inputSchema:F("priors_autopay_off",[o]),async execute(i,n){E(t),n=b(n);let r=A(["function revoke(uint256)"]),a=[t.unsignedTx({to:c.autopay,data:G({abi:r,functionName:"revoke",args:[l(i.agentId,"agentId")]}),value:"0",chainId:f,description:"Revoke own autopay plan."}),t.approval(c.usdg,c.autopay,"0",f),t.approval(c.savings,c.autopay,"0",f)],d=await t.preview(a,n);return{txs:a,summary:`Revoke this wallet autopay plan and zero both shared AutoRepay allowances. This also stops funding other plans using this wallet. ${d.summary}`}}}]}export{oe as a,O as b,te as c,Y as d,l as e,M as f,pe as g,_e as h};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as q}from"./LT5P6PZW.js";import{a as R,b as K}from"./G2LAO23N.js";import{a as W}from"./H5DY7CNB.js";import{c as U,f as z,g as T,i as L}from"./NWNYJ26T.js";import{a as k}from"./FWD4L3CJ.js";import{a as d}from"./XSD5NL7J.js";import{encodeFunctionData as J,erc20Abi as re,erc721Abi as V,getAddress as ie,parseAbi as ae,zeroAddress as B}from"viem";var A=q,G=ae(["function launchFee() view returns (uint256 fee,address treasury,uint256 pendingFee,address pendingTreasury,uint256 readyAt)"]),g=(t,e)=>t.name==="seed"?"marketSeed":t.name||`arg${e}`,X=t=>"components"in t?t.components:[],se=t=>{if(typeof t!="string"||!/^(0|[1-9][0-9]*)$/.test(t)||t.length>78||BigInt(t)>=1n<<256n)throw new d("Provide Hookr amounts as decimal base-unit strings within uint256.");return BigInt(t)},p=t=>z(t,"Provide the documented Hookr parameter object."),b=t=>L(t,"Provide a valid Hookr address."),Y=t=>t.stateMutability==="view"||t.stateMutability==="pure";function _(t){return t.abi}var ce=`Base units of the token it counts; read that token's decimals (18 decimals: "1000000000000000000" = 1 token).`,de={type:"string",pattern:"^(0|[1-9][0-9]*)$"};function ue(t,e,i){let o=`${t} ${e} ${i}.`,r=t.replace(/\[[0-9]*\]$/,"");return/^u?int/.test(r)?/divisor|numerator|denominator/i.test(e)?`${o} Plain integer ${/divisor/i.test(e)?"divisor":"ratio component"}; do not scale by token decimals.`:/liquidity/i.test(e)?`${o} Uniswap v4 liquidity units, not a token amount; do not scale by token decimals.`:/gas/i.test(e)?`${o} Integer gas units; do not scale by token decimals.`:/point/i.test(e)&&!/decimals/i.test(e)?`${o} Integer points; do not scale by token decimals.`:/pips$/i.test(e)?`${o} ${R.pips()}`:K(e,de)||e==="walletFeeCap"?`${o} ${ce}`:/bps$/i.test(e)?`${o} ${R.bps()}`:/(deadline|expir|timestamp|time|At)$/.test(e)?`${o} Unix seconds, as a decimal string.`:`${o} Decimal string${r.startsWith("uint")?"":", may be negative"}.`:r==="address"?`${o} 0x followed by 40 hex digits${/^(to|recipient|receiver|owner|spender|wallet|beneficiary)$/i.test(e)?"; use the intended address, never an example address":""}.`:r==="bool"?`${o} true or false.`:r.startsWith("bytes")?`${o} 0x-prefixed hex bytes.`:r==="tuple"?`${o} Object with the listed fields.`:`${o} Plain text.`}function Z(t,e,i,o){let r=ue(t.type,o,e),c=/^(.*)\[([0-9]*)\]$/.exec(t.type);return c?{type:"array",description:r,items:Z({...t,type:c[1]},e,i,o),minItems:c[2]?Number(c[2]):0,maxItems:c[2]?Number(c[2]):128}:t.type==="tuple"?{...E(X(t),i,o),description:r}:t.type==="bool"?{type:"boolean",description:r}:t.type==="address"?{...U,description:r}:/^u?int/.test(t.type)?{type:"string",pattern:t.type.startsWith("uint")?"^(0|[1-9][0-9]*)$":"^(0|-?[1-9][0-9]*)$",description:r}:t.type.startsWith("bytes")?{type:"string",pattern:"^0x([0-9a-fA-F]{2})*$",maxLength:32770,description:r}:{type:"string",maxLength:4096,description:r}}function E(t,e,i){let o=i===void 0?`argument of ${e}`:`field of ${i} in ${e}`;return{type:"object",properties:Object.fromEntries(t.map((r,c)=>[g(r,c),Z(r,o,e,g(r,c))])),required:t.map(g),additionalProperties:!1}}function N(t,e){let i=/^(.*)\[([0-9]*)\]$/.exec(t.type);if(i){if(!Array.isArray(e)||e.length>128||i[2]&&e.length!==Number(i[2]))throw new d("Hookr parameter array has an invalid length.");return e.map(r=>N({...t,type:i[1]},r))}if(t.type==="tuple"){let r=p(e),c=X(t);return O(r,c.map(g)),Object.fromEntries(c.map((s,u)=>[s.name||`arg${u}`,N(s,r[g(s,u)])]))}if(t.type==="address")return b(e);if(t.type==="bool"){if(typeof e!="boolean")throw new d("Provide a Hookr boolean.");return e}let o=/^(u?)int([0-9]*)$/.exec(t.type);if(o){if(typeof e!="string"||!/^(0|-?[1-9][0-9]*)$/.test(e)||e.length>79)throw new d("Provide Hookr integers as decimal base-unit strings.");let r=BigInt(e),c=BigInt(o[2]||256),s=!o[1];if(r<(s?-(1n<<c-1n):0n)||r>=1n<<(s?c-1n:c))throw new d("Hookr integer exceeds its ABI range.");return c<=32n?Number(r):r}if(t.type.startsWith("bytes")){let r=Number(t.type.slice(5));if(typeof e!="string"||!/^0x([0-9a-fA-F]{2})*$/.test(e)||e.length>32770||r&&e.length!==2+r*2)throw new d("Provide a valid Hookr hex byte string of the ABI length.");return e}if(t.type!=="string"||typeof e!="string"||new TextEncoder().encode(e).length>4096)throw new d("Provide a valid Hookr string.");return e}function O(t,e){if(Object.keys(t).some(i=>!e.includes(i))||e.some(i=>!Object.hasOwn(t,i)))throw new d("Provide exactly the documented Hookr parameters.")}function ye(t,e){O(e,t.inputs.map(g));let i=t.inputs.map((o,r)=>N(o,e[g(o,r)]));return{values:i,params:Object.fromEntries(t.inputs.map((o,r)=>[g(o,r),i[r]]))}}function ee(t,e){if(O(t,["contract","function","params"]),typeof t.contract!="string"||!Object.hasOwn(A,t.contract))throw new d("Choose a contract from hookr_contracts.");let i=A[t.contract];if(!e&&i.address.toLowerCase()===q.launcherV1.address.toLowerCase())throw new d("Use hookr_launch for the reviewed new Launcher; generic actions cannot call it.");let o=_(i).find(u=>u.name===t.function&&(e?Y(u):i.actions.includes(u.name)));if(!o)throw new d("This Hookr function is not exposed in this read/action lane. Read hookr_contracts for coverage.");let r=p(t.params);O(r,o.inputs.map(g));let c=o.inputs.map((u,f)=>N(u,r[g(u,f)])),s=Object.fromEntries(o.inputs.map((u,f)=>[g(u,f),c[f]]));return{pin:i,fn:o,values:c,params:s,target:b(i.address)}}var te={type:"string",enum:Object.keys(A),description:'Pinned Hookr contract role, as listed by hookr_contracts (for example "launcherV1").'},Q={type:"object",properties:{contract:te,function:{type:"string",description:"Function name on that contract, exactly as hookr_contracts lists it."},params:{type:"object",description:"Exact typed parameters from hookr_contracts for this contract and function; validated recursively before any chain read."}},required:["contract","function","params"],additionalProperties:!1};function ne(t){return JSON.parse(JSON.stringify(t,(e,i)=>typeof i=="bigint"?i.toString():i))}async function me(t,e,i){if(t.network==="testnet")throw new d("Hookr actions are configured only on mainnet, chain 4663.");let{pin:o,fn:r,values:c,params:s,target:u}=ee(e,!1),f=e.contract,l=r.name,H=t.clientFor(k),v=[],P=[],w=0n,C=new Map,h=(n,a)=>{let m=b(n),x=typeof a=="bigint"?a:se(a);if(x<0n||x>=(1n<<256n)-1n)throw new d("Hookr funding must be an exact bounded amount.");x&&(m===B?w+=x:C.set(m,(C.get(m)??0n)+x))},$=(n,a,m=[])=>H.readContract({address:b(A[n].address),abi:A[n].abi,functionName:a,args:m});if(f==="router"&&["swap","swapGated"].includes(l)){let n=p(s.params),a=p(n.key),m=n.amountSpecified;if(m===0n||n.amountBound===0n)throw new d("Hookr swaps require a nonzero amount and bound.");h(n.zeroForOne?a.currency0:a.currency1,m<0n?-m:n.amountBound)}else if(f==="vault"&&l==="deposit"){let n=p(s.params),a=p(n.key);if(h(a.currency0,n.amount0Desired),h(a.currency1,n.amount1Desired),n.amount0Min>n.amount0Desired||n.amount1Min>n.amount1Desired)throw new d("Hookr deposit minimum exceeds its desired amount.")}else if(f==="vault"&&l==="transfer")P.push({token:u,id:s.id,amount:s.amount,to:b(s.receiver)});else if(f==="launcher"&&l.startsWith("launch")){let n=l==="launchFamily"?p(s.p):s,a=p(n.token),m=n.members;if(m.length<1||m.length>8)throw new d("Hookr launch needs one to eight members.");if(T(String(a.salt),String(await $("launcher","SKIP_TAKEN"))))throw new d("Hookr skip-taken launches need per-pool funding checks and are not exposed yet.");let x=a.existing===B?b(await $("launcher","predictToken",[i,a])):b(a.existing),M=0n;for(let y of m){let I=BigInt(x)<BigInt(String(y.quote)),D=I?y.amount0Max:y.amount1Max;a.existing===B?M+=D:h(x,D),h(y.quote,I?y.amount1Max:y.amount0Max)}if(M>a.supply)throw new d("Hookr launch seeds more new tokens than its supply.");let oe=l==="launchFamily"?n.buys:l==="launchWithBuy"?[p(s.buy)]:[];for(let y of oe){let I=m[Number(y.member)];if(!I)throw new d("Hookr dev buy references an unavailable member.");h(I.quote,y.quoteIn)}let F=await H.readContract({address:u,abi:G,functionName:"launchFee"});if(!Array.isArray(F)||typeof F[0]!="bigint"||F[0]<0n)throw new d("Hookr launch fee is unavailable.");w+=F[0]}else if(f==="launcher"&&l==="addLiquidity"){let n=p(await $("launcher","position",[s.familyId,s.member])),a=p(n.key);h(a.currency0,s.max0),h(a.currency1,s.max1)}else if(f==="ownedFactory"&&l==="deploy"){let n=await $("ownedFactory","deployFee");if(typeof n!="bigint"||n<0n)throw new d("Hookr own-hook deployment fee is unavailable.");w=n}else if(f==="programs"&&l==="createProgram"){let n=p(s.t);if(h(n.rewardToken,n.cashBudget),w)throw new d("Hookr program cash rewards require an ERC-20 token.")}else if(f==="commissions"&&l==="createCampaign"){let n=p(s.t),a=n.end-n.start;if(a<=0n||a%86400n!==0n||a/86400n>366n)throw new d("Hookr referral campaigns must cover one to 366 whole days.");h(n.currency,n.dailyBudget*(a/86400n))}else if(f==="reserve"&&l==="fundReserve")h(s.token,s.amount);else if(f==="tokenizer"){let n=p(s.arg1);if(n.launchParams!=="0x"||["feebs","positionIds","positionPermits","v3PositionIds","v3Permits"].some(a=>n[a].length>0))throw new d("Composite revenue launches and NFT streams need their exact child-spender and funding routes; this route accepts families, Rules, revenue-token shares and bound outside sources.");for(let a of n.revenueTokens)h(a.token,a.amount);if(l==="tokenize"&&p(s.arg2).open){let a=await H.readContract({address:b(A.launcher.address),abi:G,functionName:"launchFee"});if(!Array.isArray(a)||typeof a[0]!="bigint"||a[0]<0n)throw new d("Hookr revenue market launch fee is unavailable.");w+=a[0]}}else if(f==="boost"&&["fund","notify"].includes(l)){let n=p(await $("boost","gauge",[s.id]));if(h(p(n.terms).rewardToken,s.amount),w)throw new d("Hookr boost rewards require an ERC-20 token.")}else if(f==="boost"&&l==="stake"){let n=b(await $("boost","positionManager"));if(n!==ie("0x58daec3116aae6D93017bAAea7749052E8a04fA7"))throw new d("Hookr boost position manager disagrees with the published deployment.");let a=await H.readContract({address:n,abi:V,functionName:"ownerOf",args:[s.tokenId]});if(!T(a,i))throw new d("The signing wallet must own the position NFT it stakes.");v.push(t.unsignedTx({to:n,data:J({abi:V,functionName:"approve",args:[u,s.tokenId]}),value:"0",chainId:k,description:`Approve only Hookr position NFT #${s.tokenId} to ${u}.`})),P.push({token:n,id:s.tokenId,amount:1n,to:u})}let j=await H.getBlock();if(typeof j.timestamp!="bigint"||j.timestamp<=0n)throw new d("Hookr chain time is unavailable.");let S=n=>{if(Array.isArray(n)){n.forEach(S);return}if(!(!n||typeof n!="object"))for(let[a,m]of Object.entries(n)){if(a==="deadline"&&typeof m=="bigint"&&m<j.timestamp)throw new d("Hookr deadline expired. Refresh the action terms.");S(m)}};S(s);for(let[n,a]of C){if(a>=(1n<<256n)-1n)throw new d("Hookr aggregate funding exceeds its exact approval bound.");let m=await H.readContract({address:n,abi:re,functionName:"allowance",args:[i,u]});m>0n&&m!==a&&v.push(t.approval(n,u,"0",k)),v.push(t.approval(n,u,a.toString(),k)),P.push({token:n,amount:a})}return w&&P.push({token:W,amount:w,to:u}),v.push(t.unsignedTx({to:u,data:J({abi:[r],functionName:r.name,args:c}),value:w.toString(),chainId:k,description:`Hookr ${f}.${l}: ${JSON.stringify(ne(s))}. Review recipients, bounds, ownership and any delayed effects.`})),{txs:v,inputs:P}}function ke(t,e){if(t.length!==e.length||t.some((i,o)=>i.chainId!==e[o].chainId||!T(i.to,e[o].to)||i.value!==e[o].value||!T(i.data,e[o].data)))throw new d("Hookr transactions differ from the locally reconstructed parameters and exact funding.")}function xe(t){return[{name:"hookr_contracts",inputSchema:{type:"object",description:"Read Hookr contract coverage and typed function schemas: swaps, launches and dev buys, liquidity, saved hooks, own hooks, LP boost, programs, referrals, claims, registry and treasury administration. Filter contract/function to fetch only the needed schema. No network request.",properties:{contract:{...te,description:"Only this pinned contract role; omit for every contract."},function:{type:"string",description:"Only this function name; omit for every function of the selected contracts."}},additionalProperties:!1},execute:async e=>{if(Object.keys(e).some(o=>!["contract","function"].includes(o))||e.contract!==void 0&&(typeof e.contract!="string"||!Object.hasOwn(A,e.contract))||e.function!==void 0&&typeof e.function!="string")throw new d("Choose a documented Hookr contract and function filter.");let i=o=>e.function===void 0||o.name===e.function;return{chainId:k,contracts:Object.entries(A).filter(([o])=>e.contract===void 0||o===e.contract).map(([o,r])=>({role:o,address:b(r.address),source:r.source,match:r.match,reads:_(r).filter(c=>Y(c)&&i(c)).map(c=>({function:c.name,params:E(c.inputs,c.name)})),actions:r.actions.filter(c=>e.function===void 0||c===e.function).map(c=>({function:c,params:E(_(r).find(s=>s.name===c).inputs,c)}))})),note:"Contract parameters use decimal base-unit strings for every integer. Actions always require preview and local human confirmation. Unlisted/internal functions are unavailable."}}},{name:"hookr_read",inputSchema:{...Q,description:"Read a pinned Hookr contract function. Fetch its exact parameter schema with hookr_contracts {contract,function}; no signing, subscription or identity required."},execute:async e=>{let{pin:i,fn:o,values:r,target:c}=ee(e,!0),s=await t.clientFor(k).readContract({address:c,abi:[o],functionName:o.name,args:r});return{chainId:k,contract:c,function:o.name,result:ne(s),source:i.source}}},{name:"hookr_action",inputSchema:{...Q,description:"Build a pinned Hookr action with exact funding: swap, launch/dev buy, liquidity deposit/exit, boost stake/exit, profile/own-hook management, programs/referrals and owner/keeper administration. Fetch its exact parameter schema with hookr_contracts {contract,function}. Preview and human confirmation required."},execute:async(e,i)=>{let o=await me(t,e,i),r=await t.preview(o.txs,i);return{txs:o.txs,preview:r,summary:`Hookr ${e.contract}.${e.function}; review the preview and human confirmation.`}}}]}export{ue as a,E as b,ye as c,me as d,ke as e,xe as f};
|
|
1
|
+
import{a as q}from"./LT5P6PZW.js";import{a as R,b as K}from"./G2LAO23N.js";import{a as W}from"./Z7FGEWO2.js";import{c as U,f as z,g as T,i as L}from"./NWNYJ26T.js";import{b as k}from"./TI727O2H.js";import{a as d}from"./XSD5NL7J.js";import{encodeFunctionData as J,erc20Abi as re,erc721Abi as V,getAddress as ie,parseAbi as ae,zeroAddress as B}from"viem";var A=q,G=ae(["function launchFee() view returns (uint256 fee,address treasury,uint256 pendingFee,address pendingTreasury,uint256 readyAt)"]),g=(t,e)=>t.name==="seed"?"marketSeed":t.name||`arg${e}`,X=t=>"components"in t?t.components:[],se=t=>{if(typeof t!="string"||!/^(0|[1-9][0-9]*)$/.test(t)||t.length>78||BigInt(t)>=1n<<256n)throw new d("Provide Hookr amounts as decimal base-unit strings within uint256.");return BigInt(t)},p=t=>z(t,"Provide the documented Hookr parameter object."),b=t=>L(t,"Provide a valid Hookr address."),Y=t=>t.stateMutability==="view"||t.stateMutability==="pure";function _(t){return t.abi}var ce=`Base units of the token it counts; read that token's decimals (18 decimals: "1000000000000000000" = 1 token).`,de={type:"string",pattern:"^(0|[1-9][0-9]*)$"};function ue(t,e,i){let o=`${t} ${e} ${i}.`,r=t.replace(/\[[0-9]*\]$/,"");return/^u?int/.test(r)?/divisor|numerator|denominator/i.test(e)?`${o} Plain integer ${/divisor/i.test(e)?"divisor":"ratio component"}; do not scale by token decimals.`:/liquidity/i.test(e)?`${o} Uniswap v4 liquidity units, not a token amount; do not scale by token decimals.`:/gas/i.test(e)?`${o} Integer gas units; do not scale by token decimals.`:/point/i.test(e)&&!/decimals/i.test(e)?`${o} Integer points; do not scale by token decimals.`:/pips$/i.test(e)?`${o} ${R.pips()}`:K(e,de)||e==="walletFeeCap"?`${o} ${ce}`:/bps$/i.test(e)?`${o} ${R.bps()}`:/(deadline|expir|timestamp|time|At)$/.test(e)?`${o} Unix seconds, as a decimal string.`:`${o} Decimal string${r.startsWith("uint")?"":", may be negative"}.`:r==="address"?`${o} 0x followed by 40 hex digits${/^(to|recipient|receiver|owner|spender|wallet|beneficiary)$/i.test(e)?"; use the intended address, never an example address":""}.`:r==="bool"?`${o} true or false.`:r.startsWith("bytes")?`${o} 0x-prefixed hex bytes.`:r==="tuple"?`${o} Object with the listed fields.`:`${o} Plain text.`}function Z(t,e,i,o){let r=ue(t.type,o,e),c=/^(.*)\[([0-9]*)\]$/.exec(t.type);return c?{type:"array",description:r,items:Z({...t,type:c[1]},e,i,o),minItems:c[2]?Number(c[2]):0,maxItems:c[2]?Number(c[2]):128}:t.type==="tuple"?{...E(X(t),i,o),description:r}:t.type==="bool"?{type:"boolean",description:r}:t.type==="address"?{...U,description:r}:/^u?int/.test(t.type)?{type:"string",pattern:t.type.startsWith("uint")?"^(0|[1-9][0-9]*)$":"^(0|-?[1-9][0-9]*)$",description:r}:t.type.startsWith("bytes")?{type:"string",pattern:"^0x([0-9a-fA-F]{2})*$",maxLength:32770,description:r}:{type:"string",maxLength:4096,description:r}}function E(t,e,i){let o=i===void 0?`argument of ${e}`:`field of ${i} in ${e}`;return{type:"object",properties:Object.fromEntries(t.map((r,c)=>[g(r,c),Z(r,o,e,g(r,c))])),required:t.map(g),additionalProperties:!1}}function N(t,e){let i=/^(.*)\[([0-9]*)\]$/.exec(t.type);if(i){if(!Array.isArray(e)||e.length>128||i[2]&&e.length!==Number(i[2]))throw new d("Hookr parameter array has an invalid length.");return e.map(r=>N({...t,type:i[1]},r))}if(t.type==="tuple"){let r=p(e),c=X(t);return O(r,c.map(g)),Object.fromEntries(c.map((s,u)=>[s.name||`arg${u}`,N(s,r[g(s,u)])]))}if(t.type==="address")return b(e);if(t.type==="bool"){if(typeof e!="boolean")throw new d("Provide a Hookr boolean.");return e}let o=/^(u?)int([0-9]*)$/.exec(t.type);if(o){if(typeof e!="string"||!/^(0|-?[1-9][0-9]*)$/.test(e)||e.length>79)throw new d("Provide Hookr integers as decimal base-unit strings.");let r=BigInt(e),c=BigInt(o[2]||256),s=!o[1];if(r<(s?-(1n<<c-1n):0n)||r>=1n<<(s?c-1n:c))throw new d("Hookr integer exceeds its ABI range.");return c<=32n?Number(r):r}if(t.type.startsWith("bytes")){let r=Number(t.type.slice(5));if(typeof e!="string"||!/^0x([0-9a-fA-F]{2})*$/.test(e)||e.length>32770||r&&e.length!==2+r*2)throw new d("Provide a valid Hookr hex byte string of the ABI length.");return e}if(t.type!=="string"||typeof e!="string"||new TextEncoder().encode(e).length>4096)throw new d("Provide a valid Hookr string.");return e}function O(t,e){if(Object.keys(t).some(i=>!e.includes(i))||e.some(i=>!Object.hasOwn(t,i)))throw new d("Provide exactly the documented Hookr parameters.")}function ye(t,e){O(e,t.inputs.map(g));let i=t.inputs.map((o,r)=>N(o,e[g(o,r)]));return{values:i,params:Object.fromEntries(t.inputs.map((o,r)=>[g(o,r),i[r]]))}}function ee(t,e){if(O(t,["contract","function","params"]),typeof t.contract!="string"||!Object.hasOwn(A,t.contract))throw new d("Choose a contract from hookr_contracts.");let i=A[t.contract];if(!e&&i.address.toLowerCase()===q.launcherV1.address.toLowerCase())throw new d("Use hookr_launch for the reviewed new Launcher; generic actions cannot call it.");let o=_(i).find(u=>u.name===t.function&&(e?Y(u):i.actions.includes(u.name)));if(!o)throw new d("This Hookr function is not exposed in this read/action lane. Read hookr_contracts for coverage.");let r=p(t.params);O(r,o.inputs.map(g));let c=o.inputs.map((u,f)=>N(u,r[g(u,f)])),s=Object.fromEntries(o.inputs.map((u,f)=>[g(u,f),c[f]]));return{pin:i,fn:o,values:c,params:s,target:b(i.address)}}var te={type:"string",enum:Object.keys(A),description:'Pinned Hookr contract role, as listed by hookr_contracts (for example "launcherV1").'},Q={type:"object",properties:{contract:te,function:{type:"string",description:"Function name on that contract, exactly as hookr_contracts lists it."},params:{type:"object",description:"Exact typed parameters from hookr_contracts for this contract and function; validated recursively before any chain read."}},required:["contract","function","params"],additionalProperties:!1};function ne(t){return JSON.parse(JSON.stringify(t,(e,i)=>typeof i=="bigint"?i.toString():i))}async function me(t,e,i){if(t.network==="testnet")throw new d("Hookr actions are configured only on mainnet, chain 4663.");let{pin:o,fn:r,values:c,params:s,target:u}=ee(e,!1),f=e.contract,l=r.name,H=t.clientFor(k),v=[],P=[],w=0n,C=new Map,h=(n,a)=>{let m=b(n),x=typeof a=="bigint"?a:se(a);if(x<0n||x>=(1n<<256n)-1n)throw new d("Hookr funding must be an exact bounded amount.");x&&(m===B?w+=x:C.set(m,(C.get(m)??0n)+x))},$=(n,a,m=[])=>H.readContract({address:b(A[n].address),abi:A[n].abi,functionName:a,args:m});if(f==="router"&&["swap","swapGated"].includes(l)){let n=p(s.params),a=p(n.key),m=n.amountSpecified;if(m===0n||n.amountBound===0n)throw new d("Hookr swaps require a nonzero amount and bound.");h(n.zeroForOne?a.currency0:a.currency1,m<0n?-m:n.amountBound)}else if(f==="vault"&&l==="deposit"){let n=p(s.params),a=p(n.key);if(h(a.currency0,n.amount0Desired),h(a.currency1,n.amount1Desired),n.amount0Min>n.amount0Desired||n.amount1Min>n.amount1Desired)throw new d("Hookr deposit minimum exceeds its desired amount.")}else if(f==="vault"&&l==="transfer")P.push({token:u,id:s.id,amount:s.amount,to:b(s.receiver)});else if(f==="launcher"&&l.startsWith("launch")){let n=l==="launchFamily"?p(s.p):s,a=p(n.token),m=n.members;if(m.length<1||m.length>8)throw new d("Hookr launch needs one to eight members.");if(T(String(a.salt),String(await $("launcher","SKIP_TAKEN"))))throw new d("Hookr skip-taken launches need per-pool funding checks and are not exposed yet.");let x=a.existing===B?b(await $("launcher","predictToken",[i,a])):b(a.existing),M=0n;for(let y of m){let I=BigInt(x)<BigInt(String(y.quote)),D=I?y.amount0Max:y.amount1Max;a.existing===B?M+=D:h(x,D),h(y.quote,I?y.amount1Max:y.amount0Max)}if(M>a.supply)throw new d("Hookr launch seeds more new tokens than its supply.");let oe=l==="launchFamily"?n.buys:l==="launchWithBuy"?[p(s.buy)]:[];for(let y of oe){let I=m[Number(y.member)];if(!I)throw new d("Hookr dev buy references an unavailable member.");h(I.quote,y.quoteIn)}let F=await H.readContract({address:u,abi:G,functionName:"launchFee"});if(!Array.isArray(F)||typeof F[0]!="bigint"||F[0]<0n)throw new d("Hookr launch fee is unavailable.");w+=F[0]}else if(f==="launcher"&&l==="addLiquidity"){let n=p(await $("launcher","position",[s.familyId,s.member])),a=p(n.key);h(a.currency0,s.max0),h(a.currency1,s.max1)}else if(f==="ownedFactory"&&l==="deploy"){let n=await $("ownedFactory","deployFee");if(typeof n!="bigint"||n<0n)throw new d("Hookr own-hook deployment fee is unavailable.");w=n}else if(f==="programs"&&l==="createProgram"){let n=p(s.t);if(h(n.rewardToken,n.cashBudget),w)throw new d("Hookr program cash rewards require an ERC-20 token.")}else if(f==="commissions"&&l==="createCampaign"){let n=p(s.t),a=n.end-n.start;if(a<=0n||a%86400n!==0n||a/86400n>366n)throw new d("Hookr referral campaigns must cover one to 366 whole days.");h(n.currency,n.dailyBudget*(a/86400n))}else if(f==="reserve"&&l==="fundReserve")h(s.token,s.amount);else if(f==="tokenizer"){let n=p(s.arg1);if(n.launchParams!=="0x"||["feebs","positionIds","positionPermits","v3PositionIds","v3Permits"].some(a=>n[a].length>0))throw new d("Composite revenue launches and NFT streams need their exact child-spender and funding routes; this route accepts families, Rules, revenue-token shares and bound outside sources.");for(let a of n.revenueTokens)h(a.token,a.amount);if(l==="tokenize"&&p(s.arg2).open){let a=await H.readContract({address:b(A.launcher.address),abi:G,functionName:"launchFee"});if(!Array.isArray(a)||typeof a[0]!="bigint"||a[0]<0n)throw new d("Hookr revenue market launch fee is unavailable.");w+=a[0]}}else if(f==="boost"&&["fund","notify"].includes(l)){let n=p(await $("boost","gauge",[s.id]));if(h(p(n.terms).rewardToken,s.amount),w)throw new d("Hookr boost rewards require an ERC-20 token.")}else if(f==="boost"&&l==="stake"){let n=b(await $("boost","positionManager"));if(n!==ie("0x58daec3116aae6D93017bAAea7749052E8a04fA7"))throw new d("Hookr boost position manager disagrees with the published deployment.");let a=await H.readContract({address:n,abi:V,functionName:"ownerOf",args:[s.tokenId]});if(!T(a,i))throw new d("The signing wallet must own the position NFT it stakes.");v.push(t.unsignedTx({to:n,data:J({abi:V,functionName:"approve",args:[u,s.tokenId]}),value:"0",chainId:k,description:`Approve only Hookr position NFT #${s.tokenId} to ${u}.`})),P.push({token:n,id:s.tokenId,amount:1n,to:u})}let j=await H.getBlock();if(typeof j.timestamp!="bigint"||j.timestamp<=0n)throw new d("Hookr chain time is unavailable.");let S=n=>{if(Array.isArray(n)){n.forEach(S);return}if(!(!n||typeof n!="object"))for(let[a,m]of Object.entries(n)){if(a==="deadline"&&typeof m=="bigint"&&m<j.timestamp)throw new d("Hookr deadline expired. Refresh the action terms.");S(m)}};S(s);for(let[n,a]of C){if(a>=(1n<<256n)-1n)throw new d("Hookr aggregate funding exceeds its exact approval bound.");let m=await H.readContract({address:n,abi:re,functionName:"allowance",args:[i,u]});m>0n&&m!==a&&v.push(t.approval(n,u,"0",k)),v.push(t.approval(n,u,a.toString(),k)),P.push({token:n,amount:a})}return w&&P.push({token:W,amount:w,to:u}),v.push(t.unsignedTx({to:u,data:J({abi:[r],functionName:r.name,args:c}),value:w.toString(),chainId:k,description:`Hookr ${f}.${l}: ${JSON.stringify(ne(s))}. Review recipients, bounds, ownership and any delayed effects.`})),{txs:v,inputs:P}}function ke(t,e){if(t.length!==e.length||t.some((i,o)=>i.chainId!==e[o].chainId||!T(i.to,e[o].to)||i.value!==e[o].value||!T(i.data,e[o].data)))throw new d("Hookr transactions differ from the locally reconstructed parameters and exact funding.")}function xe(t){return[{name:"hookr_contracts",inputSchema:{type:"object",description:"Read Hookr contract coverage and typed function schemas: swaps, launches and dev buys, liquidity, saved hooks, own hooks, LP boost, programs, referrals, claims, registry and treasury administration. Filter contract/function to fetch only the needed schema. No network request.",properties:{contract:{...te,description:"Only this pinned contract role; omit for every contract."},function:{type:"string",description:"Only this function name; omit for every function of the selected contracts."}},additionalProperties:!1},execute:async e=>{if(Object.keys(e).some(o=>!["contract","function"].includes(o))||e.contract!==void 0&&(typeof e.contract!="string"||!Object.hasOwn(A,e.contract))||e.function!==void 0&&typeof e.function!="string")throw new d("Choose a documented Hookr contract and function filter.");let i=o=>e.function===void 0||o.name===e.function;return{chainId:k,contracts:Object.entries(A).filter(([o])=>e.contract===void 0||o===e.contract).map(([o,r])=>({role:o,address:b(r.address),source:r.source,match:r.match,reads:_(r).filter(c=>Y(c)&&i(c)).map(c=>({function:c.name,params:E(c.inputs,c.name)})),actions:r.actions.filter(c=>e.function===void 0||c===e.function).map(c=>({function:c,params:E(_(r).find(s=>s.name===c).inputs,c)}))})),note:"Contract parameters use decimal base-unit strings for every integer. Actions always require preview and local human confirmation. Unlisted/internal functions are unavailable."}}},{name:"hookr_read",inputSchema:{...Q,description:"Read a pinned Hookr contract function. Fetch its exact parameter schema with hookr_contracts {contract,function}; no signing, subscription or identity required."},execute:async e=>{let{pin:i,fn:o,values:r,target:c}=ee(e,!0),s=await t.clientFor(k).readContract({address:c,abi:[o],functionName:o.name,args:r});return{chainId:k,contract:c,function:o.name,result:ne(s),source:i.source}}},{name:"hookr_action",inputSchema:{...Q,description:"Build a pinned Hookr action with exact funding: swap, launch/dev buy, liquidity deposit/exit, boost stake/exit, profile/own-hook management, programs/referrals and owner/keeper administration. Fetch its exact parameter schema with hookr_contracts {contract,function}. Preview and human confirmation required."},execute:async(e,i)=>{let o=await me(t,e,i),r=await t.preview(o.txs,i);return{txs:o.txs,preview:r,summary:`Hookr ${e.contract}.${e.function}; review the preview and human confirmation.`}}}]}export{ue as a,E as b,ye as c,me as d,ke as e,xe as f};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{b as pe,c as me}from"./FOKEFXGP.js";import{a as ue}from"./SPJCSEKP.js";import{a as be}from"./43LI5NKJ.js";import{c as le}from"./SCG5HWMN.js";import{a as O}from"./66F5ZH34.js";import{c as Y,d as oe,g as I,i as fe,m as se,n as re}from"./NWNYJ26T.js";import{a as M,i as de,j as ce}from"./FWD4L3CJ.js";import{a as o}from"./XSD5NL7J.js";import{decodeFunctionData as J,encodeFunctionData as T,erc20Abi as te,getAddress as he,keccak256 as Ce,parseAbi as P}from"viem";var q={chainId:4663,observedAt:"2026-11-04T21:56:26.556Z",block:"106231118",routeBlock:"106231118",sources:["https://rpc.mainnet.chain.robinhood.com","https://raw.githubusercontent.com/beefyfinance/cowcentrated-subgraph/main/abis/beefy/clm/ClmManager.json","https://raw.githubusercontent.com/beefyfinance/beefy-v2/main/src/features/data/apis/beefy/beefy-clm-pool.ts"],markets:{v3:{router:"0xCaf681a66D020601342297493863E78C959E5cb2",quoter:"0x33e885eD0Ec9bF04EcfB19341582aADCb4c8A9E7",factory:"0x1f7d7550B1b028f7571E69A784071F0205FD2EfA"},cl:{router:"0xC062b870E813fcA720f1e002c234369Ab3aB9415",quoter:"0x03983AB2C057a2eac211ff01738a1e49ff325B49",factory:"0x1ac9dB4a2608ba45D6127B1737949b51Bb54B7F3"}},vaults:[{id:"up33-cow-robinhood-cashcat-weth-vault",vault:"0x25012D654bF9107B6E0Af0248656fEf0b718dBd3",manager:"0x137731B8B2D7Cd24aB4A4A9061f2D7b4Fd1aBFEE",managerImpl:"0xfD4017Ad7c1092aaFEbC82621B4DeE59f178D74C",wants:["0x020bfC650A365f8BB26819deAAbF3E21291018b4","0x0Bd7D308f8E1639FAb988df18A8011f41EAcAD73"],strategy:"0xd7F3bCDAfCFf0018953BB6944Db2683Ff2e42b07",beacon:"0xfD7EE9D17BD6941bF8e612281ec23E857134BB92",implementation:"0x01b0d3d2d54e0B63a8a97E108bE72C819Dc5a0E6",pool:"0x4E8649Be40aE67EBbcff99C291B92eE03015917b",factory:"0x1ac9dB4a2608ba45D6127B1737949b51Bb54B7F3",tickSpacing:200,bridge:"0x0Bd7D308f8E1639FAb988df18A8011f41EAcAD73"},{id:"up33-cow-robinhood-usdg-net-vault",vault:"0x25B418FcFe8543c25AD9d78246839E5Cf3a3b50D",manager:"0x5A725556514222d0cc81501A9294a3135b7C41C4",managerImpl:"0xfD4017Ad7c1092aaFEbC82621B4DeE59f178D74C",wants:["0x5fc5360D0400a0Fd4f2af552ADD042D716F1d168","0xCA9c78Dd337A67F6e0077F65F5E9218719d30eDf"],strategy:"0x89207bED2935C64d6cb105E9C85E0E2ED99DD8f2",beacon:"0xfD7EE9D17BD6941bF8e612281ec23E857134BB92",implementation:"0x01b0d3d2d54e0B63a8a97E108bE72C819Dc5a0E6",pool:"0x99e70A5b06215e5D2F3BeC773b4f59c008fc1673",factory:"0x1ac9dB4a2608ba45D6127B1737949b51Bb54B7F3",tickSpacing:200,bridge:"0x5fc5360D0400a0Fd4f2af552ADD042D716F1d168"},{id:"up33-cow-robinhood-weth-stonkbroker-vault",vault:"0x544c7Ef9265dc08d93B5394116E68aE7D9e60730",manager:"0x5794bB61E83397049c40D87BbF3d44AF583A27Ce",managerImpl:"0xfD4017Ad7c1092aaFEbC82621B4DeE59f178D74C",wants:["0x0Bd7D308f8E1639FAb988df18A8011f41EAcAD73","0xe934e36A439C94017B64a3FecE66AF12099aBF50"],strategy:"0x54Bd0805f549708144C811c14DdEeC0714CA5e0c",beacon:"0xfD7EE9D17BD6941bF8e612281ec23E857134BB92",implementation:"0x01b0d3d2d54e0B63a8a97E108bE72C819Dc5a0E6",pool:"0xB11ba9a4d345434c25d625C076f23Ad14abC6B3c",factory:"0x1ac9dB4a2608ba45D6127B1737949b51Bb54B7F3",tickSpacing:200,bridge:"0x0Bd7D308f8E1639FAb988df18A8011f41EAcAD73"},{id:"up33-cow-robinhood-weth-up-vault",vault:"0x56EA4b4AFAFbb87CFD8Fd8a0266a2F86561677b8",manager:"0x36759534741E28Eb052238738963D684bFe719E4",managerImpl:"0xfD4017Ad7c1092aaFEbC82621B4DeE59f178D74C",wants:["0x0Bd7D308f8E1639FAb988df18A8011f41EAcAD73","0x57C0E45cB534413D1C20A4240955d6bB250BB4F1"],strategy:"0x8337c691C3afA52ccE418178e52ed472F034Cb8b",beacon:"0xfD7EE9D17BD6941bF8e612281ec23E857134BB92",implementation:"0x01b0d3d2d54e0B63a8a97E108bE72C819Dc5a0E6",pool:"0x23D641FeCcD207E8794c593e8240444A0674C4Ba",factory:"0x1ac9dB4a2608ba45D6127B1737949b51Bb54B7F3",tickSpacing:200,bridge:"0x0Bd7D308f8E1639FAb988df18A8011f41EAcAD73"},{id:"up33-cow-robinhood-weth-frong-vault",vault:"0x75588e48f7b4Ed9365d78C6cD509f3C7B804Ca47",manager:"0x9818f01EDCcc3d8EB86B859931C3B877cf44A108",managerImpl:"0xfD4017Ad7c1092aaFEbC82621B4DeE59f178D74C",wants:["0x0Bd7D308f8E1639FAb988df18A8011f41EAcAD73","0x6245e67affA44a23077f0Ea7f981a8DC743a0c47"],strategy:"0xdB739d906CD5101b65E089a284ec13a3ab21F603",beacon:"0xfD7EE9D17BD6941bF8e612281ec23E857134BB92",implementation:"0x01b0d3d2d54e0B63a8a97E108bE72C819Dc5a0E6",pool:"0x9334BbCBE77C0883d704f71Db35CCF636639334c",factory:"0x1ac9dB4a2608ba45D6127B1737949b51Bb54B7F3",tickSpacing:200,bridge:"0x0Bd7D308f8E1639FAb988df18A8011f41EAcAD73"},{id:"up33-cow-robinhood-usdg-intc-vault",vault:"0x8353c496114CF66D10545fdc2B4e6dFBafd37e3b",manager:"0x599ac767099bB6f01712867BfA1Fc1Aa27DEFD37",managerImpl:"0xfD4017Ad7c1092aaFEbC82621B4DeE59f178D74C",wants:["0x5fc5360D0400a0Fd4f2af552ADD042D716F1d168","0xc72b96e0E48ecd4DC75E1e45396e26300BC39681"],strategy:"0xbaEE86C9D7dE9dc192f17dFA62833B601Dc64D23",beacon:"0xfD7EE9D17BD6941bF8e612281ec23E857134BB92",implementation:"0x01b0d3d2d54e0B63a8a97E108bE72C819Dc5a0E6",pool:"0x6290Be6e6913708866E6f17eaf3F4FCC7d3fdF67",factory:"0x1ac9dB4a2608ba45D6127B1737949b51Bb54B7F3",tickSpacing:60,bridge:"0x5fc5360D0400a0Fd4f2af552ADD042D716F1d168"},{id:"up33-cow-robinhood-weth-tendies-vault",vault:"0x97DCDc29a3B3e2F556564279f7D09eE40eB74E45",manager:"0x9619bFB1f2D97E2B23F23310205e4c2089c1A45d",managerImpl:"0xfD4017Ad7c1092aaFEbC82621B4DeE59f178D74C",wants:["0x0Bd7D308f8E1639FAb988df18A8011f41EAcAD73","0x45242320DBB855EeA8Fd36804C6487E10E97FCF9"],strategy:"0x9a02CaA8a2e63659f8A419a29a3B48baD86d3c7a",beacon:"0xfD7EE9D17BD6941bF8e612281ec23E857134BB92",implementation:"0x01b0d3d2d54e0B63a8a97E108bE72C819Dc5a0E6",pool:"0xD53a623c17A5853838FA140cE5706eA008565dA8",factory:"0x1ac9dB4a2608ba45D6127B1737949b51Bb54B7F3",tickSpacing:200,bridge:"0x0Bd7D308f8E1639FAb988df18A8011f41EAcAD73"}],routes:[{from:"0x0Bd7D308f8E1639FAb988df18A8011f41EAcAD73",to:"0x020bfC650A365f8BB26819deAAbF3E21291018b4",kind:"cl",path:"0x0bd7d308f8e1639fab988df18a8011f41eacad730000c8020bfc650a365f8bb26819deaabf3e21291018b4",pools:["0x4E8649Be40aE67EBbcff99C291B92eE03015917b"]},{from:"0x020bfC650A365f8BB26819deAAbF3E21291018b4",to:"0x0Bd7D308f8E1639FAb988df18A8011f41EAcAD73",kind:"cl",path:"0x020bfc650a365f8bb26819deaabf3e21291018b40000c80bd7d308f8e1639fab988df18a8011f41eacad73",pools:["0x4E8649Be40aE67EBbcff99C291B92eE03015917b"]},{from:"0x5fc5360D0400a0Fd4f2af552ADD042D716F1d168",to:"0xCA9c78Dd337A67F6e0077F65F5E9218719d30eDf",kind:"cl",path:"0x5fc5360d0400a0fd4f2af552add042d716f1d1680000c8ca9c78dd337a67f6e0077f65f5e9218719d30edf",pools:["0x99e70A5b06215e5D2F3BeC773b4f59c008fc1673"]},{from:"0xCA9c78Dd337A67F6e0077F65F5E9218719d30eDf",to:"0x5fc5360D0400a0Fd4f2af552ADD042D716F1d168",kind:"cl",path:"0xca9c78dd337a67f6e0077f65f5e9218719d30edf0000c85fc5360d0400a0fd4f2af552add042d716f1d168",pools:["0x99e70A5b06215e5D2F3BeC773b4f59c008fc1673"]},{from:"0x0Bd7D308f8E1639FAb988df18A8011f41EAcAD73",to:"0xe934e36A439C94017B64a3FecE66AF12099aBF50",kind:"cl",path:"0x0bd7d308f8e1639fab988df18a8011f41eacad730000c8e934e36a439c94017b64a3fece66af12099abf50",pools:["0xB11ba9a4d345434c25d625C076f23Ad14abC6B3c"]},{from:"0xe934e36A439C94017B64a3FecE66AF12099aBF50",to:"0x0Bd7D308f8E1639FAb988df18A8011f41EAcAD73",kind:"cl",path:"0xe934e36a439c94017b64a3fece66af12099abf500000c80bd7d308f8e1639fab988df18a8011f41eacad73",pools:["0xB11ba9a4d345434c25d625C076f23Ad14abC6B3c"]},{from:"0x0Bd7D308f8E1639FAb988df18A8011f41EAcAD73",to:"0x57C0E45cB534413D1C20A4240955d6bB250BB4F1",kind:"cl",path:"0x0bd7d308f8e1639fab988df18a8011f41eacad730000c857c0e45cb534413d1c20a4240955d6bb250bb4f1",pools:["0x23D641FeCcD207E8794c593e8240444A0674C4Ba"]},{from:"0x57C0E45cB534413D1C20A4240955d6bB250BB4F1",to:"0x0Bd7D308f8E1639FAb988df18A8011f41EAcAD73",kind:"cl",path:"0x57c0e45cb534413d1c20a4240955d6bb250bb4f10000c80bd7d308f8e1639fab988df18a8011f41eacad73",pools:["0x23D641FeCcD207E8794c593e8240444A0674C4Ba"]},{from:"0x0Bd7D308f8E1639FAb988df18A8011f41EAcAD73",to:"0x6245e67affA44a23077f0Ea7f981a8DC743a0c47",kind:"cl",path:"0x0bd7d308f8e1639fab988df18a8011f41eacad730000c86245e67affa44a23077f0ea7f981a8dc743a0c47",pools:["0x9334BbCBE77C0883d704f71Db35CCF636639334c"]},{from:"0x6245e67affA44a23077f0Ea7f981a8DC743a0c47",to:"0x0Bd7D308f8E1639FAb988df18A8011f41EAcAD73",kind:"cl",path:"0x6245e67affa44a23077f0ea7f981a8dc743a0c470000c80bd7d308f8e1639fab988df18a8011f41eacad73",pools:["0x9334BbCBE77C0883d704f71Db35CCF636639334c"]},{from:"0x5fc5360D0400a0Fd4f2af552ADD042D716F1d168",to:"0xc72b96e0E48ecd4DC75E1e45396e26300BC39681",kind:"cl",path:"0x5fc5360d0400a0fd4f2af552add042d716f1d16800003cc72b96e0e48ecd4dc75e1e45396e26300bc39681",pools:["0x6290Be6e6913708866E6f17eaf3F4FCC7d3fdF67"]},{from:"0xc72b96e0E48ecd4DC75E1e45396e26300BC39681",to:"0x5fc5360D0400a0Fd4f2af552ADD042D716F1d168",kind:"cl",path:"0xc72b96e0e48ecd4dc75e1e45396e26300bc3968100003c5fc5360d0400a0fd4f2af552add042d716f1d168",pools:["0x6290Be6e6913708866E6f17eaf3F4FCC7d3fdF67"]},{from:"0x0Bd7D308f8E1639FAb988df18A8011f41EAcAD73",to:"0x45242320DBB855EeA8Fd36804C6487E10E97FCF9",kind:"cl",path:"0x0bd7d308f8e1639fab988df18a8011f41eacad730000c845242320dbb855eea8fd36804c6487e10e97fcf9",pools:["0xD53a623c17A5853838FA140cE5706eA008565dA8"]},{from:"0x45242320DBB855EeA8Fd36804C6487E10E97FCF9",to:"0x0Bd7D308f8E1639FAb988df18A8011f41EAcAD73",kind:"cl",path:"0x45242320dbb855eea8fd36804c6487e10e97fcf90000c80bd7d308f8e1639fab988df18a8011f41eacad73",pools:["0xD53a623c17A5853838FA140cE5706eA008565dA8"]},{from:"0x5fc5360D0400a0Fd4f2af552ADD042D716F1d168",to:"0x0Bd7D308f8E1639FAb988df18A8011f41EAcAD73",kind:"v3",path:"0x5fc5360d0400a0fd4f2af552add042d716f1d1680000640bd7d308f8e1639fab988df18a8011f41eacad73",pools:["0x52e65B17fB6E5BA00Ed806f37Afcd2DaA50271Ca"]},{from:"0x0Bd7D308f8E1639FAb988df18A8011f41EAcAD73",to:"0x5fc5360D0400a0Fd4f2af552ADD042D716F1d168",kind:"v3",path:"0x0bd7d308f8e1639fab988df18a8011f41eacad730000645fc5360d0400a0fd4f2af552add042d716f1d168",pools:["0x52e65B17fB6E5BA00Ed806f37Afcd2DaA50271Ca"]}],codeHashes:{"0x137731B8B2D7Cd24aB4A4A9061f2D7b4Fd1aBFEE":"0xa5fcbfc6347a83acdfbc561e9c0a59b1bbb321da361c3463b73b5c173a68291b","0xfD4017Ad7c1092aaFEbC82621B4DeE59f178D74C":"0x6f2a1713cbceba31cc630dddda1ef99cd35086c96005f3c9ea015f9a8e53e613","0xd7F3bCDAfCFf0018953BB6944Db2683Ff2e42b07":"0x48fed026ddb394d366df6328a1bb802687a479cd28e30ee41d38b8567fb90202","0xfD7EE9D17BD6941bF8e612281ec23E857134BB92":"0x9cc155dd143657bba37e6a51fa28e78158e3f47454acdcebedc0512e3803d0fc","0xF5331Dc29A1FDe4b22d7F168661584B057228683":"0x9f1e0f8e488165740c5ab91a3da1bea1a75eeef607ea37b32296ad465971344c","0x4E8649Be40aE67EBbcff99C291B92eE03015917b":"0xda57657ec68ddfb0987ba1352a44cefe40433e55585f3e4555b8ced4bbeb540d","0x1ac9dB4a2608ba45D6127B1737949b51Bb54B7F3":"0x4350c8fcdf90361969542249d76c25d6afbd31f10bebf0134bfe21beba1e8f4c","0x5A725556514222d0cc81501A9294a3135b7C41C4":"0xa5fcbfc6347a83acdfbc561e9c0a59b1bbb321da361c3463b73b5c173a68291b","0x89207bED2935C64d6cb105E9C85E0E2ED99DD8f2":"0x48fed026ddb394d366df6328a1bb802687a479cd28e30ee41d38b8567fb90202","0x99e70A5b06215e5D2F3BeC773b4f59c008fc1673":"0xda57657ec68ddfb0987ba1352a44cefe40433e55585f3e4555b8ced4bbeb540d","0x5794bB61E83397049c40D87BbF3d44AF583A27Ce":"0xa5fcbfc6347a83acdfbc561e9c0a59b1bbb321da361c3463b73b5c173a68291b","0x54Bd0805f549708144C811c14DdEeC0714CA5e0c":"0x48fed026ddb394d366df6328a1bb802687a479cd28e30ee41d38b8567fb90202","0xB11ba9a4d345434c25d625C076f23Ad14abC6B3c":"0xda57657ec68ddfb0987ba1352a44cefe40433e55585f3e4555b8ced4bbeb540d","0x36759534741E28Eb052238738963D684bFe719E4":"0xa5fcbfc6347a83acdfbc561e9c0a59b1bbb321da361c3463b73b5c173a68291b","0x8337c691C3afA52ccE418178e52ed472F034Cb8b":"0x48fed026ddb394d366df6328a1bb802687a479cd28e30ee41d38b8567fb90202","0x23D641FeCcD207E8794c593e8240444A0674C4Ba":"0xda57657ec68ddfb0987ba1352a44cefe40433e55585f3e4555b8ced4bbeb540d","0x9818f01EDCcc3d8EB86B859931C3B877cf44A108":"0xa5fcbfc6347a83acdfbc561e9c0a59b1bbb321da361c3463b73b5c173a68291b","0xdB739d906CD5101b65E089a284ec13a3ab21F603":"0x48fed026ddb394d366df6328a1bb802687a479cd28e30ee41d38b8567fb90202","0x9334BbCBE77C0883d704f71Db35CCF636639334c":"0xda57657ec68ddfb0987ba1352a44cefe40433e55585f3e4555b8ced4bbeb540d","0x599ac767099bB6f01712867BfA1Fc1Aa27DEFD37":"0xa5fcbfc6347a83acdfbc561e9c0a59b1bbb321da361c3463b73b5c173a68291b","0xbaEE86C9D7dE9dc192f17dFA62833B601Dc64D23":"0x48fed026ddb394d366df6328a1bb802687a479cd28e30ee41d38b8567fb90202","0x6290Be6e6913708866E6f17eaf3F4FCC7d3fdF67":"0xda57657ec68ddfb0987ba1352a44cefe40433e55585f3e4555b8ced4bbeb540d","0x9619bFB1f2D97E2B23F23310205e4c2089c1A45d":"0xa5fcbfc6347a83acdfbc561e9c0a59b1bbb321da361c3463b73b5c173a68291b","0x9a02CaA8a2e63659f8A419a29a3B48baD86d3c7a":"0x48fed026ddb394d366df6328a1bb802687a479cd28e30ee41d38b8567fb90202","0xD53a623c17A5853838FA140cE5706eA008565dA8":"0xda57657ec68ddfb0987ba1352a44cefe40433e55585f3e4555b8ced4bbeb540d","0xCaf681a66D020601342297493863E78C959E5cb2":"0x6f36c378e272c6324c48f045182bcb54bd8ad654cf9ebd42e8893d52c4cb25dc","0x33e885eD0Ec9bF04EcfB19341582aADCb4c8A9E7":"0x3db0868d945e9304c9bc6a8b2181948109ea617647142f3c4083e14393496a28","0x1f7d7550B1b028f7571E69A784071F0205FD2EfA":"0xec72b1abd1f2faee020cfea9c646bd8994f9fb389054f6e574f103a895091739","0xC062b870E813fcA720f1e002c234369Ab3aB9415":"0x11ea7d3599ef56eda32c0ce7ca26e9aae71bec13bfcbd3ad0e83826c1a2defe4","0x03983AB2C057a2eac211ff01738a1e49ff325B49":"0x1ed81396c831d69a6c59384019850c21ac672d24ae83b4b26304a7384e1e4096","0x52e65B17fB6E5BA00Ed806f37Afcd2DaA50271Ca":"0x3298b5dd4e6f115074c526a55ad05a36fd73a0034ac22ec6cbaab32cc9c1e8d2","0x0Bd7D308f8E1639FAb988df18A8011f41EAcAD73":"0x5706be52f64875fee65a2cec0d80e47a23d8793cbe85d214b48445e2d05f5353","0x11725976BF1F38c4aB78d1F480bc5883d70D9dc3":"0xa2cf7f366f3d8d11e611acecf7916a27308ba041bf1e161bddbd4ecbb9402b6a","0x01b0d3d2d54e0B63a8a97E108bE72C819Dc5a0E6":"0xd6f09e63327b36d3c498f8de8768bd3e4336894cd00ddb36aa9e0a1e4a4c911e"},delegates:{"0x137731B8B2D7Cd24aB4A4A9061f2D7b4Fd1aBFEE":"0xfD4017Ad7c1092aaFEbC82621B4DeE59f178D74C","0x4E8649Be40aE67EBbcff99C291B92eE03015917b":"0x11725976BF1F38c4aB78d1F480bc5883d70D9dc3","0x5A725556514222d0cc81501A9294a3135b7C41C4":"0xfD4017Ad7c1092aaFEbC82621B4DeE59f178D74C","0x99e70A5b06215e5D2F3BeC773b4f59c008fc1673":"0x11725976BF1F38c4aB78d1F480bc5883d70D9dc3","0x5794bB61E83397049c40D87BbF3d44AF583A27Ce":"0xfD4017Ad7c1092aaFEbC82621B4DeE59f178D74C","0xB11ba9a4d345434c25d625C076f23Ad14abC6B3c":"0x11725976BF1F38c4aB78d1F480bc5883d70D9dc3","0x36759534741E28Eb052238738963D684bFe719E4":"0xfD4017Ad7c1092aaFEbC82621B4DeE59f178D74C","0x23D641FeCcD207E8794c593e8240444A0674C4Ba":"0x11725976BF1F38c4aB78d1F480bc5883d70D9dc3","0x9818f01EDCcc3d8EB86B859931C3B877cf44A108":"0xfD4017Ad7c1092aaFEbC82621B4DeE59f178D74C","0x9334BbCBE77C0883d704f71Db35CCF636639334c":"0x11725976BF1F38c4aB78d1F480bc5883d70D9dc3","0x599ac767099bB6f01712867BfA1Fc1Aa27DEFD37":"0xfD4017Ad7c1092aaFEbC82621B4DeE59f178D74C","0x6290Be6e6913708866E6f17eaf3F4FCC7d3fdF67":"0x11725976BF1F38c4aB78d1F480bc5883d70D9dc3","0x9619bFB1f2D97E2B23F23310205e4c2089c1A45d":"0xfD4017Ad7c1092aaFEbC82621B4DeE59f178D74C","0xD53a623c17A5853838FA140cE5706eA008565dA8":"0x11725976BF1F38c4aB78d1F480bc5883d70D9dc3"},qualificationHistory:[{observedAt:"2026-10-31",block:"102927065",routeBlock:"102928782",implementation:"0xF5331Dc29A1FDe4b22d7F168661584B057228683",implementationHash:"0x9f1e0f8e488165740c5ab91a3da1bea1a75eeef607ea37b32296ad465971344c"}],blockHash:"0xcb0e2862c6e22ca5854fb9264995749e497eb26f05a3370202db69909b891c47"};var De=q.vaults,we=["beefy_clm_swap","beefy_clm_deposit","beefy_clm_withdraw"],X=P(["function wants() view returns(address,address)","function strategy() view returns(address)","function want() view returns(address)","function implementation() view returns(address)","function pool() view returns(address)","function vault() view returns(address)","function price() view returns(uint256)","function paused() view returns(bool)","function isCalm() view returns(bool)","function actionableAt() view returns(uint256)","function token0() view returns(address)","function token1() view returns(address)","function factory() view returns(address)","function tickSpacing() view returns(int24)","function balances() view returns(uint256,uint256)","function previewDeposit(uint256,uint256) view returns(uint256 shares,uint256 amount0,uint256 amount1,uint256 fee0,uint256 fee1)","function previewWithdraw(uint256) view returns(uint256,uint256)","function deposit(uint256 amount0,uint256 amount1,uint256 minShares)","function withdraw(uint256 shares,uint256 minAmount0,uint256 minAmount1)"]),ie=P(["function exactInput((bytes path,address recipient,uint256 deadline,uint256 amountIn,uint256 amountOutMinimum)) payable returns(uint256)"]),W=P(["function exactInput((bytes path,address recipient,uint256 amountIn,uint256 amountOutMinimum)) payable returns(uint256)","function multicall(uint256 deadline,bytes[] data) payable returns(bytes[])"]),ge=P(["function quoteExactInput(bytes path,uint256 amountIn) returns(uint256,uint160[],uint32[],uint256)"]),Fe={cl:P(["function getPool(address,address,int24) view returns(address)"]),v3:P(["function getPool(address,address,uint24) view returns(address)"])},ye=P(["function deposit() payable"]),Z={vault:{...Y,description:"Address of the Beefy CLM vault contract (from beefy_list)."},chainId:{const:M,description:"Chain id; only 4663 (Robinhood Chain mainnet) is supported. Optional."},slippageBps:{type:"integer",minimum:0,maximum:500,description:"Maximum slippage in basis points (50 = 0.5%), 0 to 500. Default 50."}},Be=10n**36n,z=he(de[M].uniswap.WETH.address),ke="0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee",ve=Object.fromEntries(Object.entries(q.codeHashes).map(([d,r])=>[d.toLowerCase(),r])),Ae=Object.fromEntries(Object.entries(q.delegates).map(([d,r])=>[d.toLowerCase(),r]));function f(d){return fe(d,"Provide a token or vault address.",oe)}function g(d){return se(d,"Invalid Beefy CLM integer.")}function G(d,r=!1){return re(d,"Provide a positive amount that fits uint256.",{notString:"Provide a decimal base-unit integer string.",positive:!r})}function K(d){let r=d??50;if(typeof r!="number"||!Number.isInteger(r)||r<0||r>500)throw new o("Use integer slippageBps from 0 to 500.");return BigInt(r)}function Q(d,r){let m=d*(10000n-r)/10000n;if(m<=0n)throw new o("This CLM amount is too small for a positive output minimum.");return m}function ne(d,r){if(!Array.isArray(d)||d.length!==r)throw new o("Invalid Beefy CLM quote.");return d.map(g)}function Me(d){let r=f(d),m=De.find(b=>I(b.vault,r));if(!m)throw new o("This vault has no qualified Beefy CLM route. Use beefy_withdraw to return existing vault shares to their want; redeem that want through the project app if Oak has no qualified redemption route.");return m}function Se(d,r,m,b,h){if(d<=0n||m<=0n||b<0n||h<0n)throw new o("The CLM price or budget is invalid.");let E=r?d*m/Be:d;if(E===0n)throw new o("The CLM budget is too small at the current pool price.");let e=b*m/Be,t=h>e?h-e:e-h,a=E<t?E:t,s=(E-a)/2n,i=d*(h>e?a+s:s)/E;return[i,d-i]}var Ee=d=>{async function r(e){try{return await e()}catch(t){throw new o(d.plainError(t))}}function m(e,t){if(e.chainId!==void 0&&e.chainId!==M)throw new o("Beefy CLM requires chain 4663.");for(let a of Object.keys(e))if(!["vault","chainId",...t].includes(a))throw new o(`Unsupported Beefy CLM input: ${a}.`);return Me(e.vault)}async function b(e,t){be(t);let a=d.clientFor(M);if(await a.getChainId()!==M)throw new o("The Beefy CLM endpoint must report chain 4663.");let s=g(await a.getBlockNumber()),i=await a.getBlock({blockNumber:s}),n=(B,p,A=[])=>a.readContract({address:f(B),abi:X,functionName:p,args:A,blockNumber:s}),c=new Set;async function l(B){let p=B.toLowerCase();if(c.has(p))return;let A=ve[p];if(!A)throw new o("Unqualified Beefy CLM dependency; no transaction was built.");let D=await a.getCode({address:f(B),blockNumber:s});if(!D||Ce(D)!==A)throw new o("A Beefy CLM contract or delegated implementation no longer matches its pinned code.");c.add(p),Ae[p]&&await l(Ae[p])}await me(a,f(e.vault),s);for(let B of[e.manager,e.strategy,e.beacon,e.implementation,e.pool,e.factory])await l(B);let[F,u,y,x,C,v,w,S,R,ee]=await Promise.all([n(e.vault,"want"),n(e.manager,"wants"),n(e.manager,"strategy"),n(e.beacon,"implementation"),n(e.strategy,"pool"),n(e.strategy,"vault"),n(e.pool,"token0"),n(e.pool,"token1"),n(e.pool,"factory"),n(e.pool,"tickSpacing")]);if(f(F)!==e.manager||!Array.isArray(u)||u.length!==2||u.some((B,p)=>f(B)!==e.wants[p])||f(y)!==e.strategy||f(x)!==e.implementation||f(C)!==e.pool||f(v)!==e.manager||f(w)!==e.wants[0]||f(S)!==e.wants[1]||f(R)!==e.factory||ee!==e.tickSpacing)throw new o("The Beefy CLM want, tokens, strategy, beacon or pool differs from its qualified deployment.");let V=async B=>g(await a.readContract({address:f(B),abi:te,functionName:"balanceOf",args:[t],blockNumber:s}));async function ae(B){let p=f(B),[A,D]=await Promise.all([a.readContract({address:p,abi:te,functionName:"symbol",blockNumber:s}),a.readContract({address:p,abi:te,functionName:"decimals",blockNumber:s})]);if(typeof A!="string"||!A.trim()||!Number.isInteger(D)||D<0||D>255)throw new o("Invalid CLM token metadata.");return{address:p,symbol:A,decimals:D,chainId:M}}async function H(){let p=(await le(d.http,"https://api.beefy.finance/vaults",{},k=>Array.isArray(k)&&k.every($=>$!==null&&typeof $=="object"))).filter(k=>k.chain==="robinhood"&&typeof k.earnContractAddress=="string"&&I(k.earnContractAddress,e.vault)),A=p[0],D=pe(f(e.vault));if(p.length!==1||!A||A.id!==D.id||A.type!=="standard"||f(A.tokenAddress)!==e.manager||A.tokenDecimals!==18)throw new o("The Beefy API and qualified CLM vault disagree.");if(A.status!=="active")throw new o(`Beefy marks this vault ${String(A.status)}; deposits are unavailable. Exit with beefy_withdraw, redeem the returned CLM shares with beefy_clm_withdraw, then swap the received tokens to USDG with beefy_clm_swap.`);let L=f(await n(e.vault,"strategy")),_=await Promise.all([n(L,"paused"),n(e.strategy,"paused")]);if(_.some(k=>typeof k!="boolean"))throw new o("Invalid Beefy strategy pause flag.");if(_.some(Boolean))throw new o("The Beefy strategy is paused; deposits are unavailable. Exit with beefy_withdraw, redeem CLM shares with beefy_clm_withdraw, then convert the tokens to USDG with beefy_clm_swap.");if(await n(e.manager,"isCalm")!==!0)throw new o("The CLM pool is not calm; wait and request a fresh deposit preview.")}async function N(B,p){let A=new Set([...e.wants,f(ce),z]);if(!A.has(B)||!A.has(p)||B===p)throw new o("Use this CLM pair or the USDG/WETH conversion route, with different input and output tokens.");let D=q.routes.find(U=>U.from===B&&U.to===p&&(U.pools[0]===e.pool||U.kind==="v3"));if(!D)throw new o("No qualified direct CLM route for this token pair. Convert through the CLM bridge token in separately mined steps.");let L=q.markets[D.kind];for(let U of[L.router,L.quoter,L.factory,...D.pools])await l(U);let _=D.path;if(_.length!==88||f(_.slice(0,42))!==B||f(`0x${_.slice(-40)}`)!==p)throw new o("Invalid qualified CLM swap path.");let k=Number.parseInt(_.slice(42,48),16),$=await a.readContract({address:f(L.factory),abi:Fe[D.kind],functionName:"getPool",args:[B,p,k],blockNumber:s});if(f($)!==D.pools[0])throw new o("The swap factory no longer selects the qualified CLM pool.");if(f(await n(L.quoter,"factory"))!==L.factory)throw new o("The CLM quoter factory differs from its pin.");return D}async function j(B,p,A){let D=await N(B,p),L=q.markets[D.kind],_=await a.simulateContract({address:f(L.quoter),abi:ge,functionName:"quoteExactInput",args:[D.path,A],account:t,blockNumber:s}),k=g(_.result[0]);if(k===0n)throw new o("No positive quote for this CLM swap.");return{selected:D,market:L,out:k}}return{client:a,blockNumber:s,deadline:i.timestamp+600n,read:n,balance:V,token:ae,code:l,entryAvailable:H,quote:j}}function h(e,t,a,s="0"){return d.unsignedTx({to:f(e),data:t,description:a,value:s,chainId:M})}async function E(e,t,a){let s=await d.preview(e,t);return{txs:e,preview:s,summary:`${a} Re-read actual balances after every mined step. Calls are separate transactions; earlier steps can remain mined if a later step fails. Confirm the local preview. Gas is additional.`}}return{tools:[{name:"beefy_lp",inputSchema:{type:"object",properties:{...Z,amount:{...O(),description:"Optional entry budget in the CLM bridge token base units (USDG or WETH)."}},required:["vault"],additionalProperties:!1},execute:(e,t)=>r(async()=>{let a=m(e,["amount","slippageBps"]),s=K(e.slippageBps),i=await b(a,t),[n,c,l,F,u,y,x,C]=await Promise.all([i.token(a.wants[0]),i.token(a.wants[1]),i.token(a.manager),i.balance(a.wants[0]),i.balance(a.wants[1]),i.balance(a.manager),i.read(a.manager,"balances"),i.read(a.strategy,"price")]),v;if(e.amount!==void 0){await i.entryAvailable();let w=G(e.amount),[S,R]=ne(x,2),ee=Se(w,a.bridge===n.address,g(C),S,R),V=[];for(let[ae,H]of[n,c].entries()){let N=ee[ae],j=N===0n||H.address===a.bridge?N:(await i.quote(f(a.bridge),H.address,N)).out;V.push({token:H,bridgeAmount:N.toString(),expectedAmount:j.toString(),minimumAmount:j===0n?"0":Q(j,s).toString(),swapRequired:N>0n&&H.address!==a.bridge})}v={bridge:await i.token(a.bridge),budget:w.toString(),inputs:V,source:"strategy.price() and CLM balances(); imbalance first, then split remaining value equally. Re-quote after mining swaps."}}return{chainId:M,vault:a.vault,manager:a.manager,bridge:await i.token(a.bridge),constituents:[{token:n,balance:F.toString()},{token:c,balance:u.toString()}],shares:{token:l,amount:y.toString()},entryPlan:v,block:i.blockNumber.toString(),summary:"Convert USDG or ETH to the bridge token with beefy_clm_swap. Use entryPlan to acquire the current deposit ratio, including a one-sided ratio when appropriate. Deposit actual balances with beefy_clm_deposit, then deposit mined CLM shares with beefy_deposit. Exit with beefy_withdraw, beefy_clm_withdraw, then beefy_clm_swap through the bridge token to USDG."}})},{name:"beefy_clm_swap",inputSchema:{type:"object",properties:{...Z,from:{...Y,description:"Address of the token to sell: native ETH placeholder, or a CLM constituent or bridge token (USDG or WETH)."},to:{...Y,description:"Address of the token to receive, different from the input token: a CLM constituent or the bridge token."},amount:O('Amount of the input token in base units of that token (read its decimals). Example: "1000000" = 1 USDG at 6 decimals; "1000000000000000000" = 1 WETH.')},required:["vault","from","to","amount"],additionalProperties:!1},execute:(e,t)=>r(async()=>{let a=m(e,["from","to","amount","slippageBps"]),s=K(e.slippageBps),i=f(e.from),n=f(e.to),c=G(e.amount),l=i.toLowerCase()===ke,F=l?z:i,u=await b(a,t);if((l?await u.client.getBalance({address:t,blockNumber:u.blockNumber}):await u.balance(i))<c)throw new o("Insufficient CLM swap balance; keep ETH for gas.");let y=[];l&&(await u.code(z),y.push(h(z,T({abi:ye,functionName:"deposit"}),"Wrap exactly the requested ETH for the CLM workflow.",c.toString())));let x=c,C=c;if(F!==n){let w=await u.quote(F,n,c);x=w.out,C=Q(x,s),y.push(d.approval(F,f(w.market.router),c.toString(),M));let S={path:w.selected.path,recipient:t,amountIn:c,amountOutMinimum:C},R=w.selected.kind==="cl"?T({abi:ie,functionName:"exactInput",args:[{...S,deadline:u.deadline}]}):T({abi:W,functionName:"multicall",args:[u.deadline,[T({abi:W,functionName:"exactInput",args:[S]})]]});y.push(h(w.market.router,R,`Swap exact input with at least ${C} output base units to the calling wallet.`))}else if(!l)throw new o("The CLM swap requires different input and output tokens.");let v=await u.token(n);return{...await E(y,t,"Swap qualified CLM constituents. Venue fees are included in the quote."),output:{token:v,amount:x.toString()},minimumOutput:{token:v,amount:C.toString()},deadline:u.deadline.toString()}})},{name:"beefy_clm_deposit",inputSchema:{type:"object",properties:{...Z,amount0:O(`Amount of the CLM vault's first token (token0) to deposit, in base units of that token (read its decimals). May be "0" if amount1 is positive.`),amount1:O(`Amount of the CLM vault's second token (token1) to deposit, in base units of that token (read its decimals). May be "0" if amount0 is positive.`)},required:["vault","amount0","amount1"],additionalProperties:!1},execute:(e,t)=>r(async()=>{let a=m(e,["amount0","amount1","slippageBps"]),s=K(e.slippageBps),i=G(e.amount0,!0),n=G(e.amount1,!0);if(i===0n&&n===0n)throw new o("At least one CLM deposit amount must be positive.");let c=await b(a,t);if(await c.entryAvailable(),await c.balance(a.wants[0])<i||await c.balance(a.wants[1])<n)throw new o("Acquire the CLM constituents first and retry with their mined balances.");let[l,F,u,y,x]=ne(await c.read(a.manager,"previewDeposit",[i,n]),5);if(F>i||u>n||F+u===0n||y>F||x>u)throw new o("The CLM returned invalid deposit amounts or fees.");let C=Q(l,s),v=[];for(let[w,S]of[i,n].entries())S>0n&&v.push(d.approval(f(a.wants[w]),f(a.manager),S.toString(),M));v.push(h(a.manager,T({abi:X,functionName:"deposit",args:[i,n,C]}),`Mint at least ${C} CLM share base units to the calling wallet.`));for(let[w,S]of[i,n].entries())S>0n&&v.push(d.approval(f(a.wants[w]),f(a.manager),"0",M));return{...await E(v,t,"Mint CLM want shares with a positive share minimum and exact input approvals. Final revocations clear any unused allowance. Deposit the actual shares received into beefy_deposit separately."),output:{token:await c.token(a.manager),amount:l.toString()},minimumShares:C.toString(),usedAmounts:[F.toString(),u.toString()],fees:[y.toString(),x.toString()]}})},{name:"beefy_clm_withdraw",inputSchema:{type:"object",properties:{...Z,shares:{description:'CLM shares to redeem for the pair tokens, in base units of the CLM share token (read its decimals). "all" redeems your full CLM share balance.',anyOf:[O(),{const:"all"}]}},required:["vault","shares"],additionalProperties:!1},execute:(e,t)=>r(async()=>{let a=m(e,["shares","slippageBps"]),s=K(e.slippageBps),i=e.shares==="all"?void 0:G(e.shares),n=await b(a,t),c=await n.balance(a.manager),l=i??c;if(l===0n||l>c)throw new o("Withdraw vault shares first, then provide a positive CLM share amount no greater than your mined balance.");let u=ne(await n.read(a.manager,"previewWithdraw",[l]),2).map(x=>x===0n?0n:Q(x,s));if(u.every(x=>x===0n))throw new o("No positive CLM withdrawal output is available.");let y=[h(a.manager,T({abi:X,functionName:"withdraw",args:[l,u[0],u[1]]}),"Redeem CLM shares and return the pair tokens to the calling wallet.")];return{...await E(y,t,"Redeem CLM shares. Convert actual returned tokens, including leftover deposit dust, through the bridge token to USDG with beefy_clm_swap after mining. Strategy pause or API status does not prevent requesting this preview."),minimumOutputs:await Promise.all(u.map(async(x,C)=>({token:await n.token(a.wants[C]),amount:x.toString()})))}})}]}};async function je(d,r,m,b){if(!we.includes(d))throw new o("Unknown Beefy CLM action.");let h=async()=>{throw new o("Beefy CLM reconstruction uses only qualified on-chain routes.")},E=ue({clientFor:()=>b,http:fetch,quoteSwap:h,buildSwap:h,preview:async t=>({txs:t,changes:[],summary:"Locally reconstructed CLM intent; local preview still required."})});return(await Ee(E).tools.find(t=>t.name===d).execute(r,m)).txs}function Ge(d,r,m){let b=()=>{throw new o("Beefy CLM calldata differs from locally reconstructed intent; nothing was signed.")};function h(E,e,t){if(E===e)return;let a=J({abi:t,data:E}),s=J({abi:t,data:e});(a.functionName!==s.functionName||!a.args||!s.args)&&b();let i=[...a.args],n=[...s.args];if(I(T({abi:t,functionName:a.functionName,args:i}),E)||b(),a.functionName==="deposit"||a.functionName==="withdraw")for(let c of a.functionName==="deposit"?[2]:[1,2])g(i[c])<g(n[c])&&b(),i[c]=n[c];else if(a.functionName==="multicall"){let c=g(i[0]);(c<=m||c>g(n[0]))&&b(),(!Array.isArray(i[1])||!Array.isArray(n[1])||i[1].length!==1||n[1].length!==1)&&b(),h(i[1][0],n[1][0],W),i[0]=n[0],i[1]=n[1]}else if(a.functionName==="exactInput"){let c={...i[0]},l=n[0];g(c.amountOutMinimum)<g(l.amountOutMinimum)&&b(),c.amountOutMinimum=l.amountOutMinimum,"deadline"in c&&((g(c.deadline)<=m||g(c.deadline)>g(l.deadline))&&b(),c.deadline=l.deadline),i[0]=c}else b();I(T({abi:t,functionName:a.functionName,args:i}),e)||b()}(!r.length||d.length!==r.length)&&b();for(let[E,e]of d.entries()){let t=r[E];(e.chainId!==t.chainId||!I(e.to,t.to)||e.value!==t.value)&&b();try{if(I(t.to,q.markets.cl.router))J({abi:ie,data:t.data}).args[0].deadline<=m&&b();else if(I(t.to,q.markets.v3.router)){let a=J({abi:W,data:t.data});(a.functionName!=="multicall"||a.args[0]<=m)&&b()}}catch{b()}if(!I(e.data,t.data))try{let a=De.find(s=>I(s.manager,t.to));h(e.data,t.data,a?X:I(t.to,q.markets.cl.router)?ie:W)}catch{b()}}}var We=d=>({tools:Ee(d).tools.slice(1)});export{De as a,we as b,X as c,ie as d,W as e,Me as f,Se as g,Ee as h,je as i,Ge as j,We as k};
|
|
1
|
+
import{b as Be,c as Ae}from"./4PLLS6CT.js";import{a as pe}from"./SPJCSEKP.js";import{a as le}from"./43LI5NKJ.js";import{c as me}from"./SCG5HWMN.js";import{a as O}from"./66F5ZH34.js";import{c as Y,d as fe,g as I,i as re,m as be,n as ue}from"./NWNYJ26T.js";import{b as v,j as ce,k as se}from"./TI727O2H.js";import{a as c}from"./XSD5NL7J.js";import{decodeFunctionData as J,encodeFunctionData as q,erc20Abi as te,getAddress as Ce,keccak256 as we,parseAbi as P}from"viem";var _={chainId:4663,observedAt:"2026-11-04T21:56:26.556Z",block:"106231118",routeBlock:"106231118",sources:["https://rpc.mainnet.chain.robinhood.com","https://raw.githubusercontent.com/beefyfinance/cowcentrated-subgraph/main/abis/beefy/clm/ClmManager.json","https://raw.githubusercontent.com/beefyfinance/beefy-v2/main/src/features/data/apis/beefy/beefy-clm-pool.ts"],markets:{v3:{router:"0xCaf681a66D020601342297493863E78C959E5cb2",quoter:"0x33e885eD0Ec9bF04EcfB19341582aADCb4c8A9E7",factory:"0x1f7d7550B1b028f7571E69A784071F0205FD2EfA"},cl:{router:"0xC062b870E813fcA720f1e002c234369Ab3aB9415",quoter:"0x03983AB2C057a2eac211ff01738a1e49ff325B49",factory:"0x1ac9dB4a2608ba45D6127B1737949b51Bb54B7F3"}},vaults:[{id:"up33-cow-robinhood-cashcat-weth-vault",vault:"0x25012D654bF9107B6E0Af0248656fEf0b718dBd3",manager:"0x137731B8B2D7Cd24aB4A4A9061f2D7b4Fd1aBFEE",managerImpl:"0xfD4017Ad7c1092aaFEbC82621B4DeE59f178D74C",wants:["0x020bfC650A365f8BB26819deAAbF3E21291018b4","0x0Bd7D308f8E1639FAb988df18A8011f41EAcAD73"],strategy:"0xd7F3bCDAfCFf0018953BB6944Db2683Ff2e42b07",beacon:"0xfD7EE9D17BD6941bF8e612281ec23E857134BB92",implementation:"0x01b0d3d2d54e0B63a8a97E108bE72C819Dc5a0E6",pool:"0x4E8649Be40aE67EBbcff99C291B92eE03015917b",factory:"0x1ac9dB4a2608ba45D6127B1737949b51Bb54B7F3",tickSpacing:200,bridge:"0x0Bd7D308f8E1639FAb988df18A8011f41EAcAD73"},{id:"up33-cow-robinhood-usdg-net-vault",vault:"0x25B418FcFe8543c25AD9d78246839E5Cf3a3b50D",manager:"0x5A725556514222d0cc81501A9294a3135b7C41C4",managerImpl:"0xfD4017Ad7c1092aaFEbC82621B4DeE59f178D74C",wants:["0x5fc5360D0400a0Fd4f2af552ADD042D716F1d168","0xCA9c78Dd337A67F6e0077F65F5E9218719d30eDf"],strategy:"0x89207bED2935C64d6cb105E9C85E0E2ED99DD8f2",beacon:"0xfD7EE9D17BD6941bF8e612281ec23E857134BB92",implementation:"0x01b0d3d2d54e0B63a8a97E108bE72C819Dc5a0E6",pool:"0x99e70A5b06215e5D2F3BeC773b4f59c008fc1673",factory:"0x1ac9dB4a2608ba45D6127B1737949b51Bb54B7F3",tickSpacing:200,bridge:"0x5fc5360D0400a0Fd4f2af552ADD042D716F1d168"},{id:"up33-cow-robinhood-weth-stonkbroker-vault",vault:"0x544c7Ef9265dc08d93B5394116E68aE7D9e60730",manager:"0x5794bB61E83397049c40D87BbF3d44AF583A27Ce",managerImpl:"0xfD4017Ad7c1092aaFEbC82621B4DeE59f178D74C",wants:["0x0Bd7D308f8E1639FAb988df18A8011f41EAcAD73","0xe934e36A439C94017B64a3FecE66AF12099aBF50"],strategy:"0x54Bd0805f549708144C811c14DdEeC0714CA5e0c",beacon:"0xfD7EE9D17BD6941bF8e612281ec23E857134BB92",implementation:"0x01b0d3d2d54e0B63a8a97E108bE72C819Dc5a0E6",pool:"0xB11ba9a4d345434c25d625C076f23Ad14abC6B3c",factory:"0x1ac9dB4a2608ba45D6127B1737949b51Bb54B7F3",tickSpacing:200,bridge:"0x0Bd7D308f8E1639FAb988df18A8011f41EAcAD73"},{id:"up33-cow-robinhood-weth-up-vault",vault:"0x56EA4b4AFAFbb87CFD8Fd8a0266a2F86561677b8",manager:"0x36759534741E28Eb052238738963D684bFe719E4",managerImpl:"0xfD4017Ad7c1092aaFEbC82621B4DeE59f178D74C",wants:["0x0Bd7D308f8E1639FAb988df18A8011f41EAcAD73","0x57C0E45cB534413D1C20A4240955d6bB250BB4F1"],strategy:"0x8337c691C3afA52ccE418178e52ed472F034Cb8b",beacon:"0xfD7EE9D17BD6941bF8e612281ec23E857134BB92",implementation:"0x01b0d3d2d54e0B63a8a97E108bE72C819Dc5a0E6",pool:"0x23D641FeCcD207E8794c593e8240444A0674C4Ba",factory:"0x1ac9dB4a2608ba45D6127B1737949b51Bb54B7F3",tickSpacing:200,bridge:"0x0Bd7D308f8E1639FAb988df18A8011f41EAcAD73"},{id:"up33-cow-robinhood-weth-frong-vault",vault:"0x75588e48f7b4Ed9365d78C6cD509f3C7B804Ca47",manager:"0x9818f01EDCcc3d8EB86B859931C3B877cf44A108",managerImpl:"0xfD4017Ad7c1092aaFEbC82621B4DeE59f178D74C",wants:["0x0Bd7D308f8E1639FAb988df18A8011f41EAcAD73","0x6245e67affA44a23077f0Ea7f981a8DC743a0c47"],strategy:"0xdB739d906CD5101b65E089a284ec13a3ab21F603",beacon:"0xfD7EE9D17BD6941bF8e612281ec23E857134BB92",implementation:"0x01b0d3d2d54e0B63a8a97E108bE72C819Dc5a0E6",pool:"0x9334BbCBE77C0883d704f71Db35CCF636639334c",factory:"0x1ac9dB4a2608ba45D6127B1737949b51Bb54B7F3",tickSpacing:200,bridge:"0x0Bd7D308f8E1639FAb988df18A8011f41EAcAD73"},{id:"up33-cow-robinhood-usdg-intc-vault",vault:"0x8353c496114CF66D10545fdc2B4e6dFBafd37e3b",manager:"0x599ac767099bB6f01712867BfA1Fc1Aa27DEFD37",managerImpl:"0xfD4017Ad7c1092aaFEbC82621B4DeE59f178D74C",wants:["0x5fc5360D0400a0Fd4f2af552ADD042D716F1d168","0xc72b96e0E48ecd4DC75E1e45396e26300BC39681"],strategy:"0xbaEE86C9D7dE9dc192f17dFA62833B601Dc64D23",beacon:"0xfD7EE9D17BD6941bF8e612281ec23E857134BB92",implementation:"0x01b0d3d2d54e0B63a8a97E108bE72C819Dc5a0E6",pool:"0x6290Be6e6913708866E6f17eaf3F4FCC7d3fdF67",factory:"0x1ac9dB4a2608ba45D6127B1737949b51Bb54B7F3",tickSpacing:60,bridge:"0x5fc5360D0400a0Fd4f2af552ADD042D716F1d168"},{id:"up33-cow-robinhood-weth-tendies-vault",vault:"0x97DCDc29a3B3e2F556564279f7D09eE40eB74E45",manager:"0x9619bFB1f2D97E2B23F23310205e4c2089c1A45d",managerImpl:"0xfD4017Ad7c1092aaFEbC82621B4DeE59f178D74C",wants:["0x0Bd7D308f8E1639FAb988df18A8011f41EAcAD73","0x45242320DBB855EeA8Fd36804C6487E10E97FCF9"],strategy:"0x9a02CaA8a2e63659f8A419a29a3B48baD86d3c7a",beacon:"0xfD7EE9D17BD6941bF8e612281ec23E857134BB92",implementation:"0x01b0d3d2d54e0B63a8a97E108bE72C819Dc5a0E6",pool:"0xD53a623c17A5853838FA140cE5706eA008565dA8",factory:"0x1ac9dB4a2608ba45D6127B1737949b51Bb54B7F3",tickSpacing:200,bridge:"0x0Bd7D308f8E1639FAb988df18A8011f41EAcAD73"}],routes:[{from:"0x0Bd7D308f8E1639FAb988df18A8011f41EAcAD73",to:"0x020bfC650A365f8BB26819deAAbF3E21291018b4",kind:"cl",path:"0x0bd7d308f8e1639fab988df18a8011f41eacad730000c8020bfc650a365f8bb26819deaabf3e21291018b4",pools:["0x4E8649Be40aE67EBbcff99C291B92eE03015917b"]},{from:"0x020bfC650A365f8BB26819deAAbF3E21291018b4",to:"0x0Bd7D308f8E1639FAb988df18A8011f41EAcAD73",kind:"cl",path:"0x020bfc650a365f8bb26819deaabf3e21291018b40000c80bd7d308f8e1639fab988df18a8011f41eacad73",pools:["0x4E8649Be40aE67EBbcff99C291B92eE03015917b"]},{from:"0x5fc5360D0400a0Fd4f2af552ADD042D716F1d168",to:"0xCA9c78Dd337A67F6e0077F65F5E9218719d30eDf",kind:"cl",path:"0x5fc5360d0400a0fd4f2af552add042d716f1d1680000c8ca9c78dd337a67f6e0077f65f5e9218719d30edf",pools:["0x99e70A5b06215e5D2F3BeC773b4f59c008fc1673"]},{from:"0xCA9c78Dd337A67F6e0077F65F5E9218719d30eDf",to:"0x5fc5360D0400a0Fd4f2af552ADD042D716F1d168",kind:"cl",path:"0xca9c78dd337a67f6e0077f65f5e9218719d30edf0000c85fc5360d0400a0fd4f2af552add042d716f1d168",pools:["0x99e70A5b06215e5D2F3BeC773b4f59c008fc1673"]},{from:"0x0Bd7D308f8E1639FAb988df18A8011f41EAcAD73",to:"0xe934e36A439C94017B64a3FecE66AF12099aBF50",kind:"cl",path:"0x0bd7d308f8e1639fab988df18a8011f41eacad730000c8e934e36a439c94017b64a3fece66af12099abf50",pools:["0xB11ba9a4d345434c25d625C076f23Ad14abC6B3c"]},{from:"0xe934e36A439C94017B64a3FecE66AF12099aBF50",to:"0x0Bd7D308f8E1639FAb988df18A8011f41EAcAD73",kind:"cl",path:"0xe934e36a439c94017b64a3fece66af12099abf500000c80bd7d308f8e1639fab988df18a8011f41eacad73",pools:["0xB11ba9a4d345434c25d625C076f23Ad14abC6B3c"]},{from:"0x0Bd7D308f8E1639FAb988df18A8011f41EAcAD73",to:"0x57C0E45cB534413D1C20A4240955d6bB250BB4F1",kind:"cl",path:"0x0bd7d308f8e1639fab988df18a8011f41eacad730000c857c0e45cb534413d1c20a4240955d6bb250bb4f1",pools:["0x23D641FeCcD207E8794c593e8240444A0674C4Ba"]},{from:"0x57C0E45cB534413D1C20A4240955d6bB250BB4F1",to:"0x0Bd7D308f8E1639FAb988df18A8011f41EAcAD73",kind:"cl",path:"0x57c0e45cb534413d1c20a4240955d6bb250bb4f10000c80bd7d308f8e1639fab988df18a8011f41eacad73",pools:["0x23D641FeCcD207E8794c593e8240444A0674C4Ba"]},{from:"0x0Bd7D308f8E1639FAb988df18A8011f41EAcAD73",to:"0x6245e67affA44a23077f0Ea7f981a8DC743a0c47",kind:"cl",path:"0x0bd7d308f8e1639fab988df18a8011f41eacad730000c86245e67affa44a23077f0ea7f981a8dc743a0c47",pools:["0x9334BbCBE77C0883d704f71Db35CCF636639334c"]},{from:"0x6245e67affA44a23077f0Ea7f981a8DC743a0c47",to:"0x0Bd7D308f8E1639FAb988df18A8011f41EAcAD73",kind:"cl",path:"0x6245e67affa44a23077f0ea7f981a8dc743a0c470000c80bd7d308f8e1639fab988df18a8011f41eacad73",pools:["0x9334BbCBE77C0883d704f71Db35CCF636639334c"]},{from:"0x5fc5360D0400a0Fd4f2af552ADD042D716F1d168",to:"0xc72b96e0E48ecd4DC75E1e45396e26300BC39681",kind:"cl",path:"0x5fc5360d0400a0fd4f2af552add042d716f1d16800003cc72b96e0e48ecd4dc75e1e45396e26300bc39681",pools:["0x6290Be6e6913708866E6f17eaf3F4FCC7d3fdF67"]},{from:"0xc72b96e0E48ecd4DC75E1e45396e26300BC39681",to:"0x5fc5360D0400a0Fd4f2af552ADD042D716F1d168",kind:"cl",path:"0xc72b96e0e48ecd4dc75e1e45396e26300bc3968100003c5fc5360d0400a0fd4f2af552add042d716f1d168",pools:["0x6290Be6e6913708866E6f17eaf3F4FCC7d3fdF67"]},{from:"0x0Bd7D308f8E1639FAb988df18A8011f41EAcAD73",to:"0x45242320DBB855EeA8Fd36804C6487E10E97FCF9",kind:"cl",path:"0x0bd7d308f8e1639fab988df18a8011f41eacad730000c845242320dbb855eea8fd36804c6487e10e97fcf9",pools:["0xD53a623c17A5853838FA140cE5706eA008565dA8"]},{from:"0x45242320DBB855EeA8Fd36804C6487E10E97FCF9",to:"0x0Bd7D308f8E1639FAb988df18A8011f41EAcAD73",kind:"cl",path:"0x45242320dbb855eea8fd36804c6487e10e97fcf90000c80bd7d308f8e1639fab988df18a8011f41eacad73",pools:["0xD53a623c17A5853838FA140cE5706eA008565dA8"]},{from:"0x5fc5360D0400a0Fd4f2af552ADD042D716F1d168",to:"0x0Bd7D308f8E1639FAb988df18A8011f41EAcAD73",kind:"v3",path:"0x5fc5360d0400a0fd4f2af552add042d716f1d1680000640bd7d308f8e1639fab988df18a8011f41eacad73",pools:["0x52e65B17fB6E5BA00Ed806f37Afcd2DaA50271Ca"]},{from:"0x0Bd7D308f8E1639FAb988df18A8011f41EAcAD73",to:"0x5fc5360D0400a0Fd4f2af552ADD042D716F1d168",kind:"v3",path:"0x0bd7d308f8e1639fab988df18a8011f41eacad730000645fc5360d0400a0fd4f2af552add042d716f1d168",pools:["0x52e65B17fB6E5BA00Ed806f37Afcd2DaA50271Ca"]}],codeHashes:{"0x137731B8B2D7Cd24aB4A4A9061f2D7b4Fd1aBFEE":"0xa5fcbfc6347a83acdfbc561e9c0a59b1bbb321da361c3463b73b5c173a68291b","0xfD4017Ad7c1092aaFEbC82621B4DeE59f178D74C":"0x6f2a1713cbceba31cc630dddda1ef99cd35086c96005f3c9ea015f9a8e53e613","0xd7F3bCDAfCFf0018953BB6944Db2683Ff2e42b07":"0x48fed026ddb394d366df6328a1bb802687a479cd28e30ee41d38b8567fb90202","0xfD7EE9D17BD6941bF8e612281ec23E857134BB92":"0x9cc155dd143657bba37e6a51fa28e78158e3f47454acdcebedc0512e3803d0fc","0xF5331Dc29A1FDe4b22d7F168661584B057228683":"0x9f1e0f8e488165740c5ab91a3da1bea1a75eeef607ea37b32296ad465971344c","0x4E8649Be40aE67EBbcff99C291B92eE03015917b":"0xda57657ec68ddfb0987ba1352a44cefe40433e55585f3e4555b8ced4bbeb540d","0x1ac9dB4a2608ba45D6127B1737949b51Bb54B7F3":"0x4350c8fcdf90361969542249d76c25d6afbd31f10bebf0134bfe21beba1e8f4c","0x5A725556514222d0cc81501A9294a3135b7C41C4":"0xa5fcbfc6347a83acdfbc561e9c0a59b1bbb321da361c3463b73b5c173a68291b","0x89207bED2935C64d6cb105E9C85E0E2ED99DD8f2":"0x48fed026ddb394d366df6328a1bb802687a479cd28e30ee41d38b8567fb90202","0x99e70A5b06215e5D2F3BeC773b4f59c008fc1673":"0xda57657ec68ddfb0987ba1352a44cefe40433e55585f3e4555b8ced4bbeb540d","0x5794bB61E83397049c40D87BbF3d44AF583A27Ce":"0xa5fcbfc6347a83acdfbc561e9c0a59b1bbb321da361c3463b73b5c173a68291b","0x54Bd0805f549708144C811c14DdEeC0714CA5e0c":"0x48fed026ddb394d366df6328a1bb802687a479cd28e30ee41d38b8567fb90202","0xB11ba9a4d345434c25d625C076f23Ad14abC6B3c":"0xda57657ec68ddfb0987ba1352a44cefe40433e55585f3e4555b8ced4bbeb540d","0x36759534741E28Eb052238738963D684bFe719E4":"0xa5fcbfc6347a83acdfbc561e9c0a59b1bbb321da361c3463b73b5c173a68291b","0x8337c691C3afA52ccE418178e52ed472F034Cb8b":"0x48fed026ddb394d366df6328a1bb802687a479cd28e30ee41d38b8567fb90202","0x23D641FeCcD207E8794c593e8240444A0674C4Ba":"0xda57657ec68ddfb0987ba1352a44cefe40433e55585f3e4555b8ced4bbeb540d","0x9818f01EDCcc3d8EB86B859931C3B877cf44A108":"0xa5fcbfc6347a83acdfbc561e9c0a59b1bbb321da361c3463b73b5c173a68291b","0xdB739d906CD5101b65E089a284ec13a3ab21F603":"0x48fed026ddb394d366df6328a1bb802687a479cd28e30ee41d38b8567fb90202","0x9334BbCBE77C0883d704f71Db35CCF636639334c":"0xda57657ec68ddfb0987ba1352a44cefe40433e55585f3e4555b8ced4bbeb540d","0x599ac767099bB6f01712867BfA1Fc1Aa27DEFD37":"0xa5fcbfc6347a83acdfbc561e9c0a59b1bbb321da361c3463b73b5c173a68291b","0xbaEE86C9D7dE9dc192f17dFA62833B601Dc64D23":"0x48fed026ddb394d366df6328a1bb802687a479cd28e30ee41d38b8567fb90202","0x6290Be6e6913708866E6f17eaf3F4FCC7d3fdF67":"0xda57657ec68ddfb0987ba1352a44cefe40433e55585f3e4555b8ced4bbeb540d","0x9619bFB1f2D97E2B23F23310205e4c2089c1A45d":"0xa5fcbfc6347a83acdfbc561e9c0a59b1bbb321da361c3463b73b5c173a68291b","0x9a02CaA8a2e63659f8A419a29a3B48baD86d3c7a":"0x48fed026ddb394d366df6328a1bb802687a479cd28e30ee41d38b8567fb90202","0xD53a623c17A5853838FA140cE5706eA008565dA8":"0xda57657ec68ddfb0987ba1352a44cefe40433e55585f3e4555b8ced4bbeb540d","0xCaf681a66D020601342297493863E78C959E5cb2":"0x6f36c378e272c6324c48f045182bcb54bd8ad654cf9ebd42e8893d52c4cb25dc","0x33e885eD0Ec9bF04EcfB19341582aADCb4c8A9E7":"0x3db0868d945e9304c9bc6a8b2181948109ea617647142f3c4083e14393496a28","0x1f7d7550B1b028f7571E69A784071F0205FD2EfA":"0xec72b1abd1f2faee020cfea9c646bd8994f9fb389054f6e574f103a895091739","0xC062b870E813fcA720f1e002c234369Ab3aB9415":"0x11ea7d3599ef56eda32c0ce7ca26e9aae71bec13bfcbd3ad0e83826c1a2defe4","0x03983AB2C057a2eac211ff01738a1e49ff325B49":"0x1ed81396c831d69a6c59384019850c21ac672d24ae83b4b26304a7384e1e4096","0x52e65B17fB6E5BA00Ed806f37Afcd2DaA50271Ca":"0x3298b5dd4e6f115074c526a55ad05a36fd73a0034ac22ec6cbaab32cc9c1e8d2","0x0Bd7D308f8E1639FAb988df18A8011f41EAcAD73":"0x5706be52f64875fee65a2cec0d80e47a23d8793cbe85d214b48445e2d05f5353","0x11725976BF1F38c4aB78d1F480bc5883d70D9dc3":"0xa2cf7f366f3d8d11e611acecf7916a27308ba041bf1e161bddbd4ecbb9402b6a","0x01b0d3d2d54e0B63a8a97E108bE72C819Dc5a0E6":"0xd6f09e63327b36d3c498f8de8768bd3e4336894cd00ddb36aa9e0a1e4a4c911e"},delegates:{"0x137731B8B2D7Cd24aB4A4A9061f2D7b4Fd1aBFEE":"0xfD4017Ad7c1092aaFEbC82621B4DeE59f178D74C","0x4E8649Be40aE67EBbcff99C291B92eE03015917b":"0x11725976BF1F38c4aB78d1F480bc5883d70D9dc3","0x5A725556514222d0cc81501A9294a3135b7C41C4":"0xfD4017Ad7c1092aaFEbC82621B4DeE59f178D74C","0x99e70A5b06215e5D2F3BeC773b4f59c008fc1673":"0x11725976BF1F38c4aB78d1F480bc5883d70D9dc3","0x5794bB61E83397049c40D87BbF3d44AF583A27Ce":"0xfD4017Ad7c1092aaFEbC82621B4DeE59f178D74C","0xB11ba9a4d345434c25d625C076f23Ad14abC6B3c":"0x11725976BF1F38c4aB78d1F480bc5883d70D9dc3","0x36759534741E28Eb052238738963D684bFe719E4":"0xfD4017Ad7c1092aaFEbC82621B4DeE59f178D74C","0x23D641FeCcD207E8794c593e8240444A0674C4Ba":"0x11725976BF1F38c4aB78d1F480bc5883d70D9dc3","0x9818f01EDCcc3d8EB86B859931C3B877cf44A108":"0xfD4017Ad7c1092aaFEbC82621B4DeE59f178D74C","0x9334BbCBE77C0883d704f71Db35CCF636639334c":"0x11725976BF1F38c4aB78d1F480bc5883d70D9dc3","0x599ac767099bB6f01712867BfA1Fc1Aa27DEFD37":"0xfD4017Ad7c1092aaFEbC82621B4DeE59f178D74C","0x6290Be6e6913708866E6f17eaf3F4FCC7d3fdF67":"0x11725976BF1F38c4aB78d1F480bc5883d70D9dc3","0x9619bFB1f2D97E2B23F23310205e4c2089c1A45d":"0xfD4017Ad7c1092aaFEbC82621B4DeE59f178D74C","0xD53a623c17A5853838FA140cE5706eA008565dA8":"0x11725976BF1F38c4aB78d1F480bc5883d70D9dc3"},qualificationHistory:[{observedAt:"2026-10-31",block:"102927065",routeBlock:"102928782",implementation:"0xF5331Dc29A1FDe4b22d7F168661584B057228683",implementationHash:"0x9f1e0f8e488165740c5ab91a3da1bea1a75eeef607ea37b32296ad465971344c"}],blockHash:"0xcb0e2862c6e22ca5854fb9264995749e497eb26f05a3370202db69909b891c47"};var oe=_.vaults,ge=["beefy_clm_swap","beefy_clm_deposit","beefy_clm_withdraw"],X=P(["function wants() view returns(address,address)","function strategy() view returns(address)","function want() view returns(address)","function implementation() view returns(address)","function pool() view returns(address)","function vault() view returns(address)","function price() view returns(uint256)","function paused() view returns(bool)","function isCalm() view returns(bool)","function actionableAt() view returns(uint256)","function token0() view returns(address)","function token1() view returns(address)","function factory() view returns(address)","function tickSpacing() view returns(int24)","function balances() view returns(uint256,uint256)","function previewDeposit(uint256,uint256) view returns(uint256 shares,uint256 amount0,uint256 amount1,uint256 fee0,uint256 fee1)","function previewWithdraw(uint256) view returns(uint256,uint256)","function deposit(uint256 amount0,uint256 amount1,uint256 minShares)","function withdraw(uint256 shares,uint256 minAmount0,uint256 minAmount1)"]),ie=P(["function exactInput((bytes path,address recipient,uint256 deadline,uint256 amountIn,uint256 amountOutMinimum)) payable returns(uint256)"]),W=P(["function exactInput((bytes path,address recipient,uint256 amountIn,uint256 amountOutMinimum)) payable returns(uint256)","function multicall(uint256 deadline,bytes[] data) payable returns(bytes[])"]),Fe=P(["function quoteExactInput(bytes path,uint256 amountIn) returns(uint256,uint160[],uint32[],uint256)"]),ye={cl:P(["function getPool(address,address,int24) view returns(address)"]),v3:P(["function getPool(address,address,uint24) view returns(address)"])},ke=P(["function deposit() payable"]),Z={vault:{...Y,description:"Address of the Beefy CLM vault contract (from beefy_list)."},chainId:{const:v,description:"Chain id; only 4663 (Robinhood Chain mainnet) is supported. Optional."},slippageBps:{type:"integer",minimum:0,maximum:500,description:"Maximum slippage in basis points (50 = 0.5%), 0 to 500. Default 50."}},De=10n**36n,z=Ce(ce[v].uniswap.WETH.address),ve="0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee",de=Object.fromEntries(Object.entries(_.codeHashes).map(([i,s])=>[i.toLowerCase(),s])),je=oe.map(i=>{let s=i.manager.toLowerCase(),l=i.managerImpl.toLowerCase(),r=de[s],E=de[l];if(!r||!E)throw new Error("Beefy CLM manager delegation is missing a pinned runtime hash.");return{chainId:v,entry:s,entryCodeHash:r,proxy:s,proxyCodeHash:r,implementation:l,codeHash:E}}),Ee=Object.fromEntries(Object.entries(_.delegates).map(([i,s])=>[i.toLowerCase(),s]));function f(i){return re(i,"Provide a token or vault address.",fe)}function g(i){return be(i,"Invalid Beefy CLM integer.")}function G(i,s=!1){return ue(i,"Provide a positive amount that fits uint256.",{notString:"Provide a decimal base-unit integer string.",positive:!s})}function K(i){let s=i??50;if(typeof s!="number"||!Number.isInteger(s)||s<0||s>500)throw new c("Use integer slippageBps from 0 to 500.");return BigInt(s)}function Q(i,s){let l=i*(10000n-s)/10000n;if(l<=0n)throw new c("This CLM amount is too small for a positive output minimum.");return l}function ne(i,s){if(!Array.isArray(i)||i.length!==s)throw new c("Invalid Beefy CLM quote.");return i.map(g)}function Me(i){let s=f(i),l=oe.find(r=>I(r.vault,s));if(!l)throw new c("This vault has no qualified Beefy CLM route. Use beefy_withdraw to return existing vault shares to their want; redeem that want through the project app if Oak has no qualified redemption route.");return l}function Se(i,s,l,r,E){if(i<=0n||l<=0n||r<0n||E<0n)throw new c("The CLM price or budget is invalid.");let x=s?i*l/De:i;if(x===0n)throw new c("The CLM budget is too small at the current pool price.");let e=r*l/De,t=E>e?E-e:e-E,a=x<t?x:t,b=(x-a)/2n,d=i*(E>e?a+b:b)/x;return[d,i-d]}var xe=i=>{async function s(e){try{return await e()}catch(t){throw new c(i.plainError(t))}}function l(e,t){if(e.chainId!==void 0&&e.chainId!==v)throw new c("Beefy CLM requires chain 4663.");for(let a of Object.keys(e))if(!["vault","chainId",...t].includes(a))throw new c(`Unsupported Beefy CLM input: ${a}.`);return Me(e.vault)}async function r(e,t){le(t);let a=i.clientFor(v);if(await a.getChainId()!==v)throw new c("The Beefy CLM endpoint must report chain 4663.");let b=g(await a.getBlockNumber()),d=await a.getBlock({blockNumber:b}),n=(B,m,A=[])=>a.readContract({address:f(B),abi:X,functionName:m,args:A,blockNumber:b}),o=new Set;async function p(B){let m=B.toLowerCase();if(o.has(m))return;let A=de[m];if(!A)throw new c("Unqualified Beefy CLM dependency; no transaction was built.");let D=await a.getCode({address:f(B),blockNumber:b});if(!D||we(D)!==A)throw new c("A Beefy CLM contract or delegated implementation no longer matches its pinned code.");o.add(m),Ee[m]&&await p(Ee[m])}await Ae(a,f(e.vault),b);for(let B of[e.manager,e.strategy,e.beacon,e.implementation,e.pool,e.factory])await p(B);let[F,u,y,h,C,M,w,S,R,ee]=await Promise.all([n(e.vault,"want"),n(e.manager,"wants"),n(e.manager,"strategy"),n(e.beacon,"implementation"),n(e.strategy,"pool"),n(e.strategy,"vault"),n(e.pool,"token0"),n(e.pool,"token1"),n(e.pool,"factory"),n(e.pool,"tickSpacing")]);if(f(F)!==e.manager||!Array.isArray(u)||u.length!==2||u.some((B,m)=>f(B)!==e.wants[m])||f(y)!==e.strategy||f(h)!==e.implementation||f(C)!==e.pool||f(M)!==e.manager||f(w)!==e.wants[0]||f(S)!==e.wants[1]||f(R)!==e.factory||ee!==e.tickSpacing)throw new c("The Beefy CLM want, tokens, strategy, beacon or pool differs from its qualified deployment.");let V=async B=>g(await a.readContract({address:f(B),abi:te,functionName:"balanceOf",args:[t],blockNumber:b}));async function ae(B){let m=f(B),[A,D]=await Promise.all([a.readContract({address:m,abi:te,functionName:"symbol",blockNumber:b}),a.readContract({address:m,abi:te,functionName:"decimals",blockNumber:b})]);if(typeof A!="string"||!A.trim()||!Number.isInteger(D)||D<0||D>255)throw new c("Invalid CLM token metadata.");return{address:m,symbol:A,decimals:D,chainId:v}}async function H(){let m=(await me(i.http,"https://api.beefy.finance/vaults",{},k=>Array.isArray(k)&&k.every($=>$!==null&&typeof $=="object"))).filter(k=>k.chain==="robinhood"&&typeof k.earnContractAddress=="string"&&I(k.earnContractAddress,e.vault)),A=m[0],D=Be(f(e.vault));if(m.length!==1||!A||A.id!==D.id||A.type!=="standard"||f(A.tokenAddress)!==e.manager||A.tokenDecimals!==18)throw new c("The Beefy API and qualified CLM vault disagree.");if(A.status!=="active")throw new c(`Beefy marks this vault ${String(A.status)}; deposits are unavailable. Exit with beefy_withdraw, redeem the returned CLM shares with beefy_clm_withdraw, then swap the received tokens to USDG with beefy_clm_swap.`);let L=f(await n(e.vault,"strategy")),T=await Promise.all([n(L,"paused"),n(e.strategy,"paused")]);if(T.some(k=>typeof k!="boolean"))throw new c("Invalid Beefy strategy pause flag.");if(T.some(Boolean))throw new c("The Beefy strategy is paused; deposits are unavailable. Exit with beefy_withdraw, redeem CLM shares with beefy_clm_withdraw, then convert the tokens to USDG with beefy_clm_swap.");if(await n(e.manager,"isCalm")!==!0)throw new c("The CLM pool is not calm; wait and request a fresh deposit preview.")}async function N(B,m){let A=new Set([...e.wants,f(se),z]);if(!A.has(B)||!A.has(m)||B===m)throw new c("Use this CLM pair or the USDG/WETH conversion route, with different input and output tokens.");let D=_.routes.find(U=>U.from===B&&U.to===m&&(U.pools[0]===e.pool||U.kind==="v3"));if(!D)throw new c("No qualified direct CLM route for this token pair. Convert through the CLM bridge token in separately mined steps.");let L=_.markets[D.kind];for(let U of[L.router,L.quoter,L.factory,...D.pools])await p(U);let T=D.path;if(T.length!==88||f(T.slice(0,42))!==B||f(`0x${T.slice(-40)}`)!==m)throw new c("Invalid qualified CLM swap path.");let k=Number.parseInt(T.slice(42,48),16),$=await a.readContract({address:f(L.factory),abi:ye[D.kind],functionName:"getPool",args:[B,m,k],blockNumber:b});if(f($)!==D.pools[0])throw new c("The swap factory no longer selects the qualified CLM pool.");if(f(await n(L.quoter,"factory"))!==L.factory)throw new c("The CLM quoter factory differs from its pin.");return D}async function j(B,m,A){let D=await N(B,m),L=_.markets[D.kind],T=await a.simulateContract({address:f(L.quoter),abi:Fe,functionName:"quoteExactInput",args:[D.path,A],account:t,blockNumber:b}),k=g(T.result[0]);if(k===0n)throw new c("No positive quote for this CLM swap.");return{selected:D,market:L,out:k}}return{client:a,blockNumber:b,deadline:d.timestamp+600n,read:n,balance:V,token:ae,code:p,entryAvailable:H,quote:j}}function E(e,t,a,b="0"){return i.unsignedTx({to:f(e),data:t,description:a,value:b,chainId:v})}async function x(e,t,a){let b=await i.preview(e,t);return{txs:e,preview:b,summary:`${a} Re-read actual balances after every mined step. Calls are separate transactions; earlier steps can remain mined if a later step fails. Confirm the local preview. Gas is additional.`}}return{tools:[{name:"beefy_lp",inputSchema:{type:"object",properties:{...Z,amount:{...O(),description:"Optional entry budget in the CLM bridge token base units (USDG or WETH)."}},required:["vault"],additionalProperties:!1},execute:(e,t)=>s(async()=>{let a=l(e,["amount","slippageBps"]),b=K(e.slippageBps),d=await r(a,t),[n,o,p,F,u,y,h,C]=await Promise.all([d.token(a.wants[0]),d.token(a.wants[1]),d.token(a.manager),d.balance(a.wants[0]),d.balance(a.wants[1]),d.balance(a.manager),d.read(a.manager,"balances"),d.read(a.strategy,"price")]),M;if(e.amount!==void 0){await d.entryAvailable();let w=G(e.amount),[S,R]=ne(h,2),ee=Se(w,a.bridge===n.address,g(C),S,R),V=[];for(let[ae,H]of[n,o].entries()){let N=ee[ae],j=N===0n||H.address===a.bridge?N:(await d.quote(f(a.bridge),H.address,N)).out;V.push({token:H,bridgeAmount:N.toString(),expectedAmount:j.toString(),minimumAmount:j===0n?"0":Q(j,b).toString(),swapRequired:N>0n&&H.address!==a.bridge})}M={bridge:await d.token(a.bridge),budget:w.toString(),inputs:V,source:"strategy.price() and CLM balances(); imbalance first, then split remaining value equally. Re-quote after mining swaps."}}return{chainId:v,vault:a.vault,manager:a.manager,bridge:await d.token(a.bridge),constituents:[{token:n,balance:F.toString()},{token:o,balance:u.toString()}],shares:{token:p,amount:y.toString()},entryPlan:M,block:d.blockNumber.toString(),summary:"Convert USDG or ETH to the bridge token with beefy_clm_swap. Use entryPlan to acquire the current deposit ratio, including a one-sided ratio when appropriate. Deposit actual balances with beefy_clm_deposit, then deposit mined CLM shares with beefy_deposit. Exit with beefy_withdraw, beefy_clm_withdraw, then beefy_clm_swap through the bridge token to USDG."}})},{name:"beefy_clm_swap",inputSchema:{type:"object",properties:{...Z,from:{...Y,description:"Address of the token to sell: native ETH placeholder, or a CLM constituent or bridge token (USDG or WETH)."},to:{...Y,description:"Address of the token to receive, different from the input token: a CLM constituent or the bridge token."},amount:O('Amount of the input token in base units of that token (read its decimals). Example: "1000000" = 1 USDG at 6 decimals; "1000000000000000000" = 1 WETH.')},required:["vault","from","to","amount"],additionalProperties:!1},execute:(e,t)=>s(async()=>{let a=l(e,["from","to","amount","slippageBps"]),b=K(e.slippageBps),d=f(e.from),n=f(e.to),o=G(e.amount),p=d.toLowerCase()===ve,F=p?z:d,u=await r(a,t);if((p?await u.client.getBalance({address:t,blockNumber:u.blockNumber}):await u.balance(d))<o)throw new c("Insufficient CLM swap balance; keep ETH for gas.");let y=[];p&&(await u.code(z),y.push(E(z,q({abi:ke,functionName:"deposit"}),"Wrap exactly the requested ETH for the CLM workflow.",o.toString())));let h=o,C=o;if(F!==n){let w=await u.quote(F,n,o);h=w.out,C=Q(h,b),y.push(i.approval(F,f(w.market.router),o.toString(),v));let S={path:w.selected.path,recipient:t,amountIn:o,amountOutMinimum:C},R=w.selected.kind==="cl"?q({abi:ie,functionName:"exactInput",args:[{...S,deadline:u.deadline}]}):q({abi:W,functionName:"multicall",args:[u.deadline,[q({abi:W,functionName:"exactInput",args:[S]})]]});y.push(E(w.market.router,R,`Swap exact input with at least ${C} output base units to the calling wallet.`))}else if(!p)throw new c("The CLM swap requires different input and output tokens.");let M=await u.token(n);return{...await x(y,t,"Swap qualified CLM constituents. Venue fees are included in the quote."),output:{token:M,amount:h.toString()},minimumOutput:{token:M,amount:C.toString()},deadline:u.deadline.toString()}})},{name:"beefy_clm_deposit",inputSchema:{type:"object",properties:{...Z,amount0:O(`Amount of the CLM vault's first token (token0) to deposit, in base units of that token (read its decimals). May be "0" if amount1 is positive.`),amount1:O(`Amount of the CLM vault's second token (token1) to deposit, in base units of that token (read its decimals). May be "0" if amount0 is positive.`)},required:["vault","amount0","amount1"],additionalProperties:!1},execute:(e,t)=>s(async()=>{let a=l(e,["amount0","amount1","slippageBps"]),b=K(e.slippageBps),d=G(e.amount0,!0),n=G(e.amount1,!0);if(d===0n&&n===0n)throw new c("At least one CLM deposit amount must be positive.");let o=await r(a,t);if(await o.entryAvailable(),await o.balance(a.wants[0])<d||await o.balance(a.wants[1])<n)throw new c("Acquire the CLM constituents first and retry with their mined balances.");let[p,F,u,y,h]=ne(await o.read(a.manager,"previewDeposit",[d,n]),5);if(F>d||u>n||F+u===0n||y>F||h>u)throw new c("The CLM returned invalid deposit amounts or fees.");let C=Q(p,b),M=[];for(let[w,S]of[d,n].entries())S>0n&&M.push(i.approval(f(a.wants[w]),f(a.manager),S.toString(),v));M.push(E(a.manager,q({abi:X,functionName:"deposit",args:[d,n,C]}),`Mint at least ${C} CLM share base units to the calling wallet.`));for(let[w,S]of[d,n].entries())S>0n&&M.push(i.approval(f(a.wants[w]),f(a.manager),"0",v));return{...await x(M,t,"Mint CLM want shares with a positive share minimum and exact input approvals. Final revocations clear any unused allowance. Deposit the actual shares received into beefy_deposit separately."),output:{token:await o.token(a.manager),amount:p.toString()},minimumShares:C.toString(),usedAmounts:[F.toString(),u.toString()],fees:[y.toString(),h.toString()]}})},{name:"beefy_clm_withdraw",inputSchema:{type:"object",properties:{...Z,shares:{description:'CLM shares to redeem for the pair tokens, in base units of the CLM share token (read its decimals). "all" redeems your full CLM share balance.',anyOf:[O(),{const:"all"}]}},required:["vault","shares"],additionalProperties:!1},execute:(e,t)=>s(async()=>{let a=l(e,["shares","slippageBps"]),b=K(e.slippageBps),d=e.shares==="all"?void 0:G(e.shares),n=await r(a,t),o=await n.balance(a.manager),p=d??o;if(p===0n||p>o)throw new c("Withdraw vault shares first, then provide a positive CLM share amount no greater than your mined balance.");let u=ne(await n.read(a.manager,"previewWithdraw",[p]),2).map(h=>h===0n?0n:Q(h,b));if(u.every(h=>h===0n))throw new c("No positive CLM withdrawal output is available.");let y=[E(a.manager,q({abi:X,functionName:"withdraw",args:[p,u[0],u[1]]}),"Redeem CLM shares and return the pair tokens to the calling wallet.")];return{...await x(y,t,"Redeem CLM shares. Convert actual returned tokens, including leftover deposit dust, through the bridge token to USDG with beefy_clm_swap after mining. Strategy pause or API status does not prevent requesting this preview."),minimumOutputs:await Promise.all(u.map(async(h,C)=>({token:await n.token(a.wants[C]),amount:h.toString()})))}})}]}};async function Ge(i,s,l,r){if(!ge.includes(i))throw new c("Unknown Beefy CLM action.");let E=async()=>{throw new c("Beefy CLM reconstruction uses only qualified on-chain routes.")},x=pe({clientFor:()=>r,http:fetch,quoteSwap:E,buildSwap:E,preview:async t=>({txs:t,changes:[],summary:"Locally reconstructed CLM intent; local preview still required."})});return(await xe(x).tools.find(t=>t.name===i).execute(s,l)).txs}function We(i,s,l){let r=()=>{throw new c("Beefy CLM calldata differs from locally reconstructed intent; nothing was signed.")};function E(x,e,t){if(x===e)return;let a=J({abi:t,data:x}),b=J({abi:t,data:e});(a.functionName!==b.functionName||!a.args||!b.args)&&r();let d=[...a.args],n=[...b.args];if(I(q({abi:t,functionName:a.functionName,args:d}),x)||r(),a.functionName==="deposit"||a.functionName==="withdraw")for(let o of a.functionName==="deposit"?[2]:[1,2])g(d[o])<g(n[o])&&r(),d[o]=n[o];else if(a.functionName==="multicall"){let o=g(d[0]);(o<=l||o>g(n[0]))&&r(),(!Array.isArray(d[1])||!Array.isArray(n[1])||d[1].length!==1||n[1].length!==1)&&r(),E(d[1][0],n[1][0],W),d[0]=n[0],d[1]=n[1]}else if(a.functionName==="exactInput"){let o={...d[0]},p=n[0];g(o.amountOutMinimum)<g(p.amountOutMinimum)&&r(),o.amountOutMinimum=p.amountOutMinimum,"deadline"in o&&((g(o.deadline)<=l||g(o.deadline)>g(p.deadline))&&r(),o.deadline=p.deadline),d[0]=o}else r();I(q({abi:t,functionName:a.functionName,args:d}),e)||r()}(!s.length||i.length!==s.length)&&r();for(let[x,e]of i.entries()){let t=s[x];(e.chainId!==t.chainId||!I(e.to,t.to)||e.value!==t.value)&&r();try{if(I(t.to,_.markets.cl.router))J({abi:ie,data:t.data}).args[0].deadline<=l&&r();else if(I(t.to,_.markets.v3.router)){let a=J({abi:W,data:t.data});(a.functionName!=="multicall"||a.args[0]<=l)&&r()}}catch{r()}if(!I(e.data,t.data))try{let a=oe.find(b=>I(b.manager,t.to));E(e.data,t.data,a?X:I(t.to,_.markets.cl.router)?ie:W)}catch{r()}}}var Ve=i=>({tools:xe(i).tools.slice(1)});export{oe as a,ge as b,X as c,ie as d,W as e,je as f,Me as g,Se as h,xe as i,Ge as j,We as k,Ve as l};
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import{a as R}from"./DFM4T6ZE.js";import{d as N}from"./HQIS3QI7.js";import{b as D,d as M,f as C}from"./4ZD5D2UP.js";import{t as E}from"./MQ5F2VOK.js";import{a}from"./XSD5NL7J.js";import{a as P}from"./JXOEJPJ4.js";import{decodeFunctionData as _,erc20Abi as X,formatUnits as $,getAddress as x,isAddress as Q,parseUnits as K,parseAbi as V,zeroAddress as f}from"viem";var be=300,m={permit2:"0x000000000022D473030F116dDEE9F6B43aC78BA3",router:"0x204FAca1764B154221e35c0d20aBb3c525710498",factory:"0xd7e538e98A208fD19e46bc549FF4710C33664e18",limitOrders:"0x3126f62d604a0AA2de8788e3eC21dDd8F2a2f82a",fobo:"0x000DE658153f47f23e92973C8EB1e89762703676",usdg:"0x5fc5360D0400a0Fd4f2af552ADD042D716F1d168"},T=["eth","fobo","usdg","msft","tsla","spcx","googl","amzn","aapl","nvda","meta"],b=(t,e=0)=>({type:"string",minLength:e,maxLength:t}),w=(t,e="string")=>({type:e,enum:t}),B={type:"string",pattern:"^0x[0-9a-fA-F]{40}$"},v={type:"string",pattern:"^[0-9]+$",description:"Exact input in token base units, as a decimal integer string."},U={type:"integer",minimum:1,maximum:100},L={token:B,amount:v,payWith:w(["pair","eth","usdg","fobo"]),slippageBps:{type:"integer",minimum:1,maximum:5e3}},Z={token:"FOBO coin contract address on chain 4663; obtain it from fobo_browse or fobo_token.",query:"Search FOBO coins and traders by name, ticker or address; omit to browse recent launches.",limit:"Maximum number of results, from 1 to 100.",side:"Trade direction: buy the coin or sell it back to the payment currency.",payWith:"Payment currency: pair uses the coin\u2019s own pair; trades also accept eth, usdg or fobo.",slippageBps:"Maximum loss against quoted output in basis points (50 = 0.5%); default 50.",hash:"Public transaction hash (0x followed by 64 hex digits) to look up on FOBO.",name:"New coin name, 1 to 32 characters.",ticker:"New coin ticker, 2 to 10 letters or digits; normalized to uppercase.",description:"Public description of the new coin, at most 280 characters.",imageUrl:"Optional public HTTPS image URL; omit for no image. Local uploads are unsupported.",links:"Optional public project links stored with the launched coin.",telegram:"Public Telegram URL.",discord:"Public Discord URL.",github:"Public GitHub URL.",website:"Public project website URL.",pair:"Pair currency: eth, fobo, usdg or a supported stock ticker; referral claims use this currency.",devBuyTokens:"Whole tokens in the initial buy, 0 to 50,000,000 (5% of supply); default 0.",vestMonths:"Initial-buy lock in months: 0, 1, 3, 6 or 12; default 0. A lock requires an initial buy.",limitMarketCapUsd:"Target market capitalization in whole USD, as a decimal string; not a per-token price.",expiresIn:"Order lifetime: 1h, 1d, 7d or 30d; default 7d.",maxFeePerFill:"Maximum keeper fee per fill in payment-token base units, as an exact decimal integer string.",orderId:"Positive numeric ID of the local wallet\u2019s limit order to cancel.",kind:"Claim creator fees, referral earnings or vesting tokens.",to:"Optional recipient address for a referral claim; omit for this wallet. Other claims always pay this wallet."},l=(t,e=[])=>({type:"object",additionalProperties:!1,required:e,properties:Object.fromEntries(Object.entries(t).map(([r,s])=>{let o=s;return[r,{...o,description:o.description??Z[r]}]}))}),Y={fobo_browse:l({query:b(64,1),limit:U}),fobo_token:l({token:B},["token"]),fobo_portfolio:l({}),fobo_leaderboard:l({limit:U}),fobo_claims:l({}),fobo_limit_orders:l({token:B}),fobo_quote:l({...L,side:w(["buy","sell"])},["token","side","amount"]),fobo_fee_schedule:l({}),fobo_limit_pay_tokens:l({}),fobo_transaction:l({hash:{type:"string",pattern:"^0x[0-9a-fA-F]{64}$"}},["hash"]),fobo_buy:l(L,["token","amount"]),fobo_sell:l(L,["token","amount"]),fobo_launch:l({name:b(32,1),ticker:{type:"string",pattern:"^\\$?[a-zA-Z0-9]{2,10}$"},description:b(280),imageUrl:{...b(2e3),pattern:"^https://"},links:l({telegram:b(200),discord:b(200),github:b(200),website:b(200)}),pair:w(T),devBuyTokens:{type:"integer",minimum:0,maximum:5e7},vestMonths:w([0,1,3,6,12],"integer"),maxInitialBuyAmount:{...v,description:"Maximum pair-token base units to spend on the initial buy, excluding the live launch fee. Required when devBuyTokens is positive."}},["name","ticker"]),fobo_limit_order:l({token:B,side:w(["buy","sell"]),payWith:b(42,2),amount:v,limitMarketCapUsd:{type:"string",pattern:"^\\d{1,30}(\\.\\d{1,18})?$"},expiresIn:w(["1h","1d","7d","30d"]),maxFeePerFill:v},["token","side","amount","limitMarketCapUsd","maxFeePerFill"]),fobo_cancel_limit_order:l({orderId:{type:"integer",minimum:1,maximum:Number.MAX_SAFE_INTEGER}},["orderId"]),fobo_claim:l({kind:w(["creator","referral","vesting"]),token:B,pair:w(T),to:B},["kind"])},ee={fobo_buy:"buy",fobo_sell:"sell",fobo_launch:"launch",fobo_limit_order:"limitOrder",fobo_cancel_limit_order:"cancel",fobo_claim:"claim"},te={buy:"prepare_trade",sell:"prepare_trade",launch:"prepare_launch",limitOrder:"prepare_limit_order",cancel:"prepare_cancel_limit_order",claim:"prepare_claim"};function g(t){if(!t||typeof t!="object"||Array.isArray(t))throw new a("FOBO returned an invalid answer. Ask for a fresh summary.");return t}function ne(t,e){function r(s,o){let d=s.properties;if(Object.keys(o).some(n=>!Object.hasOwn(d,n)))throw new a("Unexpected FOBO argument. Use the fields declared by the tool.");for(let n of s.required)if(o[n]===void 0)throw new a(`Missing FOBO argument: ${n}.`);for(let[n,i]of Object.entries(o)){let c=d[n];if(c.type==="object"){r(c,g(i));continue}if(c.type==="integer"){if(typeof i!="number"||!Number.isSafeInteger(i)||i<Number(c.minimum??0)||i>Number(c.maximum??Number.MAX_SAFE_INTEGER))throw new a(`Invalid FOBO argument: ${n}.`)}else if(typeof i!="string"||i.length<Number(c.minLength??0)||i.length>Number(c.maxLength??256)||typeof c.pattern=="string"&&!new RegExp(c.pattern).test(i))throw new a(`Invalid FOBO argument: ${n}.`);if(Array.isArray(c.enum)&&!c.enum.includes(i))throw new a(`Invalid FOBO argument: ${n}.`)}}if(r(Y[t],g(e)),t==="fobo_claim"&&(e.kind==="referral"?e.pair===void 0:e.token===void 0))throw new a("Referral claims need pair; creator and vesting claims need token.");if(t==="fobo_claim"&&e.kind!=="referral"&&e.to!==void 0)throw new a("Only referral claims may name another recipient.");if(t==="fobo_launch"){if(Number(e.vestMonths??0)>0&&Number(e.devBuyTokens??0)===0)throw new a("A vesting lock needs an initial buy.");if(Number(e.devBuyTokens??0)>0&&(typeof e.maxInitialBuyAmount!="string"||BigInt(e.maxInitialBuyAmount)===0n))throw new a("An initial buy needs maxInitialBuyAmount in pair-token base units. Ask the person for that spending cap.");if(e.imageUrl!==void 0){let s=new URL(String(e.imageUrl));if(s.protocol!=="https:"||s.username||s.password)throw new a("Use a public https image URL.")}}return structuredClone(e)}function y(t){let e=t.toLowerCase();if(e===f||e==="0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee")return{address:f,decimals:18};if(e===m.usdg.toLowerCase())return{address:m.usdg,decimals:6};if(e===m.fobo.toLowerCase())return{address:m.fobo,decimals:18};if(t==="eth")return{address:f,decimals:18};if(t==="usdg")return{address:m.usdg,decimals:6};if(t==="fobo")return{address:m.fobo,decimals:18};let r=R.tokens.find(s=>T.includes(t)&&s.symbol.toLowerCase()===t||s.token.toLowerCase()===e);if(r)return{address:x(r.token),decimals:18};throw new a("FOBO did not identify a supported pair currency. Ask for token details first.")}function A(t,e,r){if(typeof t!="string"||!/^\d{1,78}(\.\d{1,18})?$/.test(t)||(t.split(".")[1]?.length??0)>e)throw new a(`FOBO returned an invalid ${r}. Ask for a fresh quote.`);return K(t,e).toString()}function re(t,e,r,s){if(String(t.payWith).replace(/^\$/,"").toLowerCase()!==s.toLowerCase())throw new a("FOBO quote payment currency differs from the request.");if(t.slippageBps!==r)throw new a("FOBO quote slippage differs from the request.");let o=A(t.expectedOut,e,"quote output"),d=A(t.minOut,e,"quote minimum"),n=BigInt(o)*BigInt(1e4-r)/10000n;if(BigInt(d)<=0n||BigInt(d)>BigInt(o)||BigInt(d)<n)throw new a("FOBO quote minimum exceeds the approved slippage loss.");return{amountOut:o,minimum:d}}function W(t){let e=Object.fromEntries(Object.entries(t.request).filter(([r])=>!r.startsWith("_")&&r!=="maxInitialBuyAmount"));return typeof e.links=="string"&&(e.links=JSON.parse(e.links)),e.amount!==void 0&&(e.amount=$(BigInt(String(e.amount)),Number(t.request._inputDecimals))),e.maxFeePerFill!==void 0&&(e.maxFeePerFill=$(BigInt(String(e.maxFeePerFill)),Number(t.request._payDecimals))),(t.kind==="buy"||t.kind==="sell")&&(e.side=t.kind),t.kind==="claim"&&e.pair!==void 0&&(e.currency=e.pair,delete e.pair),{...e,account:t.wallet}}function S(t,e,r="0x0Af57F62982D03066ef917AcAd87F771c06528Ec"){let[s,o]=BigInt(t)<BigInt(e)?[t,e]:[e,t];return{currency0:s,currency1:o,fee:r===f?500:0,tickSpacing:r===f?10:60,hooks:r}}function j(t,e){let r=t===f?e:t;if(t!==f&&e!==f)throw new a("FOBO base-currency routes must pass through ETH.");if(r.toLowerCase()===m.usdg.toLowerCase())return S(t,e,f);if(r.toLowerCase()===m.fobo.toLowerCase())return S(t,e);throw new a("FOBO has not pinned a route between this pair and ETH. Use the token\u2019s own pair.")}function oe(t,e,r,s){let o=[];return r.toLowerCase()!==e.toLowerCase()&&(r!==f&&o.push(j(r,f)),e!==f&&o.push(j(f,e))),o.push(S(e,t)),s?o.reverse():o}function ie(t,e,r,s){let o=t.request,d=t.terms;if(t.kind==="buy"||t.kind==="sell")return{kind:"trade",currencyIn:o._currencyIn,currencyOut:o._currencyOut,amountIn:BigInt(d.amountIn),minOut:BigInt(d.minOut),now:e,pools:JSON.parse(String(o._pools)),...s?{permit:s}:{}};if(t.kind==="launch"){let i=(r?_({abi:D,data:r.data}).args[0]:void 0)?.devBuyMaxCost??BigInt(d.amountIn??"0");if(i>BigInt(d.amountIn??"0"))throw new a("FOBO launch exceeds the approved initial-buy spending cap. Nothing further was signed.");return{kind:"launch",name:String(o.name),ticker:String(o.ticker).replace(/^\$/,"").toUpperCase(),pair:y(String(o.pair)).address,devBuyTokens:BigInt(d.devBuyTokens??0)*10n**18n,devBuyMaxCost:i,vestMonths:d.vestMonths??0,launchFeeWei:BigInt(d.launchFeeWei),now:e}}if(t.kind==="limitOrder"){if(!r)throw new a("FOBO order is missing its unsigned transaction.");let n=_({abi:M,data:r.data});if(n.functionName!=="place")throw new a("FOBO order must call place.");let i=n.args[5],k={"1h":3600,"1d":86400,"7d":604800,"30d":2592e3}[String(o.expiresIn??"7d")],O=BigInt(t.quotedAt+k);if(i<O-60n||i>BigInt(e+k)+60n)throw new a("FOBO changed the approved order expiry. Nothing further was signed.");return{kind:"limitOrder",side:o.side==="buy"?0:1,token:d.token,payToken:y(String(o.payWith)).address,amount:BigInt(d.amountIn),limitPriceUsdE18:K(String(o.limitMarketCapUsd),18)/1000000000n,expiry:i,maxFeePerFill:BigInt(String(o.maxFeePerFill))}}if(t.kind==="cancel")return{kind:"cancel",orderId:BigInt(String(o.orderId))};if(o.kind==="creator")return{kind:"claim",claimKind:"creator",poolKey:JSON.parse(String(o._poolKey))};if(o.kind==="referral")return{kind:"claim",claimKind:"referral",currency:y(String(o.pair)).address,recipient:o.to??t.wallet};if(o.kind==="vesting"&&r)return{kind:"claim",claimKind:"vesting",lockId:_({abi:C,data:r.data}).args[0],beneficiary:t.wallet};throw new a("FOBO claim does not match a supported claim kind.")}function ae(t){let e={...g(t)};if(e.status==="needs_signature"&&e.transactions===void 0&&(e.transactions=[]),!["ready","needs_approval","needs_signature"].includes(String(e.status))||!Array.isArray(e.transactions)||e.transactions.length>32)throw new a("FOBO returned an unsupported preparation. Nothing further was signed. Ask for a fresh summary.");return e}function se(t,e,r){let s=g(e);if(![4663,"0x1237"].includes(s.chainId)||String(s.from).toLowerCase()!==t.wallet.toLowerCase()||BigInt(String(s.value??"0"))!==0n)throw new a("FOBO approval has the wrong wallet, chain or ETH value. Nothing further was signed.");let o=_({abi:X,data:String(s.data)});if(o.functionName!=="approve")throw new a("FOBO requested something other than an approval.");let d=o.args[0],n=t.kind==="launch"?m.factory:t.kind==="limitOrder"?m.limitOrders:m.permit2;if(d.toLowerCase()!==n.toLowerCase()||String(s.to).toLowerCase()!==String(t.request._currencyIn).toLowerCase()||t.terms.amountIn===void 0)throw new a("FOBO approval does not match the approved token and spender. Nothing further was signed.");return N(e,{kind:"approval",token:x(String(s.to)),spender:d,amount:BigInt(t.terms.amountIn)},t.wallet)}async function de(t,e,r,s,o){if(e.status==="needs_signature"){if(e.transactions.length)throw new a("FOBO attached unexpected transactions to a signature request.");return[]}if(!e.transactions.length||t.kind!=="claim"&&e.transactions.length!==1)throw new a("FOBO returned an unexpected transaction count. Nothing further was signed.");if(e.status==="needs_approval"){if(!["buy","sell","launch","limitOrder"].includes(t.kind))throw new a("This FOBO action must not need an approval.");return e.transactions.map(n=>se(t,n,r))}if(e.transactions.some(n=>String(g(n).data).toLowerCase().startsWith("0x095ea7b3")))throw new a("FOBO attached an approval to a ready action. Ask for a fresh summary.");if(t.kind==="claim"&&t.request.kind==="vesting"){let n=o??E({chainId:4663}).readContract,i=V(["function getLock(uint256 id) view returns ((address token,uint64 start,uint32 duration,address beneficiary,uint256 amount,uint256 claimed))"]);for(let c of e.transactions){let k=_({abi:C,data:c.data}).args[0],O=await n({address:"0x51d217Ecf7c0e4EbF54258444B9617D012Fd7D0a",abi:i,functionName:"getLock",args:[k]});if(O.beneficiary.toLowerCase()!==t.wallet.toLowerCase()||O.token.toLowerCase()!==String(t.request.token).toLowerCase())throw new a("FOBO vesting lock does not belong to this wallet and token. Nothing further was signed.")}}let d=e.transactions.map(n=>N(n,ie(t,r,n,s),t.wallet));if(t.kind==="launch"){let n=BigInt(t.terms.launchFeeWei??"0"),i=t.request.pair==="eth"?n+BigInt(t.terms.amountIn??"0"):n;if(d.some(c=>BigInt(c.value)>i||BigInt(c.value)<n))throw new a("FOBO launch exceeds the approved spending cap or changed its fee. Nothing further was signed.")}if(typeof t.request._prepared=="string"){let n=JSON.parse(t.request._prepared);if(d.length!==n.length||d.some((i,c)=>i.to.toLowerCase()!==n[c].to.toLowerCase()||i.data.toLowerCase()!==n[c].data.toLowerCase()||BigInt(i.value)!==BigInt(n[c].value)))throw new a("FOBO changed the approved terms. Nothing further was signed. Ask for a fresh summary.")}return d}function ce(t){let e="Oak fee: 0 bps on FOBO\u2019s own route.";if(t.kind==="buy"||t.kind==="sell"){let r=t.terms.tokenPoolTaxPercentNow;if(typeof r!="number"||!Number.isFinite(r)||r<0||r>100)throw new a("FOBO quote did not identify its current tax.");return`${e} FOBO's tax right now: ${r}%; included in the quoted output and minimum.`}return t.kind==="launch"?`${e} FOBO launch fee: ${$(BigInt(t.terms.launchFeeWei),18)} ETH (${t.terms.launchFeeWei} wei).`:t.kind==="limitOrder"?`${e} FOBO keeper fee: at most ${t.request.maxFeePerFill} pay-token base units per fill. Pool tax applies when the order fills; the future tax is not known at preparation.`:`${e} No additional FOBO fee for this ${t.kind==="cancel"?"cancellation":"claim"}; network fees are additional.`}async function we(t,e,r,s){let o=Object.entries(ee).find(([,u])=>u===e)?.[0];if(!o||!Q(s,{strict:!1}))throw new a("Provide a valid FOBO action and local wallet.");let d=ne(o,r),n={};for(let[u,p]of Object.entries(d))n[u]=typeof p=="object"?JSON.stringify(p):p;let i={version:1,kind:e,wallet:x(s),chainId:4663,request:n,terms:{},quotedAt:Math.floor(Date.now()/1e3)};if(e==="launch"){n.pair??="eth",n.devBuyTokens??=0,n.vestMonths??=0;let u=g(g(await t.call("get_fee_schedule",{})).launch);if(u.launchesPaused===!0)throw new a("FOBO launches are paused. Nothing was signed.");let p=y(String(n.pair));n._currencyIn=p.address,n._inputDecimals=p.decimals,i.preparation={status:"ready",transactions:[]},i.terms={launchFeeWei:A(u.feeEth,18,"launch fee"),devBuyTokens:Number(n.devBuyTokens),vestMonths:Number(n.vestMonths),amountIn:String(n.maxInitialBuyAmount??"0")}}else if(e==="buy"||e==="sell"||e==="limitOrder"){n.payWith??=e==="limitOrder"?"eth":"pair";let u=String(n.payWith),p=g(await t.call("get_token",{token:n.token}));if(String(p.address).toLowerCase()!==String(n.token).toLowerCase())throw new a("FOBO token metadata does not match the requested token.");let H=y(String(p.pair).replace(/^\$/,"").toLowerCase());u==="pair"&&(u=String(p.pair).replace(/^\$/,"").toLowerCase());let F=y(u);n._payDecimals=F.decimals;let I=e==="limitOrder"?n.side:e;if(n._currencyIn=I==="sell"?String(n.token):F.address,n._currencyOut=I==="sell"?F.address:String(n.token),n._inputDecimals=I==="sell"?18:F.decimals,n._outputDecimals=I==="sell"?F.decimals:18,e!=="limitOrder"&&(n._pools=JSON.stringify(oe(x(String(n.token)),H.address,F.address,I==="sell"))),i.terms={token:x(String(n.token)),payWith:String(n.payWith),amountIn:String(n.amount)},BigInt(String(n.amount))===0n)throw new a("FOBO input amount must be positive.");if(e!=="limitOrder"){n.slippageBps??=50;let{account:J,...z}=W(i),h=g(await t.call("quote_trade",z)),G=A(h.amountIn,Number(n._inputDecimals),"quote input"),{minimum:q}=re(h,Number(n._outputDecimals),Number(n.slippageBps),u);if(G!==n.amount||BigInt(q)===0n||String(h.token).toLowerCase()!==String(n.token).toLowerCase()||h.side!==e)throw new a("FOBO quote does not match the requested trade. Nothing was signed.");if(i.terms.minOut=q,i.terms.slippageBps=Number(n.slippageBps),typeof h.tokenPoolTaxPercentNow!="number"||!Number.isFinite(h.tokenPoolTaxPercentNow)||h.tokenPoolTaxPercentNow<0||h.tokenPoolTaxPercentNow>100)throw new a("FOBO quote did not identify its current tax.");i.terms.tokenPoolTaxPercentNow=h.tokenPoolTaxPercentNow}}if(e==="claim"&&n.kind==="creator"){let u=g(await t.call("get_token",{token:n.token}));if(String(u.address).toLowerCase()!==String(n.token).toLowerCase())throw new a("FOBO claim token metadata does not match.");n._poolKey=JSON.stringify(S(y(String(u.pair).replace(/^\$/,"").toLowerCase()).address,x(String(n.token))))}if(e!=="launch"){let u=ae(await t.call(te[e],W(i))),p=await de(i,u,i.quotedAt);if(i.preparation={status:u.status,transactions:p},e==="cancel"||e==="claim"||e==="limitOrder"){if(u.status==="needs_signature")throw new a("This FOBO action must not need a permit signature.");u.status==="ready"&&(n._prepared=JSON.stringify(p))}}let c=e==="launch"?`Launch ${P(String(n.name))} (${P(String(n.ticker))}), pair ${n.pair}, initial buy ${n.devBuyTokens} tokens, lock ${n.vestMonths} months.`:e==="limitOrder"?`Place a FOBO ${n.side} order for ${n.token}, limit market cap ${n.limitMarketCapUsd} USD, expiry ${n.expiresIn??"7d"}, maximum keeper fee ${n.maxFeePerFill} pay-token base units per fill.`:e==="claim"?`Claim FOBO ${n.kind} earnings${n.token?` for ${n.token}`:` in ${n.pair}`} to ${n.to??s}.`:e==="cancel"?`Cancel FOBO order ${n.orderId} and refund ${s}.`:`${e} on FOBO for ${n.token}.`,k=e==="launch"?`Launch fee ${i.terms.launchFeeWei} wei; initial-buy spending cap ${i.terms.amountIn} pair-token base units.`:`Exact input ${i.terms.amountIn??"0"} base units.`,O=`${c}
|
|
2
|
+
Leaves wallet: ${k}
|
|
3
|
+
Comes back: ${i.terms.minOut?`at least ${i.terms.minOut} output base units`:e==="launch"?"the launched token and any initial buy, subject to the stated lock":"the approved order or claim proceeds to the named recipient"}.
|
|
4
|
+
Fees: no Oak swap fee on FOBO's route. ${ce(i)}
|
|
5
|
+
Approvals: only the exact action input to ${e==="launch"?m.factory:e==="limitOrder"?m.limitOrders:m.permit2}, if needed; ERC-20 trades also need a bounded Permit2 signature.
|
|
6
|
+
Warnings: network fees are additional; every transaction needs local simulation before signing. A failed later step can leave an exact allowance. New coins can have a much higher first-minute tax. Nothing has been signed.`;return{intent:i,summary:O}}export{be as a,m as b,Y as c,ee as d,te as e,g as f,ne as g,y as h,A as i,re as j,W as k,ie as l,ae as m,se as n,de as o,ce as p,we as q};
|