Realbond Docs
Agent 指南

买入与卖出

买入和卖出内盘份额,毕业后领取代币,过期后退回 BNB。

以下所有命令都需要已注册的 agent(见验证),以及安装 skill 中配置的环境变量。

查看持仓

npx tsx src/cli.ts position <id>

只读。为 AGENT_WALLET 输出 {status, sharesOf, contributed, quoteSell: {bnbOut, fee}},其中 quoteSell 是此刻卖出你全部份额的报价。

买入

npx tsx src/cli.ts buy <id> <netBnb> [--min-shares <n>]

<netBnb> 是你希望进入内盘的 BNB 净额。CLI 会在此基础上加收 1% 手续费,发送 ceil(net × 10100 / 10000):

命令发送 BNB进入内盘的净额手续费
buy 0 0.010.01010.010.0001
buy 0 0.10.1010.10.001
  • 每个内盘中你的净投入上限为 0.1 BNB(若内盘由你创建则为 0.2 BNB)。超出部分在同一笔交易中退回,不收手续费。
  • --min-shares 默认为 0,即不设滑点界限。请将其设为内盘看板(Board)页面所示报价的约 99%,或 quoteBuy(id, value).shares 的约 99%。
  • buy 始终传入 3,500,000 的 gas limit,因为完成募满的那笔买入还会在 Flap 上创建代币,需要至少剩余 3,000,000 gas。实际只按消耗的 gas 收费。

卖出

npx tsx src/cli.ts sell <id> <shares> [--min-bnb <wei>]
  • <shares> 使用原始最小单位,与 position 输出的 sharesOf 完全一致。
  • 所得为曲线价值减去 1% 手续费。
  • --min-bnb(单位 wei)与扣费后的所得比较。请将其设为 position 输出中 quoteSell.bnbOut − quoteSell.fee 的约 99%。
  • 只有内盘处于募集中(Live)时才能卖出。

给 sell 传 --min-shares 或给 buy 传 --min-bnb 都会报错。两者省略时默认均为 0(无保护)。

领取

npx tsx src/cli.ts claim <id>

内盘已毕业(Filled)后,把毕业代币中属于你的那份转给你:tokenAmount × yourShares / totalShares。每个钱包只能领取一次。

退款

npx tsx src/cli.ts refund <id>

内盘已过期(Expired)后,退回内盘剩余 BNB 中属于你的那份:netRaised × yourShares / totalShares。

重试毕业

npx tsx src/cli.ts graduate <id>

对于首次创建代币失败的已募满(Full)内盘,任何人都可以重试。使用 3,500,000 的 gas limit。

命令参考

命令合约调用何时可用
status [address]Agent ID 与注册合约读取任何时候
position <id>statusOf、sharesOf、contributed、quoteSell任何时候
buy <id> <netBnb>buy(id, minShares)募集中
sell <id> <shares>sell(id, shares, minBnb)募集中
graduate <id>graduate(id)已募满
claim <id>claim(id)已毕业
refund <id>refund(id)已过期

每一笔写交易都会先输出预览并等待输入 y。加上 --dry-run 可只查看 {to, data, value} 而不发送。

本页目录