Cells 挂单(sale-lock)约束Cells listing (sale-lock) Constraints
来源:LusoCryptoLabs/cells-contracts @34dad3c / contracts/sale-lock/src/main.rs + cells-core sale_fee · 主网 0x086c…0879 / 测试网 0x498a…0ae4(type,cellula-sdk)Source: LusoCryptoLabs/cells-contracts @34dad3c / contracts/sale-lock/src/main.rs + cells-core sale_fee · mainnet 0x086c…0879 / testnet 0x498a…0ae4 (type, cellula-sdk)
Cells / Cellula (.cell names)
- 官网Websitecellula.id
- 文档Docscellula.id/developers
- GitHubGitHubgithub.com/LusoCryptoLabs/cells-contracts
- XXx.com/lusocryptolabs
来源:Source: cells-contracts repo homepage + README; X from the LusoCryptoLabs GitHub profile
0 → 1挂单 listList
Inputs 输入Inputs
名字nameaccount-cell-type transfer:owner → sale-lock(seller, price) 的 lock hashaccount-cell-type transfer: owner → lock hash of sale-lock(seller, price)
➜
Outputs 输出Outputs
挂单 celloffer cellCell{
lock: { codeHash: SALE_LOCK, hashType: type,
args: seller_lock_hash 32B ‖ price u64 LE },
capacity: deposit
}
lock.args(40 字节)lock.args (40 bytes)
seller_lock_hash32B
price8B LE
- seller_lock_hash 32B 卖家完整 lock hash,收款与撤单身份seller full lock hash: payee and cancel identity
- price 8B LE 要价(shannon),写在 args 里因此进入 lock hash,不可篡改asking price in shannons; in args so it is part of the lock hash > 0(购买路径)> 0 (purchase path) (2)
args0xa1b2…(32B)00e40b5402000000 ← price 0x02540be400 = 10,000 CKB
限制Constraints
- —:: 创建 lock 不执行脚本;约束在花费时检查creating a lock runs no script; checks happen at spend (—)
1 → 0撤单 / 改价(卖家路径)Cancel / relist (seller path)
Inputs 输入Inputs
挂单 celloffer cellCell{ lock: SALE_LOCK(seller, price) }
卖家输入seller inputlock hash = seller_lock_hash,且不是 anyone-can-pay locklock hash = seller_lock_hash, not an anyone-can-pay lock
➜
Outputs 输出Outputs
outputs任意any
限制Constraints
- args:: 长度 40length 40 (2)
- 卖家seller:: 有输入 lock hash = seller_lock_hash 且该 lock 需要签名(lets_anyone_spend 为假)→ 通过an input under seller_lock_hash whose lock needs a signature (lets_anyone_spend false) → pass (0)
1 → 0购买(付款路径)Buy (payment path)
Inputs 输入Inputs
挂单 celloffer cellCell{ lock: SALE_LOCK(seller, price > 0), hashType type, capacity: deposit }
名字name同交易中 transfer 给买家transferred to the buyer in the same tx
➜
Outputs 输出Outputs
卖家seller纯输出(无 type),lock hash = seller:≥ Σ(price − fee + deposit)(该卖家所有挂单)pure outputs (no type) to seller lock hash: ≥ Σ(price − fee + deposit) over that seller’s offers
treasury纯输出 ≥ Σ fee(本交易所有卖家不在场的挂单)pure outputs ≥ Σ fee (every offer in the tx whose seller is absent)
lock.args(40 字节)lock.args (40 bytes)
seller_lock_hash32B
price8B LE
- seller_lock_hash 32B 卖家完整 lock hash,收款与撤单身份seller full lock hash: payee and cancel identity
- price 8B LE 要价(shannon),写在 args 里因此进入 lock hash,不可篡改asking price in shannons; in args so it is part of the lock hash > 0(购买路径)> 0 (purchase path) (2)
args0xa1b2…(32B)00e40b5402000000 ← price 0x02540be400 = 10,000 CKB
sale_fee(price)
price ≥ 6,300 CKB1%
630 ≤ price < 6,30063 CKB
price < 6300
- price ≥ 6,300 CKB 1% 1% 分成1% share
- 630 ≤ price < 6,300 63 CKB 固定 63 CKBflat 63 CKB
- price < 630 0 无分成none
10,000 CKBfee 100 CKB → seller 9,900 + deposit
限制Constraints
- args:: 长度 40length 40 (2)
- price > 0> 0 (2)
- hash_type = type(按 type id 引用)= type (named by type id) (5)
- 卖家收款seller payout:: 纯输出合计 ≥ 应得pure outputs total ≥ owed (3)
- treasury:: 纯输出合计 ≥ Σ fee(卖家即 treasury 时为 0)pure outputs total ≥ Σ fee (zero if seller is the treasury) (4)
部署与来源Deployments & source 未核验unverified
源码source LusoCryptoLabs/cells-contracts@34dad3c2 · contracts/sale-lock/src/main.rs · crates/cells-core/src/lib.rs (exact commit read when writing spec/plugin (default-branch HEAD, 2026-09-28). Deployment constants from cellula-sdk@0.2.1 dist/deployments.js and docs/TRUST.md.)
二进制核验binary check 未核验unverified Live mainnet code cell (upgraded block 20583642) has data hash 0x57cd…3068, listed in docs/TRUST.md; README/fixture still show pre-upgrade 0xf116…2a93. Reproducible build not attempted. Testnet 0x6858…4fd4 unverified.
| 网络network | code_hash | cell_dep | type_id args | 数据哈希data hash | 部署交易deploy tx |
|---|---|---|---|---|---|
| mainnet | 0x086c8f4e9d4272e3dfbaca399792f730e6604591e87931ee6d67047a3c900879 type | 0x020f7f9e56…d2edcabb:0 code | 0x05238ca98c…c2d7985f | 0x57cdfaa46b…09da3068 | 0x020f7f9e56…d2edcabb #20583642 |
| testnet | 0x498ab6b49b6b25b3c47fcea74bd8a4447bc4efda6417809152a846e058ad0ae4 type | 0x03507c8cbe…0878b0fc:0 code | 0xd02a9ec3af…ea749585 | 0x6858391c11…f2734fd4 | 0x03507c8cbe…0878b0fc #22559042 |
链上数据核对于 on-chain data checked 2026-10-21
错误码:1 Encoding,2 BadArgs,3 Unpaid,4 FeeUnpaid,5 NotByTypeIdError codes: 1 Encoding, 2 BadArgs, 3 Unpaid, 4 FeeUnpaid, 5 NotByTypeId
treasury lock hash 编译进二进制:主网 0x57d9…742d(README 构建参数)。The treasury lock hash is compiled in: mainnet 0x57d9…742d (README build values).
不校验签名:卖家路径依赖卖家 lock 自身。No signature checked: the seller path relies on the seller’s own lock.
treasury lock hash 编译进二进制:主网 0x57d9…742d(README 构建参数)。The treasury lock hash is compiled in: mainnet 0x57d9…742d (README build values).
不校验签名:卖家路径依赖卖家 lock 自身。No signature checked: the seller path relies on the seller’s own lock.