dexe-otc
Run a DeXe OTC token sale end-to-end — open a multi-tier TokenSaleProposal, vote+execute it, then buyers check status / buy / claim. Covers the three dexe_otc_* composites and the two token-sale reads, plus the PRECISION-1e25 rate, native-BNB sentinel, and claim-timing gotchas. Use when the user mentions "OTC", "token sale", "sell DAO tokens", "buy from a tier", "claim vested tokens".
- License 许可
- MIT
- 最近更新
- 2026-11-15
- Stars
- ★ 81
- Forks
- 17
01 前言 Front Matter
- name
- dexe-otc
- description
- Run a DeXe OTC token sale end-to-end — open a multi-tier TokenSaleProposal, vote+execute it, then buyers check status / buy / claim. Covers the three dexe_otc_* composites and the two token-sale reads, plus the PRECISION-1e25 rate, native-BNB sentinel, and claim-timing gotchas. Use when the user mentions "OTC", "token sale", "sell DAO tokens", "buy from a tier", "claim vested tokens".
02 资源文件 3
- 许可证LICENSE1.0 KB
- 参考文档SOURCE.md381 B
- 参考文档TRUST.auto.yaml2.1 KB
03 SKILL.md 正文
dexe-otc
An OTC DAO sells its own token via on-chain TokenSaleProposal tiers. Each step
is one MCP call; calldata broadcasts when a signer is connected (WalletConnect,
keystore, or DEXE_SIGNER_MODE=unattended + DEXE_PRIVATE_KEY).
Validate on BSC testnet (chain 97) first. Full recipe + runnable proof:
docs/OTC.md and scripts/lifecycle-otc.mjs.
The three composites and two reads
The two reads were dexe_otc_list_sales_for_dao and dexe_otc_buyer_status
before 0.36.0; the old names still answer as deprecated aliases.
| Tool | Role |
|---|---|
dexe_otc_dao_open_sale |
multi-tier createTiers envelope + IPFS metadata + deposit + createProposalAndVote. buildOnly:true returns just the envelope. |
dexe_read_token_sales |
list a DAO's tiers (prices, totalSold, isOff, UTC times). |
dexe_read_token_sale_position |
render-ready buyer view: prices, claimable, vesting, auto-merkle proof. |
dexe_otc_buyer_buy |
preflight balance/allowance + approve + buy(); native path uses the sentinel + value. |
dexe_otc_buyer_claim_all |
claims tiers with canClaim && !isClaimed, withdraws vested; noop when nothing pending. |
Owner flow
dexe_dao_predict_addresses→ getgovPool/govToken/govTokenSale.- Deploy with treasury pre-seeded (mint to the predicted
govPoolviatokenParams.users[]) — see [[dexe-create-dao]]. dexe_otc_dao_open_salewith tiers (schema below).- Poll
dexe_proposal_stateuntilSucceededFor(index 4; it briefly sits inLocked=6), thendexe_vote_build_execute→ broadcast.
Buyer flow
dexe_read_token_sale_position → dexe_otc_buyer_buy → (after the sale window closes)
dexe_otc_buyer_claim_all.
Critical gotchas
- Buyer amounts accept human units — a decimal string (
"50.0") is scaled by the token's real on-chain decimals; digits-only stays raw wei.dexe_otc_buyer_buyconverts the 18-dec-normalized buy amount to the payment token's native decimals for the balance check and the exact approve — no silent under-pay on <18-dec payment tokens. - Exchange rate is PRECISION 1e25, not 1e18. 1:1 =
"10000000000000000000000000". - Native BNB =
0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE(ETHEREUM_ADDRESS), never0x0…0— a zero-address purchase token makes the tier unbuyable. Buy tools accept0x0as an alias but emit the sentinel. canClaimneedsblock.timestamp ≥ saleEndTime + claimLockDuration— buyers wait for the window to close even whenclaimLockDuration:0.maxAllocationPerUser == 0means unlimited, not zero — set a real cap.- Treasury must hold the sale token before the sale opens — pre-seed at deploy.
vestingPercentageis a human percent 0–100 (auto-scaled by 1e25).- Merkle tiers need the whitelist JSON on IPFS;
open_saleauto-uploads whenuriis empty (needsDEXE_PINATA_JWT). Roots viadexe_merkle_build.
Tier schema (abridged)
{
"name": "Public Tier 1", "description": "",
"totalTokenProvided": "<wei>",
"saleStartTime": "<unix sec>", "saleEndTime": "<unix sec>", "claimLockDuration": "0",
"saleTokenAddress": "0x…",
"purchaseTokenAddresses": ["0xEeee…EEeE"], // native, or ERC20 addresses
"exchangeRates": ["10000000000000000000000000"],
"minAllocationPerUser": "0", "maxAllocationPerUser": "<wei, non-zero>",
"vestingSettings": { "vestingPercentage": "0", "vestingDuration": "0", "cliffPeriod": "0", "unlockStep": "0" },
"participation": [] // AND-list; empty = open tier
}
Do not modify OTC tool behavior lightly — the v0.11.x OTC surface is validated
E2E on mainnet. See docs/OTC.md for the exhaustive reference.
Canonical recipe (generated from src/knowledge/ — edit there, then npm run gen:knowledge)
<!-- BEGIN GENERATED: flow-recipe -->
Open an OTC / token sale (otc_sale)
Open a multi-tier token sale (proposal → vote → execute → live), then buyers check status / buy / claim via the dexe_otc_* composites.
Ask the user:
govPool— Which DAO (govPool address)?saleTokenAmount— How many DAO tokens to sell in this tier? · ⚠ This amount moves from the treasury into the sale at execute.price— Price per DAO token, and in which purchase token (address, or native BNB)? · ⚠ Rates are stored ×1e25 on-chain — always pass human units and let the composite scale; a mis-scaled hand-made rate can sell the allocation for pennies.saleWindow— Sale start and end times? (ask in the user's words — e.g. 'starts tomorrow, runs 7 days' — then compute Unix seconds from the CURRENT time; never guess the date) · ⚠ The window must be in the future at EXECUTE time (add voting-period headroom). A past window creates a dead tier — every buy reverts.vesting(optional) — Vesting? (RECOMMEND 0 on newly deployed DAOs — vested funds are currently unrecoverable there) · default0· ⚠ vestingWithdraw is blocked by SphereX on fresh pools — a non-zero vestingPercentage strands the vested portion (confirmed protocol bug).whitelist(optional) — Open to everyone, or a whitelist of addresses?
Steps:
dexe_otc_dao_open_sale— Build + create the TokenSaleProposal tiers proposal (auto-uploads merkle whitelist JSON if given).dexe_proposal_vote_and_execute— Vote + execute the sale proposal — the tier goes live at execute.dexe_read_token_sales— Confirm the tier is live and show its parameters (times are UTC).
Pitfalls (danger first):
- ? TokenSaleProposal.vestingWithdraw is blocked ('SphereX error: disallowed tx pattern') in EVERY call shape on fresh pools — the VESTED portion of a purchase CANNOT be withdrawn (confirmed protocol bug, escalated upstream). Until fixed: open tiers with vestingPercentage:"0" on new DAOs. claim (the instant portion) works fine.
- ? NEVER guess dates for sale/staking windows — compute Unix timestamps from the CURRENT time (ask the user or read the latest block; your idea of 'now' may be a stale year). Windows must be in the future AT EXECUTE TIME (add headroom for the voting period). A staking tier with a past deadline is SILENTLY rejected on-chain (the execute succeeds, a StakingRejected event fires, NO tier exists, the reward bounces back); a sale tier with a past window is created dead-on-arrival (every buy reverts 'TSP: token sale is over'). The builders refuse past end-times before any transaction.
- ⚠ Native BNB in sale tiers uses the sentinel address 0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE, NOT the zero address (0x0 reverts 'TSP: incorrect token'). A native-currency buy must send msg.value equal to the buy amount. The dexe_otc_* composites canonicalize this.
- ⚠ Tier exchange rates are scaled ×1e25 (PRECISION) on-chain. Pass human units to the dexe_otc_* composites and they scale for you; only ADVANCED raw structs need pre-scaled values. A hand-scaled rate off by 10^2 sells the whole allocation for pennies.
- ℹ Whitelisted tiers use a merkle root; the tier's uri must point to IPFS JSON {"list":[lowercased addresses]} so buyers can regenerate proofs — dexe_otc_dao_open_sale auto-uploads it when uri is empty (needs DEXE_PINATA_JWT). Buyer-side reads need the proof BEFORE getUserViews or canParticipate reads false.
- ℹ Amount strings: digits-only = RAW smallest units (wei); a decimal point ("12.5") = human units scaled by the token's REAL on-chain decimals (never assumed 18). Durations and delays are SECONDS (86400 = 1 day). Composite quorum/percent params are plain percent numbers (51).
For the machine-readable plan (interview questions with risk notes, step templates with flowContext chaining), call the dexe_guide tool with flow:"otc_sale".
<!-- END GENERATED: flow-recipe -->
04 同仓库更多 Skills
troves
Deposit and withdraw from Troves DeFi yield vault strategies on Starknet. View available strategies, check positions, and manage vault deposits. Use this skill when the user mentions Troves, vault, yield vault, DeFi vault, strategy, yield farming, vault deposit, vault withdraw, earning yield through vaults, passive yield strategies, or wants to deposit into or withdraw from a yield strategy — even if they don't say "Troves" explicitly.
trade
Swap tokens on Starknet via Fibrous DEX aggregator. Supports per-provider selection (avnu, ekubo, or auto to race all). Use this skill when the user wants to swap, exchange, trade, convert, buy, or sell one token for another on Starknet. Also use when the user asks about token prices, exchange rates, DEX routing, best swap route, or wants to check how much they would receive for a given amount — even if they don't explicitly say "swap".
staking
Stake, unstake, claim, and compound rewards for STRK, WBTC, tBTC, SolvBTC, and LBTC on Starknet. View validators, pools, and staking positions. Use this skill when the user mentions staking, delegating, validators, staking pools, rewards, compounding, unstaking, earning yield, passive income on crypto, or wants to earn on their STRK or BTC tokens — even if they don't say "stake" explicitly.
send
Send STRK, ETH, or any ERC-20 token to a Starknet address. Supports simulation (dry-run) before execution. Use this skill when the user wants to send, transfer, pay, tip, or move tokens to another wallet address on Starknet. Also trigger when the user mentions sending funds to someone, making a payment, transferring assets, or moving crypto to a specific address — even if they just say "pay 10 STRK to 0x...".
portfolio
View a comprehensive DeFi portfolio dashboard and optimize portfolio allocation via automated rebalancing. Use this skill when the user wants an overview, summary, dashboard, total value, net worth, portfolio rebalancing, target allocation, or wants to see all their DeFi positions across Starknet at once. Also trigger when the user asks "what do I have", "show me everything", "how much am I worth", "my positions", "my investments", "rebalance my portfolio", "I want 50% ETH", "optimize my holdings", or any request for a holistic view of their Starknet holdings — even if they don't explicitly say "portfolio".
multi-swap
Execute multiple token swaps in a single Starknet transaction via Fibrous (default). Supports per-provider selection (avnu, ekubo, or auto to race all). Supports 2-3 swap pairs bundled into one multicall. Use this skill when the user wants to swap multiple token pairs at once, do batch swaps, execute several trades simultaneously, perform parallel swaps, or do bulk trading in one transaction. Also trigger when the user mentions "two swaps", "three swaps", "swap X and Y at the same time", or wants to convert multiple tokens in a single call.