面向开发者 / SENDIT

面向开发者的 SENDIT

SENDIT 是 Pickle Chain 上围绕一个银行合约的一组合约,外加两个读取 API。交易者做的每一件事都是一笔你可以自己发送的交易,可以从钱包发送,也可以从已登记的交易密钥发送。

组成部分

  • SenditBank 存放每个账户的 pUSD、ETH 和发行的代币,以及账户的交易密钥。其他每个合约都是一个场所(venue),用 pull 从银行扣款,用 push 向银行入账。
  • 永续合约引擎(PepperPerps VERSION 3),它用于两步市场和触发单的订单簿,以及 LP 金库。
  • 现货路由器、pUSD 兑换合约和跟单交易,以及 pUSD 本身。
  • HTTP API:dex-api 提供市场、仓位、余额、动态和代币;social-api 提供会话。
  • 构建机器人把这些组合在一起。

SENDIT 运行在公开测试网上(chain ID 78270)。它的应用和 API 由 https://sendit.picklechain.xyz 提供;JSON-RPC 用的是这条链自己的,在 https://rpc.picklechain.xyz。

读取清单

在运行时读取地址。一次引擎升级会在旧合约旁边部署新合约并更新每一个字段,而在 EVM 上调用一个没有代码的地址会成功,所以一个已经过时的硬编码地址会无声地失败。

JavaScript
const ORIGIN = "https://sendit.picklechain.xyz";

// The deployment, as the app itself reads it. Never cached (Cache-Control: no-store).
const manifest = await fetch(`${ORIGIN}/op-deployment/l2-perps.json`).then((r) => r.json());

const { bank, perps, perpOrders, perpVault, spotRouter, copyFactory, pusd, pusdExchange } = manifest;

// Or the same addresses, lower-cased and renamed, from the API:
// { engine, orders, vault, previous, bank, spotRouter, pusdExchange }
const deployment = await fetch(`${ORIGIN}/api/perp/deployment`).then((r) => r.json());

清单字段

字段类型
perpsaddressThe perps engine, PepperPerps VERSION 3. /api/perp/deployment calls it `engine`.
perpOrdersaddressThe two-step orders book, PepperPerpOrders. `orders` in /api/perp/deployment.
perpVaultaddressThe LP vault, PepperPerpVault (pLP). `vault` in /api/perp/deployment.
bankaddressSenditBank: every trader's pUSD, ETH and launched tokens, and the trading keys.
spotRouteraddressSenditSpotRouter: buy, sell and launch tokens with bank money.
copyFactoryaddressCopyFactory VERSION 3: one CopyAccount per copier and leader.
copyAccountImpladdressThe CopyAccount implementation every copy account clones (EIP-1167).
pusdaddressPickleUSD (pUSD), six decimals. The test dollar every position is margined in.
pusdExchangeaddressSenditPusdExchange: pUSD for ETH at one dollar.
perpsPreviousarrayEngines that still hold positions: [{ engine, orders, vault, block, version }]. Legacy positions there are closed by the wallet.
copyFactoryPreviousarrayEarlier copy factories: [{ factory, impl, block, version, engine }]. Stop and withdraw old copies there.
perpsBlock, bankBlock, copyFactoryBlock, pusdExchangeBlocknumberThe block each contract was deployed in: where an indexer starts reading logs.
pusdWethPool, feeRecipient, keeperaddressThe pool the protocol's fee share is sold through, the FeeRouter that receives it, and the keeper's wallet.

idBase 不在清单里:在引擎上读取 idBase()。

当前地址

截至 2026-10-20 提供的地址。请对照清单核对它们;不要把它们硬编码。

字段地址
bank0x3366f560DC1539B5Db4f889CB603C3BDd369298F
perps0x57c61D24BaE12D24100ac1FB20950B88904be971VERSION 3, idBase() 10000000: position and request ids start at 10,000,001
perpOrders0xcb62fcb714f8aa69d2b2abC8Ba9cCEF2A1E02C84
perpVault0x20F4E42E5f56E47e6e058fA137c698C86B0aF459
spotRouter0xD6516A4720018AFa6c777F2D686247d715EDa04B
copyFactory0xf288A5F90Ea3b07b014f52110FC4C7f82206dd95
pusd0x47091c58e34bDC4f32A05541C1243710249Dd777
pusdExchange0x07b5E6fd6b5A86FBE3685B434988D3b5aFB4385F
perpsPrevious[0].engine0x8452242B9d7C453556E3a9b0556e48a25ced0ef2VERSION 1, ids from 1, wallet-signed only

编号与之前的引擎

当前引擎从 idBase() + 1,即 10,000,001,开始为仓位编号,它的订单簿也从同一个基数开始为请求编号,所以无论由哪个引擎持有,一个编号在整条链上只指向一个仓位或请求。之前的引擎(VERSION 1,在 perpsPrevious 中)从 1 开始编号,早于银行合约出现,并且只接受钱包签名:仍在那里未平的仓位,要由开仓的钱包调用它自己的 close 来平仓。dex-api 把来自它的每一行都标记为 legacy: true。

缺少某个字段,意味着该功能未启用

清单是应用自己唯一使用的事实来源。如果缺少某个字段(某个网络上没有银行合约,或者还没有兑换合约),该功能在那里就是关闭的;/api/perp/deployment 会省略该字段。