@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{f as L,k as r,l as $}from"./
|
|
1
|
+
import{f as L,k as r,l as $}from"./KOKLM63Q.js";import{a as I,e as c,h as v}from"./K4GUZ5QS.js";import{j as h,k as p}from"./2GXHYI23.js";async function M(k,b,d={},O){I(b);let o=new AbortController,C=()=>o.abort(),l=()=>c(o.signal);c(d.signal),d.signal?.addEventListener("abort",C,{once:!0});let u=[];try{let f=await L(k,O,o.signal);l();let w=k.clientFor(4663),S=await v(w,o.signal),T=Array.from({length:Math.ceil(f.logs.length/r)},(t,n)=>f.logs.slice(n*r,(n+1)*r));return await Promise.all(T.map(async(t,n)=>{l(),await $(w,t,b,S,o.signal,(e,y)=>{if(l(),BigInt(e.logTokens.amount)===0n&&BigInt(e.stakedLp.amount)===0n&&BigInt(e.pendingChop.amount)===0n&&BigInt(e.claimableChop.amount)===0n)return;let a=t[y],m=BigInt(e.pendingChop.amount),B=BigInt(e.claimableChop.amount),g=B<=m,s=e.rewardsPaused?0n:B,i={principal:[],debt:[],rewards:[],backing:[],coverage:g?{complete:!0}:{complete:!1,reason:"Chop reward reads disagree."}};if(BigInt(e.logTokens.amount)>0n&&i.backing.push(p({...e.net,source:"chop.redemption.net",heldAs:e.logTokens.token.address,measuredAtBlock:e.measuredAtBlock})),BigInt(e.stakedLp.amount)>0n&&i.backing.push(p({token:a.underlying,amount:null,source:"chop.stakedLp",heldAs:e.stakedLp.token.address,measuredAtBlock:e.measuredAtBlock,unknownReason:"Staked log tokens are not redeemed in this read; unstake to see their redemption."})),g){let A={tool:"chop_harvest",args:{log:a.log.address}},P=m-s;P>0n&&i.rewards.push(h("unpaid",{token:e.pendingChop.token,amount:P.toString(),source:"chop.getUnpaid",measuredAtBlock:e.measuredAtBlock,claim:A})),s>0n&&i.rewards.push(h("claimable",{token:e.claimableChop.token,amount:s.toString(),source:"chop.getClaimable",measuredAtBlock:e.measuredAtBlock,claim:A}))}let E=g?`unpaid CHOP ${m-s} base units; claimable CHOP ${s} base units${e.rewardsPaused?"; rewards are paused":""}.`:"Chop reward reads disagree.";u[n*r+y]=[{module:"chop",id:`4663:${a.log.address}`,chainId:4663,assets:[e.logTokens,e.stakedLp,e.pendingChop],economics:i,description:`Chop log held: ${e.logTokens.amount} base units; redeemable net underlying ${e.net.amount} base units (${a.underlying.address}, decimals ${a.underlying.decimals}); staked LP ${e.stakedLp.amount} base units; ${E}`,oakNotice:e.warnings}]})}).map(t=>t.catch(n=>{throw o.abort(),n}))),[...u.flat(),{module:"chop",id:"4663:coverage",chainId:4663,assets:[],incomplete:!0,description:"Chop positions cover currently verified registry logs only. Delisted or unverified log holdings are not included."}]}catch{return o.abort(),c(d.signal),[...u.flat(),{module:"chop",id:"4663:coverage",chainId:4663,assets:[],incomplete:!0,description:"Chop positions are incomplete because a chain read is unavailable. Please try again."}]}finally{d.signal?.removeEventListener("abort",C)}}export{M as a};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{c as A,d as M,m as $}from"./
|
|
1
|
+
import{c as A,d as M,m as $}from"./35LXCSHY.js";import{f as C,g as H}from"./QPY6UTLU.js";import{d as m,e as s,z as k}from"./KLEJ3W4T.js";import{g as b}from"./NWNYJ26T.js";import{b as x}from"./TI727O2H.js";import{a as e}from"./XSD5NL7J.js";import{decodeFunctionData as v,encodeFunctionData as B,erc20Abi as q,getAddress as F}from"viem";function Q(u){return{tools:[{name:"uniswap_swap_batch",inputSchema:{type:"object",additionalProperties:!1,required:["routes"],properties:{routes:{description:"One to twenty complete uniswap_swap argument objects, each with its own minAmountOut or maxAmountIn bound.",type:"array",minItems:1,maxItems:20,items:{type:"object",description:"Complete uniswap_swap arguments, including an absolute minAmountOut or maxAmountIn."}}}},async execute(n,y){if(H(n,["routes"]),!Array.isArray(n.routes)||n.routes.length<1||n.routes.length>20)throw new e("Provide 1 to 20 explicit bounded Uniswap routes.");let p=[],I=[],l=new Map,i="0x",E=0n,a,w=[],P=new Set;for(let t of n.routes){if(!t||typeof t!="object"||Array.isArray(t))throw new e("Each route must contain uniswap_swap arguments.");let c=await $(u,t,y,!1);if(!("txs"in c))throw new e("Route did not build swap transactions.");p.push(...c.warnings??[]),I.push(...c.confirmationWarnings??[]);let R=c.txs;for(let r of R.slice(0,-1))if(b(r.to,m)){let[o,N,O,U]=v({abi:M,data:r.data}).args;if(N!==s)throw new e("Unexpected route approval spender.");let _=o.toLowerCase(),d=l.get(_),j=(d?.amount??0n)+O;if(j>=1n<<160n)throw new e("Combined input approvals exceed uint160.");l.set(_,{token:o,amount:j,expiration:d&&d.expiration<BigInt(U)?d.expiration:BigInt(U)})}else{let o=v({abi:q,data:r.data});if(o.functionName!=="approve"||!b(o.args[0],m))throw new e("Unexpected route prerequisite.")}let g=R.at(-1);if(g.to!==s)throw new e("Route does not use the pinned Universal Router.");E+=BigInt(g.value);let[D,h,S]=v({abi:A,data:g.data}).args,T=D.slice(2).match(/../g)??[];if(T.length!==h.length)throw new e("Unexpected route command/parameter count.");T.forEach((r,o)=>{r==="04"?P.add(h[o]):(i=`${i}${r}`,w.push(h[o]))}),a=a===void 0||S<a?S:a}for(let t of P)i=`${i}04`,w.push(t);let f=[];for(let t of l.values())f.push(u.approval(F(t.token),m,t.amount.toString(),x),k(t.token,s,t.amount.toString(),t.expiration.toString()));return f.push(u.unsignedTx({to:s,data:B({abi:A,functionName:"execute",args:[i,w,a]}),value:E.toString(),chainId:x,description:`Atomically execute ${n.routes.length} caller-selected v2/v3/v4 routes, preserving each route's trade bound.`})),{...await C(u,f,y,`${p.join(" ")}${p.length?" ":""}Explicit mixed-version/split routes; every route must meet its own bound. No automatic best-route search or allow-revert branch. The wallet must fund each independently previewed route.`),warnings:p,confirmationWarnings:I}}}]}}export{Q as a};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{b as z,c as I}from"./SPRVVJXI.js";import{b as W}from"./TM7Z5SA4.js";import{d as R,e as _}from"./XV6F3RET.js";import{K as E}from"./7QKYDNF6.js";import{a as F}from"./43LI5NKJ.js";import{d as H,g as A,i as j}from"./NWNYJ26T.js";import{a as C,s as S}from"./FWD4L3CJ.js";import{a as s}from"./XSD5NL7J.js";import{encodeFunctionData as M,erc20Abi as V,getAddress as Z,keccak256 as K,zeroAddress as x}from"viem";var r=R.turbo,h=R.blackjack,g=m=>j(m,"Provide an explicit card address.",H);function G(m,d){if(/^uint\d*\[\]$/.test(m.type)&&Array.isArray(d))return d.map(c=>G({...m,type:m.type.slice(0,-2)},c));if(/^uint\d*$/.test(m.type)&&(typeof d!="string"||!/^(0|[1-9]\d*)$/.test(d)))throw new s("Card integers must be canonical decimal strings, without leading zeros.");return W(m,d)}var J=["buy","cashOut","claimExpiry","refund","safeTransferFrom","safeBatchTransferFrom"],X=["liquidate","recordKnock","liquidateKnock","clearKnock","recordDrift","settle","markVoid","depositHouse","depositPutPot","withdrawHouse","withdrawPutPot","createSeries","haltSales","resumeSales","sweepFees","skim"],Q=m=>m==="netnet_turbo_action"||m.startsWith("netnet_blackjack_")&&["netnet_blackjack_finalize","netnet_blackjack_expire","netnet_blackjack_claim"].includes(m);async function de(m,d,c,k){if(F(c),!Q(m))throw new s("No local NetNet card action builder exists.");let v=m!=="netnet_turbo_action";if(Object.keys(d).some(e=>!(v?["sessionId","seriesId"]:["operation","values","minimum","allowZeroPayout"]).includes(e)))throw new s("Unexpected card action argument.");if(v&&!z(m,d))throw new s("Recovery accepts exactly one positive decimal session or series ID.");if(await k.getChainId()!==C)throw new s("NetNet cards require chain 4663.");let w=await k.getBlock();if(w.number===null||!w.hash)throw new s("Card action block is unavailable.");let p=(e,t,i=[])=>k.readContract({address:e.address,abi:e.abi,functionName:t,args:i,blockNumber:w.number});for(let e of v?[r,h]:[r]){let t=await k.getCode({address:e.address,blockNumber:w.number});if(!t||K(t)!==e.codeHash)throw new s("NetNet card runtime changed or is unavailable. Requalify this deployment before signing.")}for(let e of v?Object.values(_):[_.turbo]){let t=await k.getCode({address:Z(e.address),blockNumber:w.number});if(!t||K(t)!==e.codeHash)throw new s("NetNet linked card library changed or is unavailable. Requalify before signing.")}let l={txs:[],inputs:[],cards:[],decision:"",blockNumber:w.number,blockHash:w.hash},$=(e,t,i,a,o)=>({chainId:4663,collection:r.address,operator:e,from:t,to:i,id:a,amount:o,operation:t===x?"mint":i===x?"burn":"transfer"}),T=(e,t,i,a,o=[])=>{l.txs.push({to:e,chainId:C,value:"0",data:M({abi:t,functionName:i,args:a}),description:l.decision}),l.cards.push(o)},D=(e,t)=>{if(t<=0n||t>=1n<<128n)throw new s("Card payment must be positive and below the exact-approval ceiling.");l.inputs.push({token:e,amount:t,to:r.address}),T(e,V,"approve",[r.address,t])};if(v){if(g(await p(h,"cards"))!==r.address||g(await p(h,"turbo"))!==r.address)throw new s("Blackjack card wiring changed.");let e=m==="netnet_blackjack_claim";if(Object.keys(d).some(b=>b!==(e?"seriesId":"sessionId")))throw new s("Recovery accepts only its one exact session or series ID.");let t=E(e?d.seriesId:d.sessionId),i,a,o,u="Original-series parked payout; self-claim only.";if(e){if(i=t,a=await p(h,"unclaimedChips",[t,c]),o="claimUnclaimedChips",a===0n)throw new s("This wallet has no parked chips for that series.")}else{let b=await p(h,"sessionOf",[t]);if(!b||!A(b.player,c))throw new s("Recovery is limited to this wallet\u2019s recorded blackjack session.");let y=m==="netnet_blackjack_finalize";if(o=y?"finalize":"expireSession",b.state!==(y?2:1))throw new s(y?"Session is not Closing. Use its current on-chain state to choose recovery.":"Session is not Open. A Closing session uses finalize after its challenge window.");let N=y?b.closeAt:b.deadline;if(u=y?`Challenge ends ${new Date(Number(N)*1e3).toISOString()}.`:`Session deadline ${new Date(Number(N)*1e3).toISOString()}; player-only expiry until ${new Date(Number(N+3600n)*1e3).toISOString()}.`,w.timestamp<N)throw new s(`Recovery is not due until ${N} Unix seconds.`);i=await p(h,"tableSeries"),a=b.chips}if(i<=0n||a<0n)throw new s("Blackjack recovery accounting is unavailable.");return l.decision=`${o} ${e?"series":"session"} ${t} at ${h.address}: return ${a} whole cards of collection ${r.address}, series ${i}, to ${Z(c)}. ${u} Last on-chain chips may omit off-chain winnings; cards may be worthless. A failed receiver parks the payout at ${h.address}; self-claim only. ETH gas extra.`,T(h.address,h.abi,o,[t],a===0n?[]:[$(h.address,h.address,c,i,a)]),l.recovery={...e?{}:{sessionId:t.toString()},seriesId:i.toString(),count:a.toString(),player:c,operation:o},l}let n=String(d.operation);if(n==="setApprovalForAll")throw new s(I.setApprovalForAll);if(["convertPremiums","convertSleeveFees"].includes(n))throw new s(I.conversion);if(![...J,...X].includes(n))throw new s("Choose a qualified finite TURBO operation.");if(!Array.isArray(d.values))throw new s("Provide ordered TURBO values using decimal integer strings.");let U=n==="safeTransferFrom"||n==="safeBatchTransferFrom",B=r.abi.find(e=>e.name===n),q=U?B.inputs.slice(1,-1):B.inputs;if(d.values.length!==q.length)throw new s("TURBO values do not match the exact operation inputs.");let f=q.map((e,t)=>G(e,d.values[t])),O=g(await p(r,"manager")),L=g(await p(r,"sleeve")),P=[];if(U){if(d.minimum!==void 0||d.allowZeroPayout!==void 0)throw new s("Transfer has no payout floor.");let e=g(f[0]);if(e===x||A(e,c))throw new s("Name a nonzero, non-self card recipient.");let t=await k.getCode({address:e,blockNumber:w.number});if(t&&t!=="0x")throw new s("Card transfer to a contract requires qualified credit and recovery. New blackjack seating remains disabled.");let i=n==="safeTransferFrom"?[f[1]]:f[1],a=n==="safeTransferFrom"?[f[2]]:f[2];if(!i.length||i.length>8||i.length!==a.length||new Set(i.map(String)).size!==i.length||i.some((o,u)=>o<=0n||a[u]<=0n||u>0&&o<=i[u-1]))throw new s("Use at most eight unique positive series IDs in increasing order and exact positive counts.");for(let o=0;o<i.length;o++){if(await p(r,"balanceOf",[c,i[o]])<a[o])throw new s("Card transfer exceeds this wallet\u2019s balance.");P.push($(c,c,e,i[o],a[o])),l.inputs.push({token:r.address,id:i[o],amount:a[o],to:e,exact:!0})}l.decision=`Transfer whole cards of collection ${r.address}: ${i.map((o,u)=>`series ${o} count ${a[u]}`).join(", ")} to ${e}. Basis does not travel with cards; no operator approval. No payout; transfer is irreversible. ETH gas extra.`,f=[c,...f,"0x"]}else if(["buy","cashOut","claimExpiry","refund"].includes(n)){let e=f[0],t=f[1],i=await p(r,"seriesOf",[e]);if(!i||i.asset===x||t<=0n)throw new s("Choose a known series and positive whole-card count.");let a=i.side===0?g(i.asset):S.mainnet.usdg,o=await k.readContract({address:a,abi:V,functionName:"decimals",blockNumber:w.number});if((n==="buy"||n==="cashOut")&&(i.state!==1||w.timestamp>=i.expiry))throw new s("This TURBO series is not OPEN and unexpired.");if(n==="buy"){let[u]=await p(r,"quoteBuy",[e,t]);if(!u||u>f[2])throw new s("Current card quote exceeds the explicit maximum USDG payment.");if(d.minimum!==void 0||d.allowZeroPayout!==void 0)throw new s("Buy uses its exact count and maximum USDG price.");l.decision=`Spend at most ${f[2]} USDG base units (${S.mainnet.usdg}, decimals 6) at ${r.address}; receive ${t} whole cards, collection ${r.address}, series ${e}, into this wallet. Exact quoted approval ${u}; fees included. Strike ${i.strikeWad} WAD; expiry ${new Date(Number(i.expiry)*1e3).toISOString()}; cards can lose all value. Any residual USDG allowance requires zero cleanup. ETH gas extra.`,D(S.mainnet.usdg,u),P=[$(c,x,c,e,t)]}else{if(n==="cashOut"&&d.minimum!==void 0)throw new s("cashOut takes its one encoded minimum in values, not a second local minimum.");if(await p(r,"balanceOf",[c,e])<t)throw new s("Card burn exceeds this wallet\u2019s balance.");let u=n==="cashOut"?f[2]:E(d.minimum,!0);if(u===0n&&d.allowZeroPayout!==!0)throw new s("A zero payout floor requires allowZeroPayout:true and explicit human confirmation.");let b=0n;if(n==="cashOut"){let y=await p(r,"quoteCashOut",[e,t,c]);if(y[0]<u)throw new s("The current cash-out quote misses the payout minimum.");b=y[1]}else if(i.state!==(n==="claimExpiry"?3:4))throw new s("Expiry claims require EXPIRED; pro-rata refunds require VOID.");l.decision=`Burn ${t} whole cards of ${r.address}, series ${e}; ${n==="refund"?"series pro-rata VOID refund, not personal purchase-price repayment":n}; receive >=${u} base units of ${a} (decimals ${o}) into this wallet. ${n==="cashOut"?`Minimum encoded in calldata; current performance fee ${b}.`:"Floor is local simulation only; no on-chain minimum. Settled payout includes applicable fees."} Burned cards cannot be returned; ETH gas extra.`,P=[$(c,c,x,e,t)],l.inputs.push({token:r.address,id:e,amount:t,to:x,exact:!0}),l.receipt={token:a,minimum:u,recipient:c,enforcement:n==="cashOut"?"calldata":"simulation"}}}else{if(d.minimum!==void 0||d.allowZeroPayout!==void 0)throw new s("This TURBO operation has no caller payout floor.");if(["withdrawHouse","withdrawPutPot","createSeries","resumeSales"].includes(n)&&!A(O,c))throw new s(`This TURBO operation requires manager ${O}.`);if(n==="haltSales"&&!A(c,O)&&!A(c,g(await p(r,"halter"))))throw new s("TURBO haltSales requires the current manager or halter.");if(["depositHouse","depositPutPot","withdrawHouse","withdrawPutPot","createSeries"].includes(n)){let t=g(f[0]);if(!(await Promise.all(["asset0","asset1","asset2"].map(a=>p(r,a)))).some(a=>typeof a=="string"&&A(a,t)))throw new s("This is not a pinned TURBO reserve asset.")}l.decision=`${n} at ${r.address}; values ${JSON.stringify(f,(t,i)=>typeof i=="bigint"?String(i):i)}. Protocol capital/accounting action; manager ${O}; sleeve ${L}; no caller reward. ${n.startsWith("deposit")?"Irreversible house funding; no personal withdrawable balance.":n.startsWith("withdraw")?"Pays the current manager; operating and reservation floors still apply.":"Series state, risk or protocol fee allocation may change."} No card approval; ETH gas extra.`,(n==="depositHouse"||n==="depositPutPot")&&D(n==="depositHouse"?g(f[0]):S.mainnet.usdg,f[1])}if(l.decision.length>1024)throw new s("Card decision terms exceed the complete confirmation label capacity. Use fewer card IDs.");T(r.address,r.abi,n,f,P);for(let e of l.txs)e.description=l.decision;return l}export{J as a,X as b,Q as c,de as d};
|
|
1
|
+
import{b as z,c as I}from"./LFSJDFMY.js";import{b as W}from"./DMDOSHV7.js";import{d as R,e as _}from"./XV6F3RET.js";import{K as E}from"./AXHFNE6L.js";import{a as F}from"./43LI5NKJ.js";import{d as H,g as A,i as j}from"./NWNYJ26T.js";import{b as C,t as S}from"./TI727O2H.js";import{a as s}from"./XSD5NL7J.js";import{encodeFunctionData as M,erc20Abi as V,getAddress as Z,keccak256 as K,zeroAddress as x}from"viem";var r=R.turbo,h=R.blackjack,g=m=>j(m,"Provide an explicit card address.",H);function G(m,d){if(/^uint\d*\[\]$/.test(m.type)&&Array.isArray(d))return d.map(c=>G({...m,type:m.type.slice(0,-2)},c));if(/^uint\d*$/.test(m.type)&&(typeof d!="string"||!/^(0|[1-9]\d*)$/.test(d)))throw new s("Card integers must be canonical decimal strings, without leading zeros.");return W(m,d)}var J=["buy","cashOut","claimExpiry","refund","safeTransferFrom","safeBatchTransferFrom"],X=["liquidate","recordKnock","liquidateKnock","clearKnock","recordDrift","settle","markVoid","depositHouse","depositPutPot","withdrawHouse","withdrawPutPot","createSeries","haltSales","resumeSales","sweepFees","skim"],Q=m=>m==="netnet_turbo_action"||m.startsWith("netnet_blackjack_")&&["netnet_blackjack_finalize","netnet_blackjack_expire","netnet_blackjack_claim"].includes(m);async function de(m,d,c,k){if(F(c),!Q(m))throw new s("No local NetNet card action builder exists.");let v=m!=="netnet_turbo_action";if(Object.keys(d).some(e=>!(v?["sessionId","seriesId"]:["operation","values","minimum","allowZeroPayout"]).includes(e)))throw new s("Unexpected card action argument.");if(v&&!z(m,d))throw new s("Recovery accepts exactly one positive decimal session or series ID.");if(await k.getChainId()!==C)throw new s("NetNet cards require chain 4663.");let w=await k.getBlock();if(w.number===null||!w.hash)throw new s("Card action block is unavailable.");let p=(e,t,i=[])=>k.readContract({address:e.address,abi:e.abi,functionName:t,args:i,blockNumber:w.number});for(let e of v?[r,h]:[r]){let t=await k.getCode({address:e.address,blockNumber:w.number});if(!t||K(t)!==e.codeHash)throw new s("NetNet card runtime changed or is unavailable. Requalify this deployment before signing.")}for(let e of v?Object.values(_):[_.turbo]){let t=await k.getCode({address:Z(e.address),blockNumber:w.number});if(!t||K(t)!==e.codeHash)throw new s("NetNet linked card library changed or is unavailable. Requalify before signing.")}let l={txs:[],inputs:[],cards:[],decision:"",blockNumber:w.number,blockHash:w.hash},$=(e,t,i,a,o)=>({chainId:4663,collection:r.address,operator:e,from:t,to:i,id:a,amount:o,operation:t===x?"mint":i===x?"burn":"transfer"}),T=(e,t,i,a,o=[])=>{l.txs.push({to:e,chainId:C,value:"0",data:M({abi:t,functionName:i,args:a}),description:l.decision}),l.cards.push(o)},D=(e,t)=>{if(t<=0n||t>=1n<<128n)throw new s("Card payment must be positive and below the exact-approval ceiling.");l.inputs.push({token:e,amount:t,to:r.address}),T(e,V,"approve",[r.address,t])};if(v){if(g(await p(h,"cards"))!==r.address||g(await p(h,"turbo"))!==r.address)throw new s("Blackjack card wiring changed.");let e=m==="netnet_blackjack_claim";if(Object.keys(d).some(b=>b!==(e?"seriesId":"sessionId")))throw new s("Recovery accepts only its one exact session or series ID.");let t=E(e?d.seriesId:d.sessionId),i,a,o,u="Original-series parked payout; self-claim only.";if(e){if(i=t,a=await p(h,"unclaimedChips",[t,c]),o="claimUnclaimedChips",a===0n)throw new s("This wallet has no parked chips for that series.")}else{let b=await p(h,"sessionOf",[t]);if(!b||!A(b.player,c))throw new s("Recovery is limited to this wallet\u2019s recorded blackjack session.");let y=m==="netnet_blackjack_finalize";if(o=y?"finalize":"expireSession",b.state!==(y?2:1))throw new s(y?"Session is not Closing. Use its current on-chain state to choose recovery.":"Session is not Open. A Closing session uses finalize after its challenge window.");let N=y?b.closeAt:b.deadline;if(u=y?`Challenge ends ${new Date(Number(N)*1e3).toISOString()}.`:`Session deadline ${new Date(Number(N)*1e3).toISOString()}; player-only expiry until ${new Date(Number(N+3600n)*1e3).toISOString()}.`,w.timestamp<N)throw new s(`Recovery is not due until ${N} Unix seconds.`);i=await p(h,"tableSeries"),a=b.chips}if(i<=0n||a<0n)throw new s("Blackjack recovery accounting is unavailable.");return l.decision=`${o} ${e?"series":"session"} ${t} at ${h.address}: return ${a} whole cards of collection ${r.address}, series ${i}, to ${Z(c)}. ${u} Last on-chain chips may omit off-chain winnings; cards may be worthless. A failed receiver parks the payout at ${h.address}; self-claim only. ETH gas extra.`,T(h.address,h.abi,o,[t],a===0n?[]:[$(h.address,h.address,c,i,a)]),l.recovery={...e?{}:{sessionId:t.toString()},seriesId:i.toString(),count:a.toString(),player:c,operation:o},l}let n=String(d.operation);if(n==="setApprovalForAll")throw new s(I.setApprovalForAll);if(["convertPremiums","convertSleeveFees"].includes(n))throw new s(I.conversion);if(![...J,...X].includes(n))throw new s("Choose a qualified finite TURBO operation.");if(!Array.isArray(d.values))throw new s("Provide ordered TURBO values using decimal integer strings.");let U=n==="safeTransferFrom"||n==="safeBatchTransferFrom",B=r.abi.find(e=>e.name===n),q=U?B.inputs.slice(1,-1):B.inputs;if(d.values.length!==q.length)throw new s("TURBO values do not match the exact operation inputs.");let f=q.map((e,t)=>G(e,d.values[t])),O=g(await p(r,"manager")),L=g(await p(r,"sleeve")),P=[];if(U){if(d.minimum!==void 0||d.allowZeroPayout!==void 0)throw new s("Transfer has no payout floor.");let e=g(f[0]);if(e===x||A(e,c))throw new s("Name a nonzero, non-self card recipient.");let t=await k.getCode({address:e,blockNumber:w.number});if(t&&t!=="0x")throw new s("Card transfer to a contract requires qualified credit and recovery. New blackjack seating remains disabled.");let i=n==="safeTransferFrom"?[f[1]]:f[1],a=n==="safeTransferFrom"?[f[2]]:f[2];if(!i.length||i.length>8||i.length!==a.length||new Set(i.map(String)).size!==i.length||i.some((o,u)=>o<=0n||a[u]<=0n||u>0&&o<=i[u-1]))throw new s("Use at most eight unique positive series IDs in increasing order and exact positive counts.");for(let o=0;o<i.length;o++){if(await p(r,"balanceOf",[c,i[o]])<a[o])throw new s("Card transfer exceeds this wallet\u2019s balance.");P.push($(c,c,e,i[o],a[o])),l.inputs.push({token:r.address,id:i[o],amount:a[o],to:e,exact:!0})}l.decision=`Transfer whole cards of collection ${r.address}: ${i.map((o,u)=>`series ${o} count ${a[u]}`).join(", ")} to ${e}. Basis does not travel with cards; no operator approval. No payout; transfer is irreversible. ETH gas extra.`,f=[c,...f,"0x"]}else if(["buy","cashOut","claimExpiry","refund"].includes(n)){let e=f[0],t=f[1],i=await p(r,"seriesOf",[e]);if(!i||i.asset===x||t<=0n)throw new s("Choose a known series and positive whole-card count.");let a=i.side===0?g(i.asset):S.mainnet.usdg,o=await k.readContract({address:a,abi:V,functionName:"decimals",blockNumber:w.number});if((n==="buy"||n==="cashOut")&&(i.state!==1||w.timestamp>=i.expiry))throw new s("This TURBO series is not OPEN and unexpired.");if(n==="buy"){let[u]=await p(r,"quoteBuy",[e,t]);if(!u||u>f[2])throw new s("Current card quote exceeds the explicit maximum USDG payment.");if(d.minimum!==void 0||d.allowZeroPayout!==void 0)throw new s("Buy uses its exact count and maximum USDG price.");l.decision=`Spend at most ${f[2]} USDG base units (${S.mainnet.usdg}, decimals 6) at ${r.address}; receive ${t} whole cards, collection ${r.address}, series ${e}, into this wallet. Exact quoted approval ${u}; fees included. Strike ${i.strikeWad} WAD; expiry ${new Date(Number(i.expiry)*1e3).toISOString()}; cards can lose all value. Any residual USDG allowance requires zero cleanup. ETH gas extra.`,D(S.mainnet.usdg,u),P=[$(c,x,c,e,t)]}else{if(n==="cashOut"&&d.minimum!==void 0)throw new s("cashOut takes its one encoded minimum in values, not a second local minimum.");if(await p(r,"balanceOf",[c,e])<t)throw new s("Card burn exceeds this wallet\u2019s balance.");let u=n==="cashOut"?f[2]:E(d.minimum,!0);if(u===0n&&d.allowZeroPayout!==!0)throw new s("A zero payout floor requires allowZeroPayout:true and explicit human confirmation.");let b=0n;if(n==="cashOut"){let y=await p(r,"quoteCashOut",[e,t,c]);if(y[0]<u)throw new s("The current cash-out quote misses the payout minimum.");b=y[1]}else if(i.state!==(n==="claimExpiry"?3:4))throw new s("Expiry claims require EXPIRED; pro-rata refunds require VOID.");l.decision=`Burn ${t} whole cards of ${r.address}, series ${e}; ${n==="refund"?"series pro-rata VOID refund, not personal purchase-price repayment":n}; receive >=${u} base units of ${a} (decimals ${o}) into this wallet. ${n==="cashOut"?`Minimum encoded in calldata; current performance fee ${b}.`:"Floor is local simulation only; no on-chain minimum. Settled payout includes applicable fees."} Burned cards cannot be returned; ETH gas extra.`,P=[$(c,c,x,e,t)],l.inputs.push({token:r.address,id:e,amount:t,to:x,exact:!0}),l.receipt={token:a,minimum:u,recipient:c,enforcement:n==="cashOut"?"calldata":"simulation"}}}else{if(d.minimum!==void 0||d.allowZeroPayout!==void 0)throw new s("This TURBO operation has no caller payout floor.");if(["withdrawHouse","withdrawPutPot","createSeries","resumeSales"].includes(n)&&!A(O,c))throw new s(`This TURBO operation requires manager ${O}.`);if(n==="haltSales"&&!A(c,O)&&!A(c,g(await p(r,"halter"))))throw new s("TURBO haltSales requires the current manager or halter.");if(["depositHouse","depositPutPot","withdrawHouse","withdrawPutPot","createSeries"].includes(n)){let t=g(f[0]);if(!(await Promise.all(["asset0","asset1","asset2"].map(a=>p(r,a)))).some(a=>typeof a=="string"&&A(a,t)))throw new s("This is not a pinned TURBO reserve asset.")}l.decision=`${n} at ${r.address}; values ${JSON.stringify(f,(t,i)=>typeof i=="bigint"?String(i):i)}. Protocol capital/accounting action; manager ${O}; sleeve ${L}; no caller reward. ${n.startsWith("deposit")?"Irreversible house funding; no personal withdrawable balance.":n.startsWith("withdraw")?"Pays the current manager; operating and reservation floors still apply.":"Series state, risk or protocol fee allocation may change."} No card approval; ETH gas extra.`,(n==="depositHouse"||n==="depositPutPot")&&D(n==="depositHouse"?g(f[0]):S.mainnet.usdg,f[1])}if(l.decision.length>1024)throw new s("Card decision terms exceed the complete confirmation label capacity. Use fewer card IDs.");T(r.address,r.abi,n,f,P);for(let e of l.txs)e.description=l.decision;return l}export{J as a,X as b,Q as c,de as d};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as q}from"./NCQFWPAW.js";import{a as v}from"./D742AYEV.js";import{K as A}from"./7QKYDNF6.js";import{c as k}from"./DNNFKDZR.js";import{a as $}from"./43LI5NKJ.js";import{a as I}from"./66F5ZH34.js";import{d as M,g as F,i as G,m as U}from"./NWNYJ26T.js";import{a as y}from"./FWD4L3CJ.js";import{a as o}from"./XSD5NL7J.js";import{encodeFunctionData as L,erc20Abi as R,getAddress as N,zeroAddress as j}from"viem";var C={genesis:N("0x575b7B7c97Ef3E21C82DAeB427899d583e1E913f"),bond:N("0xff32a969A0c567129eECD926D04657728E1980C1"),inverse:N("0x92166e94Eea5B7799b761653881692f881dFC4C9"),treasury:N("0x04822Ea321A0DEE6F40656172F29312104855d66"),pteam:N("0x650F58079dAa17ee28928c2F92d22291d038B2B0"),rwa:N("0x99B6eE6eDe47d9a8a9bfd03F728a99B789df1961"),premium:N("0x346e1a31171A0f7aC73909010b5435768d3B5462"),tax:N("0x086C58400b8708Ef993f256E12e752dcF0AC918e")},z=N("0x59F95461E68e0c77605299791E1449f175165B54"),O={genesis:["purchase","finalize","refund","claim"],bond:["deposit","redeem"],inverse:["swap"],treasury:["rebalanceToMorpho","rebalanceFromMorpho","mintNet","spendUsdg"],pteam:["exercise"],rwa:["redeem","depositInventory","pokeHwm","setDiscount","setInventoryMax","setHalt","setMenu","skim"],premium:["execute"],tax:["convert"]},V={genesis:["wired","finalized","finalizeTime","saleStart","saleDeadline","raisedRaw","totalRaised","registryLength"],bond:["wired","enabled","startTime","marketCount"],inverse:["active","price","capacityRemaining","spreadBps"],treasury:["wired","rfv","backingPerToken","liquidUsdg","morphoAssets","polRfv","morphoCapBps","morphoVault","canonicalPair"],pteam:["wired","holder","vestedFraction","exercisableNow","exercised","strikeWad","capBps","circulatingSupply","excludedFromFloat"],rwa:["manager","halted","inventory","inventoryMax","owedNet","bHwm","deskDiscountBps","VEST","MAX_DISCOUNT_BPS","INVENTORY_HARD_CAP","menu","routerSource","sleeve"],premium:["active","clipSize","lastExecuteAt","premiumThresholdWad","router","pairContract"],tax:["wired","pendingNet","teamBps","treasuryBps","teamWallet","router","pairContract"]},T=h=>JSON.parse(JSON.stringify(h,(P,S)=>typeof S=="bigint"?S.toString():S));function g(h){return G(h,"Provide a checksummed address.",M)}var oe=h=>{async function P(t){if(typeof t!="string"||!Object.hasOwn(C,t))throw new o("Choose a published NetNet financial product.");let c=t,e=C[c],r=q[c],u=h.clientFor(y);if(await u.getChainId()!==y)throw new o("NetNet requires chain 4663.");let n=await u.getBlock(),a=(w,x=[])=>u.readContract({address:e,abi:r,functionName:w,args:x,blockNumber:n.number}),[i,s,l,p]=await Promise.all([a("net"),a("usdg"),u.readContract({address:v.address,abi:R,functionName:"decimals",blockNumber:n.number}),u.readContract({address:k.address,abi:R,functionName:"decimals",blockNumber:n.number})]);if(g(i)!==v.address||g(s)!==k.address||l!==v.decimals||p!==k.decimals)throw new o("NetNet financial token pins or decimals do not match the deployment.");return{product:c,contract:e,abi:r,rpc:u,block:n,read:a}}async function S(t){$(t);let c=(e,r)=>({module:"netnet",id:`4663:${C.bond.toLowerCase()}:${e}`,chainId:y,incomplete:!0,assets:[],description:`NetNet bond notes unreadable: ${h.plainError(r)} Use netnet_financial_status with product bond to inspect notes.`});try{let e=await P("bond"),r=U(await e.read("noteCount",[t]),"Invalid NetNet bond note count."),u=r<50n?Number(r):50,n=[];for(let a=0;a<u;a++)try{let i=await e.read("notes",[t,BigInt(a)]);if(!Array.isArray(i)||i.length!==4)throw new o("Invalid NetNet bond note.");let[s,l,p,w]=i.map(B=>U(B,"Invalid NetNet bond note amount or timestamp."));if(l>s||w<=p||w>=1n<<64n)throw new o("Invalid NetNet bond note vesting or claimed amount.");let x=s-l;if(x===0n)continue;let E=e.block.timestamp>=w?s:e.block.timestamp<=p?0n:s*(e.block.timestamp-p)/(w-p),D=E>l?E-l:0n;n.push({module:"netnet",id:`4663:${e.contract.toLowerCase()}:${a}`,chainId:y,matured:e.block.timestamp>=w,assets:[{token:v,amount:x.toString()}],description:`NetNet bond note ${a}: ${x} NET base units outstanding; ${D} claimable now, vesting ends at Unix ${w}. Redeem vested NET with netnet_financial_action product bond operation redeem. Payment cannot be withdrawn. Block ${e.block.number}.`})}catch(i){n.push(c(String(a),i))}return r>BigInt(u)&&n.push({module:"netnet",id:`4663:${e.contract.toLowerCase()}:coverage`,chainId:y,incomplete:!0,assets:[],description:`NetNet bond positions checked the first ${u} of ${r} notes. Use netnet_financial_status product bond offset ${u} to read the remaining notes.`}),n}catch(e){return[c("unreadable",e)]}}let _=(t,c,e,r)=>({name:t,inputSchema:{type:"object",properties:c,required:e,additionalProperties:!1},execute:async(u,n)=>{try{if($(n),Object.keys(u).some(a=>!Object.hasOwn(c,a)))throw new o("Unsupported NetNet financial argument.");return await r(u,n)}catch(a){throw new o(h.plainError(a))}}}),W={type:"string",enum:Object.keys(C),description:"NetNet financial product: genesis (founding sale), bond, inverse (NET buyback), treasury, pteam (team option), rwa (equity desk), premium (premium keeper) or tax (tax collector)."};return{positions:S,tools:[_("netnet_financial_status",{product:W,offset:{type:"integer",minimum:0,description:"Index of the first wallet note to return (bond and rwa products only). Default 0."},limit:{type:"integer",minimum:1,maximum:50,description:"Maximum notes to return, 1 to 50 (default 20; bond and rwa products only)."}},["product"],async(t,c)=>{let e=await P(t.product),r=V[e.product],u=t.offset??0,n=t.limit??20;if(!Number.isSafeInteger(u)||Number(u)<0||!Number.isSafeInteger(n)||Number(n)<1||Number(n)>50)throw new o("Use a nonnegative offset and limit 1..50.");let a=await Promise.all(r.map(async s=>{try{return[s,{value:T(await e.read(s))}]}catch(l){return[s,{unavailable:h.plainError(l)}]}})),i={};if(e.product==="genesis")for(let s of["purchasedRaw","purchasedNetOf","claimedNet","claimableNetOf"])i[s]=T(await e.read(s,[c]));if(e.product==="bond"||e.product==="rwa"){i.pending=T(await e.read("pendingFor",[c]));let s=await e.read("noteCount",[c]);if(typeof s!="bigint"||s<0n)throw new o("Invalid NetNet note count.");let l=s<BigInt(Number(u)+Number(n))?s:BigInt(Number(u)+Number(n));i.noteCount=s.toString(),i.notes=await Promise.all(Array.from({length:Math.max(0,Number(l-BigInt(Number(u))))},async(p,w)=>({id:String(Number(u)+w),note:T(await e.read(e.product==="bond"?"notes":"noteAt",[c,BigInt(Number(u)+w)]))}))),i.nextOffset=l<s?l.toString():null,e.product==="bond"&&(i.markets=await Promise.all([0n,1n].map(async p=>{try{return{id:p.toString(),quoteToken:g(await e.read("quoteToken",[p])),priceWad:String(await e.read("bondPrice",[p]))}}catch(w){return{id:p.toString(),unavailable:h.plainError(w)}}})))}return e.product==="treasury"&&(i.isMinter=await e.read("isMinter",[c]),i.isSpender=await e.read("isSpender",[c])),{chainId:y,contract:e.contract,product:e.product,blockNumber:String(e.block.number),tokens:[v,k],metrics:Object.fromEntries(a),wallet:i,units:"Raw token amounts use each token\u2019s decimals. Prices, NAV, reserve values and capacityRemaining use 18-decimal USDG WAD. Note timestamps are Unix seconds.",operations:O[e.product],caveat:"An unavailable metric is not zero. Formulaic eligibility, oracle liveness, caps and vesting are checked by the action preview. RWA entry/router calldata and initial deployment wiring remain unsupported."}}),_("netnet_financial_action",{product:W,operation:{type:"string",enum:[...new Set(Object.values(O).flat())],description:"Action to run; it must be one the chosen product supports, for example bond deposit or redeem, genesis purchase or claim, inverse swap."},amount:I('Amount in base units of the token the operation spends or moves: USDG has 6 decimals, NET 9 ("1000000" = 1 USDG, "1000000000" = 1 NET).'),minAmountOut:I('Least output you must receive, in base units of the output token (USDG 6 decimals, NET 9). Example: "1000000" = 1 USDG.'),maxPriceWad:I("Highest bond price you accept, as an 18-decimal wad of USDG per NET in base units (1e18 = 1 USDG). Bond deposit only."),maxPayment:I('Most USDG you will pay to exercise, in USDG base units (6 decimals). Example: "1000000" = 1 USDG. pteam exercise only.'),marketId:{type:"integer",enum:[0,1],description:"Bond market: 0 pays with USDG, 1 pays with the canonical NET/USDG LP token. Bond deposit only."},recipient:{type:"string",description:"Address that receives the minted NET or spent USDG. Treasury mintNet and spendUsdg only; use the intended address."},halted:{type:"boolean",description:"rwa setHalt only: true halts the desk, false resumes it."},token:{type:"string",description:"Address of the stray token to sweep (0x + 40 hex digits). rwa skim only."},noteIds:{type:"array",maxItems:50,description:"Bond note ids to redeem, unique decimal strings (rwa redeem only); omit to redeem every vested note.",items:I('Note id (index of the wallet note), as a decimal string. Example: "0".')},menu:{type:"array",maxItems:32,description:"Complete replacement RWA equity menu (rwa setMenu only): up to 32 entries; target weights must sum to 10000 basis points.",items:{type:"object",description:"Menu entry with token and feed addresses, targetWeightBps (10000 = 100%) and active (boolean)."}}},["product","operation"],async(t,c)=>{let e=await P(t.product),r=t.operation;if(typeof r!="string"||!O[e.product].includes(r))throw new o("This operation is not supported by the selected financial product.");let u=new Set(["product","operation"]),n=[],a,i=0n,s="",l=(...d)=>d.forEach(m=>u.add(m)),p=()=>(l("amount"),A(t.amount)),w=()=>(l("minAmountOut"),A(t.minAmountOut));if(e.product==="genesis"){if(r==="purchase"&&(i=p(),a=k,n=[i],s="Founding subscription; NET is claimable only after successful finalization and vesting. A failed sale requires refund."),r==="claim"&&await e.read("claimableNetOf",[c])===0n)throw new o("No vested founding NET is claimable by this wallet.")}else if(e.product==="bond")if(r==="deposit"){if(l("marketId","maxPriceWad"),t.marketId!==0&&t.marketId!==1)throw new o("Bond marketId must be 0 (USDG) or 1 (canonical LP).");let d=BigInt(t.marketId);if(g(await e.read("quoteToken",[d]))!==(d===0n?k.address:z))throw new o("Bond quote token is not the pinned USDG or canonical LP.");i=p(),a=d===0n?k:{address:z,decimals:18,symbol:"NET/USDG LP",chainId:y};let f=A(t.maxPriceWad),b=await e.read("bondPrice",[d]);if(typeof b!="bigint"||b===0n||b>f)throw new o("Bond price exceeds maxPriceWad or is invalid.");n=[d,i,f,c],s="Payment is exchanged for a non-transferable NET note with two-day linear vesting. Redeem vested NET with the same product; payment cannot be withdrawn."}else n=[c];else if(e.product==="inverse"){if(i=p(),a=v,n=[i,w()],s="Purchased NET is burned permanently; USDG pays directly to this wallet. Capacity is denominated in USDG WAD, not raw USDG.",await e.read("active")!==!0)throw new o("NetNet buyback is inactive: oracle, finalization or capacity is unavailable.")}else if(e.product==="pteam"){if(g(await e.read("holder"))!==N(c))throw new o("This wallet is not the immutable pTEAM holder.");let d=p();if(l("maxPayment"),d>await e.read("exercisableNow"))throw new o("The NET exercise amount exceeds the vested cap.");let m=await e.read("strikeWad");if(i=(d*m/10n**BigInt(v.decimals)+10n**12n-1n)/10n**12n,i===0n||i>A(t.maxPayment))throw new o("The exercise payment exceeds maxPayment or rounds to zero.");a=k,n=[d],s=`Exercise pays ${i} USDG base units into treasury reserves and mints ${d} NET base units to the immutable holder. No withdrawal or exercise reversal exists.`}else if(e.product==="treasury"){let d=p();if(r==="mintNet"||r==="spendUsdg"){l("recipient");let m=g(t.recipient);if(await e.read(r==="mintNet"?"isMinter":"isSpender",[c])!==!0)throw new o("This wallet lacks the fixed NetNet treasury minter/spender role.");n=[m,d],s=`Protocol treasury operation sends ${d} base units to ${m}; it does not deposit into this wallet\u2019s savings.`}else n=[d],s="Permissionless protocol reserve rebalance; assets remain owned by the NetNet treasury. The deployed fraction is constrained by the immutable cap."}else if(e.product==="rwa"){if(["depositInventory","setDiscount","setInventoryMax","setHalt","setMenu"].includes(r)&&g(await e.read("manager"))!==N(c))throw new o("This wallet lacks the immutable RWA manager role.");if(r==="redeem")if(l("noteIds"),t.noteIds===void 0)n=[c];else{if(!Array.isArray(t.noteIds)||!t.noteIds.length||t.noteIds.length>50)throw new o("Provide 1..50 unique note IDs.");let m=t.noteIds.map(b=>A(b,!0));if(new Set(m.map(String)).size!==m.length)throw new o("Note IDs must be unique.");let f=await e.read("noteCount",[c]);if(m.some(b=>b>=f))throw new o("RWA note ID is out of range.");n=[c,m]}else if(r==="setHalt"){if(l("halted"),typeof t.halted!="boolean")throw new o("Provide halted as a boolean.");n=[t.halted]}else if(r==="setMenu"){if(l("menu"),!Array.isArray(t.menu)||!t.menu.length||t.menu.length>32)throw new o("Provide 1..32 explicit RWA menu entries.");let m=t.menu.map(f=>{if(!f||typeof f!="object"||Array.isArray(f)||Object.keys(f).some(H=>!["token","feed","targetWeightBps","active"].includes(H)))throw new o("Invalid RWA menu fields.");let b=f;if(typeof b.active!="boolean")throw new o("RWA active must be boolean.");return{token:g(b.token),feed:g(b.feed),targetWeightBps:A(b.targetWeightBps,!0),active:b.active}});if(new Set(m.map(f=>f.token)).size!==m.length||m.reduce((f,b)=>f+b.targetWeightBps,0n)!==10000n||m.some(f=>f.active&&(f.token===j||f.feed===j)))throw new o("RWA menu tokens must be unique, weights sum to 10000, active feeds/tokens nonzero.");n=[m],s=`Replace the complete RWA equity menu: ${JSON.stringify(T(m))}.`}else if(r==="skim")l("token"),n=[g(t.token)],s=`Sweep eligible stray assets to sleeve ${g(await e.read("sleeve"))}, not to this wallet.`;else if(r!=="pokeHwm"){let m=p();if(n=[m],r==="depositInventory"&&(a=v,i=m,s="Inventory funding is one-way. The manager cannot withdraw these NET; they are committed to bond obligations."),r==="setDiscount"&&m>await e.read("MAX_DISCOUNT_BPS")||r==="setInventoryMax"&&m>await e.read("INVENTORY_HARD_CAP"))throw new o("RWA setting exceeds its immutable maximum.")}}else e.product==="premium"?(n=[w()],s="Permissionless mint-and-sell keeper operation; all sale proceeds go to NetNet treasury. The caller receives no reward."):(n=[p(),w()],s="Convert NET already owned by the tax collector. Proceeds split to treasury and team; the caller receives no reward and supplies no NET.");if(Object.keys(t).some(d=>!u.has(d)))throw new o("Unexpected fields for this NetNet operation.");if(a&&await e.rpc.readContract({address:a.address,abi:R,functionName:"balanceOf",args:[c],blockNumber:e.block.number})<i)throw new o(`Top up ${a.symbol}: needs ${i} base units.`);let x=`NetNet ${e.product}.${r}, contract ${e.contract}, chain ${y}, values ${JSON.stringify(T(n))}. ${a?`Approve exactly ${i} ${a.symbol} base units (${a.address}, decimals ${a.decimals}). `:""}${s}`,E=[...a?[h.approval(a.address,e.contract,i.toString(),y)]:[],h.unsignedTx({to:e.contract,data:L({abi:e.abi,functionName:r,args:n}),value:"0",chainId:y,description:x})],D=await h.preview(E,c),B=0n;for(let d of D.changes){if(!/^-?\d+$/.test(d.amount))throw new o("Invalid NetNet preview amount.");if(BigInt(d.amount)<0n&&(B-=BigInt(d.amount)),BigInt(d.amount)<0n&&(!a||d.token.chainId!==y||!F(d.token.address,a.address)||d.token.decimals!==a.decimals||-BigInt(d.amount)>i))throw new o("NetNet preview spends outside the exact input budget.")}if(B>i)throw new o("NetNet preview exceeds the aggregate input budget.");return{txs:E,preview:D,summary:x}})]}};export{C as a,z as b,oe as c};
|
|
1
|
+
import{a as q}from"./NCQFWPAW.js";import{a as v}from"./RUTSEGGD.js";import{K as A}from"./AXHFNE6L.js";import{c as k}from"./W7QNSNOH.js";import{a as $}from"./43LI5NKJ.js";import{a as I}from"./66F5ZH34.js";import{d as M,g as F,i as G,m as U}from"./NWNYJ26T.js";import{b as y}from"./TI727O2H.js";import{a as o}from"./XSD5NL7J.js";import{encodeFunctionData as L,erc20Abi as R,getAddress as N,zeroAddress as j}from"viem";var C={genesis:N("0x575b7B7c97Ef3E21C82DAeB427899d583e1E913f"),bond:N("0xff32a969A0c567129eECD926D04657728E1980C1"),inverse:N("0x92166e94Eea5B7799b761653881692f881dFC4C9"),treasury:N("0x04822Ea321A0DEE6F40656172F29312104855d66"),pteam:N("0x650F58079dAa17ee28928c2F92d22291d038B2B0"),rwa:N("0x99B6eE6eDe47d9a8a9bfd03F728a99B789df1961"),premium:N("0x346e1a31171A0f7aC73909010b5435768d3B5462"),tax:N("0x086C58400b8708Ef993f256E12e752dcF0AC918e")},z=N("0x59F95461E68e0c77605299791E1449f175165B54"),O={genesis:["purchase","finalize","refund","claim"],bond:["deposit","redeem"],inverse:["swap"],treasury:["rebalanceToMorpho","rebalanceFromMorpho","mintNet","spendUsdg"],pteam:["exercise"],rwa:["redeem","depositInventory","pokeHwm","setDiscount","setInventoryMax","setHalt","setMenu","skim"],premium:["execute"],tax:["convert"]},V={genesis:["wired","finalized","finalizeTime","saleStart","saleDeadline","raisedRaw","totalRaised","registryLength"],bond:["wired","enabled","startTime","marketCount"],inverse:["active","price","capacityRemaining","spreadBps"],treasury:["wired","rfv","backingPerToken","liquidUsdg","morphoAssets","polRfv","morphoCapBps","morphoVault","canonicalPair"],pteam:["wired","holder","vestedFraction","exercisableNow","exercised","strikeWad","capBps","circulatingSupply","excludedFromFloat"],rwa:["manager","halted","inventory","inventoryMax","owedNet","bHwm","deskDiscountBps","VEST","MAX_DISCOUNT_BPS","INVENTORY_HARD_CAP","menu","routerSource","sleeve"],premium:["active","clipSize","lastExecuteAt","premiumThresholdWad","router","pairContract"],tax:["wired","pendingNet","teamBps","treasuryBps","teamWallet","router","pairContract"]},T=h=>JSON.parse(JSON.stringify(h,(P,S)=>typeof S=="bigint"?S.toString():S));function g(h){return G(h,"Provide a checksummed address.",M)}var oe=h=>{async function P(t){if(typeof t!="string"||!Object.hasOwn(C,t))throw new o("Choose a published NetNet financial product.");let c=t,e=C[c],r=q[c],u=h.clientFor(y);if(await u.getChainId()!==y)throw new o("NetNet requires chain 4663.");let n=await u.getBlock(),a=(w,x=[])=>u.readContract({address:e,abi:r,functionName:w,args:x,blockNumber:n.number}),[i,s,l,p]=await Promise.all([a("net"),a("usdg"),u.readContract({address:v.address,abi:R,functionName:"decimals",blockNumber:n.number}),u.readContract({address:k.address,abi:R,functionName:"decimals",blockNumber:n.number})]);if(g(i)!==v.address||g(s)!==k.address||l!==v.decimals||p!==k.decimals)throw new o("NetNet financial token pins or decimals do not match the deployment.");return{product:c,contract:e,abi:r,rpc:u,block:n,read:a}}async function S(t){$(t);let c=(e,r)=>({module:"netnet",id:`4663:${C.bond.toLowerCase()}:${e}`,chainId:y,incomplete:!0,assets:[],description:`NetNet bond notes unreadable: ${h.plainError(r)} Use netnet_financial_status with product bond to inspect notes.`});try{let e=await P("bond"),r=U(await e.read("noteCount",[t]),"Invalid NetNet bond note count."),u=r<50n?Number(r):50,n=[];for(let a=0;a<u;a++)try{let i=await e.read("notes",[t,BigInt(a)]);if(!Array.isArray(i)||i.length!==4)throw new o("Invalid NetNet bond note.");let[s,l,p,w]=i.map(B=>U(B,"Invalid NetNet bond note amount or timestamp."));if(l>s||w<=p||w>=1n<<64n)throw new o("Invalid NetNet bond note vesting or claimed amount.");let x=s-l;if(x===0n)continue;let E=e.block.timestamp>=w?s:e.block.timestamp<=p?0n:s*(e.block.timestamp-p)/(w-p),D=E>l?E-l:0n;n.push({module:"netnet",id:`4663:${e.contract.toLowerCase()}:${a}`,chainId:y,matured:e.block.timestamp>=w,assets:[{token:v,amount:x.toString()}],description:`NetNet bond note ${a}: ${x} NET base units outstanding; ${D} claimable now, vesting ends at Unix ${w}. Redeem vested NET with netnet_financial_action product bond operation redeem. Payment cannot be withdrawn. Block ${e.block.number}.`})}catch(i){n.push(c(String(a),i))}return r>BigInt(u)&&n.push({module:"netnet",id:`4663:${e.contract.toLowerCase()}:coverage`,chainId:y,incomplete:!0,assets:[],description:`NetNet bond positions checked the first ${u} of ${r} notes. Use netnet_financial_status product bond offset ${u} to read the remaining notes.`}),n}catch(e){return[c("unreadable",e)]}}let _=(t,c,e,r)=>({name:t,inputSchema:{type:"object",properties:c,required:e,additionalProperties:!1},execute:async(u,n)=>{try{if($(n),Object.keys(u).some(a=>!Object.hasOwn(c,a)))throw new o("Unsupported NetNet financial argument.");return await r(u,n)}catch(a){throw new o(h.plainError(a))}}}),W={type:"string",enum:Object.keys(C),description:"NetNet financial product: genesis (founding sale), bond, inverse (NET buyback), treasury, pteam (team option), rwa (equity desk), premium (premium keeper) or tax (tax collector)."};return{positions:S,tools:[_("netnet_financial_status",{product:W,offset:{type:"integer",minimum:0,description:"Index of the first wallet note to return (bond and rwa products only). Default 0."},limit:{type:"integer",minimum:1,maximum:50,description:"Maximum notes to return, 1 to 50 (default 20; bond and rwa products only)."}},["product"],async(t,c)=>{let e=await P(t.product),r=V[e.product],u=t.offset??0,n=t.limit??20;if(!Number.isSafeInteger(u)||Number(u)<0||!Number.isSafeInteger(n)||Number(n)<1||Number(n)>50)throw new o("Use a nonnegative offset and limit 1..50.");let a=await Promise.all(r.map(async s=>{try{return[s,{value:T(await e.read(s))}]}catch(l){return[s,{unavailable:h.plainError(l)}]}})),i={};if(e.product==="genesis")for(let s of["purchasedRaw","purchasedNetOf","claimedNet","claimableNetOf"])i[s]=T(await e.read(s,[c]));if(e.product==="bond"||e.product==="rwa"){i.pending=T(await e.read("pendingFor",[c]));let s=await e.read("noteCount",[c]);if(typeof s!="bigint"||s<0n)throw new o("Invalid NetNet note count.");let l=s<BigInt(Number(u)+Number(n))?s:BigInt(Number(u)+Number(n));i.noteCount=s.toString(),i.notes=await Promise.all(Array.from({length:Math.max(0,Number(l-BigInt(Number(u))))},async(p,w)=>({id:String(Number(u)+w),note:T(await e.read(e.product==="bond"?"notes":"noteAt",[c,BigInt(Number(u)+w)]))}))),i.nextOffset=l<s?l.toString():null,e.product==="bond"&&(i.markets=await Promise.all([0n,1n].map(async p=>{try{return{id:p.toString(),quoteToken:g(await e.read("quoteToken",[p])),priceWad:String(await e.read("bondPrice",[p]))}}catch(w){return{id:p.toString(),unavailable:h.plainError(w)}}})))}return e.product==="treasury"&&(i.isMinter=await e.read("isMinter",[c]),i.isSpender=await e.read("isSpender",[c])),{chainId:y,contract:e.contract,product:e.product,blockNumber:String(e.block.number),tokens:[v,k],metrics:Object.fromEntries(a),wallet:i,units:"Raw token amounts use each token\u2019s decimals. Prices, NAV, reserve values and capacityRemaining use 18-decimal USDG WAD. Note timestamps are Unix seconds.",operations:O[e.product],caveat:"An unavailable metric is not zero. Formulaic eligibility, oracle liveness, caps and vesting are checked by the action preview. RWA entry/router calldata and initial deployment wiring remain unsupported."}}),_("netnet_financial_action",{product:W,operation:{type:"string",enum:[...new Set(Object.values(O).flat())],description:"Action to run; it must be one the chosen product supports, for example bond deposit or redeem, genesis purchase or claim, inverse swap."},amount:I('Amount in base units of the token the operation spends or moves: USDG has 6 decimals, NET 9 ("1000000" = 1 USDG, "1000000000" = 1 NET).'),minAmountOut:I('Least output you must receive, in base units of the output token (USDG 6 decimals, NET 9). Example: "1000000" = 1 USDG.'),maxPriceWad:I("Highest bond price you accept, as an 18-decimal wad of USDG per NET in base units (1e18 = 1 USDG). Bond deposit only."),maxPayment:I('Most USDG you will pay to exercise, in USDG base units (6 decimals). Example: "1000000" = 1 USDG. pteam exercise only.'),marketId:{type:"integer",enum:[0,1],description:"Bond market: 0 pays with USDG, 1 pays with the canonical NET/USDG LP token. Bond deposit only."},recipient:{type:"string",description:"Address that receives the minted NET or spent USDG. Treasury mintNet and spendUsdg only; use the intended address."},halted:{type:"boolean",description:"rwa setHalt only: true halts the desk, false resumes it."},token:{type:"string",description:"Address of the stray token to sweep (0x + 40 hex digits). rwa skim only."},noteIds:{type:"array",maxItems:50,description:"Bond note ids to redeem, unique decimal strings (rwa redeem only); omit to redeem every vested note.",items:I('Note id (index of the wallet note), as a decimal string. Example: "0".')},menu:{type:"array",maxItems:32,description:"Complete replacement RWA equity menu (rwa setMenu only): up to 32 entries; target weights must sum to 10000 basis points.",items:{type:"object",description:"Menu entry with token and feed addresses, targetWeightBps (10000 = 100%) and active (boolean)."}}},["product","operation"],async(t,c)=>{let e=await P(t.product),r=t.operation;if(typeof r!="string"||!O[e.product].includes(r))throw new o("This operation is not supported by the selected financial product.");let u=new Set(["product","operation"]),n=[],a,i=0n,s="",l=(...d)=>d.forEach(m=>u.add(m)),p=()=>(l("amount"),A(t.amount)),w=()=>(l("minAmountOut"),A(t.minAmountOut));if(e.product==="genesis"){if(r==="purchase"&&(i=p(),a=k,n=[i],s="Founding subscription; NET is claimable only after successful finalization and vesting. A failed sale requires refund."),r==="claim"&&await e.read("claimableNetOf",[c])===0n)throw new o("No vested founding NET is claimable by this wallet.")}else if(e.product==="bond")if(r==="deposit"){if(l("marketId","maxPriceWad"),t.marketId!==0&&t.marketId!==1)throw new o("Bond marketId must be 0 (USDG) or 1 (canonical LP).");let d=BigInt(t.marketId);if(g(await e.read("quoteToken",[d]))!==(d===0n?k.address:z))throw new o("Bond quote token is not the pinned USDG or canonical LP.");i=p(),a=d===0n?k:{address:z,decimals:18,symbol:"NET/USDG LP",chainId:y};let f=A(t.maxPriceWad),b=await e.read("bondPrice",[d]);if(typeof b!="bigint"||b===0n||b>f)throw new o("Bond price exceeds maxPriceWad or is invalid.");n=[d,i,f,c],s="Payment is exchanged for a non-transferable NET note with two-day linear vesting. Redeem vested NET with the same product; payment cannot be withdrawn."}else n=[c];else if(e.product==="inverse"){if(i=p(),a=v,n=[i,w()],s="Purchased NET is burned permanently; USDG pays directly to this wallet. Capacity is denominated in USDG WAD, not raw USDG.",await e.read("active")!==!0)throw new o("NetNet buyback is inactive: oracle, finalization or capacity is unavailable.")}else if(e.product==="pteam"){if(g(await e.read("holder"))!==N(c))throw new o("This wallet is not the immutable pTEAM holder.");let d=p();if(l("maxPayment"),d>await e.read("exercisableNow"))throw new o("The NET exercise amount exceeds the vested cap.");let m=await e.read("strikeWad");if(i=(d*m/10n**BigInt(v.decimals)+10n**12n-1n)/10n**12n,i===0n||i>A(t.maxPayment))throw new o("The exercise payment exceeds maxPayment or rounds to zero.");a=k,n=[d],s=`Exercise pays ${i} USDG base units into treasury reserves and mints ${d} NET base units to the immutable holder. No withdrawal or exercise reversal exists.`}else if(e.product==="treasury"){let d=p();if(r==="mintNet"||r==="spendUsdg"){l("recipient");let m=g(t.recipient);if(await e.read(r==="mintNet"?"isMinter":"isSpender",[c])!==!0)throw new o("This wallet lacks the fixed NetNet treasury minter/spender role.");n=[m,d],s=`Protocol treasury operation sends ${d} base units to ${m}; it does not deposit into this wallet\u2019s savings.`}else n=[d],s="Permissionless protocol reserve rebalance; assets remain owned by the NetNet treasury. The deployed fraction is constrained by the immutable cap."}else if(e.product==="rwa"){if(["depositInventory","setDiscount","setInventoryMax","setHalt","setMenu"].includes(r)&&g(await e.read("manager"))!==N(c))throw new o("This wallet lacks the immutable RWA manager role.");if(r==="redeem")if(l("noteIds"),t.noteIds===void 0)n=[c];else{if(!Array.isArray(t.noteIds)||!t.noteIds.length||t.noteIds.length>50)throw new o("Provide 1..50 unique note IDs.");let m=t.noteIds.map(b=>A(b,!0));if(new Set(m.map(String)).size!==m.length)throw new o("Note IDs must be unique.");let f=await e.read("noteCount",[c]);if(m.some(b=>b>=f))throw new o("RWA note ID is out of range.");n=[c,m]}else if(r==="setHalt"){if(l("halted"),typeof t.halted!="boolean")throw new o("Provide halted as a boolean.");n=[t.halted]}else if(r==="setMenu"){if(l("menu"),!Array.isArray(t.menu)||!t.menu.length||t.menu.length>32)throw new o("Provide 1..32 explicit RWA menu entries.");let m=t.menu.map(f=>{if(!f||typeof f!="object"||Array.isArray(f)||Object.keys(f).some(H=>!["token","feed","targetWeightBps","active"].includes(H)))throw new o("Invalid RWA menu fields.");let b=f;if(typeof b.active!="boolean")throw new o("RWA active must be boolean.");return{token:g(b.token),feed:g(b.feed),targetWeightBps:A(b.targetWeightBps,!0),active:b.active}});if(new Set(m.map(f=>f.token)).size!==m.length||m.reduce((f,b)=>f+b.targetWeightBps,0n)!==10000n||m.some(f=>f.active&&(f.token===j||f.feed===j)))throw new o("RWA menu tokens must be unique, weights sum to 10000, active feeds/tokens nonzero.");n=[m],s=`Replace the complete RWA equity menu: ${JSON.stringify(T(m))}.`}else if(r==="skim")l("token"),n=[g(t.token)],s=`Sweep eligible stray assets to sleeve ${g(await e.read("sleeve"))}, not to this wallet.`;else if(r!=="pokeHwm"){let m=p();if(n=[m],r==="depositInventory"&&(a=v,i=m,s="Inventory funding is one-way. The manager cannot withdraw these NET; they are committed to bond obligations."),r==="setDiscount"&&m>await e.read("MAX_DISCOUNT_BPS")||r==="setInventoryMax"&&m>await e.read("INVENTORY_HARD_CAP"))throw new o("RWA setting exceeds its immutable maximum.")}}else e.product==="premium"?(n=[w()],s="Permissionless mint-and-sell keeper operation; all sale proceeds go to NetNet treasury. The caller receives no reward."):(n=[p(),w()],s="Convert NET already owned by the tax collector. Proceeds split to treasury and team; the caller receives no reward and supplies no NET.");if(Object.keys(t).some(d=>!u.has(d)))throw new o("Unexpected fields for this NetNet operation.");if(a&&await e.rpc.readContract({address:a.address,abi:R,functionName:"balanceOf",args:[c],blockNumber:e.block.number})<i)throw new o(`Top up ${a.symbol}: needs ${i} base units.`);let x=`NetNet ${e.product}.${r}, contract ${e.contract}, chain ${y}, values ${JSON.stringify(T(n))}. ${a?`Approve exactly ${i} ${a.symbol} base units (${a.address}, decimals ${a.decimals}). `:""}${s}`,E=[...a?[h.approval(a.address,e.contract,i.toString(),y)]:[],h.unsignedTx({to:e.contract,data:L({abi:e.abi,functionName:r,args:n}),value:"0",chainId:y,description:x})],D=await h.preview(E,c),B=0n;for(let d of D.changes){if(!/^-?\d+$/.test(d.amount))throw new o("Invalid NetNet preview amount.");if(BigInt(d.amount)<0n&&(B-=BigInt(d.amount)),BigInt(d.amount)<0n&&(!a||d.token.chainId!==y||!F(d.token.address,a.address)||d.token.decimals!==a.decimals||-BigInt(d.amount)>i))throw new o("NetNet preview spends outside the exact input budget.")}if(B>i)throw new o("NetNet preview exceeds the aggregate input budget.");return{txs:E,preview:D,summary:x}})]}};export{C as a,z as b,oe as c};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{B as se,t as W,y as G}from"./BAIY32AV.js";import{d as ke}from"./XYPGLG6A.js";import{a as de,b as oe,c as pe,e as ne,f as ye,g as fe,h as K,i as b,j as g,l as _,m as U,o as N,p as B,q,s as V,u as $,v as D}from"./2E4I7CJ7.js";import{b as X,g as O,h as E,i as ue,j as me}from"./MQK6OP7S.js";import{a as j}from"./G2LAO23N.js";import{c as ee}from"./NWNYJ26T.js";import{a as i}from"./XSD5NL7J.js";import{encodeAbiParameters as Oe,getAddress as we,keccak256 as Ke,parseAbi as je,toHex as ce,zeroAddress as ze}from"viem";import{encodeAbiParameters as he,encodePacked as Ce,getAddress as Fe,keccak256 as re,parseAbi as Le,toHex as Re,zeroAddress as be}from"viem";var ve=1n<<256n,Ne=1n<<128n,Te=Le(["function extsload(bytes32[] slots) view returns (bytes32[])"]),Q=(o,n,e)=>({type:"object",additionalProperties:!1,properties:o,required:n,...e===void 0?{}:{description:e}}),Ue={description:"Hookr LP position, chosen by kind: a launcher family member, a position NFT, or an agent-account position.",oneOf:[Q({kind:{const:"family",description:j.enumValues({family:"one member position of a Hookr launcher family"})},launcher:{...ee,description:"Address of the Hookr launcher contract that created the family."},familyId:{...oe,description:"Bytes32 hex id of the launcher family (0x plus 64 hex digits)."},member:{type:"string",enum:["0","1","2","3","4","5","6","7"],description:'Member index within the family, a decimal string from "0" to "7".'}},["kind","launcher","familyId","member"],"Hookr family LP position: one member of a launcher family, identified by launcher, familyId and member."),Q({kind:{const:"nft",description:j.enumValues({nft:"a position held as an NFT"})},tokenId:{...de,description:j.id("position NFT")}},["kind","tokenId"]),Q({kind:{const:"agent-account",description:j.enumValues({"agent-account":"a position held by an agent account"})},account:{...ee,description:j.address("agent account that holds the position")},positionId:{...oe,description:"Bytes32 hex id of the position within the agent account (0x plus 64 hex digits)."}},["kind","account","positionId"])]};function qe(o){let n=U(o);if(n.kind!=="family")throw new i("This step supports Launcher family positions only. NFT and agent-account position reads are reserved for a later integration.");ne(n,["kind","launcher","familyId","member"],["kind","launcher","familyId","member"]);let e=ye(n.member,8);if(e>7n)throw new i("Hookr family member must be a decimal string from 0 to 7.");return{kind:"family",launcher:me(n.launcher),familyId:K(n.familyId),member:e.toString()}}var A=o=>Re(BigInt.asUintN(256,o),{size:32}),te=(o,n)=>re(he([{type:"bytes32"},{type:"bytes32"}],[o,n]));function ie(o,n,e,a,r,H){let h=te(o,A(6n)),P=m=>te(A(BigInt(m)),A(BigInt(h)+4n)),p=re(he([{type:"bytes32"},{type:"uint8"}],[e,a])),c=re(Ce(["address","int24","int24","bytes32"],[n,r,H,p])),u=te(c,A(BigInt(h)+6n));return[h,A(BigInt(h)+1n),A(BigInt(h)+2n),A(BigInt(P(r))+1n),A(BigInt(P(r))+2n),A(BigInt(P(H))+1n),A(BigInt(P(H))+2n),u,A(BigInt(u)+1n),A(BigInt(u)+2n)]}function J(o,n,e,a,r,H){return BigInt.asUintN(256,a<r?n-e:a>=H?e-n:o-n-e)}function Y(o,n,e){if(o<0n||o>=1n<<128n||[n,e].some(a=>a<0n||a>=ve))throw new i("Hookr fee inputs are outside the verified v4 layout.");return o*BigInt.asUintN(256,n-e)/Ne}function ae(o){let n=U(o),e={currency0:b(n.currency0),currency1:b(n.currency1),fee:Number(g(n.fee,24)),tickSpacing:Number(g(n.tickSpacing,24)),hooks:b(n.hooks)};if(BigInt(e.currency0)>=BigInt(e.currency1)||e.fee!==8388608||e.hooks!==q||e.tickSpacing<1||e.tickSpacing>32767)throw new i("Hookr family PoolKey is not a supported Root dynamic-fee pool.");return e}async function Ve(o,n,e,a){let r=await E(o,a),H={},h=new Set,P=(t,k=[])=>B(o,e.launcher,N(e.launcher===Fe(X.launcherV1)?"launcherV1":"launcher"),t,k,r.number),p=async(t,k)=>{try{return await k()}catch(x){return H[t]=x instanceof i?x.message:`Hookr ${t} read failed at block ${r.number}. Retry the named-block read; no zero or empty result is implied.`,null}},c={chainId:4663,blockNumber:r.number.toString(),blockHash:r.hash,position:e,owner:null,ownedByWallet:null,poolId:null,poolKey:null,range:null,liquidity:null,tokens:null,principal:null,uncollectedLpFees:null,collectedLpFees:null,claimableCoreCredits:null,poolPendingRecapture:null,inRange:null,gateStatus:null,locks:null},u=async()=>(await ue(o,r),{...c,readStatus:{status:Object.keys(H).length?"partial":"complete",reasons:H},warnings:["collectedLpFees is null: no complete collection-history reconstruction is available in this step.","LP fees can include donations already released into v4 fee growth. Pending recapture is pool-level, unallocated and excluded from LP fees.","Principal is current withdrawable token inventory before fees, gas or price changes; it is not the original deposit value."]});if(await p("pins",async()=>(await O(o,r.number,[e.launcher,q,V],h),!0))===null)return u();let m=await p("owner",async()=>{let t=b(await P("familyOwner",[e.familyId]));if(t===be)throw new i("Hookr family does not exist at this block. Check its Launcher and family ID.");return t});if(m===null)return u();c.owner=m,c.ownedByWallet=m===n;let R=await p("position",async()=>{let[t,k,x]=await Promise.all([P("memberCount",[e.familyId]),P("position",[e.familyId,Number(e.member)]),P("poolManager")]);if(x!==V||g(t,8)>8n||BigInt(e.member)>=g(t,8))throw new i("Hookr family member or PoolManager is invalid.");let w=U(k),d=ae(w.key);if(typeof w.tickLower!="number"||typeof w.tickUpper!="number")throw new i("Hookr position range is incomplete.");G(w.tickLower,w.tickUpper,d.tickSpacing);let s=g(w.liquidity,128),L=W(d);if(await P("poolFamily",[L])!==e.familyId)throw new i("Hookr pool does not belong to this family.");return{key:d,id:L,tickLower:w.tickLower,tickUpper:w.tickUpper,liquidity:s}});if(R===null)return u();let{key:l,id:y,tickLower:C,tickUpper:I,liquidity:v}=R;c.poolKey=l,c.poolId=y,c.range={tickLower:C,tickUpper:I},c.liquidity=v.toString();let[f,T,F]=await Promise.all([p("tokens",()=>Promise.all([D(o,l.currency0,r.number),D(o,l.currency1,r.number)])),p("feeGrowth",async()=>{let t=ie(y,e.launcher,e.familyId,Number(e.member),C,I),k=await B(o,V,Te,"extsload",[t],r.number),x=_(k,10).map(Ae=>BigInt(K(Ae))),[w,d,s,L,Z,S,z,Ie,xe,He]=x,le=w&(1n<<160n)-1n,M=Number(BigInt.asIntN(24,w>>160n));if(le===0n||M<-887272||M>887272||Ie!==v)throw new i("Hookr PoolManager position is uninitialized or differs from the Launcher liquidity. No principal or fee amount is inferred.");let Se=J(d,L,S,M,C,I),Be=J(s,Z,z,M,C,I);return{sqrtPriceX96:le,tick:M,fee0:Y(v,Se,xe),fee1:Y(v,Be,He)}}),p("poolConfig",async()=>{let t=U(await B(o,q,N("rootV1"),"poolConfig",[y],r.number));if(b(t.liquidityOwner)!==e.launcher||![l.currency0,l.currency1].includes(b(t.subject))||![l.currency0,l.currency1].includes(b(t.quote))||t.subject===t.quote)throw new i("Hookr pool configuration differs from this family position.");let k=b(t.rules),x=$(k);return await O(o,r.number,[k],h),{pc:t,core:k,role:x}})]);if(c.tokens=f,T&&(c.inRange=T.tick>=C&&T.tick<I,f)){let t=se({liquidity:v,tickLower:C,tickUpper:I,sqrtPriceX96:T.sqrtPriceX96});c.principal=[{token:f[0],amount:t.amount0.toString()},{token:f[1],amount:t.amount1.toString()}],c.uncollectedLpFees=[{token:f[0],amount:T.fee0.toString()},{token:f[1],amount:T.fee1.toString()}]}if(F){let t=(s,L=[])=>B(o,F.core,N("rulesV1"),s,L,r.number),[k,x,w,d]=await Promise.all([p("gateStatus",async()=>{let s=b(F.pc.advisory);return s!==be&&await O(o,r.number,[s],h),ke(o,r.number,y,e.launcher,s)}),p("locks",async()=>ge(o,{position:e,block:r,poolId:y,core:F.core,role:F.role})),p("claimableCoreCredits",async()=>{if(!f)throw new i("Read token metadata before displaying core credits.");let s=await t("poolAccruedCurrencies",[y]);if(!Array.isArray(s)||s.length>32||s.some(S=>S!==l.currency0&&S!==l.currency1))throw new i("Core accrual includes unmeasured currencies; read the core directly before collecting.");let[L,Z]=await Promise.all([Promise.all([l.currency0,l.currency1].map(S=>t("poolAccrued",[y,S]))),Promise.all([l.currency0,l.currency1].map(S=>B(o,F.core,N(F.role),"claimable",[S,n],r.number)))]);return{core:F.core,familyOwnerAccrual:L.map((S,z)=>({token:f[z],amount:g(S).toString()})),walletCredits:Z.map((S,z)=>({token:f[z],amount:g(S).toString()})),walletCreditsScope:"Core-wide wallet credits, not attributed to this position. Do not add them to LP fees."}}),p("poolPendingRecapture",async()=>{if(!f)throw new i("Read token metadata before displaying pending recapture.");let s=_(await t("pendingDonation",[y]),5).map(L=>g(L));return{due:[{token:f[0],amount:s[0].toString()},{token:f[1],amount:s[1].toString()}],fresh:[{token:f[0],amount:s[2].toString()},{token:f[1],amount:s[3].toString()}],freshChildBlock:s[4].toString(),scope:"pool",allocatedToPosition:!1}})]);c.gateStatus=k,c.locks=x,c.claimableCoreCredits=w,c.poolPendingRecapture=d}return u()}function Ze(o){return[{name:"hookr_lp_position",inputSchema:Q({position:Ue,...pe},["position"]),execute:async(n,e)=>{ne(n,["position","blockNumber"],["position"]);let a=qe(n.position);if(o.network==="testnet")throw new i("Hookr LP reads are configured only on mainnet, chain 4663.");try{return await Ve(o.clientFor(4663),e,a,fe(n))}catch(r){throw r instanceof i?r:new i("Hookr position block is unavailable. Retry the complete named-block read; no zero position or fee is implied.")}}}]}var Pe=o=>N(o.launcher===we(X.launcherV1)?"launcherV1":"launcher");function Me(o){let n=Ke(Oe([{type:"bytes32"},{type:"bytes32"}],[o,"0x3c0d3d8cba92527b3a48aa783c8734a4e170057eb16401c9df8a7c8a6588b900"]));return ce(BigInt(n)+5n,{size:32})}async function _e(o,n){try{let e="0x0000000000000000000000000000000000000a11",a=await o.request({method:"eth_call",params:[{to:e,data:"0x"},ce(n.number),{[e]:{code:"0x4360005260206000f3"}}]});return BigInt(K(a))}catch{throw new i("Hookr parent-block clock is unavailable. Retry with an RPC supporting named-block eth_call state overrides; child-chain height cannot establish lock expiry.")}}async function co(o,n,e){let a=await E(o);await O(o,a.number,[e.launcher,q,V]);let r=(d,s=[])=>B(o,e.launcher,Pe(e),d,s,a.number),[H,h,P,p]=await Promise.all([r("familyOwner",[e.familyId]),r("memberCount",[e.familyId]),r("position",[e.familyId,Number(e.member)]),r("poolManager")]),c=b(H);if(c===ze||c!==n)throw new i("Only the current Hookr family owner can add, collect or remove this position. Use its signing wallet.");if(p!==V||g(h,8)<1n||g(h,8)>8n||BigInt(e.member)>=g(h,8))throw new i("Hookr family member or PoolManager differs from the reviewed deployment.");let u=U(P),m=ae(u.key),R=g(u.liquidity,128);if(typeof u.tickLower!="number"||typeof u.tickUpper!="number")throw new i("Hookr family range is unavailable.");let l=u.tickLower,y=u.tickUpper;G(l,y,m.tickSpacing);let C=W(m);if(await r("poolFamily",[C])!==e.familyId)throw new i("Hookr pool does not belong to this Launcher family.");let I=U(await B(o,q,N("rootV1"),"poolConfig",[C],a.number)),v=b(I.rules),f=$(v);if(b(I.liquidityOwner)!==e.launcher||![m.currency0,m.currency1].includes(b(I.subject))||![m.currency0,m.currency1].includes(b(I.quote))||I.subject===I.quote)throw new i("Hookr pool configuration differs from this family key.");await O(o,a.number,[v]);let[T,F]=await Promise.all([Promise.all([m.currency0,m.currency1].map(d=>D(o,d,a.number))),B(o,V,je(["function extsload(bytes32[] slots) view returns (bytes32[])"]),"extsload",[ie(C,e.launcher,e.familyId,Number(e.member),l,y)],a.number)]),t=_(F,10).map(d=>BigInt(K(d))),k=t[0]&(1n<<160n)-1n,x=Number(BigInt.asIntN(24,t[0]>>160n));if(!k||x<-887272||x>887272||t[7]!==R)throw new i("Hookr PoolManager state differs from the family position. Retry the full read.");let w=[0,1].map(d=>Y(R,J(t[1+d],t[3+d],t[5+d],x,l,y),t[8+d]));return{position:e,block:a,owner:c,key:m,poolId:C,liquidity:R,tickLower:l,tickUpper:y,sqrtPriceX96:k,fees:w,tokens:T,pc:I,core:v,role:f}}async function ge(o,n){let{position:e,block:a,poolId:r,core:H,role:h}=n,[P,p,c,u]=await Promise.all([B(o,e.launcher,Pe(e),"principalLockedUntil",[e.familyId],a.number),B(o,H,N(h),"removalLockedUntil",[r],a.number),o.getStorageAt({address:q,slot:Me(r),blockNumber:a.number}),_e(o,a)]),m=BigInt(K(c));if(we(ce(m&(1n<<160n)-1n,{size:20}))!==e.launcher)throw new i("Hookr frozen Root lock storage does not match the family owner contract.");let R=m>>160n&(1n<<40n)-1n,l=g(P),y=g(p);return{clock:"parent-block",parentBlock:u.toString(),familyUntilParentBlock:l.toString(),poolRulesUntilParentBlock:y.toString(),rootUntilParentBlock:R.toString(),currentlyLocked:u<l||u<y||u<R,feesCollectableDuringPrincipalLocks:!0}}export{Pe as a,Me as b,_e as c,co as d,ge as e,Ue as f,qe as g,ie as h,J as i,Y as j,ae as k,Ve as l,Ze as m};
|
|
1
|
+
import{B as se,t as W,y as G}from"./KLEJ3W4T.js";import{d as ke}from"./OSMOBKRQ.js";import{a as de,b as oe,c as pe,e as ne,f as ye,g as fe,h as K,i as b,j as g,l as _,m as U,o as N,p as B,q,s as V,u as $,v as D}from"./XRDLMTBJ.js";import{b as X,g as O,h as E,i as ue,j as me}from"./MQK6OP7S.js";import{a as j}from"./G2LAO23N.js";import{c as ee}from"./NWNYJ26T.js";import{a as i}from"./XSD5NL7J.js";import{encodeAbiParameters as Oe,getAddress as we,keccak256 as Ke,parseAbi as je,toHex as ce,zeroAddress as ze}from"viem";import{encodeAbiParameters as he,encodePacked as Ce,getAddress as Fe,keccak256 as re,parseAbi as Le,toHex as Re,zeroAddress as be}from"viem";var ve=1n<<256n,Ne=1n<<128n,Te=Le(["function extsload(bytes32[] slots) view returns (bytes32[])"]),Q=(o,n,e)=>({type:"object",additionalProperties:!1,properties:o,required:n,...e===void 0?{}:{description:e}}),Ue={description:"Hookr LP position, chosen by kind: a launcher family member, a position NFT, or an agent-account position.",oneOf:[Q({kind:{const:"family",description:j.enumValues({family:"one member position of a Hookr launcher family"})},launcher:{...ee,description:"Address of the Hookr launcher contract that created the family."},familyId:{...oe,description:"Bytes32 hex id of the launcher family (0x plus 64 hex digits)."},member:{type:"string",enum:["0","1","2","3","4","5","6","7"],description:'Member index within the family, a decimal string from "0" to "7".'}},["kind","launcher","familyId","member"],"Hookr family LP position: one member of a launcher family, identified by launcher, familyId and member."),Q({kind:{const:"nft",description:j.enumValues({nft:"a position held as an NFT"})},tokenId:{...de,description:j.id("position NFT")}},["kind","tokenId"]),Q({kind:{const:"agent-account",description:j.enumValues({"agent-account":"a position held by an agent account"})},account:{...ee,description:j.address("agent account that holds the position")},positionId:{...oe,description:"Bytes32 hex id of the position within the agent account (0x plus 64 hex digits)."}},["kind","account","positionId"])]};function qe(o){let n=U(o);if(n.kind!=="family")throw new i("This step supports Launcher family positions only. NFT and agent-account position reads are reserved for a later integration.");ne(n,["kind","launcher","familyId","member"],["kind","launcher","familyId","member"]);let e=ye(n.member,8);if(e>7n)throw new i("Hookr family member must be a decimal string from 0 to 7.");return{kind:"family",launcher:me(n.launcher),familyId:K(n.familyId),member:e.toString()}}var A=o=>Re(BigInt.asUintN(256,o),{size:32}),te=(o,n)=>re(he([{type:"bytes32"},{type:"bytes32"}],[o,n]));function ie(o,n,e,a,r,H){let h=te(o,A(6n)),P=m=>te(A(BigInt(m)),A(BigInt(h)+4n)),p=re(he([{type:"bytes32"},{type:"uint8"}],[e,a])),c=re(Ce(["address","int24","int24","bytes32"],[n,r,H,p])),u=te(c,A(BigInt(h)+6n));return[h,A(BigInt(h)+1n),A(BigInt(h)+2n),A(BigInt(P(r))+1n),A(BigInt(P(r))+2n),A(BigInt(P(H))+1n),A(BigInt(P(H))+2n),u,A(BigInt(u)+1n),A(BigInt(u)+2n)]}function J(o,n,e,a,r,H){return BigInt.asUintN(256,a<r?n-e:a>=H?e-n:o-n-e)}function Y(o,n,e){if(o<0n||o>=1n<<128n||[n,e].some(a=>a<0n||a>=ve))throw new i("Hookr fee inputs are outside the verified v4 layout.");return o*BigInt.asUintN(256,n-e)/Ne}function ae(o){let n=U(o),e={currency0:b(n.currency0),currency1:b(n.currency1),fee:Number(g(n.fee,24)),tickSpacing:Number(g(n.tickSpacing,24)),hooks:b(n.hooks)};if(BigInt(e.currency0)>=BigInt(e.currency1)||e.fee!==8388608||e.hooks!==q||e.tickSpacing<1||e.tickSpacing>32767)throw new i("Hookr family PoolKey is not a supported Root dynamic-fee pool.");return e}async function Ve(o,n,e,a){let r=await E(o,a),H={},h=new Set,P=(t,k=[])=>B(o,e.launcher,N(e.launcher===Fe(X.launcherV1)?"launcherV1":"launcher"),t,k,r.number),p=async(t,k)=>{try{return await k()}catch(x){return H[t]=x instanceof i?x.message:`Hookr ${t} read failed at block ${r.number}. Retry the named-block read; no zero or empty result is implied.`,null}},c={chainId:4663,blockNumber:r.number.toString(),blockHash:r.hash,position:e,owner:null,ownedByWallet:null,poolId:null,poolKey:null,range:null,liquidity:null,tokens:null,principal:null,uncollectedLpFees:null,collectedLpFees:null,claimableCoreCredits:null,poolPendingRecapture:null,inRange:null,gateStatus:null,locks:null},u=async()=>(await ue(o,r),{...c,readStatus:{status:Object.keys(H).length?"partial":"complete",reasons:H},warnings:["collectedLpFees is null: no complete collection-history reconstruction is available in this step.","LP fees can include donations already released into v4 fee growth. Pending recapture is pool-level, unallocated and excluded from LP fees.","Principal is current withdrawable token inventory before fees, gas or price changes; it is not the original deposit value."]});if(await p("pins",async()=>(await O(o,r.number,[e.launcher,q,V],h),!0))===null)return u();let m=await p("owner",async()=>{let t=b(await P("familyOwner",[e.familyId]));if(t===be)throw new i("Hookr family does not exist at this block. Check its Launcher and family ID.");return t});if(m===null)return u();c.owner=m,c.ownedByWallet=m===n;let R=await p("position",async()=>{let[t,k,x]=await Promise.all([P("memberCount",[e.familyId]),P("position",[e.familyId,Number(e.member)]),P("poolManager")]);if(x!==V||g(t,8)>8n||BigInt(e.member)>=g(t,8))throw new i("Hookr family member or PoolManager is invalid.");let w=U(k),d=ae(w.key);if(typeof w.tickLower!="number"||typeof w.tickUpper!="number")throw new i("Hookr position range is incomplete.");G(w.tickLower,w.tickUpper,d.tickSpacing);let s=g(w.liquidity,128),L=W(d);if(await P("poolFamily",[L])!==e.familyId)throw new i("Hookr pool does not belong to this family.");return{key:d,id:L,tickLower:w.tickLower,tickUpper:w.tickUpper,liquidity:s}});if(R===null)return u();let{key:l,id:y,tickLower:C,tickUpper:I,liquidity:v}=R;c.poolKey=l,c.poolId=y,c.range={tickLower:C,tickUpper:I},c.liquidity=v.toString();let[f,T,F]=await Promise.all([p("tokens",()=>Promise.all([D(o,l.currency0,r.number),D(o,l.currency1,r.number)])),p("feeGrowth",async()=>{let t=ie(y,e.launcher,e.familyId,Number(e.member),C,I),k=await B(o,V,Te,"extsload",[t],r.number),x=_(k,10).map(Ae=>BigInt(K(Ae))),[w,d,s,L,Z,S,z,Ie,xe,He]=x,le=w&(1n<<160n)-1n,M=Number(BigInt.asIntN(24,w>>160n));if(le===0n||M<-887272||M>887272||Ie!==v)throw new i("Hookr PoolManager position is uninitialized or differs from the Launcher liquidity. No principal or fee amount is inferred.");let Se=J(d,L,S,M,C,I),Be=J(s,Z,z,M,C,I);return{sqrtPriceX96:le,tick:M,fee0:Y(v,Se,xe),fee1:Y(v,Be,He)}}),p("poolConfig",async()=>{let t=U(await B(o,q,N("rootV1"),"poolConfig",[y],r.number));if(b(t.liquidityOwner)!==e.launcher||![l.currency0,l.currency1].includes(b(t.subject))||![l.currency0,l.currency1].includes(b(t.quote))||t.subject===t.quote)throw new i("Hookr pool configuration differs from this family position.");let k=b(t.rules),x=$(k);return await O(o,r.number,[k],h),{pc:t,core:k,role:x}})]);if(c.tokens=f,T&&(c.inRange=T.tick>=C&&T.tick<I,f)){let t=se({liquidity:v,tickLower:C,tickUpper:I,sqrtPriceX96:T.sqrtPriceX96});c.principal=[{token:f[0],amount:t.amount0.toString()},{token:f[1],amount:t.amount1.toString()}],c.uncollectedLpFees=[{token:f[0],amount:T.fee0.toString()},{token:f[1],amount:T.fee1.toString()}]}if(F){let t=(s,L=[])=>B(o,F.core,N("rulesV1"),s,L,r.number),[k,x,w,d]=await Promise.all([p("gateStatus",async()=>{let s=b(F.pc.advisory);return s!==be&&await O(o,r.number,[s],h),ke(o,r.number,y,e.launcher,s)}),p("locks",async()=>ge(o,{position:e,block:r,poolId:y,core:F.core,role:F.role})),p("claimableCoreCredits",async()=>{if(!f)throw new i("Read token metadata before displaying core credits.");let s=await t("poolAccruedCurrencies",[y]);if(!Array.isArray(s)||s.length>32||s.some(S=>S!==l.currency0&&S!==l.currency1))throw new i("Core accrual includes unmeasured currencies; read the core directly before collecting.");let[L,Z]=await Promise.all([Promise.all([l.currency0,l.currency1].map(S=>t("poolAccrued",[y,S]))),Promise.all([l.currency0,l.currency1].map(S=>B(o,F.core,N(F.role),"claimable",[S,n],r.number)))]);return{core:F.core,familyOwnerAccrual:L.map((S,z)=>({token:f[z],amount:g(S).toString()})),walletCredits:Z.map((S,z)=>({token:f[z],amount:g(S).toString()})),walletCreditsScope:"Core-wide wallet credits, not attributed to this position. Do not add them to LP fees."}}),p("poolPendingRecapture",async()=>{if(!f)throw new i("Read token metadata before displaying pending recapture.");let s=_(await t("pendingDonation",[y]),5).map(L=>g(L));return{due:[{token:f[0],amount:s[0].toString()},{token:f[1],amount:s[1].toString()}],fresh:[{token:f[0],amount:s[2].toString()},{token:f[1],amount:s[3].toString()}],freshChildBlock:s[4].toString(),scope:"pool",allocatedToPosition:!1}})]);c.gateStatus=k,c.locks=x,c.claimableCoreCredits=w,c.poolPendingRecapture=d}return u()}function Ze(o){return[{name:"hookr_lp_position",inputSchema:Q({position:Ue,...pe},["position"]),execute:async(n,e)=>{ne(n,["position","blockNumber"],["position"]);let a=qe(n.position);if(o.network==="testnet")throw new i("Hookr LP reads are configured only on mainnet, chain 4663.");try{return await Ve(o.clientFor(4663),e,a,fe(n))}catch(r){throw r instanceof i?r:new i("Hookr position block is unavailable. Retry the complete named-block read; no zero position or fee is implied.")}}}]}var Pe=o=>N(o.launcher===we(X.launcherV1)?"launcherV1":"launcher");function Me(o){let n=Ke(Oe([{type:"bytes32"},{type:"bytes32"}],[o,"0x3c0d3d8cba92527b3a48aa783c8734a4e170057eb16401c9df8a7c8a6588b900"]));return ce(BigInt(n)+5n,{size:32})}async function _e(o,n){try{let e="0x0000000000000000000000000000000000000a11",a=await o.request({method:"eth_call",params:[{to:e,data:"0x"},ce(n.number),{[e]:{code:"0x4360005260206000f3"}}]});return BigInt(K(a))}catch{throw new i("Hookr parent-block clock is unavailable. Retry with an RPC supporting named-block eth_call state overrides; child-chain height cannot establish lock expiry.")}}async function co(o,n,e){let a=await E(o);await O(o,a.number,[e.launcher,q,V]);let r=(d,s=[])=>B(o,e.launcher,Pe(e),d,s,a.number),[H,h,P,p]=await Promise.all([r("familyOwner",[e.familyId]),r("memberCount",[e.familyId]),r("position",[e.familyId,Number(e.member)]),r("poolManager")]),c=b(H);if(c===ze||c!==n)throw new i("Only the current Hookr family owner can add, collect or remove this position. Use its signing wallet.");if(p!==V||g(h,8)<1n||g(h,8)>8n||BigInt(e.member)>=g(h,8))throw new i("Hookr family member or PoolManager differs from the reviewed deployment.");let u=U(P),m=ae(u.key),R=g(u.liquidity,128);if(typeof u.tickLower!="number"||typeof u.tickUpper!="number")throw new i("Hookr family range is unavailable.");let l=u.tickLower,y=u.tickUpper;G(l,y,m.tickSpacing);let C=W(m);if(await r("poolFamily",[C])!==e.familyId)throw new i("Hookr pool does not belong to this Launcher family.");let I=U(await B(o,q,N("rootV1"),"poolConfig",[C],a.number)),v=b(I.rules),f=$(v);if(b(I.liquidityOwner)!==e.launcher||![m.currency0,m.currency1].includes(b(I.subject))||![m.currency0,m.currency1].includes(b(I.quote))||I.subject===I.quote)throw new i("Hookr pool configuration differs from this family key.");await O(o,a.number,[v]);let[T,F]=await Promise.all([Promise.all([m.currency0,m.currency1].map(d=>D(o,d,a.number))),B(o,V,je(["function extsload(bytes32[] slots) view returns (bytes32[])"]),"extsload",[ie(C,e.launcher,e.familyId,Number(e.member),l,y)],a.number)]),t=_(F,10).map(d=>BigInt(K(d))),k=t[0]&(1n<<160n)-1n,x=Number(BigInt.asIntN(24,t[0]>>160n));if(!k||x<-887272||x>887272||t[7]!==R)throw new i("Hookr PoolManager state differs from the family position. Retry the full read.");let w=[0,1].map(d=>Y(R,J(t[1+d],t[3+d],t[5+d],x,l,y),t[8+d]));return{position:e,block:a,owner:c,key:m,poolId:C,liquidity:R,tickLower:l,tickUpper:y,sqrtPriceX96:k,fees:w,tokens:T,pc:I,core:v,role:f}}async function ge(o,n){let{position:e,block:a,poolId:r,core:H,role:h}=n,[P,p,c,u]=await Promise.all([B(o,e.launcher,Pe(e),"principalLockedUntil",[e.familyId],a.number),B(o,H,N(h),"removalLockedUntil",[r],a.number),o.getStorageAt({address:q,slot:Me(r),blockNumber:a.number}),_e(o,a)]),m=BigInt(K(c));if(we(ce(m&(1n<<160n)-1n,{size:20}))!==e.launcher)throw new i("Hookr frozen Root lock storage does not match the family owner contract.");let R=m>>160n&(1n<<40n)-1n,l=g(P),y=g(p);return{clock:"parent-block",parentBlock:u.toString(),familyUntilParentBlock:l.toString(),poolRulesUntilParentBlock:y.toString(),rootUntilParentBlock:R.toString(),currentlyLocked:u<l||u<y||u<R,feesCollectableDuringPrincipalLocks:!0}}export{Pe as a,Me as b,_e as c,co as d,ge as e,Ue as f,qe as g,ie as h,J as i,Y as j,ae as k,Ve as l,Ze as m};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{b as u}from"./TI727O2H.js";import{a as c}from"./XSD5NL7J.js";import{decodeErrorResult as h,encodeFunctionData as k,formatEther as p,keccak256 as w,parseAbi as y}from"viem";var l="0x5aeB8269977Ce12f62D2cD9a1f04E9A7894512ee",m="0x5236857c06be1bf151306dcc5ac134b2a2353760f3d73817da769dee67d7ef24",O=["hoodlock_buyback"],b=y(["function execute() returns(uint256)","error NotReady(uint256 balance,uint256 need,uint64 readyAt)"]);function g(e){let s=new Set;for(let o=0;e&&typeof e=="object"&&o<16&&!s.has(e);o++){s.add(e);let t=e,a=t.raw??t.data;if(typeof a=="string"&&/^0x[0-9a-f]+$/i.test(a))try{let n=h({abi:b,data:a});if(n.errorName==="NotReady"){let[r,i,d]=n.args;return`HoodLock buyback is not ready: ${p(r)} ETH pending in the vault; threshold ${p(i)} ETH${r<i?" not reached":""}. Contract readiness time: ${d} Unix seconds. No wallet funds were spent; retry when the vault is ready.`}}catch{}e=t.cause}}var v=e=>({tools:[{name:"hoodlock_buyback",inputSchema:{type:"object",properties:{},additionalProperties:!1},async execute(s,o){if(Object.keys(s).length)throw new c("HoodLock buyback accepts no amount, recipient or calldata.");let t=e.clientFor(u);if(await t.getChainId()!==u)throw new c("HoodLock buyback requires chain 4663.");let a=await t.getBlockNumber(),n=await t.getCode({address:l,blockNumber:a});if(!n||w(n)!==m)throw new c("The HoodLock buyback vault no longer matches its pinned runtime code.");let r=[e.unsignedTx({to:l,chainId:u,value:"0",data:k({abi:b,functionName:"execute"}),description:"Trigger the HoodLock vault to buy back and burn LOCK using its own ETH. No wallet funds or approvals."})];try{await t.simulateContract({address:l,abi:b,functionName:"execute",account:o,blockNumber:a})}catch(d){let f=g(d);throw new c(f??e.plainError(d))}let i=await e.preview(r,o);return{txs:r,preview:i,summary:"Permissionless HoodLock buyback and burn. The vault enforces its threshold, cooldown, oracle and slippage checks. The caller pays gas and receives no reward. Confirm the local preview before signing."}}}]});export{l as a,m as b,O as c,b as d,g as e,v as f};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as u}from"./
|
|
1
|
+
import{a as u}from"./YXXK6EPI.js";import{K as P}from"./AXHFNE6L.js";import{a as O}from"./43LI5NKJ.js";import{a as A}from"./66F5ZH34.js";import{d as g,i as T}from"./NWNYJ26T.js";import{b as p}from"./TI727O2H.js";import{a as r}from"./XSD5NL7J.js";import{a as k}from"./JXOEJPJ4.js";import{encodeFunctionData as E,getAddress as f,parseAbi as v,zeroAddress as R}from"viem";var w=v(["function owner() view returns (address)","function paused() view returns (bool)","function maximumLoanDuration() view returns (uint256)","function adminFeeInBasisPoints() view returns (uint16)","function pause()","function unpause()","function updateAdminFee(uint16)","function updateMaximumLoanDuration(uint256)","function setERC20Permit(address,bool)","function setERC20Permits(address[],bool[])","function getERC20Permit(address) view returns (bool)","function requestTransferOwnership(address)","function cancelTransferOwnership()","function acceptTransferOwnership()","function rejectTransferOwnership()"]),C=["pause","unpause","updateAdminFee","updateMaximumLoanDuration","setERC20Permit","setERC20Permits","requestTransferOwnership","cancelTransferOwnership","acceptTransferOwnership","rejectTransferOwnership"];function m(d){return T(d,"Provide an explicit checksummed address.",g)}var S=d=>{let h=(n,i,c,e)=>({name:n,inputSchema:{type:"object",properties:i,required:c,additionalProperties:!1},execute:async(s,t)=>{try{if(O(t),Object.keys(s).some(a=>!Object.hasOwn(i,a)))throw new r("Unsupported Longbow administration argument.");return await e(s,t)}catch(a){throw new r(d.plainError(a))}}});async function b(){let n=d.clientFor(p);if(await n.getChainId()!==p)throw new r("Longbow requires chain 4663.");return n}return{tools:[h("longbow_nft_admin",{token:{type:"string",description:"Optional ERC-20 token address to check whether the NFT loan contract permits it as a loan currency."}},[],async n=>{let i=await b(),c=["owner","paused","maximumLoanDuration","adminFeeInBasisPoints"],e=await Promise.all(c.map(s=>i.readContract({address:u,abi:w,functionName:s})));return{chainId:p,contract:u,...Object.fromEntries(c.map((s,t)=>[s,typeof e[t]=="bigint"?String(e[t]):e[t]])),...n.token===void 0?{}:{token:m(n.token),permitted:await i.readContract({address:u,abi:w,functionName:"getERC20Permit",args:[m(n.token)]})}}}),h("longbow_manage_nft",{operation:{type:"string",enum:C,description:"Owner administration call: pause or unpause the protocol, update the admin fee or maximum loan duration, permit tokens, or manage ownership transfer."},value:A("Integer in base units of the setting, as a decimal string. updateAdminFee: basis points (50 = 0.5%, max 10000). updateMaximumLoanDuration: seconds (86400 = 1 day)."),account:{type:"string",description:"Address of the ERC-20 token for setERC20Permit, or of the proposed new owner for requestTransferOwnership."},enabled:{type:"boolean",description:"For setERC20Permit: true permits the token as a loan currency, false removes the permission."},tokens:{type:"array",maxItems:32,description:"For setERC20Permits: unique token addresses to update; pairs by position with permissions.",items:{type:"string",description:"ERC-20 token address."}},permissions:{type:"array",maxItems:32,description:"For setERC20Permits: true/false per token, same length and order as tokens.",items:{type:"boolean",description:"True permits the token at the same index as a loan currency."}}},["operation"],async(n,i)=>{if(typeof n.operation!="string"||!C.includes(n.operation))throw new r("Choose a documented NFT administration operation.");let c=await b(),e=n.operation,s=e.startsWith("update")?["operation","value"]:e==="setERC20Permit"?["operation","account","enabled"]:e==="setERC20Permits"?["operation","tokens","permissions"]:e==="requestTransferOwnership"?["operation","account"]:["operation"];if(Object.keys(n).some(o=>!s.includes(o)))throw new r("Unexpected fields for this NFT administration operation.");if(!["acceptTransferOwnership","rejectTransferOwnership"].includes(e)){let o=await c.readContract({address:u,abi:w,functionName:"owner"});if(f(o)!==f(i))throw new r("This wallet lacks the NFT loan owner role.")}let t=[];if(e.startsWith("update")){let o=P(n.value,!0);if(o>(e==="updateAdminFee"?10000n:(1n<<32n)-1n))throw new r("NFT fee/duration exceeds the contract limit.");t=[e==="updateAdminFee"?Number(o):o]}else if(e==="setERC20Permit"){if(typeof n.enabled!="boolean")throw new r("Provide enabled as a boolean.");t=[m(n.account),n.enabled]}else if(e==="setERC20Permits"){if(!Array.isArray(n.tokens)||!Array.isArray(n.permissions)||!n.tokens.length||n.tokens.length>32||n.tokens.length!==n.permissions.length||n.permissions.some(l=>typeof l!="boolean"))throw new r("Provide equal bounded token and permission arrays.");let o=n.tokens.map(m);if(new Set(o).size!==o.length)throw new r("Currency tokens must be unique.");t=[o,n.permissions]}else if(e==="requestTransferOwnership"){let o=m(n.account);if(o===R)throw new r("New owner must be nonzero.");t=[o]}let a=`Longbow NFT protocol administration ${e} on ${u}, values ${JSON.stringify(t,(o,l)=>typeof l=="bigint"?String(l):l)}. This changes protocol-wide settings or authority. Ownership acceptance/rejection requires the pending owner; the contract preview verifies that role. Permitting a currency here does not qualify it for Oak\u2019s borrower tools.`,y=[d.unsignedTx({to:u,data:E({abi:w,functionName:e,args:t}),value:"0",chainId:p,description:a})];return{txs:y,preview:await d.preview(y,i),summary:a}}),h("longbow_referral",{},[],async(n,i)=>{let c=await d.http(`https://longbow.credit/api/referral/stats/${f(i)}`,{method:"GET",redirect:"error"});if(!c.ok)throw new r(`Longbow referral service returned HTTP ${c.status}; referral state is unavailable.`);let e=await c.json();if(!e||typeof e!="object"||m(e.address)!==f(i))throw new r("Referral response does not match this wallet.");let s=a=>{if(typeof a!="number"||!Number.isSafeInteger(a)||a<0)throw new r("Invalid referral count.");return a},t=e.bonusEarnedAllTime;if(typeof t!="number"||!Number.isFinite(t)||t<0)throw new r("Invalid referral bonus estimate.");if(e.code!==null&&e.code!==void 0&&(typeof e.code!="string"||!/^[a-zA-Z0-9_-]{1,64}$/.test(e.code)))throw new r("Invalid referral code.");return{address:f(i),chainId:p,code:e.code??null,referrals:s(e.referrals),activeThisEpoch:s(e.activeThisEpoch),bonusEstimateUsd:t,source:"Longbow public referral service; off-chain estimates, not verified payments.",warning:k("Referral links are permanent according to the app. Registration/linking publishes wallet associations and requires a separate authorized publication flow. This tool only reads stats; no payout or claim is promised.")}})]}};export{w as a,S as b};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{b as T}from"./5RXALTDT.js";import{b as p,c as C,j as S}from"./TI727O2H.js";import{a as l}from"./XSD5NL7J.js";import{AsyncLocalStorage as W}from"node:async_hooks";import{custom as X}from"viem";import{createPublicClient as U,custom as x,defineChain as q}from"viem";var A="https://rpc.mainnet.chain.robinhood.com",D="https://api.oakagentkit.org/v1/rpc",E=8453,ce=[p,E];function j(e){return e===p?A:e===E?D:void 0}var B="oak-core/0.1.0",z=S[4663].ponsClaims.multicall3.address,L=new Set(["eth_sendTransaction","eth_sendRawTransaction","eth_sign","personal_sign","eth_signTransaction","eth_signTypedData","eth_signTypedData_v1","eth_signTypedData_v3","eth_signTypedData_v4","wallet_sendTransaction","wallet_sign"]);function O(e=p,t=A){if(!Number.isSafeInteger(e)||e<=0)throw new l("Provide a positive integer chain ID.");let n=e===p?"Robinhood Chain":e===C?"Robinhood Chain Testnet":`Chain ${e}`;return q({id:e,name:n,nativeCurrency:{name:"Ether",symbol:"ETH",decimals:18},rpcUrls:{default:{http:[t]}},...e===p?{contracts:{multicall3:{address:z}}}:{}})}function ue(e=p,t){if(t?.chain&&t.chain.id===e)return t.chain.contracts?.multicall3?.address;if(!(!Number.isSafeInteger(e)||e<=0))return O(e).contracts?.multicall3?.address}function G(e,t,n){let o=e?.trim()||n?.rpcUrl?.trim()||n?.rpcUrls?.[t]?.trim(),r=t===p?(process.env[`OAK_RPC_URL_${t}`]??process.env.OAK_RPC_URL)?.trim():t===C?(process.env.OAK_TESTNET_RPC_URL??process.env.OAK_RPC_URL)?.trim():process.env[`OAK_RPC_URL_${t}`]?.trim(),s=o||r||j(t);if(!s)throw new l(`No RPC URL configured for chain ${t}.`);if(s===D&&!n?.transport)throw new l(`Hosted RPC needs a local session transport; configure OAK_RPC_URL_${t} for a direct core/server client.`);if((n?.requireKeyedRpc??process.env.NODE_ENV==="production")&&t===p&&s===A)throw new l("Production requires a keyed OAK_RPC_URL.");return s}var J=1e4;async function v(e,t=J){if(!Number.isFinite(t)||t<=0||t>3e4)throw new l("RPC timeout must be greater than zero and at most 30000 ms.");let n=new AbortController,o;try{return await Promise.race([new Promise((r,s)=>{o=setTimeout(()=>{s(new l("The RPC request timed out. Please try again.")),n.abort()},t)}),e(n.signal)])}finally{clearTimeout(o)}}function V(e,t=p,n){let o=typeof e=="object"&&e!==null,r=o?e:n??{},s=typeof e=="string"?e:r.rpcUrl,i=o?r.chainId??t:t;if(!Number.isSafeInteger(i)||i<=0)throw new l("Provide a positive integer chain ID.");if(r.timeoutMs!==void 0&&(!Number.isFinite(r.timeoutMs)||r.timeoutMs<=0||r.timeoutMs>3e4))throw new l("RPC timeout must be greater than zero and at most 30000 ms.");let d=G(s,i,r),a=O(i,d);if(r.transport){let c=r.transport({chain:a,retryCount:0});return U({chain:a,transport:x({request:f=>{if(L.has(f.method)||/^(eth_send|eth_sign|personal_sign|wallet_)/i.test(f.method))throw new l("Read-only RPC client does not allow this method.");return v(()=>c.request(f),r.timeoutMs)}},{retryCount:0})})}let u=M({url:d,chainId:i,fetch:r.fetch,userAgent:r.userAgent?.trim()||B,retries:r.retries,retryDelayMs:r.retryDelayMs,maxRetryDelayMs:r.maxRetryDelayMs,timeoutMs:r.timeoutMs,fallbackUrls:r.rpcFallbackUrls?.[i]??r.fallbackRpcUrls??P(process.env[`OAK_RPC_FALLBACK_URLS_${i}`]??(i===p?process.env.OAK_RPC_FALLBACK_URLS:void 0))})({chain:a,retryCount:0}),b=x({request:c=>{if(L.has(c.method)||/^(eth_send|eth_sign|personal_sign|wallet_)/i.test(c.method))throw new l("Read-only RPC client does not allow this method.");return u.request(c)}},{retryCount:0});return U({chain:a,transport:b})}function le(e={}){let t=new Map;return n=>{let o=t.get(n);if(o)return o;let r=V(e.rpcUrls?.[n],n,e);return t.set(n,r),r}}var y=class extends l{},Q=16,k=new Map;async function Y(e,t,n){t.throwIfAborted();let o=new URL(e).origin,r=k.get(o);r||(r={active:0,waiters:new Set},k.set(o,r));let s=r;s.active<Q?s.active++:await new Promise((i,d)=>{let a=()=>{t.removeEventListener("abort",h),i()},h=()=>{s.waiters.delete(a),t.removeEventListener("abort",h),d(t.reason)};s.waiters.add(a),t.addEventListener("abort",h,{once:!0})});try{return t.throwIfAborted(),await n()}finally{let i=s.waiters.values().next().value;i?(s.waiters.delete(i),i()):--s.active===0&&k.delete(o)}}function I(e){let t=[];for(;e&&typeof e=="object"&&!t.includes(e);)t.push(e),e=e.cause;return t}function Z(e){return I(e).find(t=>t instanceof y)}function ee(e){if(!Z(e))for(let t of I(e)){let n=Number(t.status??t.code);if(n===429||n>=500&&n<=599)return{status:n,delay:typeof t.retryAfterMs=="number"?t.retryAfterMs:void 0};if(/rate.?limit|too many requests/i.test(String(t.message??"")))return{status:429}}}async function N(e,t,n={},o){let r=T();r&&r!==o&&(o=o?AbortSignal.any([r,o]):r);let s=n.retries??3,i=n.retryDelayMs??250,d=n.maxRetryDelayMs??2e3;if(!Number.isInteger(s)||s<0||s>5||!Number.isFinite(i)||i<0||!Number.isFinite(d)||d<0||d>3e4)throw new l("RPC retries must be 0 to 5; backoff must be non-negative and at most 30000 ms.");for(let a=0;;a++){o?.throwIfAborted();try{return await e()}catch(h){o?.throwIfAborted();let u=ee(h);if(!u)throw h;let b=Math.min(d,i*2**a),c=Math.max(Math.min(d,b+Math.floor(Math.random()*b/4)),u.delay??0);if(a>=s||c>d){let f=u.status===429?"public RPC rate-limited":`RPC returned HTTP ${u.status}`,m=u.delay?` Retry after ${Math.max(1,Math.ceil(u.delay/1e3))} seconds.`:"";throw new y(`${f}, retried ${a} times (${t}).${m} ${u.status===429?"The RPC rate limit remains active. ":""}Configure a keyed OAK_RPC_URL or comma-separated OAK_RPC_FALLBACK_URLS for this chain.`)}await new Promise((f,m)=>{let w=()=>{clearTimeout(R),m(o?.reason)},R=setTimeout(()=>{o?.removeEventListener("abort",w),f()},c);o?.addEventListener("abort",w,{once:!0}),o?.aborted&&w()})}}}function P(e){if(e===void 0||e.trim()==="")return[];let t=e.split(",").map(n=>n.trim());if(t.length>4)throw new l("Configure at most four ordered fallback RPC URLs.");for(let n of t){let o;try{o=new URL(n)}catch{throw new l("Fallback RPC URLs must use HTTP or HTTPS.")}if(!["http:","https:"].includes(o.protocol))throw new l("Fallback RPC URLs must use HTTP or HTTPS.")}return t}var g=new Map;async function te(e,t,n){let o=g.get(e)??Promise.resolve(),r,s=new Promise(d=>{r=d}),i=o.then(()=>s);g.set(e,i);try{return await o,n.throwIfAborted(),await t()}finally{r(),g.get(e)===i&&g.delete(e)}}var K=new W,F=new Map,H=e=>{let t=new URL(e).origin,n=F.get(t);return n||(n={interactive:0},F.set(t,n)),n};async function re(e,t){let n=K.getStore(),o=[...new Set(e.map(H))].filter(r=>!n?.has(r));o.forEach(r=>{r.interactive++});try{let r=o.flatMap(s=>s.background?[s.background.catch(()=>{})]:[]);return r.length&&await Promise.all(r),await t()}finally{o.forEach(r=>{r.interactive--})}}async function ye(e,t,n=o=>new Promise(r=>{setTimeout(r,o).unref()})){let o=H(e);for(;o.interactive||o.background;)await n(100);let r=Promise.resolve().then(()=>K.run(new Set([o]),t));o.background=r;try{return await r}finally{o.background===r&&(o.background=void 0)}}function M(e){let t=[...new Set([e.url,...e.fallbackUrls??[]])];P(t.slice(1).join(","));let n=new Set,o=0;return X({request:({method:r,params:s})=>re(t,()=>v(async i=>{let d=T(),a=d?AbortSignal.any([d,i]):i;a.throwIfAborted();let h;for(let u of t){a.throwIfAborted();let b=async(c,f=[])=>Y(u,a,async()=>{a.throwIfAborted();let m=await(e.fetch??globalThis.fetch)(u,{method:"POST",redirect:"error",signal:a,headers:{"content-type":"application/json","user-agent":e.userAgent??"oak-core/0.1.0"},body:JSON.stringify({jsonrpc:"2.0",id:++o,method:c,params:f})});if(!m.ok){let R=m.headers.get("retry-after"),_=R===null?void 0:/^\d+(\.\d+)?$/.test(R.trim())?Number(R)*1e3:Math.max(0,Date.parse(R)-Date.now()),$=typeof _=="number"&&Number.isFinite(_)?_:void 0;throw await m.body?.cancel(),m.status===429||m.status>=500?Object.assign(new Error("Transient RPC HTTP failure"),{status:m.status,retryAfterMs:$}):new y(`RPC returned HTTP ${m.status} (${c}).`)}let w;try{w=await m.json()}catch{throw new y("The RPC endpoint returned malformed JSON.")}if(w.error)throw Object.assign(new Error(w.error.message??"RPC error"),{code:w.error.code,data:w.error.data});return w.result});try{if(u!==t[0]&&r!=="eth_chainId"&&(!n.has(u)||r==="eth_sendRawTransaction")){let m=await N(()=>b("eth_chainId"),"eth_chainId",e,a);if(Number(m)!==e.chainId)throw new y("RPC chain does not match the requested chain.");n.add(u)}let c=()=>N(()=>b(r,s),r,e,a),f=await(r==="eth_simulateV1"?te(u,c,a):c());if(r==="eth_chainId")if(Number(f)!==e.chainId){if(u!==t[0])throw new y("RPC chain does not match the requested chain.")}else n.add(u);return f}catch(c){if(a.throwIfAborted(),h=c,!(c instanceof y)||!/rate-limited|HTTP 5\d\d|chain does not match/.test(c.message))throw c}}throw h},e.timeoutMs))},{retryCount:0})}export{y as a,Q as b,Z as c,N as d,P as e,re as f,ye as g,M as h,A as i,D as j,E as k,ce as l,j as m,B as n,z as o,O as p,ue as q,J as r,v as s,V as t,le as u};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{b as B}from"./
|
|
1
|
+
import{b as B}from"./S4JUFCT4.js";import{a as u,b,c,e as k,f as m,g as l,h as w}from"./WAKZWSHB.js";import{e as y,m as o}from"./NWNYJ26T.js";import{a as n}from"./XSD5NL7J.js";import{erc20Abi as L,formatUnits as x}from"viem";var a="LayerBank returned a malformed reserve read. Please try again.";function N(r){let s=o(r,a);if(s>=1n<<128n)throw new n(a);return s}async function I(r,s){try{let e=s??await r.getBlockNumber({cacheTime:0}),p=await B(r,e),[f,h,R,v]=await Promise.all([r.readContract({address:u,abi:l,functionName:"getConfiguration",args:[c.address],blockNumber:e}),r.readContract({address:c.address,abi:L,functionName:"balanceOf",args:[b],blockNumber:e}),r.readContract({address:b,abi:w,functionName:"scaledTotalSupply",blockNumber:e}),r.readContract({address:u,abi:l,functionName:"getReserveNormalizedIncome",args:[c.address],blockNumber:e})]);if(!y(f))throw new n(a);let t=o(f.data,a);if((t>>48n&255n)!==6n)throw new n(a);let C=N(p.currentLiquidityRate),P=N(p.accruedToTreasury),T=o(R,a),g=o(v,a);if(g===0n)throw new n(a);let d=((T+P)*g+m/2n)/m,i=(t>>116n&(1n<<36n)-1n)*10n**6n;return{blockNumber:e,active:(t&1n<<56n)!==0n,frozen:(t&1n<<57n)!==0n,paused:(t&1n<<60n)!==0n,supplyCapBase:i,suppliedBase:d,capRoomBase:i===0n?k:d>=i?0n:i-d,cashUsdgBase:o(h,a),rateBasePct:Number(x(C,25))}}catch(e){throw e instanceof n?e:new n("LayerBank reserve could not be read. Please try again.")}}export{I as a};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as v}from"./66F5ZH34.js";import{c as b,d as S,i as D,m as O,n as F}from"./NWNYJ26T.js";import{a as l}from"./FWD4L3CJ.js";import{a as d}from"./XSD5NL7J.js";import{encodeFunctionData as $,erc20Abi as B,getAddress as R,parseAbi as U}from"viem";var _={source:"https://github.com/beefyfinance/beefy-v2/blob/main/src/config/promos/chain/robinhood.json",observedAt:"2026-10-31",version:2,boosts:[{id:"moo_alandale-cow-robinhood-weth-shop-vault",address:"0xdC955E855148bE11621a74A5B4588846558215d1",token:"0xEBe70034de92614ebe06Cde98C12257f9397dC0e",vaultId:"alandale-cow-robinhood-weth-shop-vault"},{id:"moo_alandale-cow-robinhood-usdg-net-vault",address:"0x3bB573076462ab4E3De4542cFDAa4f36F0Ce082d",token:"0x857b3971E8038a8f8E2C0Da797145447eFbf6b86",vaultId:"alandale-cow-robinhood-usdg-net-vault"},{id:"moo_alandale-cow-robinhood-weth-usdg-vault",address:"0x13ec60CcFFD2cf989912CCBC038D618d3F56a30E",token:"0x4ED469Ac0080bE3CD192530D482E4d321823e743",vaultId:"alandale-cow-robinhood-weth-usdg-vault"},{id:"moo_alandale-cow-robinhood-weth-lute-vault",address:"0xC5ff71a8754c9A9FC0c27EE297025Ea7eEbDD19d",token:"0xd4A452bB077618b931603DbcB60ea43c05eBEa45",vaultId:"alandale-cow-robinhood-weth-lute-vault"},{id:"moo_alandale-cow-robinhood-usdg-lute-vault",address:"0x83a074A41c06c07631e284463ea2bfc3d2f674c5",token:"0xe50D89C43D0D13eE1439Bb5E94876A1163a26434",vaultId:"alandale-cow-robinhood-usdg-lute-vault"},{id:"moo_alandale-cow-robinhood-weth-spy-vault",address:"0xcdDa7830A6F034d66a46919f3D132f53A56a356d",token:"0x87673A619Fc4F3Fc08068A0BB04f60aA2D04ca62",vaultId:"alandale-cow-robinhood-weth-spy-vault"}]};var C=_.boosts.map(c=>({...c,address:R(c.address.toLowerCase()),token:R(c.token.toLowerCase())})),H=["beefy_boost","beefy_boost_manage"],P=U(["function stakedToken() view returns(address)","function owner() view returns(address)","function whitelisted(address) view returns(bool)","function earned(address) view returns(address[],uint256[])","function stake(uint256)","function withdraw(uint256)","function getReward()","function exit()","function notifyRewardAmount(address,uint256,uint256)","function removeReward(address,address)","function rescueTokens(address,address)","function setWhitelist(address,bool)","function transferOwnership(address)","function renounceOwnership()"]);function w(c){return D(c,"Provide an address.",S)}function x(c){return O(c,"Invalid Beefy reward-pool integer.")}function I(c){return F(c,"Amount must be positive and fit in uint256.",{notString:"Provide a positive base-unit integer string.",positive:!0})}var V=c=>{async function k(e){try{return await e()}catch(o){throw new d(c.plainError(o))}}function A(e,o){if(e.chainId!==void 0&&e.chainId!==l)throw new d("Beefy requires chain 4663.");for(let n of Object.keys(e))if(!["chainId",...o].includes(n))throw new d(`Unsupported Beefy input: ${n}.`)}function T(e){let o=C.find(n=>n.address===w(e.boost));if(!o)throw new d("Choose a pinned Robinhood Beefy v2 boost from beefy_boosts.");return o}async function y(){let e=c.clientFor(l);if(await e.getChainId()!==l)throw new d("The Beefy endpoint must report chain 4663.");let o=x(await e.getBlockNumber()),n=(s,i,r=[])=>e.readContract({address:s,abi:P,functionName:i,args:r,blockNumber:o}),t=async(s,i)=>x(await e.readContract({address:s,abi:B,functionName:"balanceOf",args:[i],blockNumber:o}));async function a(s){let[i,r]=await Promise.all([e.readContract({address:s,abi:B,functionName:"symbol",blockNumber:o}),e.readContract({address:s,abi:B,functionName:"decimals",blockNumber:o})]);if(typeof i!="string"||!i.trim()||typeof r!="number"||!Number.isInteger(r)||r<0||r>255)throw new d("Invalid Beefy boost token metadata.");return{address:s,symbol:i,decimals:r,chainId:l}}async function u(s,i){if(w(await n(s.address,"stakedToken"))!==s.token)throw new d("The Beefy boost staked token no longer matches its pinned configuration.");let r=await n(s.address,"earned",[i]);if(!Array.isArray(r)||r.length!==2||!Array.isArray(r[0])||!Array.isArray(r[1])||r[0].length!==r[1].length||r[0].length>100)throw new d("Invalid Beefy boost rewards.");let m=r[0].map(w);if(new Set(m).size!==m.length)throw new d("Duplicate Beefy boost reward tokens.");let p=await Promise.all(m.map(async(h,g)=>({token:await a(h),amount:x(r[1][g]).toString()})));return{id:s.id,boost:s.address,vaultId:s.vaultId,staked:{token:await a(s.token),amount:(await t(s.address,i)).toString()},rewards:p,block:o.toString(),chainId:l,source:_.source}}return{read:n,balance:t,token:a,pool:u,blockNumber:o}}function f(e,o,n=[]){return c.unsignedTx({to:e,data:$({abi:P,functionName:o,args:n}),value:"0",chainId:l,description:`Beefy reward pool: ${o}.`})}async function E(e,o,n,t){return{txs:e,inputs:t,preview:await c.preview(e,o),summary:n}}return{tools:[{name:"beefy_boosts",inputSchema:{type:"object",properties:{chainId:{const:l,description:"Chain id; only 4663 (Robinhood Chain mainnet) is supported. Optional."}},additionalProperties:!1},execute:(e,o)=>k(async()=>{A(e,[]),o=w(o);let n=await y(),t=[];for(let a of C)t.push(await n.pool(a,o));return{boosts:t,summary:"Pinned Robinhood v2 reward pools. Staked moo receipts keep their underlying vault exposure. Earned amounts are estimates; inspect claim preview. Boost receipt acquisition depends on the corresponding vault adapter."}})},{name:"beefy_boost",inputSchema:{type:"object",properties:{boost:{...b,description:"Address of the pinned Beefy reward pool (boost) contract (from beefy_boosts)."},action:{enum:["stake","withdraw","claim","exit"],description:"stake: deposit moo receipts into the pool; withdraw: take staked receipts out; claim: collect rewards; exit: withdraw everything and claim."},amount:{description:'For stake and withdraw: amount of moo receipt (stake token) in base units of that token (read its decimals), e.g. "1000000000000000000" = 1 token at 18 decimals. "all" uses the full balance.',anyOf:[v(),{const:"all"}]},chainId:{const:l,description:"Chain id; only 4663 (Robinhood Chain mainnet) is supported. Optional."}},required:["boost","action"],additionalProperties:!1},execute:(e,o)=>k(async()=>{let n=String(e.action);if(!["stake","withdraw","claim","exit"].includes(n))throw new d("Choose stake, withdraw, claim or exit.");A(e,["boost","action",...["stake","withdraw"].includes(n)?["amount"]:[]]),o=w(o);let t=T(e),a=await y();await a.pool(t,o);let u,s=[];if(n==="stake"||n==="withdraw"){let i=n==="stake"?t.token:t.address,r=await a.balance(i,o),m=e.amount==="all"?r:I(e.amount);if(m===0n||m>r)throw new d("Provide a positive amount no greater than your current Beefy boost input balance.");s=[{token:i,amount:m.toString()}],u=[...n==="stake"?[c.approval(t.token,t.address,m.toString(),l)]:[],f(t.address,n,[m])]}else n==="exit"&&(s=[{token:t.address,amount:(await a.balance(t.address,o)).toString()}]),u=[f(t.address,n==="claim"?"getReward":"exit")];return E(u,o,`${n} Beefy boost ${t.id}. Withdraw returns moo receipts; exit also claims rewards. Redeem moo receipts with the matching supported vault adapter afterward. No output amount is guaranteed by these calls.`,s)})},{name:"beefy_boost_manage",inputSchema:{type:"object",properties:{boost:{...b,description:"Address of the pinned Beefy reward pool (boost) contract (from beefy_boosts)."},action:{enum:["notify_reward","remove_reward","rescue_tokens","set_manager","transfer_ownership","renounce_ownership"],description:"Owner or manager call: add a reward (notify_reward), remove a reward, rescue stuck tokens, set a manager, transfer ownership, or renounce it permanently."},token:{...b,description:"Address of the reward token for notify_reward, remove_reward or rescue_tokens."},amount:v('For notify_reward: reward amount in base units of the reward token (read its decimals), e.g. "1000000000000000000" = 1 token at 18 decimals.'),duration:v("For notify_reward: reward period in seconds, at least 3600 (86400 = 1 day). Decimal string."),recipient:{...b,description:"Address that receives removed or rescued tokens, or the new owner for transfer_ownership."},manager:{...b,description:"Address of the manager (reward notifier) to enable or disable with set_manager."},enabled:{type:"boolean",description:"For set_manager: true allows the manager to add rewards, false removes them."},chainId:{const:l,description:"Chain id; only 4663 (Robinhood Chain mainnet) is supported. Optional."}},required:["boost","action"],additionalProperties:!1},execute:(e,o)=>k(async()=>{let n={notify_reward:["token","amount","duration"],remove_reward:["token","recipient"],rescue_tokens:["token","recipient"],set_manager:["manager","enabled"],transfer_ownership:["recipient"],renounce_ownership:[]},t=String(e.action);if(!Object.hasOwn(n,t))throw new d("Choose a documented Beefy reward-pool management action.");A(e,["boost","action",...n[t]]),o=w(o);let a=T(e),u=await y();if(await u.pool(a,o),!(t==="notify_reward"?await u.read(a.address,"whitelisted",[o])===!0:w(await u.read(a.address,"owner"))===o))throw new d("This wallet does not hold the required Beefy reward-pool owner or manager role.");let i=[],r=[];if(t==="notify_reward"){let p=w(e.token),h=I(e.amount),g=I(e.duration);if(p===a.token||g<3600n)throw new d("Reward token must differ from the stake token and duration must be at least 3600 seconds.");if(await u.balance(p,o)<h)throw new d("Insufficient reward token balance.");r.push({token:p,amount:h.toString()}),i.push(c.approval(p,a.address,h.toString(),l),f(a.address,"notifyRewardAmount",[p,h,g]))}else if(t==="remove_reward"||t==="rescue_tokens")i.push(f(a.address,t==="remove_reward"?"removeReward":"rescueTokens",[w(e.token),w(e.recipient)]));else if(t==="set_manager"){if(typeof e.enabled!="boolean")throw new d("Provide a boolean enabled value.");i.push(f(a.address,"setWhitelist",[w(e.manager),e.enabled]))}else t==="transfer_ownership"?i.push(f(a.address,"transferOwnership",[w(e.recipient)])):i.push(f(a.address,"renounceOwnership"));let m=t==="remove_reward"?" Removing this reward discards all unclaimed entitlements for that token.":t==="renounce_ownership"?" Renouncing ownership permanently gives up owner administration.":"";return E(i,o,`Beefy owner/manager action ${t} on ${a.address}.${m} Review the exact calldata and preview before human confirmation.`,r)})}],positions:e=>k(async()=>{e=w(e);let o=await y(),n=[];for(let t of C){let a=await o.pool(t,e);a.staked.amount==="0"&&a.rewards.every(u=>u.amount==="0")||n.push({module:"beefy",id:t.address,chainId:l,assets:[a.staked,...a.rewards.filter(u=>u.amount!=="0")],description:`${t.id}: moo receipt stake and estimated claimable rewards at block ${o.blockNumber}. Unstake/exit before redeeming moo receipts.`})}return n})}};export{C as a,H as b,P as c,V as d};
|
|
1
|
+
import{a as v}from"./66F5ZH34.js";import{c as b,d as S,i as D,m as O,n as F}from"./NWNYJ26T.js";import{b as l}from"./TI727O2H.js";import{a as d}from"./XSD5NL7J.js";import{encodeFunctionData as $,erc20Abi as B,getAddress as R,parseAbi as U}from"viem";var _={source:"https://github.com/beefyfinance/beefy-v2/blob/main/src/config/promos/chain/robinhood.json",observedAt:"2026-10-31",version:2,boosts:[{id:"moo_alandale-cow-robinhood-weth-shop-vault",address:"0xdC955E855148bE11621a74A5B4588846558215d1",token:"0xEBe70034de92614ebe06Cde98C12257f9397dC0e",vaultId:"alandale-cow-robinhood-weth-shop-vault"},{id:"moo_alandale-cow-robinhood-usdg-net-vault",address:"0x3bB573076462ab4E3De4542cFDAa4f36F0Ce082d",token:"0x857b3971E8038a8f8E2C0Da797145447eFbf6b86",vaultId:"alandale-cow-robinhood-usdg-net-vault"},{id:"moo_alandale-cow-robinhood-weth-usdg-vault",address:"0x13ec60CcFFD2cf989912CCBC038D618d3F56a30E",token:"0x4ED469Ac0080bE3CD192530D482E4d321823e743",vaultId:"alandale-cow-robinhood-weth-usdg-vault"},{id:"moo_alandale-cow-robinhood-weth-lute-vault",address:"0xC5ff71a8754c9A9FC0c27EE297025Ea7eEbDD19d",token:"0xd4A452bB077618b931603DbcB60ea43c05eBEa45",vaultId:"alandale-cow-robinhood-weth-lute-vault"},{id:"moo_alandale-cow-robinhood-usdg-lute-vault",address:"0x83a074A41c06c07631e284463ea2bfc3d2f674c5",token:"0xe50D89C43D0D13eE1439Bb5E94876A1163a26434",vaultId:"alandale-cow-robinhood-usdg-lute-vault"},{id:"moo_alandale-cow-robinhood-weth-spy-vault",address:"0xcdDa7830A6F034d66a46919f3D132f53A56a356d",token:"0x87673A619Fc4F3Fc08068A0BB04f60aA2D04ca62",vaultId:"alandale-cow-robinhood-weth-spy-vault"}]};var C=_.boosts.map(c=>({...c,address:R(c.address.toLowerCase()),token:R(c.token.toLowerCase())})),H=["beefy_boost","beefy_boost_manage"],P=U(["function stakedToken() view returns(address)","function owner() view returns(address)","function whitelisted(address) view returns(bool)","function earned(address) view returns(address[],uint256[])","function stake(uint256)","function withdraw(uint256)","function getReward()","function exit()","function notifyRewardAmount(address,uint256,uint256)","function removeReward(address,address)","function rescueTokens(address,address)","function setWhitelist(address,bool)","function transferOwnership(address)","function renounceOwnership()"]);function w(c){return D(c,"Provide an address.",S)}function x(c){return O(c,"Invalid Beefy reward-pool integer.")}function I(c){return F(c,"Amount must be positive and fit in uint256.",{notString:"Provide a positive base-unit integer string.",positive:!0})}var V=c=>{async function k(e){try{return await e()}catch(o){throw new d(c.plainError(o))}}function A(e,o){if(e.chainId!==void 0&&e.chainId!==l)throw new d("Beefy requires chain 4663.");for(let n of Object.keys(e))if(!["chainId",...o].includes(n))throw new d(`Unsupported Beefy input: ${n}.`)}function T(e){let o=C.find(n=>n.address===w(e.boost));if(!o)throw new d("Choose a pinned Robinhood Beefy v2 boost from beefy_boosts.");return o}async function y(){let e=c.clientFor(l);if(await e.getChainId()!==l)throw new d("The Beefy endpoint must report chain 4663.");let o=x(await e.getBlockNumber()),n=(s,i,r=[])=>e.readContract({address:s,abi:P,functionName:i,args:r,blockNumber:o}),t=async(s,i)=>x(await e.readContract({address:s,abi:B,functionName:"balanceOf",args:[i],blockNumber:o}));async function a(s){let[i,r]=await Promise.all([e.readContract({address:s,abi:B,functionName:"symbol",blockNumber:o}),e.readContract({address:s,abi:B,functionName:"decimals",blockNumber:o})]);if(typeof i!="string"||!i.trim()||typeof r!="number"||!Number.isInteger(r)||r<0||r>255)throw new d("Invalid Beefy boost token metadata.");return{address:s,symbol:i,decimals:r,chainId:l}}async function u(s,i){if(w(await n(s.address,"stakedToken"))!==s.token)throw new d("The Beefy boost staked token no longer matches its pinned configuration.");let r=await n(s.address,"earned",[i]);if(!Array.isArray(r)||r.length!==2||!Array.isArray(r[0])||!Array.isArray(r[1])||r[0].length!==r[1].length||r[0].length>100)throw new d("Invalid Beefy boost rewards.");let m=r[0].map(w);if(new Set(m).size!==m.length)throw new d("Duplicate Beefy boost reward tokens.");let p=await Promise.all(m.map(async(h,g)=>({token:await a(h),amount:x(r[1][g]).toString()})));return{id:s.id,boost:s.address,vaultId:s.vaultId,staked:{token:await a(s.token),amount:(await t(s.address,i)).toString()},rewards:p,block:o.toString(),chainId:l,source:_.source}}return{read:n,balance:t,token:a,pool:u,blockNumber:o}}function f(e,o,n=[]){return c.unsignedTx({to:e,data:$({abi:P,functionName:o,args:n}),value:"0",chainId:l,description:`Beefy reward pool: ${o}.`})}async function E(e,o,n,t){return{txs:e,inputs:t,preview:await c.preview(e,o),summary:n}}return{tools:[{name:"beefy_boosts",inputSchema:{type:"object",properties:{chainId:{const:l,description:"Chain id; only 4663 (Robinhood Chain mainnet) is supported. Optional."}},additionalProperties:!1},execute:(e,o)=>k(async()=>{A(e,[]),o=w(o);let n=await y(),t=[];for(let a of C)t.push(await n.pool(a,o));return{boosts:t,summary:"Pinned Robinhood v2 reward pools. Staked moo receipts keep their underlying vault exposure. Earned amounts are estimates; inspect claim preview. Boost receipt acquisition depends on the corresponding vault adapter."}})},{name:"beefy_boost",inputSchema:{type:"object",properties:{boost:{...b,description:"Address of the pinned Beefy reward pool (boost) contract (from beefy_boosts)."},action:{enum:["stake","withdraw","claim","exit"],description:"stake: deposit moo receipts into the pool; withdraw: take staked receipts out; claim: collect rewards; exit: withdraw everything and claim."},amount:{description:'For stake and withdraw: amount of moo receipt (stake token) in base units of that token (read its decimals), e.g. "1000000000000000000" = 1 token at 18 decimals. "all" uses the full balance.',anyOf:[v(),{const:"all"}]},chainId:{const:l,description:"Chain id; only 4663 (Robinhood Chain mainnet) is supported. Optional."}},required:["boost","action"],additionalProperties:!1},execute:(e,o)=>k(async()=>{let n=String(e.action);if(!["stake","withdraw","claim","exit"].includes(n))throw new d("Choose stake, withdraw, claim or exit.");A(e,["boost","action",...["stake","withdraw"].includes(n)?["amount"]:[]]),o=w(o);let t=T(e),a=await y();await a.pool(t,o);let u,s=[];if(n==="stake"||n==="withdraw"){let i=n==="stake"?t.token:t.address,r=await a.balance(i,o),m=e.amount==="all"?r:I(e.amount);if(m===0n||m>r)throw new d("Provide a positive amount no greater than your current Beefy boost input balance.");s=[{token:i,amount:m.toString()}],u=[...n==="stake"?[c.approval(t.token,t.address,m.toString(),l)]:[],f(t.address,n,[m])]}else n==="exit"&&(s=[{token:t.address,amount:(await a.balance(t.address,o)).toString()}]),u=[f(t.address,n==="claim"?"getReward":"exit")];return E(u,o,`${n} Beefy boost ${t.id}. Withdraw returns moo receipts; exit also claims rewards. Redeem moo receipts with the matching supported vault adapter afterward. No output amount is guaranteed by these calls.`,s)})},{name:"beefy_boost_manage",inputSchema:{type:"object",properties:{boost:{...b,description:"Address of the pinned Beefy reward pool (boost) contract (from beefy_boosts)."},action:{enum:["notify_reward","remove_reward","rescue_tokens","set_manager","transfer_ownership","renounce_ownership"],description:"Owner or manager call: add a reward (notify_reward), remove a reward, rescue stuck tokens, set a manager, transfer ownership, or renounce it permanently."},token:{...b,description:"Address of the reward token for notify_reward, remove_reward or rescue_tokens."},amount:v('For notify_reward: reward amount in base units of the reward token (read its decimals), e.g. "1000000000000000000" = 1 token at 18 decimals.'),duration:v("For notify_reward: reward period in seconds, at least 3600 (86400 = 1 day). Decimal string."),recipient:{...b,description:"Address that receives removed or rescued tokens, or the new owner for transfer_ownership."},manager:{...b,description:"Address of the manager (reward notifier) to enable or disable with set_manager."},enabled:{type:"boolean",description:"For set_manager: true allows the manager to add rewards, false removes them."},chainId:{const:l,description:"Chain id; only 4663 (Robinhood Chain mainnet) is supported. Optional."}},required:["boost","action"],additionalProperties:!1},execute:(e,o)=>k(async()=>{let n={notify_reward:["token","amount","duration"],remove_reward:["token","recipient"],rescue_tokens:["token","recipient"],set_manager:["manager","enabled"],transfer_ownership:["recipient"],renounce_ownership:[]},t=String(e.action);if(!Object.hasOwn(n,t))throw new d("Choose a documented Beefy reward-pool management action.");A(e,["boost","action",...n[t]]),o=w(o);let a=T(e),u=await y();if(await u.pool(a,o),!(t==="notify_reward"?await u.read(a.address,"whitelisted",[o])===!0:w(await u.read(a.address,"owner"))===o))throw new d("This wallet does not hold the required Beefy reward-pool owner or manager role.");let i=[],r=[];if(t==="notify_reward"){let p=w(e.token),h=I(e.amount),g=I(e.duration);if(p===a.token||g<3600n)throw new d("Reward token must differ from the stake token and duration must be at least 3600 seconds.");if(await u.balance(p,o)<h)throw new d("Insufficient reward token balance.");r.push({token:p,amount:h.toString()}),i.push(c.approval(p,a.address,h.toString(),l),f(a.address,"notifyRewardAmount",[p,h,g]))}else if(t==="remove_reward"||t==="rescue_tokens")i.push(f(a.address,t==="remove_reward"?"removeReward":"rescueTokens",[w(e.token),w(e.recipient)]));else if(t==="set_manager"){if(typeof e.enabled!="boolean")throw new d("Provide a boolean enabled value.");i.push(f(a.address,"setWhitelist",[w(e.manager),e.enabled]))}else t==="transfer_ownership"?i.push(f(a.address,"transferOwnership",[w(e.recipient)])):i.push(f(a.address,"renounceOwnership"));let m=t==="remove_reward"?" Removing this reward discards all unclaimed entitlements for that token.":t==="renounce_ownership"?" Renouncing ownership permanently gives up owner administration.":"";return E(i,o,`Beefy owner/manager action ${t} on ${a.address}.${m} Review the exact calldata and preview before human confirmation.`,r)})}],positions:e=>k(async()=>{e=w(e);let o=await y(),n=[];for(let t of C){let a=await o.pool(t,e);a.staked.amount==="0"&&a.rewards.every(u=>u.amount==="0")||n.push({module:"beefy",id:t.address,chainId:l,assets:[a.staked,...a.rewards.filter(u=>u.amount!=="0")],description:`${t.id}: moo receipt stake and estimated claimable rewards at block ${o.blockNumber}. Unstake/exit before redeeming moo receipts.`})}return n})}};export{C as a,H as b,P as c,V as d};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as k}from"./
|
|
1
|
+
import{a as k}from"./NTUXDIY6.js";import{a as E}from"./AIYNFIG6.js";import{b as I}from"./QHV5GORV.js";import{c as $}from"./M7CQPTRK.js";import{g as w}from"./RUTSEGGD.js";import{c as C}from"./DMDOSHV7.js";import{a as b}from"./2JWAFLJU.js";import{b as U}from"./SPJCSEKP.js";import{a as h}from"./43LI5NKJ.js";import{a as G}from"./66F5ZH34.js";import{g as P,n as y}from"./NWNYJ26T.js";import{b as s,e as T,j as S}from"./TI727O2H.js";import{a as m}from"./XSD5NL7J.js";import{encodeFunctionData as v,parseAbi as j}from"viem";var a=S[s].vaults.netnet.address,d={address:S[s].tokens.USDG.address,chainId:s,decimals:T,symbol:"USDG"},N={address:a,chainId:s,decimals:18,symbol:"nnUSDG"},o=j(["function asset() view returns (address)","function decimals() view returns (uint8)","function totalAssets() view returns (uint256)","function balanceOf(address owner) view returns (uint256)","function convertToAssets(uint256 shares) view returns (uint256)","function deposit(uint256 assets,address receiver) returns (uint256 shares)","function withdraw(uint256 assets,address receiver,address owner) returns (uint256 shares)","function redeem(uint256 shares,address receiver,address owner) returns (uint256 assets)"]),_=G("Positive USDG amount in integer base units (6 decimals)."),O="Preview amounts are estimates; these ERC-4626 calls have no on-chain minimum output argument. No transaction was sent.";function M(e){return y(e,"Amount must be positive and fit in uint256.",{notString:"Provide an integer amount string in base units.",positive:!0})}function g(e,f){if(Object.keys(e).some(l=>!f.includes(l)))throw new m("Unsupported NetNet argument.")}var q=e=>{async function f(t){try{return await t()}catch(n){throw new m(e.plainError(n))}}async function l(){let t=e.clientFor(s);if(await t.getChainId()!==s)throw new m("NetNet requires chain 4663.");let[n,r]=await Promise.all([t.readContract({address:a,abi:o,functionName:"asset"}),t.readContract({address:a,abi:o,functionName:"decimals"})]);if(!P(n,d.address))throw new m("NetNet does not report the pinned USDG asset.");if(r!==N.decimals)throw new m("NetNet share decimals do not match the pinned metadata.");return t}async function D(t,n,r){let i=await e.preview(t,n),p=i.changes.map(({token:c,amount:u})=>{let A=u.startsWith("-");return`${A?"-":"+"}${e.formatAmount(A?u.slice(1):u,c.decimals)} ${c.symbol}`}).join(", ");return{txs:t,preview:i,summary:`${r} ${i.summary} ${p?`Estimated changes: ${p}. `:""}${O}`}}async function R(t){return f(async()=>{h(t);let n=await l(),r=await n.readContract({address:a,abi:o,functionName:"balanceOf",args:[t]});if(r===0n)return[];let i=await n.readContract({address:a,abi:o,functionName:"convertToAssets",args:[r]});return[{module:"netnet",id:`${s}:${a}`,chainId:s,assets:[{token:{...d},amount:i.toString()}],description:`${e.formatAmount(r.toString(),N.decimals)} nnUSDG shares in NetNet Credit (${a}); underlying USDG is an estimate, not a liquidity guarantee.`}]})}return{positions:R,tools:[{name:"netnet_list",inputSchema:{type:"object",properties:{},additionalProperties:!1},execute:t=>f(async()=>{g(t,[]);let r=await(await l()).readContract({address:a,abi:o,functionName:"totalAssets"});return[{address:a,name:"NetNet Credit",chainId:s,asset:{...d},shares:{...N},totalAssets:{token:{...d},amount:r.toString()}}]})},{name:"netnet_deposit",inputSchema:{type:"object",description:"Deposit USDG in base units (1 USDG = 1000000) for nnUSDG vault shares. Exit with netnet_withdraw; check positions after confirmation.",properties:{amount:_},required:["amount"],additionalProperties:!1},execute:(t,n)=>f(async()=>{g(t,["amount"]),h(n);let r=M(t.amount);await l();let i=[e.approval(d.address,a,r.toString(),s),e.unsignedTx({to:a,data:v({abi:o,functionName:"deposit",args:[r,n]}),value:"0",chainId:s,description:`Deposit ${e.formatAmount(r.toString(),d.decimals)} USDG into NetNet Credit.`})];return D(i,n,"Approve the exact USDG amount, then deposit into NetNet Credit.")})},{name:"netnet_withdraw",inputSchema:{type:"object",description:"Withdraw USDG in 6-decimal base units, or amount max to redeem every nnUSDG share for USDG. Check positions after confirmation.",properties:{amount:{description:'USDG to withdraw in base units (USDG has 6 decimals; "1000000" = 1 USDG), or "max" to redeem every nnUSDG share.',anyOf:[_,{const:"max",description:"Redeem the fresh full nnUSDG share balance."}]}},required:["amount"],additionalProperties:!1},execute:(t,n)=>f(async()=>{g(t,["amount"]),h(n);let r=t.amount==="max"?void 0:M(t.amount),i=await l(),p,c;if(r===void 0){let u=await i.readContract({address:a,abi:o,functionName:"balanceOf",args:[n]});if(u===0n)throw new m("This wallet has no NetNet shares to redeem.");p=v({abi:o,functionName:"redeem",args:[u,n,n]}),c=`Redeem all ${e.formatAmount(u.toString(),N.decimals)} nnUSDG shares for USDG.`}else p=v({abi:o,functionName:"withdraw",args:[r,n,n]}),c=`Withdraw ${e.formatAmount(r.toString(),d.decimals)} USDG from NetNet Credit (unmeasured on the recorded fork; full exit uses amount "max" redeem).`;return D([e.unsignedTx({to:a,data:p,value:"0",chainId:s,description:c})],n,c)})}]}};function ie(e){return U("netnet",[q(e),w(e),$(e),C(e),k(e),E(e),I(e),{tools:b(e,"netnet",[{vault:a,asset:d}])}])}export{q as a,ie as b};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as P,b as S,c as b,f as N,g as y}from"./SK2VBNAU.js";import{c as v}from"./SCG5HWMN.js";import{a as M}from"./5TUXSOMI.js";import{e as c}from"./NWNYJ26T.js";import{
|
|
1
|
+
import{a as P,b as S,c as b,f as N,g as y}from"./SK2VBNAU.js";import{c as v}from"./SCG5HWMN.js";import{a as M}from"./5TUXSOMI.js";import{e as c}from"./NWNYJ26T.js";import{b as m,j as x}from"./TI727O2H.js";import{a as l}from"./XSD5NL7J.js";import{a as h}from"./JXOEJPJ4.js";import{getAddress as q,isAddress as F}from"viem";var E=`https://api-v2.pendle.finance/core/v1/${m}/markets?limit=100`,T=x[m].pendle.marketFactory.address;function f(e){if(e?.aborted)throw new l("The request was cancelled.")}var C=e=>typeof e=="number"&&Number.isFinite(e);function p(e){return typeof e=="string"&&F(e,{strict:!1})?q(e):void 0}function I(e){if(!c(e))return"a row was not an object";let t=p(e.address);if(!t)return"a row had no valid market address";let n=c(e.pt)?p(e.pt.address):void 0,r=c(e.yt)?p(e.yt.address):void 0,o=c(e.sy)?p(e.sy.address):void 0;if(!n||!r||!o)return`market ${t} had no valid PT, YT and SY addresses`;let i=typeof e.expiry=="string"?Date.parse(e.expiry):Number.NaN;if(!Number.isFinite(i)||i%1e3!==0||i<=0)return`market ${t} had no valid end date`;if(typeof e.isActive!="boolean")return`market ${t} had no active flag`;let a=c(e.pt)&&typeof e.pt.symbol=="string"?e.pt.symbol:typeof e.name=="string"?e.name:t,s=c(e.liquidity)&&C(e.liquidity.usd)&&e.liquidity.usd>=0?e.liquidity.usd:void 0;return{market:t,sy:o,pt:n,yt:r,expiry:i/1e3,active:e.isActive,label:h(a),source:"api",...C(e.impliedApy)?{impliedApy:e.impliedApy}:{},...s!==void 0?{liquidityUsd:s}:{}}}async function D(e,t={}){let n=await v(e,E,{method:"GET",headers:{"User-Agent":"oak-core/pendle",Accept:"application/json"},...t.signal?{signal:t.signal}:{}},i=>c(i)&&Array.isArray(i.results)),r=[],o=[];for(let i of n.results){let a=I(i);typeof a=="string"?o.push(a):r.push(a)}return{rows:r,dropped:o}}var L=10000000n,B=1000000n,W=52515580n,O=new WeakMap;async function U(e,t,n){f(n);let r=await e.getBlockNumber(),o=L;for(;t.next<=r;){f(n);let i=t.next,a=i+o-1n>r?r:i+o-1n;try{let s=await e.getLogs({address:T,event:S,fromBlock:i,toBlock:a});for(let u of s){let d=p(u.args.market);d&&t.found.add(d)}t.next=a+1n}catch{if(o<=B)throw new l("Oak can't list Pendle markets from the chain because the node refused the history request.");o/=2n}}return[...t.found]}function $(e,t={}){let n=O.get(e);n||(n={next:W,found:new Set,turn:Promise.resolve()},O.set(e,n));let r=n,o=r.turn.then(()=>U(e,r,t.signal));return r.turn=o.catch(()=>{}),o}async function _(e,t,n=Math.floor(Date.now()/1e3),r={}){f(r.signal);let o=await y(e,t.flatMap(s=>[{address:s,abi:b,functionName:"readTokens"},{address:s,abi:b,functionName:"expiry"}])),i=t.flatMap((s,u)=>{let d=o[u*2],k=o[u*2+1];if(!d.ok||!k.ok||!Array.isArray(d.value)||typeof k.value!="bigint")return[];let[w,g,A]=d.value.map(p),R=Number(k.value);return w&&g&&A&&Number.isSafeInteger(R)?[{market:s,sy:w,pt:g,yt:A,end:R}]:[]});f(r.signal);let a=await y(e,i.map(s=>({address:s.pt,abi:N,functionName:"symbol"})));return i.map((s,u)=>{let d=a[u];return{market:s.market,sy:s.sy,pt:s.pt,yt:s.yt,expiry:s.end,active:s.end>n,label:h(d.ok&&typeof d.value=="string"?d.value:s.market),source:"chain"}})}async function Y(e,t,n={}){return _(e,await $(e,n),t,n)}async function X(e,t,n){let[r]=await y(e,[{address:T,abi:P,functionName:"isValidMarket",args:[t]}]);if(!r.ok)throw new l("Oak couldn't read this Pendle market from the chain, so it won't use it.");if(r.value!==!0)throw new l("This isn't a market the Pendle factory created. Oak won't use this market.");let[o]=await _(e,[t],n);if(!o)throw new l("Oak couldn't read this Pendle market from the chain, so it won't use it.");return o}async function Z(e,t){f(t.signal);try{return{source:"api",...await D(e.http,t)}}catch(n){if(!t.allowChain||n instanceof M)throw n;return f(t.signal),{source:"chain",rows:await Y(e.clientFor(m),t.now,t),dropped:[]}}}export{E as a,f as b,D as c,W as d,$ as e,_ as f,Y as g,X as h,Z as i};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as m}from"./XTFRPI4G.js";import{e as s}from"./NWNYJ26T.js";import{isAddress as C}from"viem";var x={version:"oak-wormhole-check/v1",oakRoute:"/v1/wormhole/check",upstreamPaths:{check:"/api/v1/check"}},g=5e3,O=5e3,u=(e="unavailable")=>({verdict:"unknown",reason:e}),_=e=>typeof e=="number"&&Number.isSafeInteger(e)&&e>0;function W(e){return s(e)?e.kind==="text"?Object.keys(e).length===2&&typeof e.text=="string"&&!!e.text.trim()&&e.text.length<=m&&Buffer.byteLength(e.text,"utf8")<=m&&!/(?:\b(?:private[ _-]?key|secret[ _-]?key|mnemonic|seed[ _-]?phrase|recovery[ _-]?phrase)\s*[:=]|\b0x[0-9a-f]{64}\b)/i.test(e.text):e.kind==="token"&&Object.keys(e).length===3&&e.chainId===4663&&typeof e.token=="string"&&C(e.token,{strict:!0})&&e.token.toLowerCase()!=="0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee":!1}function M(e){try{let r=new URL(e??"");return r.protocol!=="https:"||r.username||r.password||r.search||r.hash||r.pathname!=="/"?void 0:r.origin}catch{return}}function B(e,r){return s(e)&&e.ok===!0&&(e=e.data),!s(e)||!["clear","flagged","unknown"].includes(String(e.verdict))?u():e.verdict==="unknown"?u(["off","unconfigured","invalid_request","unavailable","rate_limited","price_cap"].includes(String(e.reason))?e.reason:"unavailable"):typeof e.chargedMicrousd!="number"||!Number.isSafeInteger(e.chargedMicrousd)||e.chargedMicrousd<0||e.chargedMicrousd>r||typeof e.evidenceBlockId!="string"||!/^[A-Za-z0-9_-]{1,128}$/.test(e.evidenceBlockId)?u():{verdict:e.verdict,chargedMicrousd:e.chargedMicrousd,evidenceBlockId:e.evidenceBlockId}}async function v(e,r=g){if(!Number.isFinite(r)||r<=0)throw new Error("timeout");let o=new AbortController,c,t=new Promise((d,i)=>{c=setTimeout(()=>{o.abort(),i(new Error("timeout"))},Math.min(r,g))});try{return await Promise.race([t,e(o.signal)])}finally{clearTimeout(c),o.abort()}}async function T(e,r){let o=e.body?.getReader();if(!o)throw new Error("empty_response");let c=()=>{o.cancel().catch(()=>{})};r.addEventListener("abort",c,{once:!0});let t=0,d=[];try{for(;;){if(r.aborted)throw new Error("timeout");let{value:i,done:f}=await o.read();if(f)break;if(t+=i.byteLength,t>65536)throw new Error("response_limit");d.push(i)}if(r.aborted)throw new Error("timeout");return JSON.parse(Buffer.concat(d).toString("utf8"))}finally{r.removeEventListener("abort",c),c(),o.releaseLock()}}async function A(e,r={},o=fetch){if(r.payerMode===void 0||r.payerMode==="off")return u("off");let c=M(r.endpointBaseUrl),t=r.priceCapMicrousd??O;if(r.payerMode!=="server-key"||!c||!_(t))return u("unconfigured");if(!W(e))return u("invalid_request");try{return await v(async d=>{let i=await o(`${c}${x.oakRoute}`,{method:"POST",redirect:"error",credentials:"omit",signal:d,headers:{"content-type":"application/json",accept:"application/json"},body:JSON.stringify({request:e,priceCapMicrousd:t})});return d.aborted||i.redirected||!i.ok?(i.body?.cancel().catch(()=>{}),u()):B(await T(i,d),t)})}catch{return u()}}var E="Hosted checks are paused until tomorrow. Local checks and reads still work.";async function P(e,r={},o=fetch,c=g){let t=()=>({verdicts:e.map(({field:n})=>({field:n,verdict:"unknown"})),budget:{paused:!1}}),d=M(r.endpointBaseUrl),i=r.priceCapMicrousd??O;if(r.payerMode!=="server-key"||!d||!_(i)||e.length<1||e.length>16||new Set(e.map(n=>n.field)).size!==e.length||!e.every(n=>Object.keys(n).length===2&&typeof n.field=="string"&&/^[A-Za-z0-9_][A-Za-z0-9_.[\]-]{0,127}$/.test(n.field)))return t();let f=e.filter(n=>W({kind:"text",text:n.text}));if(!f.length)return t();let k=JSON.stringify({chainId:4663,items:f,priceCap:i});if(Buffer.byteLength(k,"utf8")>65536)return t();try{return await v(async n=>{let h=await o(`${d}${x.oakRoute}`,{method:"POST",redirect:"error",credentials:"omit",signal:n,headers:{"content-type":"application/json",accept:"application/json"},body:k});if(n.aborted||h.redirected||!h.ok)return h.body?.cancel().catch(()=>{}),t();let a=await T(h,n);if(s(a)&&a.ok===!0&&(a=a.data),!s(a)||!Array.isArray(a.verdicts)||a.verdicts.length>16||!s(a.budget)||typeof a.budget.paused!="boolean")return t();let y=a.verdicts;return y.some(l=>!s(l)||!f.some(p=>p.field===l.field))?t():{verdicts:e.map(({field:l})=>{let p=y.filter(w=>s(w)&&w.field===l),b=p.length===1&&s(p[0])?p[0].verdict:void 0;return{field:l,verdict:b==="clean"?"clear":b==="flagged"?"flagged":"unknown"}}),budget:a.budget.paused?{paused:!0,line:E}:{paused:!1}}},c)}catch{return t()}}export{x as a,g as b,O as c,u as d,_ as e,W as f,M as g,B as h,v as i,T as j,A as k,E as l,P as m};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as C,b as O}from"./
|
|
1
|
+
import{a as C,b as O}from"./M6SQPOOL.js";import{a as y,c as w}from"./LFSJDFMY.js";import{a as f,b as k}from"./DMDOSHV7.js";import{d as i}from"./XV6F3RET.js";import{b as d}from"./TI727O2H.js";import{a}from"./XSD5NL7J.js";var x=r=>({tools:[{name:"netnet_card_read",inputSchema:{type:"object",additionalProperties:!1,required:["program"],properties:{program:{enum:Object.keys(i),description:"Card program to read: turbo (card collection), blackjack or feed."},method:{type:"string",description:"Exact read-only ABI signature from the catalog. Omit to list all available reads."},values:{type:"array",maxItems:16,description:"Ordered inputs for the chosen method: decimal strings for integers, 0x addresses or hex bytes, booleans, or arrays/tuples of them."}}},execute:async t=>{if(Object.keys(t).some(e=>!["program","method","values"].includes(e))||typeof t.program!="string"||!Object.hasOwn(i,t.program))throw new a("Choose turbo, blackjack or feed.");let o=i[t.program],u=o.abi.filter(e=>e.type==="function"&&["view","pure"].includes(e.stateMutability));if(t.method===void 0){if(t.values!==void 0)throw new a("values requires an exact read method.");return{chainId:d,contract:o.address,methods:u.map(e=>({method:f(e),inputs:e.inputs,outputs:e.outputs})),units:"Card amounts are whole counts, identified by collection and series ID. Metadata is untrusted text. Reads grant no signing authority."}}let n=u.find(e=>f(e)===t.method),m=t.values??[];if(!n||!Array.isArray(m)||m.length!==n.inputs.length)throw new a("Choose an exact catalog read signature and its ordered inputs. Writes and signing are unavailable.");let l=r.clientFor(d);if(await l.getChainId()!==d)throw new a("NetNet cards require chain 4663.");let p=await l.getBlock(),c=n.inputs.map((e,s)=>k(e,m[s])),E=await l.readContract({address:o.address,abi:[n],functionName:n.name,args:c,blockNumber:p.number}),g=t.program==="turbo"&&n.name==="balanceOf"?[c[1]]:t.program==="blackjack"&&["unclaimedChips","unclaimedTotalOf"].includes(n.name)?[c[0]]:n.inputs.flatMap((e,s)=>e.type==="uint256"&&["id","seriesId"].includes(e.name??"")?[c[s]]:e.type==="uint256[]"&&e.name==="ids"?c[s]:[]),b;if(g.length){let e=await l.readContract({address:i.turbo.address,abi:i.turbo.abi,functionName:"seriesCount",blockNumber:p.number});b=[...new Set(g)].map(s=>({id:s.toString(),status:s>0n&&s<=e?"known":"unknown-series"}))}return{chainId:d,collection:i.turbo.address,contract:o.address,blockNumber:String(p.number),blockHash:p.hash,method:t.method,outputs:n.outputs,...b?{seriesStatus:b}:{},data:h(E)}}},{name:"netnet_card_capabilities",inputSchema:{type:"object",properties:{},additionalProperties:!1},execute:async t=>{if(Object.keys(t).length)throw new a("Card capabilities takes no arguments.");return{chainId:d,collection:i.turbo.address,blackjack:i.blackjack.address,active:["netnet_card_read","netnet_card_capabilities",...y],candidateOnly:{turbo:[...C,...O],recovery:[]},activation:"Only self-only finalize, expire and parked-chip claim are enabled, with local human confirmation and durable recovery. TURBO writes, seating, channel signatures and collection approvals remain disabled.",refused:w}}}]});function h(r,t=0){if(t>12)throw new a("Card read result exceeds the supported nesting.");if(typeof r=="bigint")return r.toString();if(typeof r=="string"){if(r.length>8194)throw new a("Card read result exceeds the supported length.");return/^0x[0-9a-f]*$/i.test(r)?r:`untrusted ${JSON.stringify(r)}`}if(Array.isArray(r)){if(r.length>4096)throw new a("Choose a bounded card read.");return r.map(o=>h(o,t+1))}return r&&typeof r=="object"?Object.fromEntries(Object.entries(r).map(([o,u])=>[o,h(u,t+1)])):r}export{x as a};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as q,c as M,d as Y}from"./
|
|
1
|
+
import{a as q,c as M,d as Y}from"./22TU5PFT.js";import{e as Q,g as j,i as z,j as F}from"./6D3XNCOX.js";import{F as E,c as W,f as H,n as k,t as R,u as K}from"./KLEJ3W4T.js";import{a as L}from"./YEIM6BZQ.js";import{a as O}from"./XSD5NL7J.js";import{getAddress as te,parseAbi as oe,zeroAddress as ne}from"viem";var se=oe(["function getSlot0(bytes32 poolId) view returns (uint160 sqrtPriceX96, int24 tick, uint24 protocolFee, uint24 lpFee)"]),G=1n<<192n,m={feeRefusal:t=>`Blocked: this pool charges a ${t} fee on every trade. Oak will not quote or prepare a swap through it. Pick a pool with a normal fee. Only if the person has been told the fee and still wants it, repeat with allowHighFeePools: true.`,lossRefusal:(t,e)=>`Blocked: this route returns about ${t} less than ${e}. Oak will not prepare this swap. Only if the person has been told the loss and still wants it, repeat with acceptValueLoss: true.`,warning:(t,e,i)=>`This route returns about ${t} less than ${e} (pool fee ${i} plus price impact).`,own:"this pool's own current price",noIndependent:"No independent market price was available for this pair, so Oak compared the quote with this pool's own current price only.",feeOverride:t=>`You chose to trade through a pool with a ${t} fee.`,lossOverride:(t,e)=>`This trade returns about ${t} less than ${e}.`},l=t=>t.toLowerCase()===ne?H.toLowerCase():t.toLowerCase(),X=(t,e,i,c)=>l(t)===l(i)&&l(e)===l(c)||l(t)===l(c)&&l(e)===l(i),B=(t,e)=>e?[t*t,G]:[G,t*t];async function de(t,e){let{blockNumber:i}=e,c=[],g=[],T=new Map,V=o=>{let n=R(o),s=T.get(n);return s||(s=t.readContract({address:W,abi:se,functionName:"getSlot0",args:[n],blockNumber:i}),T.set(n,s)),s},C=e.poolKeys??[],x=o=>k.some(n=>n.poolId.toLowerCase()===R(o).toLowerCase()),d=e.version==="v4"?await Promise.all(C.map(async o=>K(o)?Number((await V(o))[3]):o.fee)):e.version==="v3"?e.fees:Array.from({length:e.path.length-1},()=>3e3);for(let o=0;o<d.length;o++){let n=L(d[o]);if(d[o]>=5e4&&!(e.version==="v4"&&x(C[o]))&&!e.allowHighFeePools)throw new O(m.feeRefusal(n));(e.allowHighFeePools||e.acceptValueLoss)&&g.push(m.feeOverride(n))}let I=1n,_=1n,a=e.input,y=[],U=!1;for(let o=0;o<d.length;o++){let n=C[o],s=n?n.currency0===a?n.currency1:n.currency0:e.path[o+1],A=e.references?.[o],p,f;if(A)p=A.numerator,f=A.denominator,y.push(A.label);else{let h=(n&&x(n)?k.find(r=>r.poolId.toLowerCase()===R(n).toLowerCase()):void 0)??k.find(r=>X(a,s,r.key.currency0,r.key.currency1)),v=j.find(r=>X(a,s,r.token0,r.token1));if(h||v){let r=h?h.key.currency0:v.token0,u=h?h.key.currency1:v.token1,J=h?(await V(h.key))[0]:(await t.readContract({address:v.address,abi:F,functionName:"slot0",blockNumber:i}))[0];[p,f]=B(J,l(a)===l(r));let[Z,ee]=await Promise.all([E(t,r),E(t,u)]);y.push(`Oak's measured ${Z.symbol}/${ee.symbol} pool`)}else if(U=!0,y.push(m.own),n)[p,f]=B((await V(n))[0],a===n.currency0);else if(e.version==="v3"){let r=await t.readContract({address:Q.factory,abi:z,functionName:"getPool",args:[a,s,d[o]],blockNumber:i}),u=await t.readContract({address:r,abi:F,functionName:"slot0",blockNumber:i});[p,f]=B(u[0],BigInt(a)<BigInt(s))}else{let r=await t.readContract({address:q,abi:M,functionName:"getPair",args:[a,s],blockNumber:i}),u=await t.readContract({address:r,abi:Y,functionName:"getReserves",blockNumber:i});[p,f]=BigInt(a)<BigInt(s)?[u[1],u[0]]:[u[0],u[1]]}}if(p<=0n||f<=0n)throw new O("No positive Uniswap quote is available.");I*=p,_*=f,a=te(s)}let P=[...new Set(y)].join(" \xD7 "),w=U?m.noIndependent:void 0,b=e.exactOutput?e.quoted*I:e.amount*I,D=e.exactOutput?e.amount*_:e.quoted*_,N=b>D?b-D:0n,S=(N*1000n+b/2n)/b,$=`${S/10n}${S%10n?`.${S%10n}`:""}%`;if(N*10n>=b&&!e.acceptValueLoss)throw new O(`${m.lossRefusal($,P)}${w?` ${w}`:""}`);if((e.allowHighFeePools||e.acceptValueLoss)&&g.push(m.lossOverride($,P)),N*100n>=b*2n){let o=d.reduce((n,s)=>n*BigInt(1e6-s),1000000n)/1000000n**BigInt(d.length);c.push(m.warning($,P,L(Number(1000000n-o))))}return c.unshift(...g),c.length&&w&&c.push(w),{reference:P,...w?{referenceNote:w}:{},...c.length?{warnings:c}:{},confirmationWarnings:g}}export{m as a,de as b};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{m as A,n as j}from"./WSILNJS2.js";import{b as U,i as O,n as z,o as Q,q as Y}from"./7EACRKFV.js";import{a as V}from"./Y2QADJOB.js";import{b as J,e as _,o as Z}from"./W7QNSNOH.js";import{a as g,b as k}from"./Z7FGEWO2.js";import{a as N}from"./LIUXNOLP.js";import{a as $,b as C}from"./L2AE32SL.js";import{a as v}from"./VVAM3EAK.js";import{a as F}from"./SPJCSEKP.js";import{b as X}from"./SCG5HWMN.js";import{b as h}from"./IX3GZMTM.js";import{t as w}from"./MQ5F2VOK.js";import{b as m,c as l,d as q,e as D,j as T,k as W,l as K,q as B}from"./TI727O2H.js";import{a as d}from"./XSD5NL7J.js";import{a as x,b as R}from"./JXOEJPJ4.js";import{getAddress as b,isAddress as te,parseAbi as ae}from"viem";var ee=[{inputs:[],name:"available",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"view",type:"function"},{inputs:[],name:"ethUsdE18",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[],name:"liquidityUsdgE6",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[],name:"phase",outputs:[{internalType:"uint8",name:"",type:"uint8"}],stateMutability:"view",type:"function"},{inputs:[],name:"priceSigner",outputs:[{internalType:"address",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"signer",type:"address"}],name:"setPriceSigner",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"spotOakPerEthE18",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[],name:"supplyNet",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[],name:"syncPhase",outputs:[{internalType:"uint8",name:"",type:"uint8"}],stateMutability:"nonpayable",type:"function"},{inputs:[{components:[{internalType:"address",name:"wallet",type:"address"},{internalType:"uint256",name:"oakPerEthE18",type:"uint256"},{internalType:"uint64",name:"timestamp",type:"uint64"},{internalType:"bytes32",name:"nonce",type:"bytes32"}],internalType:"struct PriceNote",name:"n",type:"tuple"},{internalType:"bytes",name:"sig",type:"bytes"},{internalType:"address",name:"boundWallet",type:"address"}],name:"verifyNote",outputs:[{internalType:"uint256",name:"oakPerEthE18",type:"uint256"}],stateMutability:"view",type:"function"},{anonymous:!1,inputs:[{indexed:!1,internalType:"address",name:"signer",type:"address"}],name:"PriceSignerSet",type:"event"},{inputs:[],name:"NotReady",type:"error"},{inputs:[],name:"NoteBadSignature",type:"error"},{inputs:[],name:"NoteExpired",type:"error"},{inputs:[],name:"NoteNotYetValid",type:"error"},{inputs:[{internalType:"uint256",name:"spot",type:"uint256"},{internalType:"uint256",name:"note",type:"uint256"}],name:"NoteOutsideGuard",type:"error"},{inputs:[],name:"NoteWrongWallet",type:"error"},{inputs:[{internalType:"address",name:"source",type:"address"}],name:"OracleUnreadable",type:"error"}];var G=300,pe="1000000000000000000",se=b(T[m].tokens.USDG.address),oe=b(T[l].deployments.test_USDG.address),I=b(T[m].tokens.WETH.address),H=b(T[l].deployments.test_WETH.address),L=b($.chop);function de(n){return n.chainId===m&&n.address.toLowerCase()===L.toLowerCase()}function ce(n){let e=n.address.toLowerCase();return n.chainId===m?e===se.toLowerCase():n.chainId===l?e===oe.toLowerCase():!1}function ue(n){return n.chainId!==m&&n.chainId!==l?!1:k(n.address)===g}function me(n){let e=n.address.toLowerCase();return n.chainId===m?e===I.toLowerCase():n.chainId===l?e===H.toLowerCase():!1}function ye(n){return ue(n)||me(n)}var le=-887272,fe=887272,we=(1n<<256n)-1n,ge=ae(["function observe(uint32[] secondsAgos) view returns (int56[] tickCumulatives, uint160[] secondsPerLiquidityCumulativeX128s)","function slot0() view returns (uint160 sqrtPriceX96, int24 tick, uint16 observationIndex, uint16 observationCardinality, uint16 observationCardinalityNext, uint8 feeProtocol, bool unlocked)"]),ne=ae(["function getSlot0(bytes32 poolId) view returns (uint160 sqrtPriceX96, int24 tick, uint24 protocolFee, uint24 lpFee)","function getLiquidity(bytes32 poolId) view returns (uint128 liquidity)"]),Ee=1n<<192n;async function Te(n,e){let t=b(C.stateView),s=C.poolId,[a,i]=await Promise.all([n.readContract({address:t,abi:ne,functionName:"getSlot0",args:[s],blockNumber:e}),n.readContract({address:t,abi:ne,functionName:"getLiquidity",args:[s],blockNumber:e})]),o=a[0],r=Number(a[1]);if(o<=0n||i<=0n||!Number.isInteger(r)||r<le||r>fe)throw new d("The pinned Uniswap v4 WETH/CHOP pool has no active liquidity, and the only other route is a near-empty pool.");return{numerator:Ee,denominator:o*o}}function M(n,e){if(typeof n=="bigint")return n;if(typeof n=="number"){if(!Number.isSafeInteger(n))throw new d(`Invalid ${e} timestamp.`);return BigInt(n)}if(typeof n=="string"&&/^-?\d+$/.test(n.trim()))return BigInt(n.trim());throw new d(`Invalid ${e} timestamp.`)}function We(n,e=BigInt(Math.floor(Date.now()/1e3)),t=G){try{return p(n,e,t),!0}catch{return!1}}function p(n,e=BigInt(Math.floor(Date.now()/1e3)),t=G){if(!Number.isInteger(t)||t<0)throw new d("Maximum price age must be a non-negative integer.");let s=M(n,"price"),a=M(e,"current");if(s<=0n)throw new d("Price timestamp must be positive.");if(s>a)throw new d("Price timestamp is in the future.");let i=a-s;if(i>BigInt(t))throw new d(`Price is stale: age ${i}s exceeds ${t}s.`);return s.toString()}function he(n){if(!Number.isInteger(n)||n<le||n>fe)throw new d(`Tick ${n} is outside valid Uniswap bounds.`);let e=BigInt(n<0?-n:n),t=(e&0x1n)!==0n?0xfffcb933bd6fad37aa2d162d1a594001n:0x100000000000000000000000000000000n;return(e&0x2n)!==0n&&(t=t*0xfff97272373d413259a46990580e213an>>128n),(e&0x4n)!==0n&&(t=t*0xfff2e50f5f656932ef12357cf3c7fdccn>>128n),(e&0x8n)!==0n&&(t=t*0xffe5caca7e10e4e61c3624eaa0941cd0n>>128n),(e&0x10n)!==0n&&(t=t*0xffcb9843d60f6159c9db58835c926644n>>128n),(e&0x20n)!==0n&&(t=t*0xff973b41fa98c081472e6896dfb254c0n>>128n),(e&0x40n)!==0n&&(t=t*0xff2ea16466c96a3843ec78b326b52861n>>128n),(e&0x80n)!==0n&&(t=t*0xfe5dee046a99a2a811c461f1969c3053n>>128n),(e&0x100n)!==0n&&(t=t*0xfcbe86c7900a88aedcffc83b479aa3a4n>>128n),(e&0x200n)!==0n&&(t=t*0xf987a7253ac413176f2b074cf7815e54n>>128n),(e&0x400n)!==0n&&(t=t*0xf3392b0822b70005940c7a398e4b70f3n>>128n),(e&0x800n)!==0n&&(t=t*0xe7159475a2c29b7443b29c7fa6e889d9n>>128n),(e&0x1000n)!==0n&&(t=t*0xd097f3bdfd2022b8845ad8f792aa5825n>>128n),(e&0x2000n)!==0n&&(t=t*0xa9f746462d870fdf8a65dc1f90e061e5n>>128n),(e&0x4000n)!==0n&&(t=t*0x70d869a156d2a1b890bb3df62baf32f7n>>128n),(e&0x8000n)!==0n&&(t=t*0x31be135f97d08fd981231505542fcfa6n>>128n),(e&0x10000n)!==0n&&(t=t*0x9aa508b5b7a84e1c677de54f3e99bc9n>>128n),(e&0x20000n)!==0n&&(t=t*0x5d6af8dedb81196699c329225ee604n>>128n),(e&0x40000n)!==0n&&(t=t*0x2216e584f5fa1ea926041bedfe98n>>128n),(e&0x80000n)!==0n&&(t=t*0x48a170391f7dc42444e8fa2n>>128n),n>0&&(t=we/t),(t>>32n)+(t%(1n<<32n)===0n?0n:1n)}async function re(n,e,t,s){let a=async()=>{throw new d("Price identity resolution is read-only.")},i=F({network:e===l?"testnet":"mainnet",clientFor:r=>t.client??w(t.rpcUrl,r),http:t.http??X(),preview:a,quoteSwap:a,buildSwap:a}),o=await Z(n,{context:i,oakTokenAddress:t.oakTokenAddress??process.env.OAK_TOKEN_ADDRESS,officialStockTokens:t.officialStockTokens,tokenMetadata:s,blockNumber:t.blockNumber,readMetadata:async r=>{let c=t.client??w(t.rpcUrl,e),[u,f]=await Promise.all([v(c,e,r,"symbol",t.blockNumber),v(c,e,r,"decimals",t.blockNumber)]);return{address:r,symbol:u,decimals:f,chainId:e}}});return{address:o.address,symbol:o.kind==="erc20"&&s?s.symbol:o.symbol,decimals:o.decimals,chainId:o.chainId}}async function Se(n,e,t){if(typeof n=="object"&&n!==null){let r=n.chainId??e,c=k(n.address)===g?g:b(n.address),u={address:c,symbol:n.symbol,decimals:n.decimals,chainId:r};return ce(u)?{address:c,symbol:"USDG",decimals:D,chainId:r}:ue(u)?{address:g,symbol:"ETH",decimals:18,chainId:r}:me(u)?{address:c,symbol:"WETH",decimals:18,chainId:r}:de(u)?{address:c,symbol:"CHOP",decimals:18,chainId:r}:re(u.address,r,t,u)}let s=n.trim(),a=s.toUpperCase(),i=s.toLowerCase();if(a==="ETH"||te(s,{strict:!1})&&k(s)===g)return{...J,chainId:e};if(a==="WETH"||e===m&&i===I.toLowerCase()||e===l&&i===H.toLowerCase()){if(e!==m&&e!==l)throw new d(`No canonical WETH address configured for chain ${e}.`);return{address:e===l?H:I,symbol:"WETH",decimals:18,chainId:e}}if(a==="USDG"||e===m&&i===W.toLowerCase()||e===l&&i===K.toLowerCase()){if(e!==m&&e!==l)throw new d(`No canonical USDG address configured for chain ${e}.`);return{address:e===l?oe:se,symbol:"USDG",decimals:D,chainId:e}}if(e===m&&(a==="USDE"||i===_.address.toLowerCase()))return{..._,chainId:e};if(e===m&&(a==="CHOP"||i===L.toLowerCase()))return{address:L,symbol:"CHOP",decimals:18,chainId:e};let o=t.oakTokenAddress??process.env.OAK_TOKEN_ADDRESS;if(a==="OAK"||o&&s.toLowerCase()===o.toLowerCase()){if(!o&&!te(s,{strict:!1}))throw new d("OAK token address is required to price OAK.");return{address:b(o??s),symbol:"OAK",decimals:q,chainId:e}}return re(n,e,t)}async function S(n,e,t){if(e)return(await n.readContract({address:e,abi:ee,functionName:"ethUsdE18",blockNumber:t})).toString();let a=(await n.readContract({address:b(B),abi:ge,functionName:"observe",args:[[U,0]],blockNumber:t}))[0];if(!a||a.length<2)throw new d("ETH/USDG pool observation returned insufficient tick cumulatives.");let i=z(a[0],a[1],U),o=he(i);return Q(o)}async function P(n,e,t,s){if(n.timestamp!==void 0)return p(n.timestamp,t(),s);if(e&&typeof e.getBlock=="function"){let i=await N(e,n.blockNumber);return p(i.timestamp,t(),s)}let a=t();return p(a,a,s)}function ie(n){if(n.startsWith("untrusted "))try{let e=JSON.parse(n.slice(10));if(typeof e=="string"&&x(e)===n)return n}catch{}return x(n)}async function Ke(n,e={}){let t=e.chainId??m,s=e.maxAgeSeconds??G,a=()=>e.now!==void 0?M(e.now,"current"):BigInt(Math.floor(Date.now()/1e3)),i=await Se(n,t,e);if((R(i.symbol)||i.symbol.length>256)&&(i.symbol=ie(i.symbol)),e.signedNote||e.priceNote){let r=e.signedNote?e.signedNote.note:e.priceNote,c=p(r.timestamp,a(),s);if(e.spotOakPerEthE18!==void 0&&!A(r.oakPerEthE18,e.spotOakPerEthE18))throw new d("Price note is outside the 50% spot guard band.");let u=e.signedNote?.signature??e.signature,f=e.signedNote?.consumer??e.consumer;if(u&&f){let E=await j({note:r,signature:u,consumer:f,signer:e.signer,now:a(),spotOakPerEthE18:e.spotOakPerEthE18,chainId:t});if(!E.valid)throw new d(E.error??"Price note verification failed.")}let y=e.ethUsdE18!==void 0?e.ethUsdE18.toString():await S(e.client??w(e.rpcUrl,t),e.oracleAddress);return{token:i,usdE18:O(y,r.oakPerEthE18),timestamp:c}}if(e.trades){let r=await P(e,e.client,a,s),c=Y(e.trades,{now:a(),windowStart:e.windowStart,windowEnd:e.windowEnd});if(e.spotOakPerEthE18!==void 0&&!A(c,e.spotOakPerEthE18))throw new d("30-minute average is outside the 50% spot guard band.");let u=e.ethUsdE18!==void 0?e.ethUsdE18.toString():await S(e.client??w(e.rpcUrl,t),e.oracleAddress);return{token:i,usdE18:O(u,c),timestamp:r}}if(e.usdE18!==void 0){let r=await P(e,e.client,a,s),c=h(e.usdE18.toString());if(c<=0n)throw new d("USD price must be positive.");return{token:i,usdE18:c.toString(),timestamp:r}}if(e.resolver){let r=await e.resolver(i),c=p(r.timestamp,a(),s),u=h(r.usdE18);if(u<=0n)throw new d("USD price must be positive.");return{token:i,usdE18:u.toString(),timestamp:c}}let o=e.client??w(e.rpcUrl,t);if(ce(i)){let r=await P(e,o,a,s);return{token:i,usdE18:pe,timestamp:r}}if(ye(i)){let r=await P(e,o,a,s),c=await S(o,e.oracleAddress,e.blockNumber);return{token:i,usdE18:c,timestamp:r}}if(de(i)){let r=e.timestamp===void 0&&o&&typeof o.getBlock=="function"?await N(o,e.blockNumber):void 0,c=r?p(r.timestamp,a(),s):await P(e,o,a,s);if(r&&r.number===null)throw new d("CHOP reference requires a mined block.");let u=r?.number??e.blockNumber,[f,y]=await Promise.all([Te(o,u),e.ethUsdE18!==void 0?Promise.resolve(e.ethUsdE18.toString()):S(o,e.oracleAddress,u)]),E=h(y)*f.numerator/f.denominator;if(E<=0n)throw new d("CHOP USD reference price must be positive.");return{token:i,usdE18:E.toString(),timestamp:c}}if(i.chainId===m)try{let r=await N(o,e.blockNumber),c=p(r.timestamp,a(),s);if(r.number===null)throw new d("Pons reference requires a mined block.");let[u,f]=await Promise.all([V(i,o,r.number),S(o,e.oracleAddress,r.number)]),y=h(f)*u.numerator/u.denominator;if(y<=0n)throw new d("Pons USD reference price must be positive.");return{token:i,usdE18:y.toString(),timestamp:c}}catch{}throw new d(`Oak has no fresh on-chain trade price for ${ie(i.symbol)}, so it shows no price. balances and positions show a labeled estimate where one exists; an estimate is not a quote.`)}export{G as a,pe as b,de as c,ce as d,ue as e,me as f,ye as g,Te as h,We as i,p as j,he as k,S as l,Ke as m};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var e={chainId:4663,epoch:"0x6179d9123C3C1f9e82f948101a4350cb55Aa8C27",maxWorkflows:100,defaultCheckpointLimit:5,maxCheckpointLimit:25};export{e as a};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{e as h,i as y}from"./
|
|
1
|
+
import{e as h,i as y}from"./6D3XNCOX.js";import{b as l,e as f,g as v}from"./QPY6UTLU.js";import{c as p}from"./NWNYJ26T.js";import{b as g}from"./TI727O2H.js";import{a as r}from"./XSD5NL7J.js";import{parseAbi as C,zeroAddress as I}from"viem";var N=C(["function observe(uint32[] secondsAgos) view returns (int56[] tickCumulatives,uint160[] secondsPerLiquidityCumulativeX128s)"]);function B(s){return{tools:[{name:"uniswap_oracle",inputSchema:{type:"object",additionalProperties:!1,required:["token0","token1","fee","secondsAgo"],properties:{token0:{...p,description:"Lower sorted ERC-20 token address; use WETH for native ETH in v3."},token1:{...p,description:"Higher sorted ERC-20 token address."},fee:{description:"Pool fee in pips, hundredths of a basis point (3000 = 0.3%; 950000 = 95%).",type:"integer",minimum:0,maximum:999999},secondsAgo:{description:"Oracle lookback duration in seconds; a positive integer.",type:"integer",minimum:1,maximum:4294967295}}},async execute(t){v(t,["token0","token1","fee","secondsAgo"]);let a=l(t.token0),c=l(t.token1),o=t.fee,e=t.secondsAgo;if(BigInt(a)>=BigInt(c))throw new r("Oracle tokens must be strictly sorted token0 < token1.");if(typeof o!="number"||!Number.isInteger(o)||o<0||o>=1e6||typeof e!="number"||!Number.isInteger(e)||e<=0||e>4294967295)throw new r("Provide integer fee pips and a positive uint32 secondsAgo.");let d=s.clientFor(g),i=await d.getBlockNumber(),m=await d.readContract({address:h.factory,abi:y,functionName:"getPool",args:[a,c,o],blockNumber:i});if(m===I)throw new r("No factory-verified v3 pool exists for this oracle.");let[[n,k],w,A]=await Promise.all([d.readContract({address:m,abi:N,functionName:"observe",args:[[e,0]],blockNumber:i}),f(s,a,i),f(s,c,i)]);if(n.length!==2||k.length!==2)throw new r("Oracle returned an unexpected observation count.");let u=n[1]-n[0],b=BigInt(e),P=u/b-(u<0n&&u%b!==0n?1n:0n);return{pool:m,token0:w,token1:A,secondsAgo:e,blockNumber:i.toString(),tickCumulatives:n.map(String),secondsPerLiquidityCumulativeX128s:k.map(String),arithmeticMeanTick:P.toString(),summary:"V3 time-weighted arithmetic mean tick, rounded toward negative infinity. Price is token1-base-units per token0-base-unit before decimal adjustment. Insufficient pool history reverts; an unavailable oracle is never reported as zero."}}}]}}export{B as a};
|