@oakagentkit/core 0.3.5 → 0.3.6
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 +14 -0
- package/build/dist/api/addresses.js +1 -1
- package/build/dist/api/chain.js +1 -1
- package/build/dist/api/history.d.ts +2 -0
- 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.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/actions.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/positions.js +1 -1
- package/build/dist/api/modules/borro/reader.js +1 -1
- package/build/dist/api/modules/chop/display.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/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/index.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.js +1 -1
- package/build/dist/api/modules/erc8004/validation.js +1 -1
- package/build/dist/api/modules/fobo/index.js +1 -1
- package/build/dist/api/modules/fobo/intent.js +1 -1
- package/build/dist/api/modules/fobo/steps.js +1 -1
- package/build/dist/api/modules/fobo/verify.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.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.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.d.ts +39 -2
- 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.d.ts +14 -2
- package/build/dist/api/modules/hookr/agent-gate.js +1 -1
- package/build/dist/api/modules/hookr/agent-link.d.ts +17 -0
- package/build/dist/api/modules/hookr/agent-link.js +1 -0
- package/build/dist/api/modules/hookr/api-client.d.ts +9 -0
- package/build/dist/api/modules/hookr/api-client.js +1 -0
- package/build/dist/api/modules/hookr/blocks/advisory.d.ts +41 -0
- package/build/dist/api/modules/hookr/blocks/advisory.js +1 -0
- package/build/dist/api/modules/hookr/blocks/buy-sell-block.d.ts +7 -0
- package/build/dist/api/modules/hookr/blocks/buy-sell-block.js +1 -0
- package/build/dist/api/modules/hookr/blocks/core-settings.d.ts +6 -0
- package/build/dist/api/modules/hookr/blocks/core-settings.js +1 -0
- package/build/dist/api/modules/hookr/blocks/exit-clock.d.ts +14 -0
- package/build/dist/api/modules/hookr/blocks/exit-clock.js +1 -0
- package/build/dist/api/modules/hookr/blocks/holder-pot.d.ts +30 -0
- package/build/dist/api/modules/hookr/blocks/holder-pot.js +1 -0
- package/build/dist/api/modules/hookr/blocks/managed-fee.d.ts +96 -0
- package/build/dist/api/modules/hookr/blocks/managed-fee.js +1 -0
- package/build/dist/api/modules/hookr/blocks/market-guard.d.ts +116 -0
- package/build/dist/api/modules/hookr/blocks/market-guard.js +1 -0
- package/build/dist/api/modules/hookr/blocks/market-hours-fee.d.ts +87 -0
- package/build/dist/api/modules/hookr/blocks/market-hours-fee.js +1 -0
- package/build/dist/api/modules/hookr/blocks/pay-later.d.ts +199 -0
- package/build/dist/api/modules/hookr/blocks/pay-later.js +1 -0
- package/build/dist/api/modules/hookr/blocks/sandwich-guard.d.ts +3 -0
- package/build/dist/api/modules/hookr/blocks/sandwich-guard.js +1 -0
- package/build/dist/api/modules/hookr/blocks/storm-fee.d.ts +3 -0
- package/build/dist/api/modules/hookr/blocks/storm-fee.js +1 -0
- package/build/dist/api/modules/hookr/blocks/swap-cut.d.ts +3 -0
- package/build/dist/api/modules/hookr/blocks/swap-cut.js +1 -0
- package/build/dist/api/modules/hookr/blocks/swap-reward-mint.d.ts +125 -0
- package/build/dist/api/modules/hookr/blocks/swap-reward-mint.js +1 -0
- package/build/dist/api/modules/hookr/blocks/wallet-cap.d.ts +3 -0
- package/build/dist/api/modules/hookr/blocks/wallet-cap.js +1 -0
- package/build/dist/api/modules/hookr/blocks/zap-source.d.ts +161 -0
- package/build/dist/api/modules/hookr/blocks/zap-source.js +1 -0
- package/build/dist/api/modules/hookr/blocks/zap-target.d.ts +51 -0
- package/build/dist/api/modules/hookr/blocks/zap-target.js +1 -0
- package/build/dist/api/modules/hookr/claims.d.ts +53 -0
- package/build/dist/api/modules/hookr/claims.js +1 -0
- package/build/dist/api/modules/hookr/contracts.d.ts +3 -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.d.ts +2 -2
- package/build/dist/api/modules/hookr/discovery.js +1 -1
- package/build/dist/api/modules/hookr/fill-bounty.d.ts +2 -0
- package/build/dist/api/modules/hookr/fill-bounty.js +1 -1
- package/build/dist/api/modules/hookr/gas.d.ts +48 -0
- package/build/dist/api/modules/hookr/gas.js +1 -0
- package/build/dist/api/modules/hookr/gates.d.ts +51 -0
- package/build/dist/api/modules/hookr/gates.js +1 -0
- package/build/dist/api/modules/hookr/hook-blocks.d.ts +304 -0
- package/build/dist/api/modules/hookr/hook-blocks.js +1 -0
- package/build/dist/api/modules/hookr/index.d.ts +4 -2
- package/build/dist/api/modules/hookr/index.js +1 -1
- package/build/dist/api/modules/hookr/jobs.d.ts +7 -0
- package/build/dist/api/modules/hookr/jobs.js +1 -0
- package/build/dist/api/modules/hookr/launch-options.d.ts +52 -3
- package/build/dist/api/modules/hookr/launch-options.js +1 -1
- package/build/dist/api/modules/hookr/launch-profile.d.ts +8 -0
- package/build/dist/api/modules/hookr/launch-profile.js +1 -1
- package/build/dist/api/modules/hookr/launch-receipt.js +1 -1
- package/build/dist/api/modules/hookr/launch.d.ts +24 -0
- 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.d.ts +90 -2
- package/build/dist/api/modules/hookr/lp-state.js +1 -1
- package/build/dist/api/modules/hookr/pay-later-actions.d.ts +52 -0
- package/build/dist/api/modules/hookr/pay-later-actions.js +1 -0
- package/build/dist/api/modules/hookr/pins.d.ts +5 -0
- package/build/dist/api/modules/hookr/pins.js +1 -1
- package/build/dist/api/modules/hookr/pm-liquidity.d.ts +215 -0
- package/build/dist/api/modules/hookr/pm-liquidity.js +1 -0
- package/build/dist/api/modules/hookr/public-reads.d.ts +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.d.ts +4 -1
- package/build/dist/api/modules/hookr/revenue.js +1 -1
- package/build/dist/api/modules/hookr/scan.d.ts +25 -0
- package/build/dist/api/modules/hookr/scan.js +1 -0
- package/build/dist/api/modules/hookr/swap.d.ts +161 -0
- package/build/dist/api/modules/hookr/swap.js +1 -0
- 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/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.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/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-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.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.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/raeto/index.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/outbound-status.js +1 -1
- package/build/dist/api/modules/relay/reads.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/stock-prices.d.ts +25 -0
- package/build/dist/api/modules/uniswap/stock-prices.js +1 -1
- package/build/dist/api/modules/uniswap/stocks.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/index.js +1 -1
- package/build/dist/api/modules/upoch/reads.js +1 -1
- 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/scan-text.d.ts +1 -1
- package/build/dist/api/positions.js +1 -1
- package/build/dist/api/pricenote.js +1 -1
- package/build/dist/api/prices.js +1 -1
- package/build/dist/api/rpc.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 +2 -0
- package/build/dist/api/swap.js +1 -1
- package/build/dist/api/tokens.d.ts +9 -1
- package/build/dist/api/tokens.js +1 -1
- package/build/dist/api/tool-policy.js +1 -1
- package/build/dist/api/universal-router.js +1 -1
- package/build/dist/api/usd-estimate.js +1 -1
- package/build/dist/chunks/{DMDOSHV7.js → 266VIESP.js} +1 -1
- package/build/dist/chunks/{R66NSNNQ.js → 2BKZLF5A.js} +1 -1
- package/build/dist/chunks/{HFVXNKA5.js → 2BM2WX2G.js} +1 -1
- package/build/dist/chunks/{OY5W7ZSL.js → 2H2OZE6X.js} +1 -1
- package/build/dist/chunks/{E76Z2TT4.js → 2QQ5CGQI.js} +1 -1
- package/build/dist/chunks/{4PLLS6CT.js → 2VYA6WIN.js} +1 -1
- package/build/dist/chunks/{LCH6F5HT.js → 342OZP53.js} +1 -1
- package/build/dist/chunks/{C57DITTF.js → 3HF6WE4L.js} +1 -1
- package/build/dist/chunks/3M7RMROZ.js +1 -0
- package/build/dist/chunks/3RGED2KO.js +1 -0
- package/build/dist/chunks/{4HQEJHCD.js → 3XIJCHT7.js} +1 -1
- package/build/dist/chunks/3XY44BP5.js +1 -0
- package/build/dist/chunks/3YNXQ3EZ.js +1 -0
- package/build/dist/chunks/45QP74CE.js +1 -0
- package/build/dist/chunks/{SX5YNFHG.js → 4GAU3JLN.js} +1 -1
- package/build/dist/chunks/{Y2QADJOB.js → 4P6DRKY3.js} +1 -1
- package/build/dist/chunks/{W3DGFMQE.js → 4RTXP2YP.js} +1 -1
- package/build/dist/chunks/{QMIH6HXH.js → 4SXRXNHG.js} +1 -1
- package/build/dist/chunks/{ZTKT3ZQK.js → 53VBLEYS.js} +1 -1
- package/build/dist/chunks/{FRT6AC6M.js → 5677LZOV.js} +1 -1
- package/build/dist/chunks/{ADIPEGNN.js → 5AO2QPWE.js} +1 -1
- package/build/dist/chunks/{GQITAJVF.js → 5BPFF7NX.js} +1 -1
- package/build/dist/chunks/{JDHPMS7X.js → 5DWQUEBA.js} +1 -1
- package/build/dist/chunks/{WAKZWSHB.js → 5KKAN7XQ.js} +1 -1
- package/build/dist/chunks/{VVAM3EAK.js → 5N6YJFFA.js} +1 -1
- package/build/dist/chunks/{QIB6OMQV.js → 5O67QQIY.js} +1 -1
- package/build/dist/chunks/5PNFV7HH.js +1 -0
- package/build/dist/chunks/5RAZFRO4.js +1 -0
- package/build/dist/chunks/{FAH7FKUT.js → 5UWVXEPD.js} +1 -1
- package/build/dist/chunks/5VKVAUFQ.js +1 -0
- package/build/dist/chunks/5Y457HYC.js +1 -0
- package/build/dist/chunks/64LAWFBE.js +1 -0
- package/build/dist/chunks/{3BQ5XHDJ.js → 6EWSLHXL.js} +1 -1
- package/build/dist/chunks/{6F527FLN.js → 6HNQAYBM.js} +1 -1
- package/build/dist/chunks/{FUP53K6G.js → 6LDC5D2S.js} +1 -1
- package/build/dist/chunks/{TZ7S5KRB.js → 6QXTL65K.js} +1 -1
- package/build/dist/chunks/6RVAV6BB.js +1 -0
- package/build/dist/chunks/{WSILNJS2.js → 6STUQOFL.js} +1 -1
- package/build/dist/chunks/{RUHNLNVX.js → 6Y2546JA.js} +1 -1
- package/build/dist/chunks/{4Z3IGMU6.js → 7AYP4ATZ.js} +1 -1
- package/build/dist/chunks/{YGW4ODAP.js → 7EPU3XGY.js} +1 -1
- package/build/dist/chunks/7GL547YZ.js +1 -0
- package/build/dist/chunks/7JTXYMNP.js +1 -0
- package/build/dist/chunks/{A3BJSQ23.js → 7VU5VCTL.js} +1 -1
- package/build/dist/chunks/{Z7FGEWO2.js → 7WXAS54T.js} +1 -1
- package/build/dist/chunks/{WQ2XTDHO.js → 7X5JVF3F.js} +1 -1
- package/build/dist/chunks/{DRLBTB4E.js → A72ADVYF.js} +1 -1
- package/build/dist/chunks/{ANIF3JMV.js → AG66NM3J.js} +1 -1
- package/build/dist/chunks/AODUTN65.js +1 -0
- package/build/dist/chunks/{DBOGRUPS.js → AONO47JX.js} +1 -1
- package/build/dist/chunks/{JTPHZCO3.js → AQJLEG6B.js} +1 -1
- package/build/dist/chunks/AZBTNUXF.js +1 -0
- package/build/dist/chunks/{TOIKOIY6.js → B5BU645H.js} +1 -1
- package/build/dist/chunks/{ZX43P4BK.js → B75SS7H6.js} +1 -1
- package/build/dist/chunks/{GBIBRYOV.js → B7HVPHSS.js} +1 -1
- package/build/dist/chunks/{LT5P6PZW.js → B7WZJHIJ.js} +1 -1
- package/build/dist/chunks/{3A2IKFTV.js → BIFANUTV.js} +1 -1
- package/build/dist/chunks/BM4KHOFB.js +1 -0
- package/build/dist/chunks/{N65J3L2H.js → BSV65PCA.js} +1 -1
- package/build/dist/chunks/{ZVY7GGSP.js → BW755PNH.js} +1 -1
- package/build/dist/chunks/{VXCGMALF.js → BWE5PXRE.js} +1 -1
- package/build/dist/chunks/{7U62MMUQ.js → BY2OWKZB.js} +1 -1
- package/build/dist/chunks/{CNDIAF3P.js → C2H3BWN5.js} +1 -1
- package/build/dist/chunks/{F7MGYRPU.js → CCPG6PRL.js} +1 -1
- package/build/dist/chunks/{OI3N4EW4.js → CG7ABZXH.js} +1 -1
- package/build/dist/chunks/CJMVRV34.js +1 -0
- package/build/dist/chunks/CQPIR6ER.js +1 -0
- package/build/dist/chunks/{A4K5GXVO.js → CR7DPGI6.js} +1 -1
- package/build/dist/chunks/{UUF4Z6K6.js → CVVNAFUE.js} +1 -1
- package/build/dist/chunks/{MI5HZDMH.js → D6JOXK7Q.js} +1 -1
- package/build/dist/chunks/{2PS4GCOZ.js → DJRS3TR5.js} +1 -1
- package/build/dist/chunks/{IZFED3R2.js → DLNDJZR4.js} +1 -1
- package/build/dist/chunks/{MQXSCNUL.js → DPSFR3ZS.js} +1 -1
- package/build/dist/chunks/{LKUZAJPZ.js → DV2HVFTM.js} +1 -1
- package/build/dist/chunks/{NMJVQX5M.js → DWRRIFXS.js} +1 -1
- package/build/dist/chunks/{3ZH5SOC2.js → EFOC337C.js} +1 -1
- package/build/dist/chunks/EHQRAA3R.js +1 -0
- package/build/dist/chunks/{A4FLWHLP.js → EJIP7RBG.js} +1 -1
- package/build/dist/chunks/EWZFZUVF.js +1 -0
- package/build/dist/chunks/{OB7BFDOV.js → EYE3ZAJB.js} +1 -1
- package/build/dist/chunks/{MQ5F2VOK.js → EZUQMTLE.js} +1 -1
- package/build/dist/chunks/{O2QBSINK.js → F36IA5RI.js} +1 -1
- package/build/dist/chunks/{XTXXWRN2.js → F74ARK4H.js} +1 -1
- package/build/dist/chunks/{HPS4KOU4.js → FGGDAAHW.js} +1 -1
- package/build/dist/chunks/FMEO7RX7.js +1 -0
- package/build/dist/chunks/{FHB7QYJO.js → FN6XY6ET.js} +1 -1
- package/build/dist/chunks/G4IX4CYN.js +1 -0
- package/build/dist/chunks/G53U6Y4L.js +1 -0
- package/build/dist/chunks/{HDBZZOHJ.js → GBIL2I2K.js} +1 -1
- package/build/dist/chunks/{MJGEGNDU.js → GCFHKJIO.js} +1 -1
- package/build/dist/chunks/{O5QTITN6.js → GRHBE4MQ.js} +1 -1
- package/build/dist/chunks/GTJ6LBGB.js +1 -0
- package/build/dist/chunks/GV6Z3MET.js +1 -0
- package/build/dist/chunks/{GK3D7OKG.js → GVCNTGLC.js} +1 -1
- package/build/dist/chunks/GX2RCAHG.js +1 -0
- package/build/dist/chunks/{7TRO6MBQ.js → H5KU4DUU.js} +1 -1
- package/build/dist/chunks/H7ZJ7LAB.js +1 -0
- package/build/dist/chunks/{DCGNVMKG.js → HC3QFA5I.js} +1 -1
- package/build/dist/chunks/{6CKCZJ3F.js → HEQBTHFS.js} +1 -1
- package/build/dist/chunks/{C76D54YG.js → HGSFRN57.js} +1 -1
- package/build/dist/chunks/HJI7KO6F.js +1 -0
- package/build/dist/chunks/{KO7ANIKY.js → HNBYPHTA.js} +1 -1
- package/build/dist/chunks/{MSRCJ2BS.js → HPBTSJW7.js} +1 -1
- package/build/dist/chunks/HPO673QQ.js +1 -0
- package/build/dist/chunks/{4IOHSX3Z.js → HRGLFGFL.js} +1 -1
- package/build/dist/chunks/{DGDMRATN.js → ICHT3H3W.js} +1 -1
- package/build/dist/chunks/IJVBCEA2.js +1 -0
- package/build/dist/chunks/{N742W5KX.js → IKVRFAUP.js} +1 -1
- package/build/dist/chunks/IM7ZF7XZ.js +1 -0
- package/build/dist/chunks/{I4473OC6.js → IMD33NQS.js} +1 -1
- package/build/dist/chunks/IR7KDBFU.js +1 -0
- package/build/dist/chunks/{X24YTJST.js → IY7FWTAL.js} +1 -1
- package/build/dist/chunks/IYOWMW5B.js +1 -0
- package/build/dist/chunks/J2J73XYU.js +1 -0
- package/build/dist/chunks/JCS24YBB.js +1 -0
- package/build/dist/chunks/JQVTHPUO.js +1 -0
- package/build/dist/chunks/{USGMGKAG.js → JTWJT2O3.js} +1 -1
- package/build/dist/chunks/{W7BFM6CK.js → K4CYAWNL.js} +1 -1
- package/build/dist/chunks/{7VH6JQ2H.js → K5C6QBOO.js} +1 -1
- package/build/dist/chunks/K5OXLIPK.js +1 -0
- package/build/dist/chunks/{ZKBOPZH5.js → K6GECT3F.js} +1 -1
- package/build/dist/chunks/{6LVHN33V.js → KB2JWQZ4.js} +1 -1
- package/build/dist/chunks/{YW4W3LPQ.js → KHLM6NIZ.js} +1 -1
- package/build/dist/chunks/{OIQTZOBN.js → KKGHXNM4.js} +1 -1
- package/build/dist/chunks/{SUNTJ6IU.js → KYANIEPX.js} +1 -1
- package/build/dist/chunks/{JJSCDDQO.js → L3IAEXQR.js} +1 -1
- package/build/dist/chunks/{ZZ6FZGHF.js → L4UFGM7M.js} +1 -1
- package/build/dist/chunks/{YWVPK3DV.js → L76P6WIH.js} +1 -1
- package/build/dist/chunks/{QMNUB2GM.js → LBT6WR4U.js} +1 -1
- package/build/dist/chunks/LD3A2KLN.js +1 -0
- package/build/dist/chunks/{WRUTW6CG.js → LFSNAQ7V.js} +1 -1
- package/build/dist/chunks/{ZQPC54J5.js → LKRAUTYI.js} +1 -1
- package/build/dist/chunks/{23HNDJ76.js → M2SWILNG.js} +1 -1
- package/build/dist/chunks/{IT2JLILU.js → MFKDNAHB.js} +1 -1
- package/build/dist/chunks/MFQTBUSD.js +1 -0
- package/build/dist/chunks/{V4UJMUIB.js → MLN5KTG7.js} +1 -1
- package/build/dist/chunks/{S4JUFCT4.js → MSQNOK3I.js} +1 -1
- package/build/dist/chunks/{O4P5IQCP.js → MXI7LX2F.js} +1 -1
- package/build/dist/chunks/N6YNJGEF.js +1 -0
- package/build/dist/chunks/{DXAPKN7H.js → NLC36QHL.js} +1 -1
- package/build/dist/chunks/NUTTPUYJ.js +1 -0
- package/build/dist/chunks/{O4S6XAYV.js → O7L55XM3.js} +1 -1
- package/build/dist/chunks/{NAO7VWZF.js → OCIEVYPR.js} +1 -1
- package/build/dist/chunks/{4NBXBKOX.js → OD7CY6BY.js} +1 -1
- package/build/dist/chunks/{RUTSEGGD.js → OHZHQSCA.js} +1 -1
- package/build/dist/chunks/{E47UYYK4.js → OIGTTRN5.js} +1 -1
- package/build/dist/chunks/{2I7XHRTI.js → P6JE2NRA.js} +1 -1
- package/build/dist/chunks/PD5NXIRT.js +1 -0
- package/build/dist/chunks/{TXGZ6NWN.js → PG7HZIZL.js} +1 -1
- package/build/dist/chunks/{VREGY7E6.js → PMFR47H3.js} +1 -1
- package/build/dist/chunks/{PV7FEVBD.js → PXVF2SHU.js} +1 -1
- package/build/dist/chunks/{2FOI2625.js → Q43WPRYU.js} +1 -1
- package/build/dist/chunks/QAAKUIWE.js +1 -0
- package/build/dist/chunks/{ZXFJKW6H.js → QAVP3CWL.js} +1 -1
- package/build/dist/chunks/{YXXK6EPI.js → QBHY2QRC.js} +1 -1
- package/build/dist/chunks/{ELHRXA5U.js → QFK335LC.js} +1 -1
- package/build/dist/chunks/{3PHJUFU2.js → QFUSCK5C.js} +1 -1
- package/build/dist/chunks/{IPU656WB.js → QKH7ED6B.js} +1 -1
- package/build/dist/chunks/{XW3VGWXK.js → QMWHQRYC.js} +1 -1
- package/build/dist/chunks/{ZXRIJG6H.js → QP2B7AYX.js} +1 -1
- package/build/dist/chunks/{TJU644I7.js → QZ6V6J6W.js} +1 -1
- package/build/dist/chunks/{MDLJFCT4.js → R5Z4HPCA.js} +1 -1
- package/build/dist/chunks/RKJFSDGV.js +1 -0
- package/build/dist/chunks/RKS3M7L5.js +1 -0
- package/build/dist/chunks/{GDOHHXNH.js → RLX6YTNT.js} +1 -1
- package/build/dist/chunks/{IZP3EKKS.js → RYEQIZ2H.js} +1 -1
- package/build/dist/chunks/{USEF3QKG.js → S432S6NA.js} +1 -1
- package/build/dist/chunks/{2OVJ2BTJ.js → SEXKWYUM.js} +1 -1
- package/build/dist/chunks/{KKTOBXIT.js → SRYX65GZ.js} +1 -1
- package/build/dist/chunks/{GKUPC4DO.js → TMENUIBC.js} +1 -1
- package/build/dist/chunks/{BSX4LFYI.js → TNHU5UBQ.js} +1 -1
- package/build/dist/chunks/{PDPTJMTJ.js → TT2ST3Q3.js} +1 -1
- package/build/dist/chunks/TTBB6EFN.js +1 -0
- package/build/dist/chunks/{FRVCSDKU.js → TWVDWNTG.js} +1 -1
- package/build/dist/chunks/TZG7HTVM.js +1 -0
- package/build/dist/chunks/{OVM4QIET.js → U4MSIH4G.js} +1 -1
- package/build/dist/chunks/{G5AMH4IP.js → UGFRBJDQ.js} +1 -1
- package/build/dist/chunks/{OB3YMTDI.js → UIVOYAO2.js} +1 -1
- package/build/dist/chunks/{XRDLMTBJ.js → UMY6SP7C.js} +1 -1
- package/build/dist/chunks/UNBRUWSV.js +1 -0
- package/build/dist/chunks/{LGLWEGPY.js → UPX3OWKA.js} +1 -1
- package/build/dist/chunks/{TGXEKBLV.js → URTQNYWU.js} +1 -1
- package/build/dist/chunks/{4RCYYN6O.js → V7HTGO23.js} +1 -1
- package/build/dist/chunks/{HZSYMGJ2.js → VS7ZA4OF.js} +1 -1
- package/build/dist/chunks/{BJ2U2VXJ.js → VTWAVH74.js} +1 -1
- package/build/dist/chunks/{LZM3DO5Q.js → W5GWK72I.js} +1 -1
- package/build/dist/chunks/{65OITTDL.js → W73SLWBT.js} +1 -1
- package/build/dist/chunks/{3YH5B5NQ.js → WUONMIA2.js} +1 -1
- package/build/dist/chunks/{XL3W7DAQ.js → X3BB6WME.js} +1 -1
- package/build/dist/chunks/{XADHV2DT.js → X53QVHBC.js} +1 -1
- package/build/dist/chunks/{GBPB7JIB.js → XSQJOOEY.js} +1 -1
- package/build/dist/chunks/XUDQYSPU.js +1 -0
- package/build/dist/chunks/{S37D7HOK.js → XWZ5SL5Q.js} +1 -1
- package/build/dist/chunks/{NIWAVMDR.js → XXLQDQEX.js} +1 -1
- package/build/dist/chunks/{QBNASL3T.js → Y5T36EEU.js} +1 -1
- package/build/dist/chunks/{R73R4KN3.js → YBLJ2MCR.js} +1 -1
- package/build/dist/chunks/ZSGW2ZSO.js +1 -0
- package/build/dist/chunks/{HRAHGYNK.js → ZTNBX4VH.js} +1 -1
- package/package.json +1 -1
- package/build/dist/chunks/5H7NVE6O.js +0 -1
- package/build/dist/chunks/7OOCAZBE.js +0 -1
- package/build/dist/chunks/DFM4T6ZE.js +0 -1
- package/build/dist/chunks/FCVH4FYH.js +0 -1
- package/build/dist/chunks/GDUKZYE2.js +0 -1
- package/build/dist/chunks/GYPMUYB5.js +0 -1
- package/build/dist/chunks/J7OZLXSG.js +0 -1
- package/build/dist/chunks/JFC2QCMW.js +0 -1
- package/build/dist/chunks/M6JNGU4E.js +0 -1
- package/build/dist/chunks/M7OVMIIE.js +0 -1
- package/build/dist/chunks/MQK6OP7S.js +0 -1
- package/build/dist/chunks/N624NR7Y.js +0 -1
- package/build/dist/chunks/OSMOBKRQ.js +0 -1
- package/build/dist/chunks/Q3Q3YHEX.js +0 -1
- package/build/dist/chunks/QQD4PV64.js +0 -1
- package/build/dist/chunks/RN3WUJIO.js +0 -1
- package/build/dist/chunks/RP5VCG54.js +0 -1
- package/build/dist/chunks/TI727O2H.js +0 -1
- package/build/dist/chunks/UHIJMDD2.js +0 -1
- package/build/dist/chunks/W32UECOL.js +0 -1
- package/build/dist/chunks/WWNAGOCD.js +0 -1
- package/build/dist/chunks/XWC6IC5E.js +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{b as U}from"./CQ5WRWV4.js";import{a as O,b as C,c as J,d as de}from"./IV4K7FMD.js";import{a as Ae,e as he}from"./GVCNTGLC.js";import{d as Se}from"./KKGHXNM4.js";import{a as ee,d as ve,f as Oe}from"./3XY44BP5.js";import{b as E}from"./7WXAS54T.js";import{a as ce,b as me,d as le,f as $,g as q,h as H,j as pe,k as fe,l as we,m as ge}from"./TNHU5UBQ.js";import{a as f,b as Y,c as ue}from"./43LI5NKJ.js";import{c as Z}from"./5TUXSOMI.js";import{g as y}from"./NWNYJ26T.js";import{b as o,e as ie}from"./IX3GZMTM.js";import{A as ae,b as F,j as G,x as X,y as M}from"./EWZFZUVF.js";import{a as r}from"./XSD5NL7J.js";import{decodeFunctionData as L,encodeFunctionData as z,parseAbi as ke}from"viem";var Te=60,oe=50,st=200;var ye="0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE",_="0x0000000000000000000000000000000000000000",R=G[4663].routes.kyberswap.address,P=G[4663].routes.velora.address,re=X[4663].kyberswap.toLowerCase(),Ie=X[4663].velora.toLowerCase(),Ce="0x0000000000000000000000000000000000000000000000000000000000000000",Le=[le.pons,...$],K=ke(["function swap((address callTarget, address approveTarget, bytes targetData, (address srcToken, address dstToken, address[] srcReceivers, uint256[] srcAmounts, address[] feeReceivers, uint256[] feeAmounts, address dstReceiver, uint256 amount, uint256 minReturnAmount, uint256 flags, bytes permit) desc, bytes clientData) execution) payable returns (uint256 returnAmount, uint256 gasUsed)"]),W=ke(["function swapExactAmountIn(address executor, (address srcToken, address destToken, uint256 fromAmount, uint256 toAmount, uint256 quotedAmount, bytes32 metadata, address beneficiary) swapData, uint256 partnerAndFee, bytes permit, bytes executorData) payable returns (uint256 receivedAmount, uint256 submittedAmount, uint256 augustusFeeAmount)"]),B=class extends r{name="NoRouteError";constructor(t="No swap route is available for this token pair and amount."){super(t)}},Q=class extends r{name="ExpiredQuoteError";constructor(t="Quote has expired. Request a fresh quote."){super(t)}},_e=1e3,I=new Map;function Fe(e){for(let[t,n]of I)BigInt(e)>=o(n.expiresAt)&&I.delete(t)}function ne(e){return{...e,...e.sourcePoolRoute!==void 0?{sourcePoolRoute:structuredClone(e.sourcePoolRoute)}:{},...e.txs?{txs:e.txs.map(t=>({...t}))}:{}}}function be(e){let t=ne(e);return t.txs&&(t.txs.forEach(Object.freeze),Object.freeze(t.txs)),Object.freeze(t)}var Pe=["router","from","to","wallet","amountIn","amountOut","minAmountOut","expiresAt","chainId","spender","value","hookrPoolId","gasLimit","ponsCurveToken","ponsPoolToken","blockNumber","calldataMinAmountOut","expectedSpend","expectedRefund","oakFee","oakFeeBps","oakFeeToken","grossAmountOut","venueFee","venueFeeBps"];function j(e,t,n=!1){for(let s of Pe)if(!(s==="expiresAt"&&n&&o(e.expiresAt)<=o(t.expiresAt))&&e[s]!==void 0&&String(e[s]).toLowerCase()!==String(t[s]).toLowerCase())throw new r(`Quote ${s} does not match the accepted quote.`)}function N(e=Date.now){let t=e();if(!Number.isFinite(t)||t<0)throw new r("Clock must return a non-negative timestamp.");return t>1e11?Math.floor(t/1e3):Math.floor(t)}function x(e){let t=e.toLowerCase();return t===ye.toLowerCase()||t===_.toLowerCase()}function Qe(e,t=oe){if(!Number.isInteger(t)||t<0||t>=1e4)throw new r("Slippage must be an integer from 0 to 9999 bps.");return ie(e,String(1e4-t),"10000","floor")}var Ne=200;function at(e){if(typeof e!="number"||!Number.isFinite(e)||!/^\d+(?:\.\d{1,2})?$/.test(String(e)))throw new r("Velora returned an unsupported venue fee. Request a fresh quote.");let[t,n=""]=String(e).split("."),s=Number(t)*100+Number(n.padEnd(2,"0"));return se(s),s}function se(e){if(!Number.isInteger(e)||e<0||e>Ne)throw new r("Velora returned an unsupported venue fee. Request a fresh quote.")}function xe(e,t=O.bps){return se(t),o(e)*10000n/BigInt(1e4-t)+1n}function Ve(e,t){if(se(t),t!==O.bps||e!==J)throw new r("Velora partnerAndFee must match the pinned Oak fee, recipient and flags.")}function Ee(e){if(e.oakFeeBps===O.bps)return`${de()} ${e.provider==="velora"?"Oak\u2019s share is paid to the Oak treasury.":"Paid to the Oak treasury."} Venue fee: ${e.venueFee} base units (${e.venueFeeBps} bps) retained by ${e.provider??"venue"}. Output and minimum are net.${e.provider==="velora"?" Velora retains 15% of the partner fee; Oak receives 85% (about 21.25 bps).":""}`;if(e.oakFee!==void 0&&o(e.oakFee)!==0n)throw new r("Oak fee requires the pinned rate and token; venue fees must never be counted as Oak income.");let t=e.provider??"venue";return`Venue fee: ${e.venueFee} base units (${e.venueFeeBps} bps) retained by ${t}; Oak swap fee: 0 (venue fee is never Oak income).`}function Me(e){f(e.from),f(e.to),f(e.wallet);let t=e.callTarget??M[F].kyberswap.address,n=e.approveTarget??_;f(t),f(n);let s=o(e.amountIn),a=o(e.minAmountOut);return z({abi:K,functionName:"swap",args:[{callTarget:t,approveTarget:n,targetData:e.targetData??"0x",desc:{srcToken:e.from,dstToken:e.to,srcReceivers:x(e.from)?[]:[t],srcAmounts:x(e.from)?[]:[s-BigInt(C(e.amountIn))],feeReceivers:[O.recipient],feeAmounts:[BigInt(O.bps)],dstReceiver:e.wallet,amount:s,minReturnAmount:a,flags:640n,permit:"0x"},clientData:e.clientData??"0x"}]})}function Ue(e){f(e.from),f(e.to),f(e.wallet);let t=e.executor??M[F].velora.address;return f(t),z({abi:W,functionName:"swapExactAmountIn",args:[t,{srcToken:e.from,destToken:e.to,fromAmount:o(e.amountIn),toAmount:o(e.minAmountOut),quotedAmount:o(e.amountOut),metadata:e.metadata??Ce,beneficiary:e.wallet},e.partnerAndFee??J,"0x",e.executorData??"0x"]})}function $e(e){if(typeof e!="string"||!/^0x([0-9a-fA-F]{2})+$/.test(e)||e.length<10)throw new r("Swap calldata must contain a 4-byte function selector.");let t=e.slice(0,10).toLowerCase();if(t===re)return L({abi:K,data:e}).args[0].desc.minReturnAmount;if(t===Ie)return L({abi:W,data:e}).args[1].toAmount;if(t==="0x3593564c")return H(e,Le).amountOutMinimum;let n=L({abi:Ae,data:e});if(n.functionName==="buy"||n.functionName==="sell")return n.args[1];throw new r(`Unsupported swap router selector ${t}.`)}function Be(e,t,n=!1){let s=o(t),a=$e(e);if(a<=0n||s<=0n||a!==s&&!(n&&(a>s||e.slice(0,10).toLowerCase()===re&&a+1n===s)))throw new r(`Built swap calldata minimum output (${a}) does not match the accepted quote minimum (${s}).`);return a}function De(e,t){let{from:n,to:s,wallet:a,amountIn:c}=t;if(!n||!s||!a||c===void 0)throw new r("Accepted quote must include input, output, amount and wallet.");for(let i of[n,s,a,t.router,e.to])f(i);let l=(i,m,w)=>{if(i.toLowerCase()!==m.toLowerCase())throw new r(`Built swap ${w} does not match the accepted quote.`)};if(l(e.to,t.router,"router"),e.chainId!==(t.chainId??F))throw new r("Built swap chain does not match the accepted quote.");let g=x(n)?o(c):0n;if(o(e.value)!==g||t.value!==void 0&&o(t.value)!==g)throw new r("Built swap value does not match the accepted quote input.");let A=e.data.slice(0,10).toLowerCase(),u=t.router.toLowerCase();if(u===R.toLowerCase()||u===P.toLowerCase()){let i=u===R.toLowerCase(),m=i?c:t.grossAmountOut,w=i?n:s;if(t.oakFeeBps!==O.bps||m===void 0||t.oakFee!==C(m)||t.oakFeeToken?.toLowerCase()!==E(w).toLowerCase())throw new r("Oak fee must match the pinned rate, token and amount.")}let d;if(u===R.toLowerCase()&&A===re){l(t.spender??t.router,R,"spender");let i=L({abi:K,data:e.data});if(z({abi:K,...i}).toLowerCase()!==e.data.toLowerCase())throw new r("KyberSwap calldata must be canonically decodable.");let{callTarget:m,approveTarget:w,desc:p}=i.args[0];l(m,M[F].kyberswap.address,"executor"),l(w,_,"executor approval target");let S=x(n);if(p.srcReceivers.length!==p.srcAmounts.length||(S?p.srcReceivers.length!==0:p.srcReceivers.length===0||p.srcAmounts.some(h=>h<=0n)||p.srcAmounts.reduce((h,k)=>h+k,0n)!==o(c)-BigInt(C(c))))throw new r("KyberSwap source transfers must send the exact input less the pinned fee to the pinned executor or verified input pool.");for(let h of p.srcReceivers)if(h.toLowerCase()!==m.toLowerCase()&&!Se(n,h,e.data))throw new r(`KyberSwap source transfers: receiver ${h} is not a verified input pool or the pinned executor.`);if(p.feeReceivers.length!==1||p.feeAmounts.length!==1||p.feeReceivers[0].toLowerCase()!==O.recipient.toLowerCase()||p.feeAmounts[0]!==BigInt(O.bps)||p.flags!==640n||p.permit!=="0x")throw new r("KyberSwap fee recipients, fee amounts, flags and permit must match the pinned Oak input-fee policy.");d={from:p.srcToken,to:p.dstToken,wallet:p.dstReceiver,amount:p.amount}}else if(u===P.toLowerCase()&&A===Ie){l(t.spender??t.router,P,"spender");let i=L({abi:W,data:e.data});if(z({abi:W,...i}).toLowerCase()!==e.data.toLowerCase())throw new r("Velora calldata must be canonically decodable.");let[m,w,p,S]=i.args;if(!ae.some(h=>h.toLowerCase()===m.toLowerCase()))throw new r("Built swap executor does not match the accepted quote.");if(S!=="0x")throw new r("Velora permit must match the pinned empty-permit policy.");if(Ve(p,t.oakFeeBps??O.bps),t.calldataMinAmountOut!==void 0&&o(t.calldataMinAmountOut)!==xe(t.minAmountOut,O.bps))throw new r("Velora calldata minimum must cover the accepted net output, venue fee and router dust.");if(t.calldataMinAmountOut!==void 0&&(w.quotedAmount!==o(t.grossAmountOut??"0")||w.quotedAmount<o(t.calldataMinAmountOut)))throw new r("Velora quoted gross output must match the accepted quote and cover its calldata minimum.");if(p!==0n&&t.calldataMinAmountOut===void 0)throw new r("Velora venue fee requires a fee-adjusted calldata minimum.");d={from:w.srcToken,to:w.destToken,wallet:w.beneficiary,amount:w.fromAmount}}else if(t.provider==="pons"&&(t.ponsPoolToken||t.ponsCurveToken))d=he(e,{...t,from:n,to:s,wallet:a});else if(t.provider==="hookr"){if(!t.hookrPoolId||!y(t.router,ee)||!y(t.spender??t.router,ee))throw new r("Hookr quote must bind the pinned Router and pool.");if(e.gasLimit!==t.gasLimit||t.gasLimit!==void 0&&(o(t.gasLimit)===0n||o(t.gasLimit)>10000000n))throw new r("Hookr gas limit is zero, exceeds the ceiling or differs from the quote.");let i=ve(e,{poolId:t.hookrPoolId,from:x(n)?_:n,to:x(s)?_:s,wallet:a,amountIn:o(c),minimum:o(t.minAmountOut),now:BigInt(N())});d={from:i.zeroForOne?i.key.currency0:i.key.currency1,to:i.zeroForOne?i.key.currency1:i.key.currency0,wallet:i.recipient,amount:-i.amountSpecified},x(n)&&(d.from=n),x(s)&&(d.to=s)}else if(t.provider==="fobo")d=ze(e,{...t,from:n,to:s,wallet:a});else throw new r("Built swap selector does not match the accepted router.");if(l(d.from,n,"input token"),l(d.to,s,"output token"),l(d.wallet,a,"recipient"),d.amount!==o(c))throw new r("Built swap input amount does not match the accepted quote.");t.provider!=="hookr"&&Be(e.data,t.calldataMinAmountOut??t.minAmountOut,u===R.toLowerCase())}var He="FOBO route: the quoted output is already net of FOBO's pool taxes (2.5% per pool after a coin's first minute, higher during it). Oak swap fee: 0 on FOBO's route.";function ze(e,t){let n=(c,l,g)=>{if(!y(c,l))throw new r(`Built swap ${g} does not match the accepted quote.`)};if(n(t.router,ce,"FOBO router"),n(t.spender??t.router,me,"FOBO spender"),t.oakFeeBps!==void 0||t.oakFee!==void 0&&o(t.oakFee)!==0n)throw new r("FOBO route trades carry no Oak fee.");let s=H(e.data,$);ge(s),n(s.currencyIn,q(t.from),"input token"),n(s.currencyOut,q(t.to),"output token");let a=o(t.expiresAt);if(s.deadline>a+BigInt(fe))throw new r("FOBO swap deadline is more than 20 minutes past the accepted quote. Request a fresh quote.");if(s.permit&&(s.permit.amount!==s.amountIn||BigInt(s.permit.expiration)>s.permit.sigDeadline||s.permit.sigDeadline>a+BigInt(we)))throw new r("FOBO permit must be for the exact swap input, expire no later than its signature deadline, and end within 30 minutes of the quote.");if(t.data!==void 0&&!y(t.data,e.data)&&!pe(H(t.data,$).legs,s.legs))throw new r("Built swap FOBO pools or direction differ from the accepted quote.");return{from:t.from,to:t.to,wallet:t.wallet,amount:s.amountIn}}function te(e,t={}){if(!e||typeof e.quoteId!="string"||!e.quoteId.trim())throw new r("Quote must include a non-empty quoteId.");if(f(e.router),e.oakFeeBps!==void 0){let v=t.provider??e.provider,b=v==="kyberswap"?t.amountIn??e.amountIn:e.grossAmountOut,V=v==="kyberswap"?t.from??e.from:t.to??e.to;if(!["kyberswap","velora"].includes(v??"")||e.oakFeeBps!==O.bps||b===void 0||e.oakFee!==C(b)||!V||e.oakFeeToken?.toLowerCase()!==E(V).toLowerCase())throw new r("Oak fee must match the pinned rate, token and amount.")}else if(e.oakFee!==void 0&&o(e.oakFee)!==0n)throw new r("Oak fee requires the pinned rate and token; venue fees must never be counted as Oak income.");let n=o(e.amountOut),s=e.destAmountAfterFee??e.netAmountOut,a,c,l;if(s!==void 0){if(c=o(s),a=e.grossAmountOut!==void 0?o(e.grossAmountOut):n>=c?n:c,a<c)throw new r("Gross output cannot be less than net output.");l=e.venueFee!==void 0?o(e.venueFee):a-c}else if(e.grossAmountOut!==void 0){if(a=o(e.grossAmountOut),c=n,a<c)throw new r("Gross output cannot be less than net output.");l=e.venueFee!==void 0?o(e.venueFee):a-c}else e.venueFee!==void 0?(l=o(e.venueFee),c=n,a=c+l):(c=n,a=n,l=0n);if(c<=0n)throw new B("Quote output amount must be positive.");let g=t.slippageBps??e.slippageBps??oe,A=e.minAmountOut!==void 0?o(e.minAmountOut):o(Qe(c.toString(),g));if(A<=0n||A>a)throw new r("Quote minAmountOut must be positive and not exceed gross output.");if((t.provider??e.provider)==="velora"&&e.calldataMinAmountOut!==void 0){if(o(e.calldataMinAmountOut)!==xe(A.toString(),O.bps)||o(e.calldataMinAmountOut)>a)throw new r("Velora calldata minimum must cover the accepted net output, venue fee and router dust.")}else if(e.calldataMinAmountOut!==void 0||e.ponsCurveToken!==void 0){if((t.provider??e.provider)!=="pons"||!e.ponsCurveToken)throw new r("Curve minimum requires a Pons curve quote.");f(e.ponsCurveToken);let v=o(t.amountIn??e.amountIn??"0"),b=o(e.expectedSpend??"0"),V=o(e.expectedRefund??"0"),Re=o(e.calldataMinAmountOut??"0");if(v<=0n||b<=0n||b+V!==v||Re*b/v!==A)throw new r("Pons actual minimum and refund do not match the encoded minimum.")}let u=N(t.now),d=BigInt(u+Te),i=e.expiresAt!==void 0?o(e.expiresAt):d,m=(i>d?d:i).toString(),w=l.toString(),p=e.venueFeeBps??(a>0n&&l>0n?Number((l*10000n+a/2n)/a):0),S=t.provider??e.provider??(e.router.toLowerCase()===P.toLowerCase()?"velora":"kyberswap"),h=S==="fobo"?He:(S==="pons"||S==="hookr")&&e.feeDisclosure?e.feeDisclosure:Ee({provider:S,venueFee:w,venueFeeBps:p,oakFee:e.oakFee??"0",oakFeeBps:e.oakFeeBps}),k={...e,quoteId:e.quoteId,amountOut:c.toString(),minAmountOut:A.toString(),router:e.router,expiresAt:m,provider:S,grossAmountOut:a.toString(),destAmountAfterFee:c.toString(),netAmountOut:c.toString(),venueFee:w,venueFeeBps:p,oakFee:e.oakFee??"0",feeDisclosure:h,...t.from??e.from?{from:E(t.from??e.from)}:{},...t.to??e.to?{to:E(t.to??e.to)}:{},...t.amountIn??e.amountIn?{amountIn:t.amountIn??e.amountIn}:{},...t.wallet??e.wallet?{wallet:t.wallet??e.wallet}:{},slippageBps:g,chainId:t.chainId??e.chainId??F,spender:e.spender??e.router,...t.allowance??e.allowance?{allowance:t.allowance??e.allowance}:{}};if(BigInt(u)>=o(m))throw new Q;if(t.cache===!1)return k;if(Fe(u),BigInt(u)>=o(m))throw new Q;let T=I.get(k.quoteId);if(T){j(k,T,!0);let v=be({...T,expiresAt:k.expiresAt});return I.set(v.quoteId,v),ne(v)}for(;I.size>=_e;)I.delete(I.keys().next().value);let D=be(k);return I.set(D.quoteId,D),ne(D)}async function it(e,t,n={}){e={...e},f(e.from),f(e.to),f(e.wallet),e.from=E(e.from),e.to=E(e.to);let s=o(e.amountIn);if(s<=0n)throw new r("Swap amountIn must be greater than zero.");let a=e.slippageBps??oe;if(!Number.isInteger(a)||a<0||a>=1e4)throw new r("Slippage must be an integer from 0 to 9999 bps.");if(!Array.isArray(t)||t.length===0)throw new B;let c={from:e.from,to:e.to,amountIn:s.toString(),slippageBps:a},l=await Promise.allSettled(t.map(async u=>{let d=await(u.quotePrices??u.quote).call(u,{...c},e.wallet);return{quote:te(d,{provider:u.name,from:e.from,to:e.to,amountIn:s.toString(),wallet:e.wallet,slippageBps:a,chainId:e.chainId??F,allowance:e.allowance,now:e.now,cache:!1}),provider:u}})),g,A=[];for(let u of l)u.status==="rejected"&&(g??=Z(u.reason)),u.status==="fulfilled"&&o(u.value.quote.expiresAt)>BigInt(N(e.now))&&A.push(u.value);if(A.length===0){let u=l.some(d=>d.status==="rejected"&&d.reason instanceof Error&&d.reason.message===U)&&l.every(d=>d.status==="rejected"&&(d.reason instanceof B||d.reason instanceof Oe||d.reason instanceof Error&&d.reason.message===U));throw g??new B(u?U:void 0)}A.sort((u,d)=>{let m=o(d.quote.amountOut)-o(u.quote.amountOut)||o(d.quote.minAmountOut)-o(u.quote.minAmountOut);return m>0n?1:m<0n?-1:0});for(let{quote:u,provider:d}of A)try{if(BigInt(N(e.now))>=o(u.expiresAt))continue;if(n.deferBuild||!d.prepareQuote)return te(u,{now:e.now});let i=await d.prepareQuote(u.quoteId,e.wallet);if(i.quoteId!==u.quoteId)throw new r("Prepared quote ID does not match the selected route.");if(j(i,u,!0),!i.data)throw new r("Selected route did not return swap calldata.");let m={...u,expiresAt:i.expiresAt,data:i.data,value:i.value,allowance:i.allowance??u.allowance};return De(Y({to:m.router,data:i.data,value:i.value??"0",chainId:m.chainId??F,description:"Selected swap route"}),m),te(m,{now:e.now})}catch(i){g??=Z(i);continue}throw g??new B}function ut(e,t={}){if(!e||typeof e.quoteId!="string"||!e.quoteId.trim())throw new r("Provide a valid quote to build a swap.");f(e.router);let n=I.get(e.quoteId),s=N(t.now);if(Fe(s),!n||BigInt(s)>=o(n.expiresAt))throw I.delete(e.quoteId),new Q;if(e.oakFeeBps===void 0&&e.oakFee!==void 0&&o(e.oakFee)!==0n)throw new r("Oak fee requires the pinned rate and token; venue fees must never be counted as Oak income.");j(e,n),j({...n,...t},n);let a=n.from,c=n.to,l=n.amountIn,g=n.wallet;if(!a||!c||!g||l===void 0)throw new r("Accepted quote must include input, output, amount and wallet.");let A=n.chainId??F,u=n.spender??n.router,d=t.allowance??e.allowance??n?.allowance??"0";f(a),f(c),f(g),f(u);let i=o(l);if(i<=0n)throw new r("Swap amountIn must be greater than zero.");let m=o(n.minAmountOut);if(m<=0n)throw new r("Swap minAmountOut must be greater than zero.");let w=e.router.toLowerCase()===P.toLowerCase(),p=t.data??e.data??n?.data??(w?Ue({from:a,to:c,amountIn:i.toString(),amountOut:n.grossAmountOut??n.amountOut,minAmountOut:n.calldataMinAmountOut??m.toString(),wallet:g}):Me({from:a,to:c,amountIn:i.toString(),minAmountOut:m.toString(),wallet:g}));n.provider!=="hookr"&&Be(p,n.calldataMinAmountOut??m.toString(),n.router.toLowerCase()===R.toLowerCase());let S=n.venueFee??"0",h=n.venueFeeBps??0,k=n.provider??(w?"velora":"kyberswap"),T=n.feeDisclosure??Ee({provider:k,venueFee:S,venueFeeBps:h,oakFee:n.oakFee??"0",oakFeeBps:n.oakFeeBps}),D=x(a),v=t.value??e.value??n?.value??(D?i.toString():"0"),b=Y({to:e.router,data:p,value:v,chainId:A,...n.provider==="hookr"&&n.gasLimit!==void 0?{gasLimit:n.gasLimit}:{},description:`Swap ${i} base units of ${a} for at least ${m} base units of ${c} via ${k} (${e.router}). ${T}`});return n.provider==="hookr"&&n.gasLimit!==void 0&&(b.gasLimit=n.gasLimit),De(b,n),D||o(d)>=i?[b]:[ue(a,u,i.toString(),A),b]}export{Te as a,oe as b,st as c,ye as d,_ as e,K as f,B as g,Q as h,_e as i,ne as j,be as k,j as l,N as m,x as n,Qe as o,Ne as p,at as q,xe as r,Ve as s,Ee as t,Me as u,Ue as v,$e as w,Be as x,De as y,He as z,te as A,it as B,ut as C};
|
|
@@ -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"./OIGTTRN5.js";import{e as Q,g as j,i as z,j as F}from"./5DWQUEBA.js";import{F as E,c as W,f as H,n as k,t as R,u as K}from"./5677LZOV.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{h as Le}from"./5Y457HYC.js";import{m as le}from"./IR7KDBFU.js";import{e as Z,f as O,h as H,i as y,j as d,k as de,l as ke,m as W,o as U,p as u}from"./UMY6SP7C.js";import{b as q,i as Pe,j as ue,k as X}from"./CJMVRV34.js";import{a as c}from"./XSD5NL7J.js";import{decodeAbiParameters as Ge,decodeFunctionResult as We,encodeAbiParameters as z,encodeFunctionData as M,getAddress as D,keccak256 as N,parseAbi as _,parseAbiParameters as ze,toHex as _e,zeroAddress as x}from"viem";var mt="Pay Later requires a separate vault and family custody with beneficiary and premium terms; this launch does not create or fund that vault.",R=["premiumBps","strikeMarkupBps","tenor","priceWindowBlocks","maxBlockDepthBps","anchorDecayBlocks","topGuardBps","minOrderUnits","maxOrderUnits","maxUnitsPerBlock","maxActiveUnits","maxInventory","minPremium"],ie=[16,16,32,16,16,32,16,128,128,128,128,128,128],ye={type:"tuple",components:R.map((e,t)=>({name:e,type:`uint${ie[t]}`}))},Be=_(["function createVault(bytes32 familyId, uint8 member, (uint16 premiumBps,uint16 strikeMarkupBps,uint32 tenor,uint16 priceWindowBlocks,uint16 maxBlockDepthBps,uint32 anchorDecayBlocks,uint16 topGuardBps,uint128 minOrderUnits,uint128 maxOrderUnits,uint128 maxUnitsPerBlock,uint128 maxActiveUnits,uint128 maxInventory,uint128 minPremium) terms) returns (address vault)"]);function ee(e){let t=Z(e,R,R),r=R.map((o,i)=>O(t[o],ie[i]));if(r[0]<100n||r[0]>5000n||r[1]>5000n||r[2]<300n||r[2]>604800n||r[3]<1n||r[3]>64n||r[4]<1n||r[4]>100n||r[5]<300n||r[5]>50400n||r[6]>5000n||r[7]<1n||r[7]>r[8]||r[8]>r[9]||r[9]>r[10]||r[10]>r[11]||r[11]>10n**36n)throw new c("Pay Later terms violate the immutable economic bounds or nested inventory limits.");return Object.fromEntries(R.map((o,i)=>[o,String(r[i])]))}function $e(e){return Object.fromEntries(R.map((t,r)=>[t,ie[r]<=32?Number(e[t]):BigInt(e[t])]))}function fe(e){return z([ye],[$e(ee(e))])}function Qe(e){if(e.length!==834)throw new c("Pay Later requires exactly thirteen ABI words.");let[t]=Ge([ye],e),r=ee(Object.fromEntries(R.map(o=>[o,String(t[o])])));if(fe(r).toLowerCase()!==e.toLowerCase())throw new c("Pay Later terms are not canonical.");return r}function Ce(e,t,r){let o=H(e),i=O(t,8),n=ee(r);return M({abi:Be,functionName:"createVault",args:[o,Number(i),$e(n)]})}function Oe(e,t,r,o){let i=Qe(e);if(!/^0x[0-9a-fA-F]{40}$/.test(t)||!/^0x[0-9a-fA-F]{40}$/.test(r)||/^0x0{40}$/i.test(t)||/^0x0{40}$/i.test(r)||!Number.isInteger(o)||o<2e3||o>5e3)throw new c("Pay Later requires nonzero beneficiary and protocol recipient and a protocol share of 2000\u20135000 bps.");return`Pay Later: beneficiary ${t}, protocol recipient ${r}, protocol premium share ${o} bps. Immutable terms: ${R.map(n=>`${n} ${i[n]}`).join(", ")}. After the owner transfers the entire family and the beneficiary accepts, the vault owns the LP family through the Launcher; its LP principal cannot be removed while held by the vault. The beneficiary can start a two-step release of the family. Harvested subject-token fees become vault inventory up to maxInventory; excess subject and other-currency fees are owed to the beneficiary. The beneficiary can withdraw free inventory and earnings; reserved inventory remains in the vault to cover open orders, including after a family release. At order opening the buyer pays the quote-currency premium to the vault and its subject inventory is reserved: premium = max(ceil(strike \xD7 premiumBps / 10000), minPremium). The vault credits floor(premium \xD7 ${o} / 10000) to the protocol recipient, payable by anyone through payProtocol, and the rest to beneficiary earnings, withdrawable by the beneficiary. The buyer may exercise in a later block strictly before expiry (open timestamp plus tenor), in full or in parts, paying the cumulative pro-rata strike rounded up in quote; the vault credits the strike to beneficiary earnings and delivers the exercised subject tokens to the buyer's chosen recipient. At expiry anyone may return unexercised units to free inventory; the premium is not refunded. Token resale or profit is not guaranteed. Creation, transfer and acceptance are separate actions requiring fresh chain checks and confirmations.`}var we=_(["function transferFamily(bytes32 familyId,address newOwner,uint16 claims)","function acceptFamily(bytes32 familyId)"]),oe=_(["function acceptFamily()","function releaseFamily()","function withdrawEarnings(address currency,address to,uint256 amount)","function withdrawInventory(address to,uint128 amount)"]);function Ye(e,t,r){let o=H(e),i=y(t),n=O(r,16);if(i===x)throw new c("Pay Later vault must be nonzero.");return M({abi:we,functionName:"transferFamily",args:[o,i,Number(n)]})}function Ke(e){return M({abi:we,functionName:"transferFamily",args:[H(e),x,0]})}function Je(){return M({abi:oe,functionName:"acceptFamily"})}function Xe(){return M({abi:oe,functionName:"releaseFamily"})}function Ze(e){return M({abi:we,functionName:"acceptFamily",args:[H(e)]})}function Se(e){let t=y(e);if(t===x)throw new c("Pay Later withdrawal recipient must be nonzero.");return t}function Ne(e,t,r){return M({abi:oe,functionName:"withdrawEarnings",args:[y(e),Se(t),O(r)]})}function et(e,t){return M({abi:oe,functionName:"withdrawInventory",args:[Se(e),O(t,128)]})}var L="0xFc3e9e435C79e1712CF949C6ea921fA165cadEf3",Re="0x2f66c525278406c6261d911135b17bd618578a9bf910aff17d426e438180e050",B=_(["function launcher() view returns (address)","function registry() view returns (address)","function protocolShareBps() view returns (uint16)","function minTopGuardBps() view returns (uint16)","function minDynamicFeeSpanPips() view returns (uint24)","function bandReachBps(bytes32,uint8) view returns (uint256)","function vaultOf(bytes32,address) view returns (address)","function isVault(address) view returns (bool)"]),S=(e,t)=>String(e).toLowerCase()===String(t).toLowerCase(),ae=e=>e===x?"native ETH":e;async function je(e,t,r,o){let i=D(q.launcherV1),n=W(await u(e,i,U("launcherV1"),"position",[r,o],t)),l=W(n.key),m=y(l.currency0),f=y(l.currency1),a=y(l.hooks),P=Number(d(l.fee,24)),{tickSpacing:v}=l,{tickLower:b,tickUpper:j}=n;if(typeof v!="number"||!Number.isInteger(v)||typeof b!="number"||typeof j!="number")throw new c("Pay Later reference position is incomplete.");if(a!==D(q.rootV1))throw new c("Pay Later reference root is not the reviewed current root.");let $=N(z(ze("address,address,uint24,int24,address"),[m,f,P,v,a])),C=W(await u(e,a,U("rootV1"),"poolConfig",[$],t)),A=y(C.rules);await Pe(e,t,[i,a,A]);let g=y(await u(e,A,_(["function protocolRecipient() view returns (address)"]),"protocolRecipient",[],t));return{currency0:m,currency1:f,root:a,poolId:$,rules:A,subject:y(C.subject),quote:y(C.quote),baseLpFeePips:d(C.baseLpFeePips,24),liquidity:d(n.liquidity,128),tickLower:b,tickUpper:j,protocolRecipient:g}}async function he(e,t,r,o){let i=D(q.launcherV1);return Promise.all(Array.from({length:o},async(n,l)=>{let m=W(await u(e,i,U("launcherV1"),"position",[r,l],t)),f=W(m.key);return{member:l,currency0:y(f.currency0),currency1:y(f.currency1),liquidity:d(m.liquidity,128),tickLower:m.tickLower,tickUpper:m.tickUpper}}))}function re(e){return e.map(t=>`member ${t.member}, currencies ${t.currency0}/${t.currency1}, liquidity ${t.liquidity}, ticks ${t.tickLower}/${t.tickUpper}`).join("; ")}function pe(e,t){let r=o=>(t>>o&1)===1?"as a PoolManager claim":"as tokens";return e.map(o=>`member ${o.member}: ${ae(o.currency0)} ${r(2*o.member)}, ${ae(o.currency1)} ${r(2*o.member+1)}`).join("; ")}var xe="A PoolManager claim is a balance recorded inside the Uniswap PoolManager, not tokens in the wallet. Oak has no tool to redeem PoolManager claims.";async function tt(e,t,r,o){let i=Z(r,["familyId","member","terms","protocolRecipient","protocolShareBps"],["familyId","member","terms","protocolRecipient","protocolShareBps"]),n=y(o),l=H(i.familyId),m=Number(O(i.member,8)),f=ee(i.terms),a=y(i.protocolRecipient),P=Number(O(i.protocolShareBps,16));if(n===x||a===x||P<2e3||P>5e3)throw new c("Pay Later needs nonzero owner and protocol recipient and a protocol share of 2000\u20135000 bps.");let v=await ue(e,t),b=D(q.launcherV1),j=D(q.registry),[$,C,A,g,E,Q,I,s,p,F,se]=await Promise.all([e.getCode({address:L,blockNumber:t}),u(e,L,B,"launcher",[],t),u(e,L,B,"registry",[],t),u(e,L,B,"protocolShareBps",[],t),u(e,L,B,"minTopGuardBps",[],t),u(e,L,B,"minDynamicFeeSpanPips",[],t),u(e,L,B,"bandReachBps",[l,m],t),u(e,L,B,"vaultOf",[l,n],t),u(e,b,U("launcherV1"),"familyOwner",[l],t),u(e,b,U("launcherV1"),"pendingFamilyOwner",[l],t),u(e,b,U("launcherV1"),"memberCount",[l],t)]);if(!$||N($)!==Re||!S(C,b)||!S(A,j))throw new c("Pay Later factory runtime, launcher or registry does not match the reviewed deployment.");if(!S(p,n)||!S(s,x)||!Array.isArray(F)||!S(F[0],x))throw new c("Pay Later needs the current family owner, no existing beneficiary vault and no pending family transfer.");let Y=d(se,8);if(Y<1n||Y>8n||BigInt(m)>=Y)throw new c("Pay Later member exceeds the live family member count.");if(d(g,16)!==BigInt(P)||BigInt(f.topGuardBps)<d(E,16)||d(I)<100000n)throw new c("Pay Later protocol share, top guard floor or band reach differs from the requested listing.");let k=await je(e,t,l,m);if(k.liquidity===0n)throw new c("Pay Later reference position is incomplete or has no liquidity.");if(k.protocolRecipient!==a||BigInt(f.maxBlockDepthBps)*400n>k.baseLpFeePips)throw new c("Pay Later protocol recipient or depth share does not match the reference pool.");let K=await he(e,t,l,Number(Y)),G=Ce(l,String(m),f),w;try{let te=await e.call({account:n,to:L,data:G,blockNumber:t});if(!te.data)throw new Error("empty");w=te.data}catch{throw new c("Pay Later createVault simulation failed at the named block; listing, dynamic fee, family or custody requirements are not satisfied.")}let J=We({abi:Be,functionName:"createVault",data:w});if(J===x)throw new c("Pay Later factory predicted a zero vault.");return await X(e,v),{block:v,familyId:l,member:m,owner:n,vault:J,poolId:k.poolId,root:k.root,rules:k.rules,familyPositions:K,subject:k.subject,quote:k.quote,liquidity:k.liquidity,terms:f,protocolRecipient:a,protocolShareBps:P,minDynamicFeeSpanPips:d(Q,24),bandReachBps:d(I),summary:`${Oe(fe(f),n,a,P)} Family ${l}, member ${m}, vault ${J}. Creating the vault moves nothing. Positions that would later enter vault custody: ${re(K)}. Whether fees already accrued are paid as tokens or as PoolManager claims is chosen at the transfer step. Creation, transfer and acceptance are separate confirmations; repeat checks and simulate each immediately before signing.`}}var Ae={launcher:[3354,4191,5647,9253,9716,11135,11275,12237],poolManager:[1327,1907,2912,3967,5926,7408,9165,10771,13734,14082],root:[1139],familyId:[3315,4150,5603,8928,9654,11234,12196],member:[1212,12340],memberCount:[3267,11748],poolId:[2879,3934,5893,7375,9055,10738,13701,14049],subject:[4333,5106,7974,11416,12058,13931,14697,15021,16987],quote:[3690,6644,7850,11912,13993,14776,15260],subjectIsCurrency0:[2680,15880],beneficiary:[1772,3212,4920,5279,10829,12135],termsHash:[3016],bandLiquidity:[8995,12429,16471],bandTickLower:[5969,8866],bandTickUpper:[7077,10959],anchorCeiling:[2741,13779,14140,16409],anchorDecayBlocks:[2258,13832],topGuardBps:[3830],guardPrice:[2800,6988],protocolRecipient:[3759,11874],protocolShareBps:[6583,10900]};function nt(e,t){Le(e,17333,"0x2d650492c4352eebba37441fa43b06ca3c8c9f0aa7106c806c9f6ab44162f45b",Ae,t)}var rt=_(["function poolManager() view returns (address)","function memberCount() view returns (uint8)","function subjectIsCurrency0() view returns (bool)","function termsHash() view returns (bytes32)","function bandTickLower() view returns (int24)","function bandTickUpper() view returns (int24)","function anchorCeiling() view returns (uint256)","function anchorDecayBlocks() view returns (uint256)","function topGuardBps() view returns (uint256)","function guardPrice() view returns (uint256)","function root() view returns (address)","function poolId() view returns (bytes32)","function subject() view returns (address)","function quote() view returns (address)","function beneficiary() view returns (address)","function launcher() view returns (address)","function familyId() view returns (bytes32)","function member() view returns (uint8)","function protocolRecipient() view returns (address)","function protocolShareBps() view returns (uint256)","function bandLiquidity() view returns (uint128)","function custodyReachBps() view returns (uint256)","function terms() view returns ((uint16 premiumBps,uint16 strikeMarkupBps,uint32 tenor,uint16 priceWindowBlocks,uint16 maxBlockDepthBps,uint32 anchorDecayBlocks,uint16 topGuardBps,uint128 minOrderUnits,uint128 maxOrderUnits,uint128 maxUnitsPerBlock,uint128 maxActiveUnits,uint128 maxInventory,uint128 minPremium))"]),Ie=["poolManager","memberCount","subjectIsCurrency0","termsHash","bandTickLower","bandTickUpper","anchorCeiling","anchorDecayBlocks","topGuardBps","guardPrice","root","poolId","subject","quote","beneficiary","launcher","familyId","member","protocolRecipient","protocolShareBps","bandLiquidity","custodyReachBps","terms"],V=_(["function accountedFree() view returns (uint128)","function accountedReserved() view returns (uint128)","function owed(address) view returns (uint256)","function protocolOwed() view returns (uint256)","function nextPositionId() view returns (uint256)","function accountingInvariant() view returns (bool)"]);function at(e,t,r){if(e)return le(r);let o=le(t);return((1n<<192n)+o-1n)/o}async function qe(e,t,r,o){let i=y(o),n=H(r);if(i===x)throw new c("Pay Later custody needs the beneficiary wallet.");let l=await ue(e,t),m=D(q.launcherV1),f=U("launcherV1"),[a,P,v,b,j,$,C,A]=await Promise.all([e.getCode({address:L,blockNumber:t}),u(e,L,B,"launcher",[],t),u(e,L,B,"registry",[],t),u(e,L,B,"protocolShareBps",[],t),u(e,L,B,"vaultOf",[n,i],t),u(e,m,f,"familyOwner",[n],t),u(e,m,f,"pendingFamilyOwner",[n],t),u(e,m,f,"memberCount",[n],t)]);if(!a||N(a)!==Re||!S(P,m)||!S(v,q.registry))throw new c("Pay Later factory runtime, launcher or registry does not match the reviewed deployment.");let g=y(j);if(g===x)throw new c("This wallet has no Pay Later vault for this family; only the beneficiary that created a vault can act on it.");let[E,Q,...I]=await Promise.all([e.getCode({address:g,blockNumber:t}),u(e,L,B,"isVault",[g],t),...Ie.map(h=>u(e,g,rt,h,[],t))]);if(!E)throw new c("Pay Later vault has not been created.");let s=Object.fromEntries(Ie.map((h,T)=>[h,I[T]])),p=W(s.terms),F=ee(Object.fromEntries(R.map(h=>[h,String(p[h])]))),se=["launcher","poolManager","root","subject","quote","beneficiary","protocolRecipient"],Y=["familyId","poolId","termsHash"],k={};for(let h of Object.keys(Ae))if(se.includes(h))k[h]=z([{type:"address"}],[y(s[h])]);else if(Y.includes(h))k[h]=H(s[h]);else if(h==="subjectIsCurrency0")k[h]=z([{type:"bool"}],[de(s[h])]);else if(h==="bandTickLower"||h==="bandTickUpper"){let T=s[h];if(typeof T!="number"||!Number.isInteger(T)||T<-8388608||T>8388607)throw new c("Pay Later vault tick is invalid.");k[h]=z([{type:"int24"}],[T])}else k[h]=z([{type:"uint256"}],[d(s[h])]);if(nt(E,k),Q!==!0||y(s.beneficiary)!==i||!S(s.launcher,m)||!S(s.familyId,n))throw new c("Pay Later vault beneficiary, family or factory attestation does not match this wallet and family.");let K=Number(d(s.member,8)),G=d(A,8);if(G<1n||G>8n||BigInt(K)>=G||d(s.memberCount,8)!==G)throw new c("Pay Later vault member does not fit the live family member count.");let w=await je(e,t,n,K),[J,te,Te,He,Ue,Ve,De]=await Promise.all([u(e,g,V,"accountedFree",[],t),u(e,g,V,"accountedReserved",[],t),u(e,g,V,"owed",[w.subject],t),u(e,g,V,"owed",[w.quote],t),u(e,g,V,"protocolOwed",[],t),u(e,g,V,"nextPositionId",[],t),u(e,g,V,"accountingInvariant",[],t)]),Me=N(_e("Terms(uint16 premiumBps,uint16 strikeMarkupBps,uint32 tenor,uint16 priceWindowBlocks,uint16 maxBlockDepthBps,uint32 anchorDecayBlocks,uint16 topGuardBps,uint128 minOrderUnits,uint128 maxOrderUnits,uint128 maxUnitsPerBlock,uint128 maxActiveUnits,uint128 maxInventory,uint128 minPremium)")),Ee=N(z([{type:"bytes32"},...ye.components],[Me,...R.map((h,T)=>ie[T]<=32?Number(F[h]):BigInt(F[h]))])),ce=w.subject===w.currency0,ne=at(ce,w.tickLower,w.tickUpper),be=ne*ne/(1n<<96n)*(10000n-BigInt(F.topGuardBps))/10000n,ge=d(b,16);if(y(s.poolManager)!==D(q.poolManager)||y(s.root)!==w.root||!S(s.poolId,w.poolId)||y(s.subject)!==w.subject||y(s.quote)!==w.quote||s.subjectIsCurrency0!==ce||s.bandTickLower!==w.tickLower||s.bandTickUpper!==w.tickUpper||!S(s.termsHash,Ee)||d(s.anchorDecayBlocks)!==BigInt(F.anchorDecayBlocks)||d(s.topGuardBps)!==BigInt(F.topGuardBps)||d(s.anchorCeiling)!==ne||d(s.guardPrice)!==be||y(s.protocolRecipient)!==w.protocolRecipient||d(s.protocolShareBps)!==ge)throw new c("Pay Later vault immutables differ from the pool, band, terms or protocol recipient derived from the chain for this family.");let ve=ke(C,2);return await X(e,l),{block:l,familyId:n,owner:i,vault:g,member:K,memberCount:Number(G),poolId:w.poolId,root:w.root,rules:w.rules,subject:w.subject,quote:w.quote,subjectIsCurrency0:ce,terms:F,protocolRecipient:w.protocolRecipient,protocolShareBps:Number(ge),familyOwner:y($),pendingOwner:y(ve[0]),pendingClaims:Number(d(ve[1],16)),liquidity:w.liquidity,bandLiquidity:d(s.bandLiquidity,128),bandTickLower:w.tickLower,bandTickUpper:w.tickUpper,anchorCeiling:ne,guardPrice:be,custodyReachBps:d(s.custodyReachBps),accountedFree:d(J,128),accountedReserved:d(te,128),owedSubject:d(Te),owedQuote:d(He),protocolOwed:d(Ue),nextPositionId:d(Ve),accountingInvariant:de(De)}}var Fe=e=>`Pay Later family ${e.familyId}, reference member ${e.member}, vault ${e.vault}, beneficiary ${e.owner}.`,me={transfer:["familyId","claims"],cancel:["familyId"],accept:["familyId"],release:["familyId"],"accept-back":["familyId"],"withdraw-earnings":["familyId","currency","amount"],"withdraw-inventory":["familyId","amount"]};async function pt(e,t,r,o,i){if(i==="create"){let p=await tt(e,t,r,o);return{step:i,action:{to:L,data:Ce(p.familyId,String(p.member),p.terms)},block:p.block,familyId:p.familyId,member:p.member,vault:p.vault,beneficiary:p.owner,summary:p.summary,plan:p}}if(!Object.hasOwn(me,i))throw new c("Choose a Pay Later step: create, transfer, cancel, accept, release, accept-back, withdraw-earnings or withdraw-inventory.");let n=Z(r,me[i],me[i]),l=i==="transfer"?Number(O(n.claims,16)):0,m=i==="withdraw-earnings"?y(n.currency):x,f=i==="withdraw-earnings"?O(n.amount):i==="withdraw-inventory"?O(n.amount,128):0n,a=await qe(e,t,n.familyId,o),{familyId:P,owner:v,vault:b}=a,j=D(q.launcherV1),$=a.familyOwner===v,C=a.familyOwner===b,A=(1<<2*a.memberCount)-1,g=()=>he(e,t,P,a.memberCount),E=()=>{if(a.liquidity<a.bandLiquidity||a.custodyReachBps<100000n)throw new c("Pay Later vault custody requires the frozen band liquidity and at least 100000 bps reach.")},Q=p=>{if(f===0n||f>p)throw new c(`Pay Later ${i} amount must be above zero and at most ${p}, the amount available at the named block.`)},I,s;if(i==="transfer"){if(l>>2*a.memberCount!==0)throw new c(`Pay Later claims mask ${l} selects a member beyond the ${a.memberCount} in this family.`);if(!$||a.pendingOwner!==x)throw new c("Pay Later transfer needs this wallet to own the family with no pending transfer; cancel a pending transfer first.");E();let p=await g();I={to:j,data:Ye(P,b,String(l))},s=`Start the transfer of the entire family to the vault. Nothing moves until the separate accept step. Positions: ${re(p)}. When the vault accepts, fees already accrued are paid to this wallet, the current owner: ${pe(p,l)}. ${xe} To change this choice before acceptance, use the cancel step and start the transfer again.`}else if(i==="cancel"){if(!$)throw new c("Pay Later cancel needs this wallet to own the family.");if(a.pendingOwner===x)throw new c("Pay Later cancel found no pending family transfer to cancel.");I={to:j,data:Ke(P)},s=`Cancel the pending transfer to ${a.pendingOwner}${a.pendingOwner===b?" (the vault)":""}. The pending owner is set to the zero address, so nobody can accept it and this wallet keeps the family. A new transfer can then be started with a different choice of how accrued fees are paid.`}else if(i==="accept"){if(!$||a.pendingOwner!==b)throw new c("Pay Later accept needs this wallet to own the family and a pending transfer to the vault.");E();let p=await g();I={to:b,data:Je()},s=`Accept custody of the entire family into the vault. Positions: ${re(p)}. Fees already accrued are paid to this wallet, the previous owner, as set when the transfer was started: ${pe(p,a.pendingClaims)}. ${xe} ${Oe(fe(a.terms),v,a.protocolRecipient,a.protocolShareBps)}`}else if(i==="release"){if(!C)throw new c("Pay Later release needs the vault to own the family.");if(a.pendingOwner!==x)throw new c("Pay Later release is already pending back to the beneficiary; the next step is accept-back.");I={to:b,data:Xe()},s=`Release the family from vault custody. This starts a two-step hand-back to the beneficiary ${v} with every fee-claim bit set (mask ${A}). The vault still owns the family until the next step, accept-back, is sent by this wallet; reserved inventory stays in the vault to cover open orders (${a.accountedReserved} subject base units reserved at this block). Free inventory and earnings remain withdrawable by the beneficiary.`}else if(i==="accept-back"){if(!C||a.pendingOwner!==v||a.pendingClaims!==A)throw new c("Pay Later accept-back needs the vault to own the family and the released family pending back to this wallet with every fee-claim bit set.");let p=await g();I={to:j,data:Ze(P)},s=`Accept the released family back from the vault: this wallet becomes the owner of every family position again. Positions: ${re(p)}. Fees accrued at acceptance are paid to the previous owner, which is the vault ${b}, as PoolManager claims. They are not paid to this wallet; the vault's redeemClaims, which anyone may call, turns them into vault inventory or beneficiary earnings. Oak has no tool to redeem PoolManager claims. Reserved inventory (${a.accountedReserved} subject base units) stays in the vault to cover open orders.`}else if(i==="withdraw-earnings"){let p=m===a.subject?a.owedSubject:m===a.quote?a.owedQuote:d(await u(e,b,V,"owed",[m],t));Q(p),I={to:b,data:Ne(m,v,String(f))},s=`Withdraw ${f} base units of ${ae(m)} from the earnings the vault owes its beneficiary (${p} owed at this block) to the beneficiary wallet ${v}. No other recipient can be chosen.`}else Q(a.accountedFree),I={to:b,data:et(v,String(f))},s=`Withdraw ${f} base units of the subject token ${a.subject} from the vault's free inventory (${a.accountedFree} free at this block; ${a.accountedReserved} reserved for open orders and not withdrawable) to the beneficiary wallet ${v}. No other recipient can be chosen.`;try{await e.call({account:v,to:I.to,data:I.data,blockNumber:t})}catch{throw new c(`Pay Later ${i} simulation failed at the named block; refresh the custody conditions.`)}return await X(e,a.block),{step:i,action:I,block:a.block,familyId:P,member:a.member,vault:b,beneficiary:v,summary:`${Fe(a)} ${s}`}}function it(e){return e.familyOwner===e.vault?e.pendingOwner===e.owner?"released, pending back to beneficiary":"in custody":e.familyOwner===e.owner?e.pendingOwner===e.vault?"transfer pending to vault":"not transferred":"family held by another owner"}async function yt(e,t,r,o){let i=Z(r,["familyId"],["familyId"]),n=await qe(e,t,i.familyId,o),l=await he(e,t,n.familyId,n.memberCount);await X(e,n.block);let m=it(n),f=n.pendingOwner===x?"no transfer is pending":`on acceptance by ${n.pendingOwner}, accrued fees are paid to the current owner ${n.familyOwner}: ${pe(l,n.pendingClaims)}`,a=`${Fe(n)} Custody: ${m}. Family owner ${n.familyOwner}; pending owner ${n.pendingOwner}; ${f}. Subject ${n.subject}, quote ${ae(n.quote)}, pool ${n.poolId}. Inventory in subject base units: ${n.accountedFree} free and withdrawable, ${n.accountedReserved} reserved for open orders. Owed to the beneficiary in base units: ${n.owedSubject} subject, ${n.owedQuote} quote. Owed to the protocol recipient ${n.protocolRecipient}: ${n.protocolOwed} quote. Next position ID ${n.nextPositionId}. Band reach ${n.custodyReachBps} bps; the vault accepts custody only at 100000 or more. The vault's accounting invariant ${n.accountingInvariant?"holds":"DOES NOT hold: its balances are below what it has accounted"}. Protocol premium share ${n.protocolShareBps} bps. Immutable terms: ${R.map(P=>`${P} ${n.terms[P]}`).join(", ")}.`;return{block:{number:String(n.block.number),hash:n.block.hash,timestamp:String(n.block.timestamp)},vault:n.vault,beneficiary:n.owner,familyId:n.familyId,member:String(n.member),memberCount:String(n.memberCount),custody:m,familyOwner:n.familyOwner,pendingOwner:n.pendingOwner,pendingClaims:String(n.pendingClaims),pendingClaimsWords:f,poolId:n.poolId,root:n.root,rules:n.rules,subject:n.subject,quote:n.quote,protocolRecipient:n.protocolRecipient,protocolShareBps:String(n.protocolShareBps),accountedFree:String(n.accountedFree),accountedReserved:String(n.accountedReserved),owedSubject:String(n.owedSubject),owedQuote:String(n.owedQuote),protocolOwed:String(n.protocolOwed),nextPositionId:String(n.nextPositionId),custodyReachBps:String(n.custodyReachBps),accountingInvariant:n.accountingInvariant,bandLiquidity:String(n.bandLiquidity),liveBandLiquidity:String(n.liquidity),bandTickLower:String(n.bandTickLower),bandTickUpper:String(n.bandTickUpper),anchorCeiling:String(n.anchorCeiling),guardPrice:String(n.guardPrice),terms:n.terms,summary:a}}export{mt as a,fe as b,Qe as c,Ce as d,Oe as e,Ye as f,Ke as g,Je as h,Xe as i,Ze as j,Ne as k,et as l,L as m,Re as n,tt as o,Ae as p,nt as q,at as r,qe as s,pt as t,yt as u};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{b as l,c as A}from"./
|
|
1
|
+
import{b as l,c as A}from"./5KKAN7XQ.js";import{b as h}from"./SCG5HWMN.js";import{e as o,h as b}from"./NWNYJ26T.js";import{b as f}from"./EWZFZUVF.js";var c=()=>({bonus:"unavailable",checks:["LayerBank bonus is unavailable. The base rate excludes rewards."]});function d(e){return typeof e=="number"&&Number.isFinite(e)&&e>=0}function I(e){let n=typeof e=="string"&&/^\d+$/.test(e)?Number(e):e;return typeof n=="number"&&Number.isSafeInteger(n)&&n>0?n:void 0}function k(e,n){return Math.abs(e-n)<=1e-8*Math.max(1,e,n)}function L(e,n){let t=e.aprRecord;if(!d(e.apr)||!o(t)||!d(t.cumulated)||!Array.isArray(t.breakdowns)||!t.breakdowns.length||!Array.isArray(e.campaigns))return;let m=e.campaigns,u=new Set,a=0,i=1/0;for(let s of t.breakdowns){if(!o(s)||s.type!=="CAMPAIGN"||!d(s.value)||typeof s.identifier!="string"||u.has(s.identifier))return;u.add(s.identifier);let r=m.find(g=>o(g)&&g.campaignId===s.identifier);if(!o(r)||r.distributionChainId!==f||r.opportunityId!==e.id||!d(r.apr)||!k(r.apr,s.value)||!o(r.params)||!b(r.params.targetToken,l)||!b(r.params.underlyingToken,A.address))return;let y=I(r.startTimestamp),p=I(r.endTimestamp);if(y===void 0||p===void 0||y>n||p<=n||y>=p)return;a+=s.value,i=Math.min(i,p)}if(!(!d(a)||!k(a,e.apr)||!k(a,t.cumulated)))return{bonus:{ratePct:a,endsAt:i},checks:[]}}async function T(e=h(),n=Math.floor(Date.now()/1e3)){try{let t=new URL("https://api.merkl.xyz/v4/opportunities");t.search=new URLSearchParams({chainId:String(f),mainProtocolId:"layerbank",campaigns:"true",items:"100"}).toString();let m=await e(t.toString(),{method:"GET",headers:{"User-Agent":"oak-core/layerbank"}});if(!m.ok)return c();let u=await m.json();if(!Array.isArray(u))return c();let a=u.filter(i=>o(i)&&i.chainId===f&&b(i.explorerAddress,l)&&i.status==="LIVE"&&i.action==="LEND");return a.length!==1||!o(a[0])?c():L(a[0],n)??c()}catch{return c()}}export{T as a};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as C,b as O}from"./
|
|
1
|
+
import{a as C,b as O}from"./L3IAEXQR.js";import{a as f,b as k}from"./266VIESP.js";import{d as i}from"./XV6F3RET.js";import{a as y,c as w}from"./LFSJDFMY.js";import{b as d}from"./EWZFZUVF.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 G}from"./
|
|
1
|
+
import{a as G}from"./A72ADVYF.js";import{b as I}from"./K5C6QBOO.js";import{b as M}from"./BY2OWKZB.js";import{h as C}from"./2GXHYI23.js";import{b as W}from"./SPJCSEKP.js";import{a as U}from"./43LI5NKJ.js";import{a as P}from"./66F5ZH34.js";import{g as $}from"./NWNYJ26T.js";import{b as R}from"./IX3GZMTM.js";import{b as h,e as y,j as T,k as b}from"./EWZFZUVF.js";import{a as p}from"./XSD5NL7J.js";import{encodeFunctionData as A,erc20Abi as E,parseAbi as N}from"viem";var f=T[h].vaults.spark.address,i={address:b,chainId:h,symbol:"USDG",decimals:y},m={address:f,chainId:h,symbol:"spUSDG",decimals:6},_=(1n<<256n)-1n,k=N(["function asset() view returns (address)","function decimals() view returns (uint8)","function totalAssets() view returns (uint256)","function balanceOf(address owner) view returns (uint256)","function maxDeposit(address receiver) view returns (uint256)","function maxWithdraw(address owner) view returns (uint256)","function maxRedeem(address owner) view returns (uint256)","function previewDeposit(uint256 assets) view returns (uint256)","function previewWithdraw(uint256 assets) view returns (uint256)","function previewRedeem(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)"]),t=(s,l)=>({token:{...s},amount:l.toString()});function D(s,l,v=!1){if(!s||typeof s!="object"||Array.isArray(s)||Object.keys(s).some(g=>!l||g!=="amount"))throw new p(l?"Provide only the amount for this Spark action.":"Spark listing takes no arguments.");if(!l)return 0n;if(v&&s.amount==="max")return"max";if(typeof s.amount!="string")throw new p("Amount must be a positive integer string in base units.");let n=R(s.amount);if(n===0n||n>_)throw new p("Amount must be positive and within the uint256 range.");return n}var F=s=>{async function l(a){try{return await a()}catch(e){throw new p(s.plainError(e))}}async function v(a){U(a);let e=s.clientFor(h);if(await e.getChainId()!==h)throw new p("Spark requires an endpoint on chain 4663.");let[r,d,o]=await Promise.all([e.readContract({address:f,abi:k,functionName:"asset"}),e.readContract({address:f,abi:k,functionName:"decimals"}),e.readContract({address:b,abi:E,functionName:"decimals"})]);if(typeof r!="string"||!$(r,b))throw new p("Spark does not report the expected USDG asset on chain 4663.");if(d!==m.decimals||o!==i.decimals)throw new p("Spark shares and USDG must both have 6 decimals.");return async(u,x=[])=>{let c=await e.readContract({address:f,abi:k,functionName:u,args:x});if(typeof c!="bigint"||c<0n||c>_)throw new p(`Spark returned an invalid ${u} value.`);return c}}function n(a){let e=a.amount.startsWith("-"),r=e?a.amount.slice(1):a.amount;return`${e?"-":""}${s.formatAmount(r,a.token.decimals)} ${a.token.symbol}`}async function g(a,e,r,d){let o=await s.preview(a,e),u=o.changes.map(n).join(", ");return{txs:a,amounts:r,preview:o,summary:`${d} Preview values can change before execution. ${o.summary}${u?` Changes: ${u}.`:""}`}}return{positions:a=>l(async()=>{let e=await v(a),r=await e("balanceOf",[a]);if(r===0n)return[];let[d,o,u]=await Promise.all([e("previewRedeem",[r]),e("maxRedeem",[a]),e("maxWithdraw",[a])]);return[{module:"spark",id:`${h}:${f}`,chainId:h,assets:[t(m,r)],economics:{principal:d===0n?[]:[C("redeemable",{token:{...i},amount:d.toString(),source:"spark.previewRedeem",heldAs:m.address})],debt:[],rewards:[],backing:[],coverage:{complete:!0}},description:`${n(t(m,r))}; redeem preview ${n(t(i,d))} (rounded down). Current maximum redeem ${n(t(m,o))}; maximum withdrawal ${n(t(i,u))}.`}]}),tools:[I(s),...M(s),...G(s),{name:"spark_list",inputSchema:{type:"object",properties:{},additionalProperties:!1},execute:(a,e)=>l(async()=>{D(a,!1);let r=await v(e),d=await r("totalAssets"),[o,u,x,c,w]=await Promise.all([r("balanceOf",[e]),r("maxDeposit",[e]),r("maxWithdraw",[e]),r("maxRedeem",[e]),r("previewDeposit",[1000000n])]),S=await r("previewRedeem",[o]);return[{chainId:h,address:f,name:"Spark Savings USDG",asset:{...i},shareToken:{...m},totalAssets:t(i,d),balance:t(m,o),maxDeposit:t(i,u),maxWithdraw:t(i,x),maxRedeem:t(m,c),previewDepositAssets:t(i,1000000n),previewDeposit:t(m,w),previewRedeemShares:t(m,o),previewRedeem:t(i,S),rounding:"Deposit shares and redeemed assets round down; exact-asset withdrawals round shares up. Previews can change before execution."}]})},{name:"spark_deposit",inputSchema:{type:"object",properties:{amount:P('Amount of USDG in base units (USDG has 6 decimals). Example: "1000000" = 1 USDG.')},required:["amount"],additionalProperties:!1},execute:(a,e)=>l(async()=>{let r=D(a,!0),d=await v(e),[o,u]=await Promise.all([d("maxDeposit",[e]),d("previewDeposit",[r])]);if(r>o)throw new p("The deposit exceeds Spark\u2019s current maximum deposit.");if(u===0n)throw new p("This deposit would return zero Spark shares.");let x=[s.approval(b,f,r.toString(),h),s.unsignedTx({to:f,data:A({abi:k,functionName:"deposit",args:[r,e]}),value:"0",chainId:h,description:`Deposit ${n(t(i,r))} into Spark for this wallet.`})];return g(x,e,{assets:t(i,r),shares:t(m,u),maxDeposit:t(i,o)},`Approve exactly ${n(t(i,r))} for Spark ${f}, then deposit. Expected ${n(t(m,u))}, rounded down; current maximum deposit ${n(t(i,o))}.`)})},{name:"spark_withdraw",inputSchema:{type:"object",properties:{amount:{type:"string",anyOf:[{pattern:"^[0-9]+$"},{const:"max"}],description:'Amount of USDG in base units (USDG has 6 decimals; "1000000" = 1 USDG), or "max" to redeem all held shares.'}},required:["amount"],additionalProperties:!1},execute:(a,e)=>l(async()=>{let r=D(a,!0,!0),d=await v(e),[o,u,x]=await Promise.all([d("balanceOf",[e]),d("maxWithdraw",[e]),d("maxRedeem",[e])]);if(o===0n)throw new p("This wallet has no Spark shares to withdraw.");let c,w,S;if(r==="max"){if(w=o,w>x)throw new p("The full share balance exceeds Spark\u2019s current maximum redeem. Request an asset amount within the current maximum withdrawal.");c=await d("previewRedeem",[w]),S=A({abi:k,functionName:"redeem",args:[w,e,e]})}else{if(c=r,c>u)throw new p("The withdrawal exceeds Spark\u2019s current maximum withdrawal.");if(w=await d("previewWithdraw",[c]),w>o)throw new p("This wallet has insufficient Spark shares for the withdrawal.");S=A({abi:k,functionName:"withdraw",args:[c,e,e]})}if(c===0n||w===0n)throw new p("Spark returned a zero asset or share preview for this withdrawal.");let j=r==="max"?`Redeem all ${n(t(m,w))} from Spark to this wallet.`:`Withdraw ${n(t(i,c))} from Spark to this wallet.`,O=[s.unsignedTx({to:f,data:S,value:"0",chainId:h,description:j})];return g(O,e,{assets:t(i,c),shares:t(m,w),maxWithdraw:t(i,u),maxRedeem:t(m,x)},r==="max"?`Redeem all ${n(t(m,w))} for an expected ${n(t(i,c))}, rounded down. Current maximum redeem ${n(t(m,x))}.`:`Withdraw ${n(t(i,c))} using an expected ${n(t(m,w))}, rounded up. Current maximum withdrawal ${n(t(i,u))}.`)})}]}};function te(s){return W("spark",[F(s)])}export{F as a,te as b};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{b as s}from"./
|
|
1
|
+
import{b as s}from"./CJMVRV34.js";import{a as u}from"./7WXAS54T.js";import{a as p}from"./B7WZJHIJ.js";import{f as a}from"./NWNYJ26T.js";import{a as r}from"./XSD5NL7J.js";import{erc20Abi as f,getAddress as i,parseAbi as g,zeroAddress as b}from"viem";var w={type:"string",pattern:"^(0|[1-9][0-9]*)$",maxLength:78},O={type:"string",pattern:"^0x[0-9a-fA-F]{64}$"},R={blockNumber:{...w,description:"Optional named chain-4663 block; defaults to the head captured once for this read."}},T=g(["function launchFee() view returns (uint256 fee,address treasury,uint256 pendingFee,address pendingTreasury,uint256 readyAt)"]),k=p;function B(e,n,t=[]){let o=a(e,"Provide the documented Hookr object.");if(Object.keys(o).some(d=>!n.includes(d))||t.some(d=>!Object.hasOwn(o,d)))throw new r("Provide exactly the documented Hookr fields; wallet overrides are not accepted.");return o}function l(e,n=256){if(typeof e!="string"||!/^(0|[1-9][0-9]*)$/.test(e)||e.length>78||BigInt(e)>=1n<<BigInt(n))throw new r(`Provide a decimal integer string within uint${n}.`);return BigInt(e)}function N(e){return e.blockNumber===void 0?void 0:l(e.blockNumber,64)}function S(e){if(typeof e!="string"||!/^0x[0-9a-fA-F]{64}$/.test(e))throw new r("Provide an exact bytes32 Hookr ID.");return e.toLowerCase()}function $(e){if(typeof e!="string"||!/^0x[0-9a-fA-F]{40}$/.test(e)||i(e)!==e)throw new r("Provide an EIP-55 checksummed address.");return i(e)}function y(e,n=256){if(typeof e!="bigint"&&(typeof e!="number"||!Number.isSafeInteger(e)))throw new r("Hookr integer read is incomplete. Retry the named-block read.");let t=BigInt(e);if(t<0n||t>=1n<<BigInt(n))throw new r("Hookr integer read is outside its ABI bounds.");return t}function E(e){if(typeof e!="boolean")throw new r("Hookr boolean read is incomplete.");return e}function j(e,n){if(!Array.isArray(e)||e.length!==n)throw new r("Hookr tuple read is incomplete.");return e}var C=e=>a(e,"Hookr struct read is incomplete.");function F(e){return JSON.parse(JSON.stringify(e,(n,t)=>typeof t=="bigint"||typeof t=="number"?String(t):t))}function V(e){return k[e].abi}function m(e,n,t,o,d,c){return e.readContract({address:n,abi:t,functionName:o,args:d,blockNumber:c})}var L=i(s.rootV1),_=i(s.registry),D=i(s.poolManager),J=i(s.agentGateV1);function K(e){if(e===i(s.rulesV1))return"rulesV1";if(e===i(s.rulesPrevious))return"rules";if(e===i(s.rulesLegacy))return"rulesLegacy";throw new r("Unknown Hookr core deployment. Review and pin it before reading this position.")}async function U(e,n,t){if(n===b)return{address:u,symbol:"ETH",decimals:18,chainId:4663};let[o,d]=await Promise.all([m(e,n,f,"symbol",[],t),m(e,n,f,"decimals",[],t)]),c=y(d,8);if(typeof o!="string"||o.length===0||new TextEncoder().encode(o).length>128)throw new r("Hookr token metadata is incomplete. Retry before valuing this currency.");return{address:n,symbol:o,decimals:Number(c),chainId:4663}}export{w as a,O as b,R as c,T as d,B as e,l as f,N as g,S as h,$ as i,y as j,E as k,j as l,C as m,F as n,V as o,m as p,L as q,_ as r,D as s,J as t,K as u,U as v};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var a={chainId:4663,usdg:"0x5fc5360D0400a0Fd4f2af552ADD042D716F1d168",v4:{poolManager:"0x8366a39CC670B4001A1121B8F6A443A643e40951",swapper:"0x7Cd4E04E433E69e588728c86A3832753B5F846d4",quoter:"0x8dc178efb8111bb0973dd9d722ebeff267c98f94",stateView:"0xf3334192d15450cdd385c8b70e03f9a6bd9e673b"},v3:{router:"0xCaf681a66D020601342297493863E78C959E5cb2",quoter:"0x33e885eD0Ec9bF04EcfB19341582aADCb4c8A9E7",factory:"0x1f7d7550B1b028f7571E69A784071F0205FD2EfA"},tokens:[{symbol:"AAPL",token:"0xaF3D76f1834A1d425780943C99Ea8A608f8a93f9",pools:[{v:3,fee:500,pool:"0xAae0d815EE56e4092a5E5C2911E676Fea50B2d6D"},{v:4,fee:3e3,tickSpacing:60,id:"0xc748f4671a867db48b552f6b7650bf3255e05f80f00e3f7aad1b17ccb7898fdb"},{v:3,fee:3e3,pool:"0x783C9bbB765047CFdD2b84b92b2Ca9F11D34b7Ed"}]},{symbol:"AMD",token:"0x86923f96303D656E4aa86D9d42D1e57ad2023fdC",pools:[{v:3,fee:3e3,pool:"0x48D284A2A4d3DC1b3Da08231Fe44317e7e7Aa51f"}]},{symbol:"AMZN",token:"0x12f190a9F9d7D37a250758b26824B97CE941bF54",pools:[{v:3,fee:3e3,pool:"0x8AC92DA74AB5F3b1d024Dc1943Ad7e15Dc4179Ef"},{v:4,fee:2400,tickSpacing:24,id:"0xefc94885c96b02696b9b45de43eeeb8ac53c0199cab42b4daae4911b96fb8825"}]},{symbol:"ASML",token:"0x47F93d52cBeC7C6D2CfC080e154002370a60dAEA",pools:[{v:3,fee:1e4,pool:"0xedb22516B14Eb2d1C86927Db373B0E8bF70F5cD1"}]},{symbol:"BABA",token:"0xad25Ac6C84D497db898fa1E8387bf6Af3532a1c4",pools:[{v:4,fee:1e3,tickSpacing:10,id:"0x1791fc651cc794a282e5dbcb56d0b2b38eff8754b677c8876e86901521ecc439"},{v:3,fee:3e3,pool:"0xa57ab582b310dd6f9e934EA1EEEa152741545E6A"}]},{symbol:"COIN",token:"0x6330D8C3178a418788dF01a47479c0ce7CCF450b",pools:[{v:4,fee:2500,tickSpacing:25,id:"0xe2e1a0e32205e854525e0fb1d3667a53bd3b4919f032b9bcd2a038b6b6dac314"},{v:4,fee:1e4,tickSpacing:200,id:"0x007a13fa152f6dc383cad20a8eaab4e1e2538b606936eae2a424f8aa47d6db31"}]},{symbol:"CRCL",token:"0xdF0992E440dD0be65BD8439b609d6D4366bf1CB5",pools:[{v:3,fee:3e3,pool:"0x654E4143e82a5824445Ade0824351C2A9ACD95a8"},{v:4,fee:3e3,tickSpacing:30,id:"0x628c98ab436ee34a6a7decd606242890582591bdf7c9a35d90e0d08021c31ea0"},{v:4,fee:1500,tickSpacing:15,id:"0x5177eac8c2176468bbf15e44081e151d35c2e7d068e96d3db94f496a4dc944b2"}]},{symbol:"CRWV",token:"0x5f10A1C971B69e47e059e1dC91901B59b3fB49C3",pools:[{v:4,fee:9e3,tickSpacing:90,id:"0x237014478f7ef98afbe7412ac35b6a3f96b8fb111de48b7c4dbf49dba4bd9c4b"}]},{symbol:"DELL",token:"0x941AE714EC6D8130c7B75d67160Ca08f1e7d11Dd",pools:[{v:3,fee:1e4,pool:"0xc30c89cB7815A1488b7998D15eEC73961707Fc5a"}]},{symbol:"GME",token:"0x1b0E319c6A659F002271B69dB8A7df2F911c153E",pools:[{v:3,fee:500,pool:"0xE2b46c905E12Ab8E2f864e4821a4325884C1B126"}]},{symbol:"GOOGL",token:"0x2e0847E8910a9732eB3fb1bb4b70a580ADAD4FE3",pools:[{v:3,fee:500,pool:"0x34D0dC122CF9A8Eb296fC5e0D3A233625D7d19b7"},{v:4,fee:300,tickSpacing:3,id:"0x43fe16b75cabbf38f5b185d16142b02d1d9200d8f1ba17cb6cf899f562c6197f"},{v:4,fee:3e3,tickSpacing:60,id:"0xd4ecb79fdc521d7725d22b33ed43cb4e47aa96bfad76aa29577e3151f723ac5e"}]},{symbol:"INTC",token:"0xc72b96e0E48ecd4DC75E1e45396e26300BC39681",pools:[{v:3,fee:3e3,pool:"0x2e5a92f5013a64661A49312111be2e8aBd33F56a"}]},{symbol:"META",token:"0xc0D6457C16Cc70d6790Dd43521C899C87ce02f35",pools:[{v:4,fee:310,tickSpacing:3,id:"0xc58bb68060bcb7b3ea0f6d4a4afef1e57f628722e808db12afb6d1733552872f"},{v:3,fee:3e3,pool:"0x107a7Cb40d8665360ba10E59471Af06150A50922"},{v:4,fee:3e3,tickSpacing:60,id:"0x5875d407a42965b0e768c8925cea290e06fa50603ef34fc99eb92a1050e6ae36"}]},{symbol:"MSFT",token:"0xe93237C50D904957Cf27E7B1133b510C669c2e74",pools:[{v:3,fee:3e3,pool:"0xeb60bCD1D920ad6E102690CCFC6fB488899E1510"},{v:4,fee:3e3,tickSpacing:60,id:"0x9194a557b6a6bb2236b49ea7e2bbccec5d3eeb705aef00903be4b3de1d949579"}]},{symbol:"MSTR",token:"0xec262a75e413fAfD0dF80480274532C79D42da09",pools:[{v:4,fee:2500,tickSpacing:25,id:"0x319bac87e616a89e241c10aeb8afd4892a852cdd8b373cd9765ecddc40b87cfe"},{v:4,fee:2400,tickSpacing:24,id:"0xc105b8300ff65d750a0e4e63c7a879e20504069b770713464a5315e797735326"}]},{symbol:"MU",token:"0xfF080c8ce2E5feadaCa0Da81314Ae59D232d4afD",pools:[{v:3,fee:3e3,pool:"0xd057B1Bc54917855BBee58eAd58647f47caB35E5"}]},{symbol:"NBIS",token:"0x9D9c6684F596F66a64C030B93A886D51Fd4D7931",pools:[{v:4,fee:9900,tickSpacing:99,id:"0x7c2f9ce1214ba9baf56d1b6a1fc640c1b63e9a711172c0c7d10e5a9c4a3d4f0c"}]},{symbol:"NVDA",token:"0xd0601CE157Db5bdC3162BbaC2a2C8aF5320D9EEC",pools:[{v:3,fee:500,pool:"0xd4EB21209C4D6093f80B5b84f5C45cc093EA14a3"},{v:4,fee:100,tickSpacing:1,id:"0x6444a8e0b267406a15db74ca00c4a24bdfa81ed3180f5b6d0851f8ed6f4f29c5"},{v:4,fee:3e3,tickSpacing:60,id:"0x3bb34a44f1b2b5f32c034c38a53065a521a47b199700fa9bd19d60985ff24bf1"}]},{symbol:"ORCL",token:"0xb0992820E760d836549ba69BC7598b4af75dEE03",pools:[{v:4,fee:1e4,tickSpacing:200,id:"0xc2ce4784e1e72cf0221b51b30c8aaadf6c0b12863cf03ab3687854fb7b1d850a"}]},{symbol:"PLTR",token:"0x894E1EC2D74FFE5AEF8Dc8A9e84686acCB964F2A",pools:[{v:4,fee:1500,tickSpacing:15,id:"0xc59eaeda6d1a6f031bc7e1d039772f2d675e7b4de2c8668610f4471bd60b3802"},{v:3,fee:3e3,pool:"0x851680416A4f4E1c463d45171d61ACDdBc8554c0"}]},{symbol:"QQQ",token:"0xD5f3879160bc7c32ebb4dC785F8a4F505888de68",pools:[{v:3,fee:500,pool:"0xD60A5d14dB690B7Afad71F76B108071D7175597d"}]},{symbol:"SGOV",token:"0x92FD66527192E3e61d4DDd13322Aa222DE86F9B5",pools:[{v:3,fee:500,pool:"0x6Ba50150B17Ffd0972915Aaf04fFd5E8f4Fa49b4"},{v:3,fee:3e3,pool:"0xfAb520051f96F4D2a32c22B6a3dD7fFfdf231bFe"}]},{symbol:"SLV",token:"0x411eFb0E7f985935DAec3D4C3ebaEa0d0AD7D89f",pools:[{v:3,fee:3e3,pool:"0x8cB787e6c315D464775289BaD00FDD67d53Ecb3D"},{v:3,fee:1e4,pool:"0x0Fa7BC480885DCf58Ad2ef63eC7289cF2481D51c"}]},{symbol:"SNDK",token:"0xB90A19fF0Af67f7779afF50A882A9CfF42446400",pools:[{v:4,fee:1e4,tickSpacing:200,id:"0x2707cb88a6a40fa0f948f58958051ba097d6f6a3cf7f87929bd68ccc5becea24"}]},{symbol:"SPCX",token:"0x4a0E65A3EcceC6dBe60AE065F2e7bb85Fae35eEa",pools:[{v:3,fee:500,pool:"0xc61284332117c3FB23A2A56cceFFD07F7aF60029"},{v:3,fee:3e3,pool:"0xEb07d9587eFD1778dFb9c385Ec43EF6d5F9fE401"}]},{symbol:"SPY",token:"0x117cc2133c37B721F49dE2A7a74833232B3B4C0C",pools:[{v:4,fee:100,tickSpacing:1,id:"0xe1ae6a4c6ccc9f037389a8d50a4f577bde1a9fe01d85d88ecbbd39955ce53288"},{v:3,fee:500,pool:"0xa7Bb1AC63BBaB0C44316E6c8C455213441689167"},{v:4,fee:500,tickSpacing:5,id:"0xe5923c8a8be481ec89a2ca784a2bbfa4235de6d88f92260fd66b660c4babf907"}]},{symbol:"TSLA",token:"0x322F0929c4625eD5bAd873c95208D54E1c003b2d",pools:[{v:3,fee:3e3,pool:"0xf4ACdAEEB7022862A763C9B1B885e11191c889E3"},{v:4,fee:3e3,tickSpacing:60,id:"0x8517f8071ae5b831b738052f12125e8e3d6c158b78728aa44ce3b25e5104d32e"}]},{symbol:"TSM",token:"0x58FfE4a942d3885bAa22D7520691F611EF09e7AA",pools:[{v:4,fee:7500,tickSpacing:75,id:"0x0ba5d53d2f6255f334b7c8ead4f56b6aef5af3402c5e4d11180afd38c6b85fb1"},{v:3,fee:1e4,pool:"0x07e8Ea83D4C1340774c8965125e26e12bf943bf1"}]},{symbol:"USAR",token:"0xd917B029C761D264c6A312BBbcDA868658eF86a6",pools:[{v:3,fee:3e3,pool:"0x04391780F519B7d3ba59c9590459D76e23d225C4"}]},{symbol:"USO",token:"0xa30FA36Db767ad9eD3f7a60fC79526fB4d56D344",pools:[{v:4,fee:1200,tickSpacing:15,id:"0x1f2ad5a274a776d8e1408292bde1d92d8fa7b6444acf14ad60b9c3e4e5b66420"},{v:3,fee:3e3,pool:"0x02175608F1b5E6b5ed221cCFdC7Be197D111D915"}]}],priceReferences:[{symbol:"AMC",token:"0x05a3d1Cd21d0C88145E82600E62e7E496e0F222B",pools:[{v:4,fee:1e3,tickSpacing:10,id:"0x7499938c352d5b5b8f0c648722aca5ee964ef9b85c3a3041f1ec379726291d9d"},{v:3,fee:3e3,pool:"0xaA34feA710a1A737840329051D81D3B0B7C564d5"},{v:4,fee:500,tickSpacing:5,id:"0x06b9732431bd134599dd112a93c708fe80cadd2fb7dc750fe632e1cbf49fd8c0"}]},{symbol:"AVGO",token:"0x156E175DD063a8cE274C50654eF40e0032b3fbcF",pools:[{v:3,fee:3e3,pool:"0x5B7C404f1d7d77F9f3885aB13d7764F8a173028c"}]},{symbol:"AXON",token:"0xC27dBD474aF5181c5A8777903690D8D262D12648",pools:[{v:4,fee:2500,tickSpacing:25,id:"0x76e3dd1779473383d64c232fd03862f3d8c31136141ab1aae52bcdf2ce897b6e"}]},{symbol:"BA",token:"0x4D21483a44Bf67a86b77E3dA301411880797D452",pools:[{v:3,fee:3e3,pool:"0xc6517047b189c72D3bAa9eF37D1d28F27a63638a"}]},{symbol:"BB",token:"0x48E39E56aCdbA37b09020C0b734A613C9a2f100A",pools:[{v:3,fee:1e4,pool:"0xc424e56e816F148a8B30ccbde2128e04d21f51e9"}]},{symbol:"BE",token:"0x822CC93fFD030293E9842c30BBD678F530701867",pools:[{v:3,fee:3e3,pool:"0x1baD145C8F06444E0dF81c28257cd20231Bd1f16"}]},{symbol:"CEG",token:"0xaE517A2903E68bd929Dfd15be875F8369D53e94a",pools:[{v:4,fee:9e3,tickSpacing:90,id:"0x21e190d0a42ad1b36f957bf2490eef78825d13a579d3a326bf10aadc1d634f4f"},{v:3,fee:1e4,pool:"0xc9529b7dc74BF15da6Cee01a282908E8C7aB6BA3"}]},{symbol:"COST",token:"0x4EA005168D7F09a7A0Ba9D1DEf21a479950E44C2",pools:[{v:3,fee:3e3,pool:"0x0a2121A50A09eD0796ae81F9c53fF9398355a398"}]},{symbol:"CRWD",token:"0xea72Ecca2d0f6bFA1394DBBCff85b52CD4233931",pools:[{v:4,fee:1e3,tickSpacing:10,id:"0xb11086b1ff40749a1e619c0f87299e5c67ac84a8feceee0c039d574e5cd4c520"}]},{symbol:"DIS",token:"0x501B1B3B79750313AD2C4CcCD08586c4C17d7283",pools:[{v:3,fee:3e3,pool:"0x75F7109Eb00Eab50426f19b00Fb05783bD1a0501"}]},{symbol:"DJT",token:"0x1D11f0496982706C5e14A514D4E79F2e6BdE4516",pools:[{v:3,fee:1e4,pool:"0x31a89afd92F9397465649AD03226c52292fc1ae5"}]},{symbol:"F",token:"0x25C288E6D899b9BC30160965aD9644c67e73bE0C",pools:[{v:3,fee:3e3,pool:"0x4dbAC19E895322ac5b93abad9008691632bFFC05"}]},{symbol:"FIG",token:"0x41F4267525a8AFf329540eF24fD83d9044758B33",pools:[{v:3,fee:3e3,pool:"0xca5904C0a9d42F0Ec1Bf760FDf779907877144fD"}]},{symbol:"GLD",token:"0xC9a981FEE1F9DEc688bb123ccDeCc63D0deBFC4e",pools:[{v:3,fee:3e3,pool:"0x7A6A053eCCf1446A2633E05aA6D40D09381997ec"},{v:3,fee:500,pool:"0xBA2f1ed4cEB2169D538d1e614D847E83C5A55913"},{v:3,fee:1e4,pool:"0x32cb909aCF78354E08aa45639Ff5CD33767E730a"}]},{symbol:"GLXY",token:"0x2D427692E928fa156ec22acfaBaFA0447C5805B7",pools:[{v:3,fee:3e3,pool:"0xC67C2D200E0b7E5D99F4CFBede8CB09B48892f2c"}]},{symbol:"HIMS",token:"0xCceE82fE024c36fA15E1005edE3E9e4787e23D09",pools:[{v:4,fee:9e3,tickSpacing:90,id:"0x68d4f28f1432e0ad714658853edb2e6b0b1ac4060355ff3d169fea656b1d1c52"},{v:3,fee:3e3,pool:"0xC8C90d3a1c1a24967E773ac2aD0d456BA3E31F64"}]},{symbol:"IBM",token:"0x980dcf6766FA79f5Cf0c4AAdb3ab477ff15a9619",pools:[{v:3,fee:3e3,pool:"0x8cD848ce18b829C5c769AFf27164078bB52e0E97"},{v:3,fee:1e4,pool:"0xA0A79bC62fC822f3bcDF0EBbc586031781c53a5B"},{v:4,fee:1500,tickSpacing:15,id:"0xfefcd3697193dacac74626b2c8ca15937479605b4ee074670186f746b448028a"},{v:4,fee:9e3,tickSpacing:90,id:"0xd43a51c85ca0b12309a46a8b6c68dd76837fbd3dba5d413cd4686b85a52f9081"}]},{symbol:"INDA",token:"0xACEF2e09adb47aD6aBeBAD9fF06689E60615C2B6",pools:[{v:4,fee:2e3,tickSpacing:20,id:"0x7d0895d8162b0be326ef944faeb5a84f4a08377b9bc9f010e38fa4d268a94469"},{v:3,fee:3e3,pool:"0x2171c94d8073C4913f4653a0766D18aA8A29D1f6"}]},{symbol:"JBL",token:"0xEAf2512dFC1bEAc608F8794B3793CD4E02894Aa6",pools:[{v:4,fee:2500,tickSpacing:25,id:"0xe0c9d8c4ca2e0f2435bb7d07ed6c9a4273397dd097e72fa4d9ba4ee476abfd3f"}]},{symbol:"JNJ",token:"0x03DfbBE0AC4E7bCDaFd08eD41A400326B77D8c80",pools:[{v:3,fee:3e3,pool:"0x7F0aCE18D1dCEd47063CF26e649bc8AB14D09e67"},{v:3,fee:1e4,pool:"0x8d39388EF11Bb78843130Bd74AB0e5d89fA76b30"}]},{symbol:"JPM",token:"0x07c44dA0848960bFf894F17584dB8B2F60B2409E",pools:[{v:3,fee:3e3,pool:"0x3ebDBc2a316F87BaeD3A9d1229E03b0a49A27eC3"}]},{symbol:"KTOS",token:"0x7FD06a4d81cCfA3F351394E144d5191874C31313",pools:[{v:4,fee:2500,tickSpacing:25,id:"0x2204b8dffc2cf19091c5fb124ca745459e41ba5bf6db69f3723c7f5908688819"}]},{symbol:"LLY",token:"0x8005d266423c7ea827372c9c864491e5786600ea",pools:[{v:3,fee:500,pool:"0xF212D02146a897F5F686E9d629F6A73da534324a"},{v:3,fee:3e3,pool:"0xD2038788ebe1e0BFd7C0A6112f09778F3aeAecA6"},{v:3,fee:1e4,pool:"0xF4274130137eeE20bAD928B593d992716516CEB9"}]},{symbol:"LMT",token:"0x329fcACEb9AD6F9580DD5F643fed0646900D043c",pools:[{v:3,fee:3e3,pool:"0x54f160Bea60EC5207918C539d86E0b906b4DA297"},{v:4,fee:5e3,tickSpacing:50,id:"0x0b118d2480ebdb11374d3ad2ea1b935e9458a9f704222004b3b8de07bc98f1eb"}]},{symbol:"LULU",token:"0x4e62068525Ab11FE768e29dfD00ef909B9803016",pools:[{v:3,fee:3e3,pool:"0x0F4227D27082B3BCA6818381b9ea6460275e49f4"}]},{symbol:"MCD",token:"0x2fdaa4604F10F4AE7f66fa48A174bCd25b1ece20",pools:[{v:3,fee:3e3,pool:"0x2e97F9Ec9C6BAC972aB5BC1b8a1A7973B701dd97"}]},{symbol:"MRNA",token:"0x43B07D15cE533bEc5476d70C22a78a1B2B662155",pools:[{v:3,fee:3e3,pool:"0xB40196272A6d2EB5edF6d93bc4DC39856AD95E0E"},{v:3,fee:1e4,pool:"0xA34d0667334074DF2d5BfD259e79E6B9cf1fA8Bf"}]},{symbol:"MRVL",token:"0x62fd0668e10D8B72339BE2DCF7643001688ff13B",pools:[{v:3,fee:3e3,pool:"0xb5E892F0fC6dAAdDA5b927266FE7907e623e4843"}]},{symbol:"NET",token:"0x116F00968269B7bfbaD4109cE591d6E74c0601d4",pools:[{v:3,fee:3e3,pool:"0xA9Caebb1b2fB2b954F192572b309aEf1cAf6a330"}]},{symbol:"NFLX",token:"0xE0444EF8BF4eD74f74FD73686e2ddF4C1c5591E8",pools:[{v:3,fee:3e3,pool:"0x59895C0302F41aEaa129D2fa2442CEc01E7eF45E"},{v:4,fee:1e4,tickSpacing:100,id:"0xe4930a6215f21aa3b37c01adbded3362f56ae31b9a60066f5f9641e601d5111f"}]},{symbol:"NU",token:"0x408c14038a04f7bD235329E26d2bf569ee20e250",pools:[{v:3,fee:1e4,pool:"0xb6d047637151f6De1d02028acdd187Aa9cb7AFE3"},{v:3,fee:3e3,pool:"0x0E3FaEd512E7909758EB924E6919e0057Bd6b45E"}]},{symbol:"ON",token:"0xbBD09F72b025360FeE5C928053Dca6248d35be54",pools:[{v:3,fee:1e4,pool:"0xfcE637eeAd7D62d9ED27F81D9767de03e9E534Cf"}]},{symbol:"P",token:"0x1Cdad396DB64BDa184d5182A97Dd9B3C62100b7D",pools:[{v:4,fee:1e4,tickSpacing:100,id:"0x2300c9273ea3f89e86787cfb01d522ca36be342d40ed754c15feca69f3afbe6a"}]},{symbol:"PANW",token:"0xB039597eD45CBa7B6E2fb9E8BE51802969CEe5Be",pools:[{v:4,fee:1e3,tickSpacing:10,id:"0xb544fd24f37f3d7a6ee3c20e4b4f7797807d92603ccae703149e374337d5013a"}]},{symbol:"PFE",token:"0x7066A64c24e4206CD62E83bf198c1E7EB361F51e",pools:[{v:3,fee:3e3,pool:"0xC7d573Fcda6D2107C97fb582ae18411F9Db32E7f"},{v:4,fee:1500,tickSpacing:15,id:"0x632d9bdccf26e13dbf23b185f29cba47e237371010e1abf7aceaeff653f66be4"},{v:3,fee:1e4,pool:"0xA26dF7296ef5DFc727f3bc6F1E9050E6B62e6abF"}]},{symbol:"POET",token:"0xcf6B2D875361be807EAfa57458c80f28521F9333",pools:[{v:3,fee:1e4,pool:"0xa1C781ed62AC2d0283f50fF5A843647a56ddd80a"}]},{symbol:"PYPL",token:"0xa45aBDc77918F7B9199b022eEe400C0BC5712BD2",pools:[{v:3,fee:3e3,pool:"0x4F59397a5F742dcF91C69763de550f406af7EbfF"}]},{symbol:"QUBT",token:"0x59818904ab4cE163b3cE4FfB64f2D6Ca02c434B4",pools:[{v:3,fee:1e4,pool:"0x2E2a857C08aD6C09f1d1EC4FDB4Cc7cd06cF17f4"},{v:3,fee:3e3,pool:"0x227Bbce9A81B3694b01754298a983Be3F9E44A93"}]},{symbol:"RBLX",token:"0xF0C4BF4C582cb3836e98394b1d4e7B7281101bE8",pools:[{v:3,fee:3e3,pool:"0x1BDB8e3A79Cb1a7F228808739311E23098D33d43"},{v:3,fee:1e4,pool:"0x2ef5945cd5664876b6481FdacFaA2942995a4DA8"},{v:4,fee:1e3,tickSpacing:10,id:"0xf807376333cd408c36d48a11a96309b92c5bd2bca9ba9f0b21800636cb3a30da"}]},{symbol:"RCAT",token:"0xFDE6b5d9BB419B10C23268c74e369AbFF39C0460",pools:[{v:3,fee:1e4,pool:"0x64710a70839585Af718e1B1FAEf9E7f1665F1116"}]},{symbol:"RDDT",token:"0x05b37Fb53A299a1b874A619e1c4C404D52C36F4C",pools:[{v:3,fee:1e4,pool:"0xa8744E76aED23B05F0126335E7BD38f7935D19fe"},{v:4,fee:1e4,tickSpacing:200,id:"0xec481672a94cfe42e2d8c996b7eaeee8a93093d56bd01c1714341971e3f406c1"}]},{symbol:"RIVN",token:"0xB1BF26c1D20ff267A4f93550d1E0d06ac40a114B",pools:[{v:3,fee:3e3,pool:"0xF9e71558eEf115b6C8fbFc9ad5fda00033E9d69C"},{v:3,fee:1e4,pool:"0xb30A75B200D98A600a3766869344928E35823E23"}]},{symbol:"RKLB",token:"0x3b14C39E89D60D627b42a1A4CA45b5bb45Fc12e2",pools:[{v:4,fee:9e3,tickSpacing:90,id:"0xbbc15d66fef8391f53569e19016e86545be9de3f302b82db93ed6165236d22f3"}]},{symbol:"SHOP",token:"0xF53F66751B1Eff985311b693531E3290F600c410",pools:[{v:3,fee:1e4,pool:"0x18A1aFa849A6940870c2163B7ECBCC85d455Ad99"},{v:4,fee:1e4,tickSpacing:100,id:"0x8baff387b51c50e2747e85bcddf87da78fee6efb45629743e1af4dfb07ad13ee"}]},{symbol:"SKHY",token:"0x84CAb63bc87912E71ad199ff14A0bA45de68FeF8",pools:[{v:3,fee:3e3,pool:"0x5F2a5025feb93a4C44DA4E3B37e4fD3Fb0ab5171"}]},{symbol:"SNAP",token:"0xF6589F11Bc40b669e584073F428B05562F568733",pools:[{v:3,fee:3e3,pool:"0x0EbD4650C9e641E9745b5A508A2D46935DFE753E"}]},{symbol:"SNOW",token:"0xBa0CAB75495255d0cB58E22B648bFED4ECD1F47E",pools:[{v:4,fee:1e4,tickSpacing:200,id:"0xac720e95589b7124f0affbdb9e66c7ec6e824c68eae00dc54f9e11b0b294bac8"}]},{symbol:"TE",token:"0xb1969f6604CA1AE7a2cD3F1827876e914594CA2D",pools:[{v:4,fee:1e3,tickSpacing:10,id:"0x87d302c27b610c19114a51f848ba27acd197933493458bea30c558df5cae6cd8"}]},{symbol:"TTWO",token:"0x5e81213613b6B86EaB4c6c50d718d34359459786",pools:[{v:3,fee:3e3,pool:"0xD9Ab4b7fAe6DC2f7020134Ec744A8F53Ef3E5E24"},{v:4,fee:1e4,tickSpacing:200,id:"0x131e6ebeeedb524a1e7590aa3eea3bc8782b5425a78d5128c0ca955190d0ea69"}]},{symbol:"UBER",token:"0xbd335Aa5A1693F0121A5c0Ef18A080E9958DA78b",pools:[{v:3,fee:3e3,pool:"0x0DF328152A3708F99f6cf13fb3c820BbBF9115C1"}]},{symbol:"UPS",token:"0xf23250dac154D05Bb671CB0d0eBEf3c635c79CE2",pools:[{v:3,fee:1e4,pool:"0x3Ab74C45DceCC6A62898204Dd42143a816B44CB1"},{v:3,fee:3e3,pool:"0x5c67a84Ec5494ffE24E217B28dEbb96341014c86"}]},{symbol:"V",token:"0x9BFF87700337babF5099e99F322F888DafB1d551",pools:[{v:3,fee:3e3,pool:"0xfE67885765C29C25A589d99003C19C082664c26f"}]},{symbol:"VTI",token:"0x0594134DF3f171a354D9C85eBD65b7A6148F6D09",pools:[{v:3,fee:1e4,pool:"0xb78DD1A97fa544c65d7D1f12453EcaAF1e05c36d"}]}],unpriced:{AAOI:{token:"0x521Cf887E6531c6F667b5BC4D896E5d9bfE8EB2E",reason:"thin"},ABCL:{token:"0x3139D77Ace0cbAA5bDfD38bD1F1911a794AF0B0e",reason:"no-pool"},ADBE:{token:"0x232B8ed6377BE97813853B0Ac104c4Cda8378d1B",reason:"thin"},AEHR:{token:"0x5F604fBA1162193A4388A5DFa56F556f3E133cC2",reason:"no-pool"},AEIS:{token:"0xfAf9cb261B5FCC1f404Bb10CD39C5c6C1974E612",reason:"no-pool"},ALAB:{token:"0x748c32c3ca24eDf31ea597Db1F3d330a7a6DA3Dc",reason:"no-pool"},AMAT:{token:"0x36046893810a7E7fCE501229d57dc3FC8c8716d0",reason:"thin"},AMBA:{token:"0x99D9D8663545151603863C5AcbD6FC3218899009",reason:"no-pool"},AMKR:{token:"0xDd356AA38F40A7b7076755aC854B6FBb1F0D305B",reason:"thin"},ANET:{token:"0x28bABD556b60E53663B8615036479a29c2CDd1Bf",reason:"thin"},APLD:{token:"0xb8DBf92F9741c9ac1c32115E78581f23509916FD",reason:"thin"},APP:{token:"0xA249BAF1063Af884807C1E1400AEf7784836917E",reason:"no-pool"},ASTS:{token:"0x1AF6446f07eb1d97c546AFC8c9544cBDF3AD5137",reason:"no-pool"},AUR:{token:"0x373C06c4f7BDe527D7Dae4BA169E42b55E393CeD",reason:"no-pool"},AVAV:{token:"0xF6290b5e7C26502e2dA514C31509849718EA76A5",reason:"no-pool"},AXTI:{token:"0x141eEa040c2250eEc0314e336975e81f85f6585e",reason:"no-pool"},BMNR:{token:"0x9a7842EDed60b0FE1e03eEc342C82A397c821eD0",reason:"no-pool"},BND:{token:"0x2F62fC9fAbb470C690f141c28340eD832bB27020",reason:"no-pool"},BULL:{token:"0xceF9027c7d6985b85f0BA431125073529A947A68",reason:"no-pool"},CBRS:{token:"0x5c90450Bbb4273D7b2f17CF6917AEB237A569679",reason:"thin"},CCL:{token:"0x9651342CeA770aE9a2969Ba2A52611523146aef9",reason:"thin"},CELH:{token:"0x8cF07C5A878945185d327aAa6e33FAa95F95e7bF",reason:"no-pool"},CIEN:{token:"0x44f6D488021f8233B9416294d1FE9b1fEe28382d",reason:"no-pool"},CLOV:{token:"0x62200915e7DEab1eC7f79fb246daDbB80eACdDd0",reason:"thin"},CLS:{token:"0xBf449977089c718C004a66C554B26B94ef3Ad4De",reason:"thin"},CLSK:{token:"0xcBB95BBF36099d34dA091dc6Fa6F49EfA257Cee3",reason:"no-pool"},COHR:{token:"0x92F9F459F1a9a5AD266b182BE7Bffd1C6c666894",reason:"no-pool"},CRDO:{token:"0x4D67253bc223e6b0e104F1084c1fb2b669dDC41b",reason:"no-pool"},CRM:{token:"0xd95B44124e475743a7589e68F3D74008A5536D44",reason:"thin"},CSCO:{token:"0xF543967EEBB6f1917992eF0E68De63ab07a5a0dA",reason:"no-pool"},CTSH:{token:"0x63D5a3b6939a33f1e75d8Bcd85759858239600DB",reason:"no-pool"},CVNA:{token:"0xa4f319104089FE321dc8093C6E707d4fE190A988",reason:"no-pool"},DDOG:{token:"0x27c99fBde9D0d2AA4f4Bfb4943f237843DdF6958",reason:"thin"},DOCN:{token:"0xc02f12B9fe9E707079EC0d546f3050d3F6C1F8bD",reason:"no-pool"},ELF:{token:"0x39EC44Bee4F6A116c6F9B8De566848a985C53C60",reason:"quote-failed"},EWT:{token:"0x1c690498150252222C275A5CEd69d3A6b1f52D5E",reason:"no-pool"},EWY:{token:"0x7f0aBeF0C07280F82c6a08ead09dEd6BAE2C13Fc",reason:"thin"},FICO:{token:"0xa48F22A46C0F1C46CA7D111CB6c137c271987180",reason:"no-pool"},FISV:{token:"0x9ECe29A4A2397C0a35fb5fA8EE2b9509130a98cc",reason:"no-pool"},FIX:{token:"0x93Dbb1d2Dc5D63F4abACFF30485273f538Df68Ac",reason:"thin"},FLNC:{token:"0x282e87451E10fA6679BC7D76C69BE44cD3fC777C",reason:"no-pool"},FLY:{token:"0x03BC731Ffb162cdd7B98D3C6542bFC291126075d",reason:"thin"},FTNT:{token:"0x3FB8976980d486084b2eb4a404BD12e72823958f",reason:"thin"},FUTU:{token:"0xeB30663bDFf0622Ef4e4E5cBb4E975F19f33f51D",reason:"no-pool"},GDX:{token:"0xBDFa7A06458Aa26b8E736E0fC87aD37C3BB8Ac2e",reason:"no-pool"},GE:{token:"0x63b814DDBd6BF339f25Fed8c36158a008D5B373e",reason:"no-pool"},GEV:{token:"0x94B8AAE43A1cCc08Aa64B7D1F29b4D920aF4a0C9",reason:"no-pool"},GLW:{token:"0x7c04E6A3368F2A1DE3874f0e80d2e0A1a9915da6",reason:"no-pool"},HII:{token:"0xEB61c0Ed490A367d4E3631cCf8a74B3bfc7E775D",reason:"no-pool"},HPE:{token:"0x59dd09d4900C2E4B5F75b7c0d4E6796fcc234Cb1",reason:"thin"},HWM:{token:"0xAEa445c5F3DB1a462998ccC422A875A361ee5d99",reason:"thin"},IBRX:{token:"0x7c148F74ac7445D1F28366b7FcDC6792a9Fcd0Cf",reason:"no-pool"},INFQ:{token:"0xB853bC83a753342a4f8320ea680b4B1E84118D21",reason:"no-pool"},INOD:{token:"0xf1953DAB6FaD537488d5A022361FfAa8B4c95eC6",reason:"no-pool"},INTU:{token:"0x56d23beE5f41A7120170b0c603Dae30128e460e9",reason:"no-pool"},IONQ:{token:"0x558378E000D634A36593E338eBacdd6207640EfE",reason:"thin"},IREN:{token:"0xF0AB0c93bE6F41369d302e55db1A96b3c430212D",reason:"thin"},JOBY:{token:"0xb334C5cE741B80B5B671F47F5C269Cb193fe8E24",reason:"no-pool"},KLAC:{token:"0x96b933C74eCB4A0926b9210cef7b743EF46be2E9",reason:"no-pool"},KSS:{token:"0x12e3c047bf9AeCAF9dDC98c05C31BFD1dd043993",reason:"no-pool"},LHX:{token:"0x48d60243c66437c6ac3c2495Be94747aEd5Dfe25",reason:"no-pool"},LITE:{token:"0x8eF20885F94e3D9bc7eB3080279188Bd5ED7c08C",reason:"thin"},LRCX:{token:"0x57b0030166DB0C31690d1A5aA167e2e26e2C29a4",reason:"no-pool"},LUNR:{token:"0xa5D4968421bA94814Be3B136b15cf422101aC1a3",reason:"no-pool"},MDB:{token:"0xDdf2266b79abf0B48898959B0ed6E6adf512be74",reason:"no-pool"},MOD:{token:"0xc6Cbad1016b38B797610c25E1dc7D95988B1f362",reason:"no-pool"},MPWR:{token:"0x52D50D0280AD1054b43f052bD70a49a212A1b128",reason:"thin"},MTSI:{token:"0xC93f4d80e268AB922e871bd169156C3CC41894e6",reason:"no-pool"},MXL:{token:"0x48961813349333209994750ffA89b3c5C22eC969",reason:"no-pool"},NAVN:{token:"0xf7181b63Fdb858558A74ba96BC42732684cd7965",reason:"no-pool"},NNE:{token:"0xBEF75684C43c4ea7BD18Dd532a2244674Ee8b926",reason:"thin"},NOW:{token:"0x0C3260aF4B8f13a69c4c2dFb84fD667890CDFa14",reason:"thin"},NVTS:{token:"0xbE6702d7b70315376dC48a3293f24f0982F86386",reason:"no-pool"},OKLO:{token:"0x8B2f88497f15A18E9D4FFa1a8fFB8538399aE774",reason:"no-pool"},ONTO:{token:"0x8ff63eAeEe3fE54Ba450c4F5538064Ec5A893Aef",reason:"no-pool"},OUST:{token:"0x40E7a279850e443f582059ae5dC1c3b6563E6395",reason:"no-pool"},PATH:{token:"0xfb2664f07B6Aadd29ea7a59D8859b1AeB8645cDa",reason:"thin"},PENG:{token:"0x9b23573b156B52565012F5cE02CDF60AFBaa70Be",reason:"no-pool"},PL:{token:"0xAA4d64474c172010aB57719cb9951E6142a100d3",reason:"no-pool"},POWL:{token:"0x237c16D66590F67B886d978ACD362EAeaD8B18c7",reason:"no-pool"},PR:{token:"0x4189F0c66EBBB0bfeF1C31f763131361EF32f77C",reason:"no-pool"},PWR:{token:"0x9Ab02Ead789b6903c3c44d0ED32F9c707CDF12FD",reason:"thin"},QBTS:{token:"0xC583c60aeF9Dc401Da72cEC1B404743a93cea1Cc",reason:"no-pool"},QCOM:{token:"0x0f17206447090e464C277571124dD2688E48AEA9",reason:"no-pool"},RDW:{token:"0x92Ef19E82bD8fF36661DE838D5eaE7e5CEF0EfFE",reason:"no-pool"},RGTI:{token:"0x284358abc07F9359f19f4b5b4aC91901Be2597Ba",reason:"no-pool"},RUN:{token:"0x756Bc80af765C82da966a788858d65aDF14f3793",reason:"thin"},SATS:{token:"0x95052ddcd5DC25641657424A8Cf04834997E1730",reason:"no-pool"},SCHD:{token:"0xd63ABB2C13d7a8421a8017a712802053568e3C1D",reason:"thin"},SHY:{token:"0xBE274710Bf3d9567e1B290eF6a5F9f90ca016FD8",reason:"no-pool"},SIMO:{token:"0x77E655E37F4d913fB9540e0d541D824171a60e81",reason:"no-pool"},SLS:{token:"0x285b231728c7E4333799183DF1094d775246a535",reason:"no-pool"},SMCI:{token:"0xc01aA1fECeC0605b13bc84874ff7256C0f5F562a",reason:"no-pool"},SMH:{token:"0x072f979c2CAc8e1391B0162a87Fee094bF8744a0",reason:"thin"},SMR:{token:"0x1Eebee7F74517e0279dFb09d25B0407bEEc3FDd6",reason:"no-pool"},SOFI:{token:"0x98E75885157C80992A8D41b696D8c9C6Fb30A926",reason:"thin"},SOUN:{token:"0x6E3Dfd9f7e1649BaA14D25cac18C94d62dB10A54",reason:"no-pool"},SOXX:{token:"0x75742c18BC1f1C5c5f448f4C9D9C6F66dafAAa38",reason:"thin"},SPMO:{token:"0xAd622320e520de39e72d41EF07438C3Fd3354875",reason:"no-pool"},TEAM:{token:"0x5B97476b922F3305131B8f0B9D333172E87f4aaE",reason:"no-pool"},TEM:{token:"0xB1CC0EC7Db69Cf43539119814df40071b9d61793",reason:"no-pool"},TER:{token:"0x2778C5024D5cA2CdB0f8eAD671ffc69963AdCD9C",reason:"no-pool"},TSEM:{token:"0x89776d4Cd68193597A2fC132cfaC1fDe36CCeA8a",reason:"no-pool"},TTD:{token:"0x0b5fb4031cae9163db10B169Ee72685F0EdC8545",reason:"no-pool"},UMC:{token:"0x0E6e67Ba88e7b5d9B67636A215c76779B948dE79",reason:"thin"},UNH:{token:"0xcF364ea52787e289De6F32077834056E3E70D6A8",reason:"no-pool"},VICR:{token:"0x6006ed4B2F94110851ff7509D97D034f0EeD9226",reason:"no-pool"},VRT:{token:"0xFA78C12E6488814A0262E4e802749a4a737d5fB7",reason:"thin"},VSAT:{token:"0x26dCbfb34FC83CAbD6990f449674efDc6097fF85",reason:"no-pool"},VST:{token:"0x561e2a49212b7cCF47f2744Ccb83e200722fADBc",reason:"no-pool"},WDAY:{token:"0x82DA4646242e1D962e96e932269Dc644c94a9CaA",reason:"quote-failed"},WDC:{token:"0xF52597345A8Edf418bc4071b4a35112472277D3e",reason:"no-pool"},WULF:{token:"0x348Be1A8663f15edDe5CDf8A96BB69078f7aB6Fd",reason:"thin"},WYFI:{token:"0x9e7ABD3C9139D14E4c86DcE0e455AAB7A0C2FB3E",reason:"thin"},XLK:{token:"0x15Cd20759CE7F3285c29A319dE2D1A2e098c6f43",reason:"thin"},XNDU:{token:"0xA8eB3BCcbf2017eE7CBfb652eB51CF2E1B153289",reason:"no-pool"},XOM:{token:"0xf9B46d3D1B22199D4D1025a9cEDB540A33F1a2d5",reason:"thin"},ZETA:{token:"0xE674C5c071821f48BB2d12CAdb83617Eff438f9e",reason:"no-pool"},ZM:{token:"0x44c4F142009036cF477eD2d09932051843137CF1",reason:"thin"},ZS:{token:"0x7dc013eB55e436f30d7ED1AFE4E36d6e45e3c3f7",reason:"no-pool"}},census:{block:111456101,measuredAt:"2026-11-11T05:12:11.414Z",file:"ops/qa/2026-11-11-stock-census.json",rule:"priceReferences: hookless Uniswap USDG pools with at least 10,000 USDG in range whose 10 USDG quote executed within 2% of the pool spot. unpriced: every other official stock, with the reason: no-pool (no live USDG pool), thin (under 10,000 USDG in range) or quote-failed (enough depth, but the 10 USDG quote failed, so the price is unverified)."},notOffered:{CLSK:"thin",EWY:"thin",IONQ:"thin",RGTI:"thin",RKLB:"thin"},sourceCommit:"02230282d8888e00794207ed271ee01b4ce30309"};export{a};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{b as le,o as K}from"./GYPMUYB5.js";import{b as x}from"./66F5ZH34.js";import{c as W,f as de,h as g,i as ce,l as ue}from"./NWNYJ26T.js";import{b as k,j as oe,k as G}from"./TI727O2H.js";import{a as N}from"./XSD5NL7J.js";import{a as F}from"./JXOEJPJ4.js";import{randomBytes as ye,randomUUID as he}from"node:crypto";import{isDeepStrictEqual as pe}from"node:util";import{decodeFunctionData as me,encodeAbiParameters as ne,erc20Abi as J,keccak256 as ie,parseAbi as re,parseAbiParameters as ae,toEventSelector as be,zeroAddress as L}from"viem";var se=oe[k].meridian,Q=se.PredictionMarketEscrow.address,V=se.SecondaryMarketEscrow.address,$={address:se.CollateralToken_USDe.address,chainId:k,symbol:"USDe",decimals:18},we="wss://relayer.predict.meridian.xyz/auction",ke=ae("(address conditionResolver,bytes conditionId,uint8 predictedOutcome)[]"),Ie=ae("bytes32,uint256,uint256,address,address,address,bytes"),Se=ae("address,address,address,address,uint256,uint256"),X=re(["function isNonceUsed(address,uint256) view returns (bool)"]),Be=re(["function mint(((address conditionResolver,bytes conditionId,uint8 predictedOutcome)[] picks,uint256 predictorCollateral,uint256 counterpartyCollateral,address predictor,address counterparty,uint256 predictorNonce,uint256 counterpartyNonce,uint256 predictorDeadline,uint256 counterpartyDeadline,bytes predictorSignature,bytes counterpartySignature,bytes32 refCode,bytes predictorSessionKeyData,bytes counterpartySessionKeyData,address predictorSponsor,bytes predictorSponsorData) request)"]),Me=re(["function executeTrade((address token,address collateral,address seller,address buyer,uint256 tokenAmount,uint256 price,uint256 sellerNonce,uint256 buyerNonce,uint256 sellerDeadline,uint256 buyerDeadline,bytes sellerSignature,bytes buyerSignature,bytes32 refCode,bytes sellerSessionKeyData,bytes buyerSessionKeyData) request)"]),$e=be("Transfer(address,address,uint256)"),Ce=[{name:"predictionHash",type:"bytes32"},{name:"signer",type:"address"},{name:"collateral",type:"uint256"},{name:"nonce",type:"uint256"},{name:"deadline",type:"uint256"}],ve=[{name:"tradeHash",type:"bytes32"},{name:"signer",type:"address"},{name:"nonce",type:"uint256"},{name:"deadline",type:"uint256"}];function i(n){throw new N(n)}function _(n){return de(n,"Meridian returned an invalid exchange object.")}function M(n,t,d=!1){return d&&typeof n=="number"&&Number.isSafeInteger(n)&&n>=0&&(n=String(n)),(typeof n!="string"||!/^\d+$/.test(n)||BigInt(n)>=1n<<256n)&&i(`Provide ${t} as a decimal base-unit integer string.`),n}function O(n){let t=Number(n);return(!Number.isSafeInteger(t)||t<0||BigInt(t)!==BigInt(n))&&i("Meridian signing terms cannot be represented exactly as JSON numbers."),t}function R(n){let t="Provide a nonzero token, resolver or wallet address.";return ue(ce(n,t),t)}function Z(n,t){return(typeof n!="string"||!/^0x(?:[0-9a-fA-F]{2})+$/.test(n)||t!==void 0&&n.length!==2+t*2)&&i("Meridian returned invalid hexadecimal data."),n}function A(n){return(typeof n!="string"||n.length===0||n.length>256)&&i("Meridian returned an invalid exchange identifier."),n}function j(){return BigInt(Math.floor(Date.now()/1e3))}function Ae(n,t){let d=n==="buy"?["picks","stake","minCounterpartyCollateral","usdgAmountIn","slippageBps","continuation","signature"]:["token","amount","minPrice","slippageBps","continuation","signature"];Object.keys(t).some(S=>!d.includes(S))&&i("Unsupported Meridian arguments; use the tool input schema."),t.slippageBps!==void 0&&(typeof t.slippageBps!="number"||!Number.isInteger(t.slippageBps)||t.slippageBps<0||t.slippageBps>=1e4)&&i("Slippage must be an integer from 0 to 9999 basis points.");let c=t.slippageBps;if(n==="sell"){let S=M(t.amount,"the position amount");BigInt(S)===0n&&i("The position amount must be positive.");let B=R(t.token);(g(B,$.address)||g(B,G))&&i("Choose a Meridian position token to sell.");let C;if(t.minPrice!==void 0){let e=M(t.minPrice,"the minimum sale price");BigInt(e)<=1n&&i("The minimum sale price must be greater than 1 base unit."),C=e}else{let e=BigInt(S)/100n>10n**18n?BigInt(S)/100n:10n**18n;C=c===void 0?e.toString():K(e.toString(),c)}return{side:n,token:B,amount:S,minPrice:C,priceFloorSource:t.minPrice===void 0?"default":"explicit",...c===void 0?{}:{slippageBps:c}}}(!Array.isArray(t.picks)||t.picks.length<1||t.picks.length>10)&&i("Provide between one and ten Meridian picks.");let m=t.picks.map(S=>{let B=_(S);return(Object.keys(B).some(C=>!["conditionResolver","conditionId","predictedOutcome"].includes(C))||B.predictedOutcome!==0&&B.predictedOutcome!==1)&&i("Each pick needs a resolver, condition ID and outcome 0 or 1."),{conditionResolver:R(B.conditionResolver),conditionId:Z(B.conditionId),predictedOutcome:B.predictedOutcome}}).sort((S,B)=>{let C=`${S.conditionResolver.toLowerCase()}:${S.conditionId.toLowerCase()}:${S.predictedOutcome}`,e=`${B.conditionResolver.toLowerCase()}:${B.conditionId.toLowerCase()}:${B.predictedOutcome}`;return C<e?-1:C>e?1:0}),y=m.map(S=>`${S.conditionResolver.toLowerCase()}:${S.conditionId.toLowerCase()}`);new Set(y).size!==m.length&&i("Do not repeat a condition in the same prediction.");let l=M(t.stake,"the USDe stake");BigInt(l)<10n**18n&&i("Meridian requires a stake of at least 1 USDe.");let I=t.usdgAmountIn===void 0?void 0:M(t.usdgAmountIn,"the USDG swap amount");I!==void 0&&BigInt(I)===0n&&i("The USDG swap amount must be positive.");let D=t.minCounterpartyCollateral!==void 0?M(t.minCounterpartyCollateral,"the minimum counterparty collateral"):K(l,c??le);return BigInt(D)<=1n&&i("The minimum counterparty collateral must be greater than 1 base unit."),{side:n,picks:m,stake:l,minCounterpartyCollateral:D,...I===void 0?{}:{usdgAmountIn:I},...c===void 0?{}:{slippageBps:c}}}var ee=class{constructor(t,d){this.id=t;this.prefix=d;this.socket=new globalThis.WebSocket(we),this.socket.addEventListener("open",()=>{this.opened=!0,this.notify?.()}),this.socket.addEventListener("close",()=>this.stop("Meridian exchange socket was lost. Start a fresh auction.")),this.socket.addEventListener("error",()=>this.stop("Meridian exchange socket failed. Start a fresh auction.")),this.socket.addEventListener("message",c=>{try{(typeof c.data!="string"||c.data.length>65536)&&i("Meridian returned a malformed exchange message.");let m=_(JSON.parse(c.data));if(m.type==="pong")return;let y=A(m.type),l=_(m.payload);if(y==="error"&&i("Meridian rejected or failed the exchange. Start a fresh auction."),y===`${d}.ack`){this.auctionId===void 0?((l.id!==t||this.accepting||l.accepted!==void 0)&&i("Meridian acknowledged a different exchange."),l.error!==void 0&&i(`Meridian rejected the exchange: ${F(A(l.error))}.`),this.auctionId=A(l.auctionId)):((!this.accepting||l.auctionId!==this.auctionId||l.id!==void 0&&l.id!==t)&&i("Meridian acknowledged a different exchange."),l.error!==void 0&&i(`Meridian rejected acceptance: ${F(A(l.error))}.`),l.accepted!==!0&&i("Meridian rejected acceptance of the exchange."));return}if((!y.startsWith(`${d}.`)||l.auctionId!==this.auctionId||!this.auctionId)&&i("Meridian returned a message for a different exchange."),["error","rejected","failed","expired"].some(I=>y===`${d}.${I}`)){let I=["reason","makerReason"].flatMap(D=>l[D]===void 0?[]:[`${D}=${F(A(l[D]))}`]);i(`Meridian exchange ${y.slice(d.length+1)}${I.length?`: ${I.join("; ")}`:""}. Start a fresh auction.`)}if((y===`${d}.pending`||y===`${d}.filled`)&&!this.accepting&&i("Meridian returned settlement before acceptance."),y===`${d}.pending`)return;this.queue.length>=16&&i("Meridian returned too many exchange messages."),this.queue.push({type:y,payload:l}),this.notify?.()}catch(m){this.stop(m instanceof N?m.message:"Meridian rejected or returned an invalid exchange message. Start a fresh auction.")}})}id;prefix;socket;queue=[];notify;error;auctionId;accepting=!1;opened=!1;check(){if(this.error)throw this.error;this.socket.readyState>1&&i("Meridian exchange socket was lost. Start a fresh auction.")}stop(t){this.error??=new N(t),this.notify?.(),this.socket.readyState<2&&this.socket.close()}async wait(t,d=3e4){return new Promise((c,m)=>{let y=setTimeout(()=>this.stop("Meridian exchange timed out. Start a fresh auction."),d),l=()=>{try{if(this.check(),t===void 0?!this.opened:!this.queue.length)return;let I=t===void 0?void 0:this.queue.shift();I&&I.type!==`${this.prefix}.${t}`&&i("Meridian returned an unexpected exchange stage."),clearTimeout(y),this.notify=void 0,c(I?.payload??{})}catch(I){clearTimeout(y),this.notify=void 0,m(I)}};this.notify=l,l()})}send(t,d){this.check(),this.socket.readyState!==1&&i("Meridian exchange socket is not open."),t==="accept"&&(this.accepting=!0),this.socket.send(JSON.stringify({...t==="start"?{id:this.id}:{},type:`${this.prefix}.${t}`,payload:d}))}};function te(n){return ie(ne(ke,[n]))}function De(n,t,d){return ie(ne(Ie,[te(n.picks),BigInt(n.stake),BigInt(d.counterpartyCollateral),t,d.counterparty,L,"0x"]))}function Pe(n,t,d,c){return ie(ne(Se,[n.token,$.address,t,d,BigInt(n.amount),BigInt(c)]))}function Y(n,t){let{input:d,wallet:c,nonce:m,deadline:y}=n,l={name:d.side==="buy"?"PredictionMarketEscrow":"SecondaryMarketEscrow",version:"1",chainId:k,verifyingContract:n.continuation.escrowContract};return(!m||!y)&&i("Meridian exchange is missing its signing terms."),d.side==="buy"?(t||i("Meridian has not returned a winning bid."),{domain:l,primaryType:"MintApproval",types:{MintApproval:Ce},message:{predictionHash:De(d,c,t),signer:c,collateral:d.stake,nonce:m,deadline:y}}):{domain:l,primaryType:"TradeApproval",types:{TradeApproval:ve},message:{tradeHash:Pe(d,c,t?t.buyer:L,t?t.price:"0"),signer:c,nonce:m,deadline:y}}}function fe(n){let t=[BigInt(n.deadline)],d=n.continuation;if(d.stage==="primary_accept"||d.stage==="secondary_accept"){t.push(BigInt(d.acceptDeadline));let c=d.winningBid;d.stage==="primary_accept"&&t.push(BigInt(c.counterpartyDeadline)),c.buyerDeadline!==void 0&&t.push(BigInt(M(c.buyerDeadline,"the buyer deadline",!0)))}return t.reduce((c,m)=>c<m?c:m)}function H(n){n.channel?.check(),n.deadline&&j()>=fe(n)&&i("Meridian exchange expired. Start a fresh auction.")}var Fe=n=>{let t=new Map;function d(e){clearTimeout(e.timer),t.delete(e.continuation.requestId),e.channel?.stop("Meridian exchange is closed or expired. Start a fresh auction.")}function c(e,a){clearTimeout(e.timer),e.timer=setTimeout(()=>d(e),a),e.timer.unref?.()}function m(e){let{wallet:a,chainId:s,escrowContract:f,requestId:u}=e.continuation;return{wallet:a,chainId:s,escrowContract:f,requestId:u}}function y(e){return e.side!=="sell"?"":` Effective minimum sale proceeds: ${e.minPrice} USDe base units (${$.address}, 18 decimals). ${e.priceFloorSource==="explicit"?"Caller minPrice is unchanged; slippageBps does not reduce this floor.":`Default floor with ${e.slippageBps??0} bps slippage applied.`}`}async function l(e){let{input:a,wallet:s}=e,f=n.clientFor(k),u=a.side==="buy"?$.address:a.token,r=a.side==="buy"?a.stake:a.amount,[h,w]=await Promise.all([f.readContract({address:u,abi:J,functionName:"balanceOf",args:[s]}),f.readContract({address:u,abi:J,functionName:"allowance",args:[s,e.continuation.escrowContract]})]);if(a.side==="sell"&&await f.readContract({address:u,abi:J,functionName:"decimals"})!==18&&i("Meridian position tokens must have 18 decimals."),h>=BigInt(r)&&w>=BigInt(r))return;(e.continuation.stage==="primary_accept"||e.continuation.stage==="secondary_accept")&&i("Meridian prerequisites changed during the auction. Start a fresh auction after funding and approval.");let p,v;if(h<BigInt(r)){a.side==="sell"&&i("The wallet does not have enough position tokens to sell."),a.usdgAmountIn||i("Not enough USDe. Provide usdgAmountIn in USDG base units to quote a swap before the auction.");let b=await n.quoteSwap({from:G,to:$.address,amountIn:a.usdgAmountIn,...a.slippageBps===void 0?{}:{slippageBps:a.slippageBps}},s);(j()>=BigInt(M(b.expiresAt,"the swap expiry"))||BigInt(M(b.minAmountOut,"the swap minimum"))+h<BigInt(r))&&i("The USDG swap minimum does not cover the USDe stake, or the quote expired. Request a fresh quote with sufficient input.");let o=await n.buildSwap(b.quoteId,s);(!("txs"in o)||!o.txs.length)&&i("The swap coordinator did not return prerequisite transactions."),p=o.txs,v=`${o.summary} Minimum USDe output: ${b.minAmountOut} base units (18 decimals).`}else p=[n.approval(u,e.continuation.escrowContract,r,k)],v=`Approve exactly ${r} base units (18 decimals) of ${u} for ${e.continuation.escrowContract} on chain ${k}.`;p.some(b=>b.chainId!==k)&&i("Meridian prerequisite transactions must use chain 4663.");let P=await n.preview(p,s),T=P.changes.map(b=>{let o=b.amount.startsWith("-");return`${o?"-":"+"}${n.formatAmount(o?b.amount.slice(1):b.amount,b.token.decimals)} ${b.token.symbol} (${b.token.address}, chain ${b.token.chainId}, ${b.token.decimals} decimals)`}).join("; ");return e.channel?.stop("Meridian prerequisites must be mined before the auction."),e.channel=void 0,e.deadline=void 0,e.nonce=void 0,e.continuation={...m(e),stage:"prerequisites"},{steps:p.map(b=>({kind:"tx",tx:b})),continuation:structuredClone(e.continuation),summary:`${v}${y(a)} ${P.summary} ${T}. Mine these prerequisites before continuing; no RFQ has started.`}}function I(e){let a=e.continuation;a.stage==="prerequisites"&&i("Meridian prerequisites need to finish before signing."),H(e),c(e,Number(fe(e)-j())*1e3);let s=e.input,f=s.side==="buy"?`Stake ${s.stake} base units of USDe (${$.address}, 18 decimals)`:`Sell ${s.amount} base units of position ${s.token} (18 decimals)`,u=a.stage==="secondary_start"?"Initial buyer-zero, price-zero intent only.":a.stage==="primary_accept"?`Counterparty ${a.winningBid.counterparty}; counterparty collateral ${a.winningBid.counterpartyCollateral} USDe base units; counterparty deadline ${a.winningBid.counterpartyDeadline}.`:`Buyer ${a.winningBid.buyer}; receive ${a.winningBid.price} USDe base units (${$.address}, 18 decimals).`;return{steps:[{kind:"typedData",request:structuredClone(a.request)}],continuation:structuredClone(a),summary:`${f} on chain ${k}.${y(s)} Approval was checked on chain. ${u} Sign locally for domain ${a.request.domain.name}, version 1, escrow ${a.escrowContract}, signature deadline ${e.deadline}${"acceptDeadline"in a?`, acceptance deadline ${a.acceptDeadline}`:""}. External relayer settlement is pending; a signature is not a fill.`}}async function D(e){let a=await e.channel.wait("result"),s=_(a.winningBid),f=A(a.auctionId);s.auctionId!==f&&i("Meridian winning bid belongs to another auction.");let u=M(a.acceptDeadline,"the acceptance deadline",!0);if(e.input.side==="buy"){let r={auctionId:f,counterparty:A(s.counterparty),counterpartyCollateral:M(s.counterpartyCollateral,"the counterparty collateral"),counterpartyNonce:M(s.counterpartyNonce,"the counterparty nonce",!0),counterpartyDeadline:M(s.counterpartyDeadline,"the counterparty deadline",!0),receivedAt:A(s.receivedAt)};R(r.counterparty),(!Number.isFinite(Date.parse(r.receivedAt))||BigInt(r.counterpartyCollateral)<=1n||BigInt(r.counterpartyCollateral)<BigInt(e.input.minCounterpartyCollateral))&&i("Meridian winning bid counterparty collateral is below the caller minimum."),e.continuation={...m(e),stage:"primary_accept",auctionId:f,winningBid:r,acceptDeadline:u,request:Y(e,r)}}else{let r={auctionId:f,buyer:A(s.buyer),price:M(s.price,"the sale price"),...s.buyerDeadline!==void 0?{buyerDeadline:M(s.buyerDeadline,"the buyer deadline",!0)}:{},...s.buyerNonce!==void 0?{buyerNonce:M(s.buyerNonce,"the buyer nonce",!0)}:{},...s.receivedAt!==void 0?{receivedAt:A(s.receivedAt)}:{}};R(r.buyer),(BigInt(r.price)<=1n||BigInt(r.price)<BigInt(e.input.minPrice))&&i("Meridian winning bid sale price is below the caller minimum."),e.continuation={...m(e),stage:"secondary_accept",auctionId:f,winningBid:r,acceptDeadline:u,request:Y(e,r)}}return I(e)}async function S(e,a){let s=e.continuation;s.stage!=="primary_accept"&&s.stage!=="secondary_accept"&&i("Meridian exchange is not ready for acceptance."),H(e),e.channel.send("accept",{auctionId:s.auctionId,[e.input.side==="buy"?"predictorSignature":"sellerSignature"]:a}),c(e,15e4);let f=await e.channel.wait("filled",12e4),u=Z(f.transactionHash,32),r=n.clientFor(k),[h,w]=await Promise.all([r.waitForTransactionReceipt({hash:u,timeout:12e4}),r.getTransaction({hash:u})]);(h.status!=="success"||!g(h.transactionHash,u)||!g(w.hash,u)||!g(h.to,s.escrowContract)||!g(w.to,s.escrowContract)||w.chainId!==k)&&i("Meridian fill has no matching successful receipt on chain 4663.");let{input:p,wallet:v}=e;if(p.side==="buy"&&s.stage==="primary_accept"){let o=me({abi:Be,data:w.input}).args[0];(!g(te([...o.picks]),te(p.picks))||o.predictorCollateral!==BigInt(p.stake)||o.counterpartyCollateral!==BigInt(s.winningBid.counterpartyCollateral)||!g(o.predictor,v)||!g(o.counterparty,s.winningBid.counterparty)||o.predictorNonce!==BigInt(e.nonce)||o.predictorDeadline!==BigInt(e.deadline)||!g(o.predictorSponsor,L)||o.predictorSponsorData!=="0x"||!g(o.predictorSignature,a))&&i("Meridian mint receipt does not match the accepted prediction.")}else if(p.side==="sell"&&s.stage==="secondary_accept"){let o=me({abi:Me,data:w.input}).args[0];(!g(o.token,p.token)||!g(o.collateral,$.address)||!g(o.seller,v)||!g(o.buyer,s.winningBid.buyer)||o.tokenAmount!==BigInt(p.amount)||o.price!==BigInt(s.winningBid.price)||o.sellerNonce!==BigInt(e.nonce)||o.sellerDeadline!==BigInt(e.deadline)||!g(o.sellerSignature,a))&&i("Meridian sale receipt does not match the accepted trade.")}let P=new Map,T=new Map;for(let o of h.logs){if(o.topics[0]!==$e||o.topics.length!==3)continue;(!/^0x[0-9a-fA-F]{64}$/.test(o.data)||!o.topics.slice(1).every(ge=>/^0x0{24}[0-9a-fA-F]{40}$/.test(ge)))&&i("Meridian receipt has malformed transfer logs.");let U=`0x${o.topics[1].slice(-40)}`,E=`0x${o.topics[2].slice(-40)}`,q=o.address.toLowerCase(),z=BigInt(o.data);P.set(q,(P.get(q)??0n)+(g(E,v)?z:0n)-(g(U,v)?z:0n)),g(U,L)&&g(E,v)&&T.set(q,(T.get(q)??0n)+z)}let b;if(p.side==="buy"&&s.stage==="primary_accept"){let o=BigInt(p.stake)+BigInt(s.winningBid.counterpartyCollateral),U=[...T].filter(([E,q])=>!g(E,$.address)&&q===o&&P.get(E)===o);(U.length!==1||P.get($.address.toLowerCase())!==-BigInt(p.stake))&&i("Meridian mint receipt does not prove the expected collateral and position delta."),b=`${o} base units received in position ${U[0][0]}`}else p.side==="sell"&&s.stage==="secondary_accept"?((P.get(p.token.toLowerCase())!==-BigInt(p.amount)||P.get($.address.toLowerCase())!==BigInt(s.winningBid.price))&&i("Meridian sale receipt does not prove the expected collateral and position delta."),b=`${p.amount} base units sold from position ${p.token}; ${s.winningBid.price} USDe base units received`):i("Meridian fill has a different exchange stage.");return{txs:[],hashes:[u],status:"mined",summary:`Mined: ${u}. Status: mined. Meridian ${p.side} filled by the external relayer. Successful receipt and transfer deltas verified on chain ${k}: ${b} (18 decimals); collateral USDe ${$.address} (18 decimals).`}}async function B(e,a,s){let f=R(s),u=Ae(e,a),r;if(a.continuation!==void 0){let h=_(a.continuation),w=t.get(A(h.requestId));w||i("Meridian exchange is lost or expired. Start a fresh auction."),(!g(w.wallet,f)||!pe(w.input,u)||!pe(w.continuation,h))&&i("Meridian continuation or arguments do not match the active wallet exchange."),w.busy&&i("Meridian exchange is already processing this continuation."),r=w}else{a.signature!==void 0&&i("A signature requires an active Meridian continuation."),t.size>=1e3&&i("Too many active Meridian exchanges. Please try again later.");let h=he(),w=setTimeout(()=>{let p=t.get(h);p&&d(p)},9e5);w.unref?.(),r={input:u,wallet:f,continuation:{stage:"prerequisites",wallet:f,chainId:k,escrowContract:e==="buy"?Q:V,requestId:h},busy:!1,timer:w},t.set(h,r)}r.busy=!0;try{H(r),await n.clientFor(k).getChainId()!==k&&i("Meridian requires an RPC on chain 4663.");let h=r.continuation.stage;h==="prerequisites"&&a.signature!==void 0&&i("Do not sign before Meridian prerequisites have mined.");let w=await l(r);if(w)return w;if(h==="prerequisites")return r.nonce=(ye(4).readUInt32BE()+1).toString(),r.deadline=(j()+300n).toString(),await n.clientFor(k).readContract({address:r.continuation.escrowContract,abi:X,functionName:"isNonceUsed",args:[f,BigInt(r.nonce)]})&&i(`Meridian ${e==="buy"?"predictor":"seller"} nonce is already used. Start a fresh auction.`),r.channel=new ee(r.continuation.requestId,e==="buy"?"auction":"secondary.auction"),await r.channel.wait(),u.side==="buy"?(r.channel.send("start",{id:r.continuation.requestId,picks:u.picks,predictorCollateral:u.stake,predictor:f,predictorNonce:O(r.nonce),predictorDeadline:O(r.deadline),chainId:k,escrowContract:Q,mode:"blind"}),await D(r)):(r.continuation={...m(r),stage:"secondary_start",request:Y(r)},I(r));let p=Z(a.signature);if(e==="sell"&&await n.clientFor(k).readContract({address:V,abi:X,functionName:"isNonceUsed",args:[f,BigInt(r.nonce)]})&&i("Meridian seller nonce is already used. Start a fresh auction."),e==="buy"&&await n.clientFor(k).readContract({address:Q,abi:X,functionName:"isNonceUsed",args:[f,BigInt(r.nonce)]})&&i("Meridian predictor nonce is already used. Start a fresh auction."),H(r),h==="secondary_start"&&u.side==="sell")return r.channel.send("start",{id:r.continuation.requestId,token:u.token,collateral:$.address,tokenAmount:u.amount,seller:f,sellerNonce:O(r.nonce),sellerDeadline:O(r.deadline),chainId:k,escrowContract:V,mode:"blind",sellerSignature:p}),await D(r);let v=await S(r,p);return d(r),v}catch(h){throw d(r),new N(n.plainError(h))}finally{r.busy=!1}}let C={continuation:{type:"object",description:"Internal continuation returned by the previous local signing round."},signature:{type:"string",pattern:"^0x([0-9a-fA-F]{2})+$",description:"Internal hexadecimal signature supplied by local signing; never enter manually."}};return{tools:[{name:"meridian_buy",inputSchema:{type:"object",additionalProperties:!1,required:["picks","stake"],properties:{...C,stake:x('USDe stake in base units (18 decimals): "1000000000000000000" = 1 USDe.'),minCounterpartyCollateral:x('Minimum counterparty USDe collateral in base units (18 decimals): "1000000000000000000" = 1 USDe.'),usdgAmountIn:x('USDG swap input in base units if USDe is short (6 decimals): "1000000" = 1 USDG.'),slippageBps:{type:"integer",minimum:0,maximum:9999,description:"Slippage in basis points (50 = 0.5%)."},picks:{type:"array",minItems:1,maxItems:10,items:{type:"object",additionalProperties:!1,required:["conditionResolver","conditionId","predictedOutcome"],properties:{conditionResolver:{...W,description:"Condition resolver contract address on chain 4663."},conditionId:{type:"string",pattern:"^0x([0-9a-fA-F]{2})+$",description:"Condition identifier as a 0x-prefixed even-length hex string."},predictedOutcome:{type:"integer",enum:[0,1],description:"Predicted binary outcome, 0 or 1, as defined by the condition."}}},description:"Prediction picks for the auction."}}},execute:(e,a)=>B("buy",e,a)},{name:"meridian_sell",inputSchema:{type:"object",additionalProperties:!1,required:["token","amount"],properties:{...C,token:{...W,description:"Position token address on chain 4663."},amount:x('Position token amount in base units (18 decimals): "1000000000000000000" = 1 position token.'),minPrice:x('Minimum total USDe proceeds in base units (18 decimals): "1000000000000000000" = 1 USDe. Explicit minimum is not reduced by slippage.'),slippageBps:{type:"integer",minimum:0,maximum:9999,description:"Slippage in basis points (50 = 0.5%); applies only to the default floor when minPrice is omitted."}}},execute:(e,a)=>B("sell",e,a)}]}};export{Ce as a,ve as b,Fe as c};
|
|
1
|
+
import{b as le,o as K}from"./TTBB6EFN.js";import{b as x}from"./66F5ZH34.js";import{c as W,f as de,h as g,i as ce,l as ue}from"./NWNYJ26T.js";import{b as k,j as oe,k as G}from"./EWZFZUVF.js";import{a as N}from"./XSD5NL7J.js";import{a as F}from"./JXOEJPJ4.js";import{randomBytes as ye,randomUUID as he}from"node:crypto";import{isDeepStrictEqual as pe}from"node:util";import{decodeFunctionData as me,encodeAbiParameters as ne,erc20Abi as J,keccak256 as ie,parseAbi as re,parseAbiParameters as ae,toEventSelector as be,zeroAddress as L}from"viem";var se=oe[k].meridian,Q=se.PredictionMarketEscrow.address,V=se.SecondaryMarketEscrow.address,$={address:se.CollateralToken_USDe.address,chainId:k,symbol:"USDe",decimals:18},we="wss://relayer.predict.meridian.xyz/auction",ke=ae("(address conditionResolver,bytes conditionId,uint8 predictedOutcome)[]"),Ie=ae("bytes32,uint256,uint256,address,address,address,bytes"),Se=ae("address,address,address,address,uint256,uint256"),X=re(["function isNonceUsed(address,uint256) view returns (bool)"]),Be=re(["function mint(((address conditionResolver,bytes conditionId,uint8 predictedOutcome)[] picks,uint256 predictorCollateral,uint256 counterpartyCollateral,address predictor,address counterparty,uint256 predictorNonce,uint256 counterpartyNonce,uint256 predictorDeadline,uint256 counterpartyDeadline,bytes predictorSignature,bytes counterpartySignature,bytes32 refCode,bytes predictorSessionKeyData,bytes counterpartySessionKeyData,address predictorSponsor,bytes predictorSponsorData) request)"]),Me=re(["function executeTrade((address token,address collateral,address seller,address buyer,uint256 tokenAmount,uint256 price,uint256 sellerNonce,uint256 buyerNonce,uint256 sellerDeadline,uint256 buyerDeadline,bytes sellerSignature,bytes buyerSignature,bytes32 refCode,bytes sellerSessionKeyData,bytes buyerSessionKeyData) request)"]),$e=be("Transfer(address,address,uint256)"),Ce=[{name:"predictionHash",type:"bytes32"},{name:"signer",type:"address"},{name:"collateral",type:"uint256"},{name:"nonce",type:"uint256"},{name:"deadline",type:"uint256"}],ve=[{name:"tradeHash",type:"bytes32"},{name:"signer",type:"address"},{name:"nonce",type:"uint256"},{name:"deadline",type:"uint256"}];function i(n){throw new N(n)}function _(n){return de(n,"Meridian returned an invalid exchange object.")}function M(n,t,d=!1){return d&&typeof n=="number"&&Number.isSafeInteger(n)&&n>=0&&(n=String(n)),(typeof n!="string"||!/^\d+$/.test(n)||BigInt(n)>=1n<<256n)&&i(`Provide ${t} as a decimal base-unit integer string.`),n}function O(n){let t=Number(n);return(!Number.isSafeInteger(t)||t<0||BigInt(t)!==BigInt(n))&&i("Meridian signing terms cannot be represented exactly as JSON numbers."),t}function R(n){let t="Provide a nonzero token, resolver or wallet address.";return ue(ce(n,t),t)}function Z(n,t){return(typeof n!="string"||!/^0x(?:[0-9a-fA-F]{2})+$/.test(n)||t!==void 0&&n.length!==2+t*2)&&i("Meridian returned invalid hexadecimal data."),n}function A(n){return(typeof n!="string"||n.length===0||n.length>256)&&i("Meridian returned an invalid exchange identifier."),n}function j(){return BigInt(Math.floor(Date.now()/1e3))}function Ae(n,t){let d=n==="buy"?["picks","stake","minCounterpartyCollateral","usdgAmountIn","slippageBps","continuation","signature"]:["token","amount","minPrice","slippageBps","continuation","signature"];Object.keys(t).some(S=>!d.includes(S))&&i("Unsupported Meridian arguments; use the tool input schema."),t.slippageBps!==void 0&&(typeof t.slippageBps!="number"||!Number.isInteger(t.slippageBps)||t.slippageBps<0||t.slippageBps>=1e4)&&i("Slippage must be an integer from 0 to 9999 basis points.");let c=t.slippageBps;if(n==="sell"){let S=M(t.amount,"the position amount");BigInt(S)===0n&&i("The position amount must be positive.");let B=R(t.token);(g(B,$.address)||g(B,G))&&i("Choose a Meridian position token to sell.");let C;if(t.minPrice!==void 0){let e=M(t.minPrice,"the minimum sale price");BigInt(e)<=1n&&i("The minimum sale price must be greater than 1 base unit."),C=e}else{let e=BigInt(S)/100n>10n**18n?BigInt(S)/100n:10n**18n;C=c===void 0?e.toString():K(e.toString(),c)}return{side:n,token:B,amount:S,minPrice:C,priceFloorSource:t.minPrice===void 0?"default":"explicit",...c===void 0?{}:{slippageBps:c}}}(!Array.isArray(t.picks)||t.picks.length<1||t.picks.length>10)&&i("Provide between one and ten Meridian picks.");let m=t.picks.map(S=>{let B=_(S);return(Object.keys(B).some(C=>!["conditionResolver","conditionId","predictedOutcome"].includes(C))||B.predictedOutcome!==0&&B.predictedOutcome!==1)&&i("Each pick needs a resolver, condition ID and outcome 0 or 1."),{conditionResolver:R(B.conditionResolver),conditionId:Z(B.conditionId),predictedOutcome:B.predictedOutcome}}).sort((S,B)=>{let C=`${S.conditionResolver.toLowerCase()}:${S.conditionId.toLowerCase()}:${S.predictedOutcome}`,e=`${B.conditionResolver.toLowerCase()}:${B.conditionId.toLowerCase()}:${B.predictedOutcome}`;return C<e?-1:C>e?1:0}),y=m.map(S=>`${S.conditionResolver.toLowerCase()}:${S.conditionId.toLowerCase()}`);new Set(y).size!==m.length&&i("Do not repeat a condition in the same prediction.");let l=M(t.stake,"the USDe stake");BigInt(l)<10n**18n&&i("Meridian requires a stake of at least 1 USDe.");let I=t.usdgAmountIn===void 0?void 0:M(t.usdgAmountIn,"the USDG swap amount");I!==void 0&&BigInt(I)===0n&&i("The USDG swap amount must be positive.");let D=t.minCounterpartyCollateral!==void 0?M(t.minCounterpartyCollateral,"the minimum counterparty collateral"):K(l,c??le);return BigInt(D)<=1n&&i("The minimum counterparty collateral must be greater than 1 base unit."),{side:n,picks:m,stake:l,minCounterpartyCollateral:D,...I===void 0?{}:{usdgAmountIn:I},...c===void 0?{}:{slippageBps:c}}}var ee=class{constructor(t,d){this.id=t;this.prefix=d;this.socket=new globalThis.WebSocket(we),this.socket.addEventListener("open",()=>{this.opened=!0,this.notify?.()}),this.socket.addEventListener("close",()=>this.stop("Meridian exchange socket was lost. Start a fresh auction.")),this.socket.addEventListener("error",()=>this.stop("Meridian exchange socket failed. Start a fresh auction.")),this.socket.addEventListener("message",c=>{try{(typeof c.data!="string"||c.data.length>65536)&&i("Meridian returned a malformed exchange message.");let m=_(JSON.parse(c.data));if(m.type==="pong")return;let y=A(m.type),l=_(m.payload);if(y==="error"&&i("Meridian rejected or failed the exchange. Start a fresh auction."),y===`${d}.ack`){this.auctionId===void 0?((l.id!==t||this.accepting||l.accepted!==void 0)&&i("Meridian acknowledged a different exchange."),l.error!==void 0&&i(`Meridian rejected the exchange: ${F(A(l.error))}.`),this.auctionId=A(l.auctionId)):((!this.accepting||l.auctionId!==this.auctionId||l.id!==void 0&&l.id!==t)&&i("Meridian acknowledged a different exchange."),l.error!==void 0&&i(`Meridian rejected acceptance: ${F(A(l.error))}.`),l.accepted!==!0&&i("Meridian rejected acceptance of the exchange."));return}if((!y.startsWith(`${d}.`)||l.auctionId!==this.auctionId||!this.auctionId)&&i("Meridian returned a message for a different exchange."),["error","rejected","failed","expired"].some(I=>y===`${d}.${I}`)){let I=["reason","makerReason"].flatMap(D=>l[D]===void 0?[]:[`${D}=${F(A(l[D]))}`]);i(`Meridian exchange ${y.slice(d.length+1)}${I.length?`: ${I.join("; ")}`:""}. Start a fresh auction.`)}if((y===`${d}.pending`||y===`${d}.filled`)&&!this.accepting&&i("Meridian returned settlement before acceptance."),y===`${d}.pending`)return;this.queue.length>=16&&i("Meridian returned too many exchange messages."),this.queue.push({type:y,payload:l}),this.notify?.()}catch(m){this.stop(m instanceof N?m.message:"Meridian rejected or returned an invalid exchange message. Start a fresh auction.")}})}id;prefix;socket;queue=[];notify;error;auctionId;accepting=!1;opened=!1;check(){if(this.error)throw this.error;this.socket.readyState>1&&i("Meridian exchange socket was lost. Start a fresh auction.")}stop(t){this.error??=new N(t),this.notify?.(),this.socket.readyState<2&&this.socket.close()}async wait(t,d=3e4){return new Promise((c,m)=>{let y=setTimeout(()=>this.stop("Meridian exchange timed out. Start a fresh auction."),d),l=()=>{try{if(this.check(),t===void 0?!this.opened:!this.queue.length)return;let I=t===void 0?void 0:this.queue.shift();I&&I.type!==`${this.prefix}.${t}`&&i("Meridian returned an unexpected exchange stage."),clearTimeout(y),this.notify=void 0,c(I?.payload??{})}catch(I){clearTimeout(y),this.notify=void 0,m(I)}};this.notify=l,l()})}send(t,d){this.check(),this.socket.readyState!==1&&i("Meridian exchange socket is not open."),t==="accept"&&(this.accepting=!0),this.socket.send(JSON.stringify({...t==="start"?{id:this.id}:{},type:`${this.prefix}.${t}`,payload:d}))}};function te(n){return ie(ne(ke,[n]))}function De(n,t,d){return ie(ne(Ie,[te(n.picks),BigInt(n.stake),BigInt(d.counterpartyCollateral),t,d.counterparty,L,"0x"]))}function Pe(n,t,d,c){return ie(ne(Se,[n.token,$.address,t,d,BigInt(n.amount),BigInt(c)]))}function Y(n,t){let{input:d,wallet:c,nonce:m,deadline:y}=n,l={name:d.side==="buy"?"PredictionMarketEscrow":"SecondaryMarketEscrow",version:"1",chainId:k,verifyingContract:n.continuation.escrowContract};return(!m||!y)&&i("Meridian exchange is missing its signing terms."),d.side==="buy"?(t||i("Meridian has not returned a winning bid."),{domain:l,primaryType:"MintApproval",types:{MintApproval:Ce},message:{predictionHash:De(d,c,t),signer:c,collateral:d.stake,nonce:m,deadline:y}}):{domain:l,primaryType:"TradeApproval",types:{TradeApproval:ve},message:{tradeHash:Pe(d,c,t?t.buyer:L,t?t.price:"0"),signer:c,nonce:m,deadline:y}}}function fe(n){let t=[BigInt(n.deadline)],d=n.continuation;if(d.stage==="primary_accept"||d.stage==="secondary_accept"){t.push(BigInt(d.acceptDeadline));let c=d.winningBid;d.stage==="primary_accept"&&t.push(BigInt(c.counterpartyDeadline)),c.buyerDeadline!==void 0&&t.push(BigInt(M(c.buyerDeadline,"the buyer deadline",!0)))}return t.reduce((c,m)=>c<m?c:m)}function H(n){n.channel?.check(),n.deadline&&j()>=fe(n)&&i("Meridian exchange expired. Start a fresh auction.")}var Fe=n=>{let t=new Map;function d(e){clearTimeout(e.timer),t.delete(e.continuation.requestId),e.channel?.stop("Meridian exchange is closed or expired. Start a fresh auction.")}function c(e,a){clearTimeout(e.timer),e.timer=setTimeout(()=>d(e),a),e.timer.unref?.()}function m(e){let{wallet:a,chainId:s,escrowContract:f,requestId:u}=e.continuation;return{wallet:a,chainId:s,escrowContract:f,requestId:u}}function y(e){return e.side!=="sell"?"":` Effective minimum sale proceeds: ${e.minPrice} USDe base units (${$.address}, 18 decimals). ${e.priceFloorSource==="explicit"?"Caller minPrice is unchanged; slippageBps does not reduce this floor.":`Default floor with ${e.slippageBps??0} bps slippage applied.`}`}async function l(e){let{input:a,wallet:s}=e,f=n.clientFor(k),u=a.side==="buy"?$.address:a.token,r=a.side==="buy"?a.stake:a.amount,[h,w]=await Promise.all([f.readContract({address:u,abi:J,functionName:"balanceOf",args:[s]}),f.readContract({address:u,abi:J,functionName:"allowance",args:[s,e.continuation.escrowContract]})]);if(a.side==="sell"&&await f.readContract({address:u,abi:J,functionName:"decimals"})!==18&&i("Meridian position tokens must have 18 decimals."),h>=BigInt(r)&&w>=BigInt(r))return;(e.continuation.stage==="primary_accept"||e.continuation.stage==="secondary_accept")&&i("Meridian prerequisites changed during the auction. Start a fresh auction after funding and approval.");let p,v;if(h<BigInt(r)){a.side==="sell"&&i("The wallet does not have enough position tokens to sell."),a.usdgAmountIn||i("Not enough USDe. Provide usdgAmountIn in USDG base units to quote a swap before the auction.");let b=await n.quoteSwap({from:G,to:$.address,amountIn:a.usdgAmountIn,...a.slippageBps===void 0?{}:{slippageBps:a.slippageBps}},s);(j()>=BigInt(M(b.expiresAt,"the swap expiry"))||BigInt(M(b.minAmountOut,"the swap minimum"))+h<BigInt(r))&&i("The USDG swap minimum does not cover the USDe stake, or the quote expired. Request a fresh quote with sufficient input.");let o=await n.buildSwap(b.quoteId,s);(!("txs"in o)||!o.txs.length)&&i("The swap coordinator did not return prerequisite transactions."),p=o.txs,v=`${o.summary} Minimum USDe output: ${b.minAmountOut} base units (18 decimals).`}else p=[n.approval(u,e.continuation.escrowContract,r,k)],v=`Approve exactly ${r} base units (18 decimals) of ${u} for ${e.continuation.escrowContract} on chain ${k}.`;p.some(b=>b.chainId!==k)&&i("Meridian prerequisite transactions must use chain 4663.");let P=await n.preview(p,s),T=P.changes.map(b=>{let o=b.amount.startsWith("-");return`${o?"-":"+"}${n.formatAmount(o?b.amount.slice(1):b.amount,b.token.decimals)} ${b.token.symbol} (${b.token.address}, chain ${b.token.chainId}, ${b.token.decimals} decimals)`}).join("; ");return e.channel?.stop("Meridian prerequisites must be mined before the auction."),e.channel=void 0,e.deadline=void 0,e.nonce=void 0,e.continuation={...m(e),stage:"prerequisites"},{steps:p.map(b=>({kind:"tx",tx:b})),continuation:structuredClone(e.continuation),summary:`${v}${y(a)} ${P.summary} ${T}. Mine these prerequisites before continuing; no RFQ has started.`}}function I(e){let a=e.continuation;a.stage==="prerequisites"&&i("Meridian prerequisites need to finish before signing."),H(e),c(e,Number(fe(e)-j())*1e3);let s=e.input,f=s.side==="buy"?`Stake ${s.stake} base units of USDe (${$.address}, 18 decimals)`:`Sell ${s.amount} base units of position ${s.token} (18 decimals)`,u=a.stage==="secondary_start"?"Initial buyer-zero, price-zero intent only.":a.stage==="primary_accept"?`Counterparty ${a.winningBid.counterparty}; counterparty collateral ${a.winningBid.counterpartyCollateral} USDe base units; counterparty deadline ${a.winningBid.counterpartyDeadline}.`:`Buyer ${a.winningBid.buyer}; receive ${a.winningBid.price} USDe base units (${$.address}, 18 decimals).`;return{steps:[{kind:"typedData",request:structuredClone(a.request)}],continuation:structuredClone(a),summary:`${f} on chain ${k}.${y(s)} Approval was checked on chain. ${u} Sign locally for domain ${a.request.domain.name}, version 1, escrow ${a.escrowContract}, signature deadline ${e.deadline}${"acceptDeadline"in a?`, acceptance deadline ${a.acceptDeadline}`:""}. External relayer settlement is pending; a signature is not a fill.`}}async function D(e){let a=await e.channel.wait("result"),s=_(a.winningBid),f=A(a.auctionId);s.auctionId!==f&&i("Meridian winning bid belongs to another auction.");let u=M(a.acceptDeadline,"the acceptance deadline",!0);if(e.input.side==="buy"){let r={auctionId:f,counterparty:A(s.counterparty),counterpartyCollateral:M(s.counterpartyCollateral,"the counterparty collateral"),counterpartyNonce:M(s.counterpartyNonce,"the counterparty nonce",!0),counterpartyDeadline:M(s.counterpartyDeadline,"the counterparty deadline",!0),receivedAt:A(s.receivedAt)};R(r.counterparty),(!Number.isFinite(Date.parse(r.receivedAt))||BigInt(r.counterpartyCollateral)<=1n||BigInt(r.counterpartyCollateral)<BigInt(e.input.minCounterpartyCollateral))&&i("Meridian winning bid counterparty collateral is below the caller minimum."),e.continuation={...m(e),stage:"primary_accept",auctionId:f,winningBid:r,acceptDeadline:u,request:Y(e,r)}}else{let r={auctionId:f,buyer:A(s.buyer),price:M(s.price,"the sale price"),...s.buyerDeadline!==void 0?{buyerDeadline:M(s.buyerDeadline,"the buyer deadline",!0)}:{},...s.buyerNonce!==void 0?{buyerNonce:M(s.buyerNonce,"the buyer nonce",!0)}:{},...s.receivedAt!==void 0?{receivedAt:A(s.receivedAt)}:{}};R(r.buyer),(BigInt(r.price)<=1n||BigInt(r.price)<BigInt(e.input.minPrice))&&i("Meridian winning bid sale price is below the caller minimum."),e.continuation={...m(e),stage:"secondary_accept",auctionId:f,winningBid:r,acceptDeadline:u,request:Y(e,r)}}return I(e)}async function S(e,a){let s=e.continuation;s.stage!=="primary_accept"&&s.stage!=="secondary_accept"&&i("Meridian exchange is not ready for acceptance."),H(e),e.channel.send("accept",{auctionId:s.auctionId,[e.input.side==="buy"?"predictorSignature":"sellerSignature"]:a}),c(e,15e4);let f=await e.channel.wait("filled",12e4),u=Z(f.transactionHash,32),r=n.clientFor(k),[h,w]=await Promise.all([r.waitForTransactionReceipt({hash:u,timeout:12e4}),r.getTransaction({hash:u})]);(h.status!=="success"||!g(h.transactionHash,u)||!g(w.hash,u)||!g(h.to,s.escrowContract)||!g(w.to,s.escrowContract)||w.chainId!==k)&&i("Meridian fill has no matching successful receipt on chain 4663.");let{input:p,wallet:v}=e;if(p.side==="buy"&&s.stage==="primary_accept"){let o=me({abi:Be,data:w.input}).args[0];(!g(te([...o.picks]),te(p.picks))||o.predictorCollateral!==BigInt(p.stake)||o.counterpartyCollateral!==BigInt(s.winningBid.counterpartyCollateral)||!g(o.predictor,v)||!g(o.counterparty,s.winningBid.counterparty)||o.predictorNonce!==BigInt(e.nonce)||o.predictorDeadline!==BigInt(e.deadline)||!g(o.predictorSponsor,L)||o.predictorSponsorData!=="0x"||!g(o.predictorSignature,a))&&i("Meridian mint receipt does not match the accepted prediction.")}else if(p.side==="sell"&&s.stage==="secondary_accept"){let o=me({abi:Me,data:w.input}).args[0];(!g(o.token,p.token)||!g(o.collateral,$.address)||!g(o.seller,v)||!g(o.buyer,s.winningBid.buyer)||o.tokenAmount!==BigInt(p.amount)||o.price!==BigInt(s.winningBid.price)||o.sellerNonce!==BigInt(e.nonce)||o.sellerDeadline!==BigInt(e.deadline)||!g(o.sellerSignature,a))&&i("Meridian sale receipt does not match the accepted trade.")}let P=new Map,T=new Map;for(let o of h.logs){if(o.topics[0]!==$e||o.topics.length!==3)continue;(!/^0x[0-9a-fA-F]{64}$/.test(o.data)||!o.topics.slice(1).every(ge=>/^0x0{24}[0-9a-fA-F]{40}$/.test(ge)))&&i("Meridian receipt has malformed transfer logs.");let U=`0x${o.topics[1].slice(-40)}`,E=`0x${o.topics[2].slice(-40)}`,q=o.address.toLowerCase(),z=BigInt(o.data);P.set(q,(P.get(q)??0n)+(g(E,v)?z:0n)-(g(U,v)?z:0n)),g(U,L)&&g(E,v)&&T.set(q,(T.get(q)??0n)+z)}let b;if(p.side==="buy"&&s.stage==="primary_accept"){let o=BigInt(p.stake)+BigInt(s.winningBid.counterpartyCollateral),U=[...T].filter(([E,q])=>!g(E,$.address)&&q===o&&P.get(E)===o);(U.length!==1||P.get($.address.toLowerCase())!==-BigInt(p.stake))&&i("Meridian mint receipt does not prove the expected collateral and position delta."),b=`${o} base units received in position ${U[0][0]}`}else p.side==="sell"&&s.stage==="secondary_accept"?((P.get(p.token.toLowerCase())!==-BigInt(p.amount)||P.get($.address.toLowerCase())!==BigInt(s.winningBid.price))&&i("Meridian sale receipt does not prove the expected collateral and position delta."),b=`${p.amount} base units sold from position ${p.token}; ${s.winningBid.price} USDe base units received`):i("Meridian fill has a different exchange stage.");return{txs:[],hashes:[u],status:"mined",summary:`Mined: ${u}. Status: mined. Meridian ${p.side} filled by the external relayer. Successful receipt and transfer deltas verified on chain ${k}: ${b} (18 decimals); collateral USDe ${$.address} (18 decimals).`}}async function B(e,a,s){let f=R(s),u=Ae(e,a),r;if(a.continuation!==void 0){let h=_(a.continuation),w=t.get(A(h.requestId));w||i("Meridian exchange is lost or expired. Start a fresh auction."),(!g(w.wallet,f)||!pe(w.input,u)||!pe(w.continuation,h))&&i("Meridian continuation or arguments do not match the active wallet exchange."),w.busy&&i("Meridian exchange is already processing this continuation."),r=w}else{a.signature!==void 0&&i("A signature requires an active Meridian continuation."),t.size>=1e3&&i("Too many active Meridian exchanges. Please try again later.");let h=he(),w=setTimeout(()=>{let p=t.get(h);p&&d(p)},9e5);w.unref?.(),r={input:u,wallet:f,continuation:{stage:"prerequisites",wallet:f,chainId:k,escrowContract:e==="buy"?Q:V,requestId:h},busy:!1,timer:w},t.set(h,r)}r.busy=!0;try{H(r),await n.clientFor(k).getChainId()!==k&&i("Meridian requires an RPC on chain 4663.");let h=r.continuation.stage;h==="prerequisites"&&a.signature!==void 0&&i("Do not sign before Meridian prerequisites have mined.");let w=await l(r);if(w)return w;if(h==="prerequisites")return r.nonce=(ye(4).readUInt32BE()+1).toString(),r.deadline=(j()+300n).toString(),await n.clientFor(k).readContract({address:r.continuation.escrowContract,abi:X,functionName:"isNonceUsed",args:[f,BigInt(r.nonce)]})&&i(`Meridian ${e==="buy"?"predictor":"seller"} nonce is already used. Start a fresh auction.`),r.channel=new ee(r.continuation.requestId,e==="buy"?"auction":"secondary.auction"),await r.channel.wait(),u.side==="buy"?(r.channel.send("start",{id:r.continuation.requestId,picks:u.picks,predictorCollateral:u.stake,predictor:f,predictorNonce:O(r.nonce),predictorDeadline:O(r.deadline),chainId:k,escrowContract:Q,mode:"blind"}),await D(r)):(r.continuation={...m(r),stage:"secondary_start",request:Y(r)},I(r));let p=Z(a.signature);if(e==="sell"&&await n.clientFor(k).readContract({address:V,abi:X,functionName:"isNonceUsed",args:[f,BigInt(r.nonce)]})&&i("Meridian seller nonce is already used. Start a fresh auction."),e==="buy"&&await n.clientFor(k).readContract({address:Q,abi:X,functionName:"isNonceUsed",args:[f,BigInt(r.nonce)]})&&i("Meridian predictor nonce is already used. Start a fresh auction."),H(r),h==="secondary_start"&&u.side==="sell")return r.channel.send("start",{id:r.continuation.requestId,token:u.token,collateral:$.address,tokenAmount:u.amount,seller:f,sellerNonce:O(r.nonce),sellerDeadline:O(r.deadline),chainId:k,escrowContract:V,mode:"blind",sellerSignature:p}),await D(r);let v=await S(r,p);return d(r),v}catch(h){throw d(r),new N(n.plainError(h))}finally{r.busy=!1}}let C={continuation:{type:"object",description:"Internal continuation returned by the previous local signing round."},signature:{type:"string",pattern:"^0x([0-9a-fA-F]{2})+$",description:"Internal hexadecimal signature supplied by local signing; never enter manually."}};return{tools:[{name:"meridian_buy",inputSchema:{type:"object",additionalProperties:!1,required:["picks","stake"],properties:{...C,stake:x('USDe stake in base units (18 decimals): "1000000000000000000" = 1 USDe.'),minCounterpartyCollateral:x('Minimum counterparty USDe collateral in base units (18 decimals): "1000000000000000000" = 1 USDe.'),usdgAmountIn:x('USDG swap input in base units if USDe is short (6 decimals): "1000000" = 1 USDG.'),slippageBps:{type:"integer",minimum:0,maximum:9999,description:"Slippage in basis points (50 = 0.5%)."},picks:{type:"array",minItems:1,maxItems:10,items:{type:"object",additionalProperties:!1,required:["conditionResolver","conditionId","predictedOutcome"],properties:{conditionResolver:{...W,description:"Condition resolver contract address on chain 4663."},conditionId:{type:"string",pattern:"^0x([0-9a-fA-F]{2})+$",description:"Condition identifier as a 0x-prefixed even-length hex string."},predictedOutcome:{type:"integer",enum:[0,1],description:"Predicted binary outcome, 0 or 1, as defined by the condition."}}},description:"Prediction picks for the auction."}}},execute:(e,a)=>B("buy",e,a)},{name:"meridian_sell",inputSchema:{type:"object",additionalProperties:!1,required:["token","amount"],properties:{...C,token:{...W,description:"Position token address on chain 4663."},amount:x('Position token amount in base units (18 decimals): "1000000000000000000" = 1 position token.'),minPrice:x('Minimum total USDe proceeds in base units (18 decimals): "1000000000000000000" = 1 USDe. Explicit minimum is not reduced by slippage.'),slippageBps:{type:"integer",minimum:0,maximum:9999,description:"Slippage in basis points (50 = 0.5%); applies only to the default floor when minPrice is omitted."}}},execute:(e,a)=>B("sell",e,a)}]}};export{Ce as a,ve as b,Fe as c};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{d as l,e as N,f as T}from"./
|
|
1
|
+
import{d as l,e as N,f as T}from"./WUONMIA2.js";import{a as D}from"./HPBTSJW7.js";import{a as w,c as o,d as u,e as y,g as b}from"./5KKAN7XQ.js";import{a as U}from"./43LI5NKJ.js";import{b as A}from"./66F5ZH34.js";import{h as S,n as x}from"./NWNYJ26T.js";import{b as p}from"./EWZFZUVF.js";import{a as n}from"./XSD5NL7J.js";import{encodeFunctionData as G}from"viem";function $(e,s){if(!e||typeof e!="object"||Array.isArray(e)||Object.keys(e).some(t=>t!=="amount"))throw new n("Provide only the amount for this LayerBank action.");return s&&e.amount==="max"?"max":x(e.amount,"Amount must be positive and fit uint256.",{notString:"Amount must be a positive base-unit integer string.",positive:!0})}function k(e,s){return e.changes.filter(t=>t.token.chainId===p&&S(t.token.address,s.address)).reduce((t,i)=>{if(i.token.decimals!==s.decimals||typeof i.amount!="string"||!/^-?\d+$/.test(i.amount)||BigInt(i.amount)<-y||BigInt(i.amount)>y)throw new n("LayerBank preview returned invalid token metadata or amounts.");return t+BigInt(i.amount)},0n)}function z(e){let s=t=>async(i,d)=>{try{let m=$(i,t);U(d),N(e);let v=e.clientFor(p),r=await D(v);if(!r.active)throw new n("LayerBank reserve is inactive. Nothing was signed.");if(r.paused)throw new n("LayerBank reserve is paused. Nothing was signed.");if(!t&&r.frozen)throw new n("LayerBank reserve is frozen for deposits. Nothing was signed.");let c=await T(v,t?u:o,d,r.blockNumber),a=m==="max"?c:m;if(t){if(c===0n)throw new n("This wallet has no lRobUSDG to withdraw. Nothing was signed.");if(a>c)throw new n("The withdrawal exceeds this wallet\u2019s lRobUSDG balance. Nothing was signed.");if(r.cashUsdgBase===0n)throw new n("LayerBank has no cash on hand for a withdrawal right now. Please try again later. Nothing was signed.");if(a>r.cashUsdgBase){let g=r.cashUsdgBase;return{status:"unavailable",offer:{tool:"layerbank_withdraw",arguments:{amount:g.toString()},amount:l(o,g),requiresConfirmation:!0},summary:`LayerBank has only ${e.formatAmount(g.toString(),6)} USDG in cash on hand. Request that smaller amount only if you agree; Oak will check it again. Nothing was signed.`}}}else{if(a>r.capRoomBase)throw new n("The deposit exceeds LayerBank\u2019s current supply cap room. Nothing was signed.");if(a>c)throw new n("The deposit exceeds this wallet\u2019s USDG balance. Nothing was signed.")}let f=e.formatAmount(a.toString(),6),L=t?G({abi:b,functionName:"withdraw",args:[o.address,m==="max"?y:a,d]}):G({abi:b,functionName:"supply",args:[o.address,a,d,0]}),B=[...t?[]:[e.approval(o.address,w,a.toString(),p)],e.unsignedTx({to:w,data:L,value:"0",chainId:p,description:t?`Withdraw ${m==="max"?"all ":""}${f} USDG from LayerBank to this wallet.`:`Supply ${f} USDG to LayerBank for this wallet.`})],h=await e.preview(B,d);if(t?k(h,o)<a:k(h,o)!==-a||k(h,u)<a-1n)throw new n("LayerBank preview does not match the requested input and minimum receipt. Nothing was signed.");return{txs:B,preview:h,amounts:{assets:l(o,a),...t?{receiptBalance:l(u,c)}:{expectedReceipt:l(u,a),minimumReceipt:l(u,a-1n)}},summary:`${t?`Withdraw ${m==="max"?"the full measured balance of ":""}${f} USDG to this wallet.`:`Approve exactly ${f} USDG to LayerBank pool ${w}, then supply for this wallet.`} Receipts are checked in simulation; the pool encodes no output minimum.`}}catch(m){throw new n(e.plainError(m))}};return[{name:"layerbank_deposit",inputSchema:{type:"object",properties:{amount:A('Positive USDG amount in base units (6 decimals): "1000000" = 1 USDG.')},required:["amount"],additionalProperties:!1},execute:s(!1)},{name:"layerbank_withdraw",inputSchema:{type:"object",properties:{amount:{type:"string",anyOf:[{pattern:"^[0-9]+$"},{const:"max"}],description:'USDG amount in base units (6 decimals): "1000000" = 1 USDG; max withdraws the full balance.'}},required:["amount"],additionalProperties:!1},execute:s(!0)}]}export{z as a};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as J,i as K}from"./W3DGFMQE.js";import{a as H}from"./43LI5NKJ.js";import{a as I}from"./66F5ZH34.js";import{c as D,d as Y,g as N,i as V,m as Q,n as z}from"./NWNYJ26T.js";import{b as p,j as R,k as j}from"./TI727O2H.js";import{a as d}from"./XSD5NL7J.js";import{decodeFunctionData as X,encodeFunctionData as x,erc20Abi as F,getAddress as L,parseAbi as Z}from"viem";var e={router:L("0xf5198743240fac98db71868f34c70139b1eb0474"),factory:L("0xfa5429aeba338bea2bfcc1b9a889862ee395bc28"),pair:L("0x8697bb63743678640710b1270e98772a29642b3c"),weth:L("0x0bd7d308f8e1639fab988df18a8011f41eacad73"),up:L("0x57c0e45cb534413d1c20a4240955d6bb250bb4f1"),eth:"0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee"},E=Z(["function token0() view returns (address)","function token1() view returns (address)","function factory() view returns (address)","function defaultFactory() view returns (address)","function stable() view returns (bool)","function getReserves() view returns (uint112,uint112,uint32)","function poolFor(address,address,bool,address) view returns (address)","function getPool(address,address,bool) view returns (address)","function getAmountsOut(uint256,(address from,address to,bool stable,address factory)[]) view returns (uint256[])","function quoteAddLiquidity(address,address,bool,address,uint256,uint256) view returns (uint256,uint256,uint256)","function addLiquidity(address,address,bool,uint256,uint256,uint256,uint256,address,uint256) returns (uint256,uint256,uint256)","function removeLiquidity(address,address,bool,uint256,uint256,uint256,address,uint256) returns (uint256,uint256)","function swapExactTokensForTokens(uint256,uint256,(address from,address to,bool stable,address factory)[],address,uint256) returns (uint256[])","function deposit() payable"]),ee=Z(["function want() view returns (address)"]),O={vault:{...D,description:"Address of the Beefy vault contract (from beefy_list)."},chainId:{const:p,description:"Chain id; only 4663 (Robinhood Chain mainnet) is supported. Optional."},slippageBps:{type:"integer",minimum:0,maximum:500,description:"Maximum slippage in basis points (50 = 0.5%), 0 to 500. Default 50."}},ue=["beefy_swap","beefy_add_liquidity","beefy_remove_liquidity"];function de(s,h){let f=()=>{throw new d("Beefy calldata differs from locally reconstructed inputs, recipient, route or minimums; nothing was signed.")};s.length!==h.length&&f();for(let q=0;q<s.length;q++){let P=s[q],v=h[q];if((P.chainId!==v.chainId||!N(P.to,v.to)||P.value!==v.value)&&f(),!N(P.data,v.data))try{let B=X({abi:E,data:P.data}),n=X({abi:E,data:v.data});(B.functionName!==n.functionName||!B.args||!n.args)&&f();let t=[...B.args],a=n.args,r=B.functionName==="swapExactTokensForTokens"?[1]:B.functionName==="addLiquidity"?[5,6]:B.functionName==="removeLiquidity"?[4,5]:f(),i=x({abi:E,functionName:B.functionName,args:t});N(i,P.data)||f();let u=t.length-1;(l(t[u])<=l(a[u])-600n||l(t[u])>l(a[u]))&&f(),t[u]=a[u];for(let o of r)l(t[o])<l(a[o])&&f(),t[o]=a[o];N(x({abi:E,functionName:B.functionName,args:t}),v.data)||f()}catch{f()}}}function y(s){return V(s,"Provide a token or vault address.",Y)}function G(s){return z(s,"Amount must be positive and fit in uint256.",{notString:"Provide a positive base-unit integer string.",positive:!0})}function l(s){return Q(s,"Invalid Beefy liquidity integer.")}function M(s){let h=s??50;if(typeof h!="number"||!Number.isInteger(h)||h<0||h>500)throw new d("Use integer slippageBps from 0 to 500.");return BigInt(h)}function W(s,h){let f=s*(10000n-h)/10000n;if(f===0n)throw new d("The liquidity amount is too small for a positive minimum output.");return f}var ce=s=>{async function h(n){try{return await n()}catch(t){throw new d(s.plainError(t))}}function f(n,t){if(n.chainId!==void 0&&n.chainId!==p)throw new d("Beefy requires chain 4663.");for(let a of Object.keys(n))if(!["vault","chainId",...t].includes(a))throw new d(`Unsupported Beefy input: ${a}.`);if(y(n.vault)!==L(R[p].vaults.beefyTestedLpVault.address))throw new d("Beefy LP routes are qualified only for up33-weth-up.")}async function q(){let n=s.clientFor(p);if(await n.getChainId()!==p)throw new d("The Beefy endpoint must report chain 4663.");let t=l(await n.getBlockNumber()),a=await n.getBlock({blockNumber:t}),r=l(a.timestamp)+600n,i=(S,g,A=[])=>n.readContract({address:S,abi:E,functionName:g,args:A,blockNumber:t}),[u,o,m,c,w,b]=await Promise.all([i(e.pair,"token0"),i(e.pair,"token1"),i(e.pair,"factory"),i(e.router,"defaultFactory"),i(e.pair,"stable"),n.readContract({address:R[p].vaults.beefyTestedLpVault.address,abi:ee,functionName:"want",blockNumber:t})]);if(y(u)!==e.weth||y(o)!==e.up||y(m)!==e.factory||y(c)!==e.factory||w!==!1||y(b)!==e.pair)throw new d("The Beefy LP, vault or router no longer matches the qualified route.");if(y(await i(e.router,"poolFor",[e.weth,e.up,!1,e.factory]))!==e.pair)throw new d("The router selects a different Beefy LP.");let k=async(S,g)=>l(await n.readContract({address:S,abi:F,functionName:"balanceOf",args:[g],blockNumber:t}));async function T(S){let[g,A]=await Promise.all([n.readContract({address:S,abi:F,functionName:"symbol",blockNumber:t}),n.readContract({address:S,abi:F,functionName:"decimals",blockNumber:t})]);if(typeof g!="string"||!g.trim()||typeof A!="number"||!Number.isInteger(A)||A<0||A>255)throw new d("Invalid Beefy constituent metadata.");return{address:S,symbol:g,decimals:A,chainId:p}}return{client:n,blockNumber:t,deadline:r,read:i,balance:k,token:T}}async function P(n,t,a){let r=await s.preview(n,t);return{txs:n,preview:r,summary:`${a} ${r.summary} Re-read balances after mining each step; these transactions are separate and earlier steps can remain mined if a later step fails. Gas is additional.`}}function v(n,t,a,r="0"){return s.unsignedTx({to:n,data:t,value:r,description:a,chainId:p})}return{tools:[{name:"beefy_lp",inputSchema:{type:"object",properties:{vault:{...D,description:"Address of the Beefy vault contract (from beefy_list)."},chainId:{const:p,description:"Chain id; only 4663 (Robinhood Chain mainnet) is supported. Optional."},amount:{...I(),description:'Optional CLM entry budget in base units of the bridge token (read its decimals). Example: "1000000" = 1 USDG at 6 decimals.'},slippageBps:O.slippageBps},required:["vault"],additionalProperties:!1},execute:(n,t)=>h(async()=>{if(J.some(b=>N(b.vault,y(n.vault))))return K(s).tools[0].execute(n,t);f(n,[]),H(t);let a=await q(),[r,i,u,o,m,c,w]=await Promise.all([a.token(e.weth),a.token(e.up),a.token(e.pair),a.read(e.pair,"getReserves"),a.balance(e.weth,t),a.balance(e.up,t),a.balance(e.pair,t)]);if(!Array.isArray(o)||o.length!==3)throw new d("Invalid Beefy LP reserves.");return{chainId:p,vault:y(n.vault),router:e.router,factory:e.factory,stable:!1,constituents:[{token:r,balance:m.toString(),reserve:l(o[0]).toString()},{token:i,balance:c.toString(),reserve:l(o[1]).toString()}],lp:{token:u,balance:w.toString()},block:a.blockNumber.toString(),summary:"Acquire WETH and UP with beefy_swap; add with beefy_add_liquidity, then deposit the mined LP balance with beefy_deposit. Withdraw moo shares, remove LP with beefy_remove_liquidity, then swap constituents to USDG. Every action requires its own preview and local confirmation."}})},{name:"beefy_swap",inputSchema:{type:"object",properties:{...O,from:{...D,description:"Address of the token to sell: native ETH placeholder, WETH, UP or USDG."},to:{...D,description:"Address of the token to receive: WETH, UP or USDG, different from the input token."},amount:I('Amount of the input token in base units of that token (read its decimals). Example: "1000000" = 1 USDG at 6 decimals; "1000000000000000000" = 1 WETH.')},required:["vault","from","to","amount"],additionalProperties:!1},execute:(n,t)=>h(async()=>{f(n,["from","to","amount","slippageBps"]),H(t);let a=y(n.from),r=y(n.to),i=G(n.amount),u=M(n.slippageBps),o=[e.weth,e.up,L(j)],m=a.toLowerCase()===e.eth;if(!m&&!o.includes(a)||!o.includes(r)||a===r)throw new d("Use ETH, WETH, UP or USDG as input and a different WETH, UP or USDG output.");let c=await q();if((m?await c.client.getBalance({address:t,blockNumber:c.blockNumber}):await c.balance(a,t))<i)throw new d("Insufficient Beefy swap input balance; keep ETH for gas.");let w=[];m&&w.push(v(e.weth,x({abi:E,functionName:"deposit"}),`Wrap ${i} ETH base units for the Beefy LP workflow.`,i.toString()));let b=m?e.weth:a,k=i,T=i;if(b!==r){let g=b===e.weth||r===e.weth?[b,r]:[b,e.weth,r],A=[];for(let U=0;U<g.length-1;U++){let C={from:g[U],to:g[U+1],stable:!1,factory:e.factory},$=y(await c.read(e.factory,"getPool",[C.from,C.to,!1]));if($==="0x0000000000000000000000000000000000000000"||$!==y(await c.read(e.router,"poolFor",[C.from,C.to,!1,e.factory])))throw new d("No verified Up33 route for these Beefy constituents.");A.push(C)}let _=await c.read(e.router,"getAmountsOut",[i,A]);if(!Array.isArray(_)||_.length!==g.length||l(_[0])!==i)throw new d("Invalid Beefy constituent quote.");for(let U of _)if(l(U)===0n)throw new d("No liquidity for this Beefy constituent swap.");k=l(_.at(-1)),T=W(k,u),w.push(s.approval(b,e.router,i.toString(),p)),w.push(v(e.router,x({abi:E,functionName:"swapExactTokensForTokens",args:[i,T,A,t,c.deadline]}),`Swap ${i} constituent base units; receive at least ${T} output base units.`))}let S=await c.token(r);return{...await P(w,t,"Prepare or convert Beefy LP constituents using the verified Up33 router."),output:{token:S,amount:k.toString()},minimumOutput:{token:S,amount:T.toString()},deadline:c.deadline.toString()}})},{name:"beefy_add_liquidity",inputSchema:{type:"object",properties:{...O,amount0:I('Amount of WETH to add in base units (WETH has 18 decimals). Example: "1000000000000000000" = 1 WETH.'),amount1:I('Amount of UP to add in base units of the UP token (read its decimals). Example: "1000000000000000000" = 1 UP at 18 decimals.')},required:["vault","amount0","amount1"],additionalProperties:!1},execute:(n,t)=>h(async()=>{f(n,["amount0","amount1","slippageBps"]),H(t);let a=G(n.amount0),r=G(n.amount1),i=M(n.slippageBps),u=await q();if(await u.balance(e.weth,t)<a||await u.balance(e.up,t)<r)throw new d("Acquire the WETH and UP constituents with beefy_swap, then retry with their mined balances.");let o=await u.read(e.router,"quoteAddLiquidity",[e.weth,e.up,!1,e.factory,a,r]);if(!Array.isArray(o)||o.length!==3)throw new d("Invalid Beefy add-liquidity quote.");let m=l(o[0]),c=l(o[1]),w=l(o[2]);if(m>a||c>r||w===0n)throw new d("Invalid Beefy add-liquidity amounts.");let b=W(m,i),k=W(c,i),T=[s.approval(e.weth,e.router,a.toString(),p),s.approval(e.up,e.router,r.toString(),p),v(e.router,x({abi:E,functionName:"addLiquidity",args:[e.weth,e.up,!1,a,r,b,k,t,u.deadline]}),"Mint the supported Beefy want LP directly to the calling wallet."),s.approval(e.weth,e.router,"0",p),s.approval(e.up,e.router,"0",p)];return{...await P(T,t,"Mint UP\u2013WETH LP. The router may use less than the approved desired amounts; final revocations clear unused allowances. Deposit the actual LP received in a separate beefy_deposit call."),output:{token:await u.token(e.pair),amount:w.toString()},minimumInputs:[{token:await u.token(e.weth),amount:b.toString()},{token:await u.token(e.up),amount:k.toString()}],deadline:u.deadline.toString()}})},{name:"beefy_remove_liquidity",inputSchema:{type:"object",properties:{...O,amount:{description:'Amount of UP-WETH LP tokens to remove, in base units of the LP token (18 decimals). Example: "1000000000000000000" = 1 LP token. "all" removes your full LP balance.',anyOf:[I(),{const:"all"}]}},required:["vault","amount"],additionalProperties:!1},execute:(n,t)=>h(async()=>{f(n,["amount","slippageBps"]),H(t);let a=M(n.slippageBps),r=n.amount==="all"?void 0:G(n.amount),i=await q(),u=await i.balance(e.pair,t),o=r??u;if(o===0n||o>u)throw new d("Withdraw your moo shares first, then provide a positive LP amount no greater than the fresh LP balance.");let[m,c,w]=await Promise.all([i.client.readContract({address:e.pair,abi:F,functionName:"totalSupply",blockNumber:i.blockNumber}),i.balance(e.weth,e.pair),i.balance(e.up,e.pair)]);if(l(m)===0n||o>m)throw new d("Invalid Beefy LP total supply.");let b=W(c*o/m,a),k=W(w*o/m,a),T=[s.approval(e.pair,e.router,o.toString(),p),v(e.router,x({abi:E,functionName:"removeLiquidity",args:[e.weth,e.up,!1,o,b,k,t,i.deadline]}),"Burn Beefy want LP and return WETH and UP to the calling wallet.")];return{...await P(T,t,"Remove UP\u2013WETH liquidity. Convert actual received constituents to USDG with beefy_swap after mining."),minimumOutputs:[{token:await i.token(e.weth),amount:b.toString()},{token:await i.token(e.up),amount:k.toString()}],deadline:i.deadline.toString()}})}]}};export{e as a,E as b,ue as c,de as d,ce as e};
|
|
1
|
+
import{a as J,i as K}from"./4RTXP2YP.js";import{a as H}from"./43LI5NKJ.js";import{a as I}from"./66F5ZH34.js";import{c as D,d as Y,g as N,i as V,m as Q,n as z}from"./NWNYJ26T.js";import{b as p,j as R,k as j}from"./EWZFZUVF.js";import{a as d}from"./XSD5NL7J.js";import{decodeFunctionData as X,encodeFunctionData as x,erc20Abi as F,getAddress as L,parseAbi as Z}from"viem";var e={router:L("0xf5198743240fac98db71868f34c70139b1eb0474"),factory:L("0xfa5429aeba338bea2bfcc1b9a889862ee395bc28"),pair:L("0x8697bb63743678640710b1270e98772a29642b3c"),weth:L("0x0bd7d308f8e1639fab988df18a8011f41eacad73"),up:L("0x57c0e45cb534413d1c20a4240955d6bb250bb4f1"),eth:"0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee"},E=Z(["function token0() view returns (address)","function token1() view returns (address)","function factory() view returns (address)","function defaultFactory() view returns (address)","function stable() view returns (bool)","function getReserves() view returns (uint112,uint112,uint32)","function poolFor(address,address,bool,address) view returns (address)","function getPool(address,address,bool) view returns (address)","function getAmountsOut(uint256,(address from,address to,bool stable,address factory)[]) view returns (uint256[])","function quoteAddLiquidity(address,address,bool,address,uint256,uint256) view returns (uint256,uint256,uint256)","function addLiquidity(address,address,bool,uint256,uint256,uint256,uint256,address,uint256) returns (uint256,uint256,uint256)","function removeLiquidity(address,address,bool,uint256,uint256,uint256,address,uint256) returns (uint256,uint256)","function swapExactTokensForTokens(uint256,uint256,(address from,address to,bool stable,address factory)[],address,uint256) returns (uint256[])","function deposit() payable"]),ee=Z(["function want() view returns (address)"]),O={vault:{...D,description:"Address of the Beefy vault contract (from beefy_list)."},chainId:{const:p,description:"Chain id; only 4663 (Robinhood Chain mainnet) is supported. Optional."},slippageBps:{type:"integer",minimum:0,maximum:500,description:"Maximum slippage in basis points (50 = 0.5%), 0 to 500. Default 50."}},ue=["beefy_swap","beefy_add_liquidity","beefy_remove_liquidity"];function de(s,h){let f=()=>{throw new d("Beefy calldata differs from locally reconstructed inputs, recipient, route or minimums; nothing was signed.")};s.length!==h.length&&f();for(let q=0;q<s.length;q++){let P=s[q],v=h[q];if((P.chainId!==v.chainId||!N(P.to,v.to)||P.value!==v.value)&&f(),!N(P.data,v.data))try{let B=X({abi:E,data:P.data}),n=X({abi:E,data:v.data});(B.functionName!==n.functionName||!B.args||!n.args)&&f();let t=[...B.args],a=n.args,r=B.functionName==="swapExactTokensForTokens"?[1]:B.functionName==="addLiquidity"?[5,6]:B.functionName==="removeLiquidity"?[4,5]:f(),i=x({abi:E,functionName:B.functionName,args:t});N(i,P.data)||f();let u=t.length-1;(l(t[u])<=l(a[u])-600n||l(t[u])>l(a[u]))&&f(),t[u]=a[u];for(let o of r)l(t[o])<l(a[o])&&f(),t[o]=a[o];N(x({abi:E,functionName:B.functionName,args:t}),v.data)||f()}catch{f()}}}function y(s){return V(s,"Provide a token or vault address.",Y)}function G(s){return z(s,"Amount must be positive and fit in uint256.",{notString:"Provide a positive base-unit integer string.",positive:!0})}function l(s){return Q(s,"Invalid Beefy liquidity integer.")}function M(s){let h=s??50;if(typeof h!="number"||!Number.isInteger(h)||h<0||h>500)throw new d("Use integer slippageBps from 0 to 500.");return BigInt(h)}function W(s,h){let f=s*(10000n-h)/10000n;if(f===0n)throw new d("The liquidity amount is too small for a positive minimum output.");return f}var ce=s=>{async function h(n){try{return await n()}catch(t){throw new d(s.plainError(t))}}function f(n,t){if(n.chainId!==void 0&&n.chainId!==p)throw new d("Beefy requires chain 4663.");for(let a of Object.keys(n))if(!["vault","chainId",...t].includes(a))throw new d(`Unsupported Beefy input: ${a}.`);if(y(n.vault)!==L(R[p].vaults.beefyTestedLpVault.address))throw new d("Beefy LP routes are qualified only for up33-weth-up.")}async function q(){let n=s.clientFor(p);if(await n.getChainId()!==p)throw new d("The Beefy endpoint must report chain 4663.");let t=l(await n.getBlockNumber()),a=await n.getBlock({blockNumber:t}),r=l(a.timestamp)+600n,i=(S,g,A=[])=>n.readContract({address:S,abi:E,functionName:g,args:A,blockNumber:t}),[u,o,m,c,w,b]=await Promise.all([i(e.pair,"token0"),i(e.pair,"token1"),i(e.pair,"factory"),i(e.router,"defaultFactory"),i(e.pair,"stable"),n.readContract({address:R[p].vaults.beefyTestedLpVault.address,abi:ee,functionName:"want",blockNumber:t})]);if(y(u)!==e.weth||y(o)!==e.up||y(m)!==e.factory||y(c)!==e.factory||w!==!1||y(b)!==e.pair)throw new d("The Beefy LP, vault or router no longer matches the qualified route.");if(y(await i(e.router,"poolFor",[e.weth,e.up,!1,e.factory]))!==e.pair)throw new d("The router selects a different Beefy LP.");let k=async(S,g)=>l(await n.readContract({address:S,abi:F,functionName:"balanceOf",args:[g],blockNumber:t}));async function T(S){let[g,A]=await Promise.all([n.readContract({address:S,abi:F,functionName:"symbol",blockNumber:t}),n.readContract({address:S,abi:F,functionName:"decimals",blockNumber:t})]);if(typeof g!="string"||!g.trim()||typeof A!="number"||!Number.isInteger(A)||A<0||A>255)throw new d("Invalid Beefy constituent metadata.");return{address:S,symbol:g,decimals:A,chainId:p}}return{client:n,blockNumber:t,deadline:r,read:i,balance:k,token:T}}async function P(n,t,a){let r=await s.preview(n,t);return{txs:n,preview:r,summary:`${a} ${r.summary} Re-read balances after mining each step; these transactions are separate and earlier steps can remain mined if a later step fails. Gas is additional.`}}function v(n,t,a,r="0"){return s.unsignedTx({to:n,data:t,value:r,description:a,chainId:p})}return{tools:[{name:"beefy_lp",inputSchema:{type:"object",properties:{vault:{...D,description:"Address of the Beefy vault contract (from beefy_list)."},chainId:{const:p,description:"Chain id; only 4663 (Robinhood Chain mainnet) is supported. Optional."},amount:{...I(),description:'Optional CLM entry budget in base units of the bridge token (read its decimals). Example: "1000000" = 1 USDG at 6 decimals.'},slippageBps:O.slippageBps},required:["vault"],additionalProperties:!1},execute:(n,t)=>h(async()=>{if(J.some(b=>N(b.vault,y(n.vault))))return K(s).tools[0].execute(n,t);f(n,[]),H(t);let a=await q(),[r,i,u,o,m,c,w]=await Promise.all([a.token(e.weth),a.token(e.up),a.token(e.pair),a.read(e.pair,"getReserves"),a.balance(e.weth,t),a.balance(e.up,t),a.balance(e.pair,t)]);if(!Array.isArray(o)||o.length!==3)throw new d("Invalid Beefy LP reserves.");return{chainId:p,vault:y(n.vault),router:e.router,factory:e.factory,stable:!1,constituents:[{token:r,balance:m.toString(),reserve:l(o[0]).toString()},{token:i,balance:c.toString(),reserve:l(o[1]).toString()}],lp:{token:u,balance:w.toString()},block:a.blockNumber.toString(),summary:"Acquire WETH and UP with beefy_swap; add with beefy_add_liquidity, then deposit the mined LP balance with beefy_deposit. Withdraw moo shares, remove LP with beefy_remove_liquidity, then swap constituents to USDG. Every action requires its own preview and local confirmation."}})},{name:"beefy_swap",inputSchema:{type:"object",properties:{...O,from:{...D,description:"Address of the token to sell: native ETH placeholder, WETH, UP or USDG."},to:{...D,description:"Address of the token to receive: WETH, UP or USDG, different from the input token."},amount:I('Amount of the input token in base units of that token (read its decimals). Example: "1000000" = 1 USDG at 6 decimals; "1000000000000000000" = 1 WETH.')},required:["vault","from","to","amount"],additionalProperties:!1},execute:(n,t)=>h(async()=>{f(n,["from","to","amount","slippageBps"]),H(t);let a=y(n.from),r=y(n.to),i=G(n.amount),u=M(n.slippageBps),o=[e.weth,e.up,L(j)],m=a.toLowerCase()===e.eth;if(!m&&!o.includes(a)||!o.includes(r)||a===r)throw new d("Use ETH, WETH, UP or USDG as input and a different WETH, UP or USDG output.");let c=await q();if((m?await c.client.getBalance({address:t,blockNumber:c.blockNumber}):await c.balance(a,t))<i)throw new d("Insufficient Beefy swap input balance; keep ETH for gas.");let w=[];m&&w.push(v(e.weth,x({abi:E,functionName:"deposit"}),`Wrap ${i} ETH base units for the Beefy LP workflow.`,i.toString()));let b=m?e.weth:a,k=i,T=i;if(b!==r){let g=b===e.weth||r===e.weth?[b,r]:[b,e.weth,r],A=[];for(let U=0;U<g.length-1;U++){let C={from:g[U],to:g[U+1],stable:!1,factory:e.factory},$=y(await c.read(e.factory,"getPool",[C.from,C.to,!1]));if($==="0x0000000000000000000000000000000000000000"||$!==y(await c.read(e.router,"poolFor",[C.from,C.to,!1,e.factory])))throw new d("No verified Up33 route for these Beefy constituents.");A.push(C)}let _=await c.read(e.router,"getAmountsOut",[i,A]);if(!Array.isArray(_)||_.length!==g.length||l(_[0])!==i)throw new d("Invalid Beefy constituent quote.");for(let U of _)if(l(U)===0n)throw new d("No liquidity for this Beefy constituent swap.");k=l(_.at(-1)),T=W(k,u),w.push(s.approval(b,e.router,i.toString(),p)),w.push(v(e.router,x({abi:E,functionName:"swapExactTokensForTokens",args:[i,T,A,t,c.deadline]}),`Swap ${i} constituent base units; receive at least ${T} output base units.`))}let S=await c.token(r);return{...await P(w,t,"Prepare or convert Beefy LP constituents using the verified Up33 router."),output:{token:S,amount:k.toString()},minimumOutput:{token:S,amount:T.toString()},deadline:c.deadline.toString()}})},{name:"beefy_add_liquidity",inputSchema:{type:"object",properties:{...O,amount0:I('Amount of WETH to add in base units (WETH has 18 decimals). Example: "1000000000000000000" = 1 WETH.'),amount1:I('Amount of UP to add in base units of the UP token (read its decimals). Example: "1000000000000000000" = 1 UP at 18 decimals.')},required:["vault","amount0","amount1"],additionalProperties:!1},execute:(n,t)=>h(async()=>{f(n,["amount0","amount1","slippageBps"]),H(t);let a=G(n.amount0),r=G(n.amount1),i=M(n.slippageBps),u=await q();if(await u.balance(e.weth,t)<a||await u.balance(e.up,t)<r)throw new d("Acquire the WETH and UP constituents with beefy_swap, then retry with their mined balances.");let o=await u.read(e.router,"quoteAddLiquidity",[e.weth,e.up,!1,e.factory,a,r]);if(!Array.isArray(o)||o.length!==3)throw new d("Invalid Beefy add-liquidity quote.");let m=l(o[0]),c=l(o[1]),w=l(o[2]);if(m>a||c>r||w===0n)throw new d("Invalid Beefy add-liquidity amounts.");let b=W(m,i),k=W(c,i),T=[s.approval(e.weth,e.router,a.toString(),p),s.approval(e.up,e.router,r.toString(),p),v(e.router,x({abi:E,functionName:"addLiquidity",args:[e.weth,e.up,!1,a,r,b,k,t,u.deadline]}),"Mint the supported Beefy want LP directly to the calling wallet."),s.approval(e.weth,e.router,"0",p),s.approval(e.up,e.router,"0",p)];return{...await P(T,t,"Mint UP\u2013WETH LP. The router may use less than the approved desired amounts; final revocations clear unused allowances. Deposit the actual LP received in a separate beefy_deposit call."),output:{token:await u.token(e.pair),amount:w.toString()},minimumInputs:[{token:await u.token(e.weth),amount:b.toString()},{token:await u.token(e.up),amount:k.toString()}],deadline:u.deadline.toString()}})},{name:"beefy_remove_liquidity",inputSchema:{type:"object",properties:{...O,amount:{description:'Amount of UP-WETH LP tokens to remove, in base units of the LP token (18 decimals). Example: "1000000000000000000" = 1 LP token. "all" removes your full LP balance.',anyOf:[I(),{const:"all"}]}},required:["vault","amount"],additionalProperties:!1},execute:(n,t)=>h(async()=>{f(n,["amount","slippageBps"]),H(t);let a=M(n.slippageBps),r=n.amount==="all"?void 0:G(n.amount),i=await q(),u=await i.balance(e.pair,t),o=r??u;if(o===0n||o>u)throw new d("Withdraw your moo shares first, then provide a positive LP amount no greater than the fresh LP balance.");let[m,c,w]=await Promise.all([i.client.readContract({address:e.pair,abi:F,functionName:"totalSupply",blockNumber:i.blockNumber}),i.balance(e.weth,e.pair),i.balance(e.up,e.pair)]);if(l(m)===0n||o>m)throw new d("Invalid Beefy LP total supply.");let b=W(c*o/m,a),k=W(w*o/m,a),T=[s.approval(e.pair,e.router,o.toString(),p),v(e.router,x({abi:E,functionName:"removeLiquidity",args:[e.weth,e.up,!1,o,b,k,t,i.deadline]}),"Burn Beefy want LP and return WETH and UP to the calling wallet.")];return{...await P(T,t,"Remove UP\u2013WETH liquidity. Convert actual received constituents to USDG with beefy_swap after mining."),minimumOutputs:[{token:await i.token(e.weth),amount:b.toString()},{token:await i.token(e.up),amount:k.toString()}],deadline:i.deadline.toString()}})}]}};export{e as a,E as b,ue as c,de as d,ce as e};
|