Cells 价格 cell(price-cell-type)约束Cells price cell (price-cell-type) Constraints
来源:LusoCryptoLabs/cells-contracts @34dad3c / contracts/price-cell-type/src/main.rs + cells-core · 主网 0x97bf…d4f9 / 测试网 0xe105…4294(type,cellula-sdk)Source: LusoCryptoLabs/cells-contracts @34dad3c / contracts/price-cell-type/src/main.rs + cells-core · mainnet 0x97bf…d4f9 / testnet 0xe105…4294 (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创建Create
Inputs 输入Inputs
tx.inputs[0]任意 cell(用于 type id)any cell (for the type id)
➜
Outputs 输出Outputs
price cellCell{
type: { codeHash: PRICE_TYPE, hashType: type,
args: blake2b(inputs[0] ‖ index u64 LE) 32B },
data: 0x01 ‖ bps u32 LE
}
data(5 字节)data (5 bytes)
version1B
factor4B LE u32
- version 1B 数据版本data version = 0x01 (6)
- factor 4B LE u32 折扣系数(基点),乘到整张费用表上discount factor in basis points, multiplies the whole fee schedule 126 ≤ bps ≤ 10000 (6)
data0x0110270000 ← 0x2710 = 10000 bps (full price)
data0x01a00f0000 ← 4000 bps = 40%
限制Constraints
- 输出数outputs:: 恰好 1 个价格 cell 输出exactly 1 price cell output (3)
- data:: 5 字节,version 1,126–100005 bytes, version 1, 126–10000 (6)
- args = 32 字节 type id= 32-byte type id (2)
1 → 1调价Update
Inputs 输入Inputs
price cellCell{ type: PRICE_TYPE(id), data: old, since: relative ts ≥ 21600 s }
➜
Outputs 输出Outputs
price cell′Cell{ lock: same, capacity: ≥ old, type: same, data: new }
data(5 字节)data (5 bytes)
version1B
factor4B LE u32
- version 1B 数据版本data version = 0x01 (6)
- factor 4B LE u32 折扣系数(基点),乘到整张费用表上discount factor in basis points, multiplies the whole fee schedule 126 ≤ bps ≤ 10000 (6)
data0x0110270000 ← 0x2710 = 10000 bps (full price)
data0x01a00f0000 ← 4000 bps = 40%
since
flags1B
seconds7B
- flags 1B 0xC0 = 相对 + 时间戳0xC0 = relative + timestamp = 0xC0 (8)
- seconds 7B 距上次更新的秒数seconds since last update ≥ 21600 (8)
since0xc000000000005460 ← 0x5460 = 21600 s
限制Constraints
- 数量arity:: 恰好 1 进 1 出(不能销毁 / 复制)exactly 1 in 1 out (never destroyed / duplicated) (3)
- lock:: 不变unchanged (4)
- capacity:: 不减not reduced (5)
- data:: 新旧都合法old and new valid (6)
- factor:: new×16 ∈ [old×15, old×17](每次 ≤ 1/16)new×16 ∈ [old×15, old×17] (≤ 1/16 per step) (7)
- since:: 相对时间戳(0xC0)≥ 21,600 s(6 小时)relative timestamp (0xC0) ≥ 21,600 s (6 h) (8)
部署与来源Deployments & source 未核验unverified
源码source LusoCryptoLabs/cells-contracts@34dad3c2 · contracts/price-cell-type/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 Data hash 0x238e…2342 (same on both networks) appears in README and docs/TRUST.md as the reproduced build output; reproducible build not attempted here.
0x238e74e1d2…f5662342: listed in README.md
0x238e74e1d2…f5662342: listed in README.md
| 网络network | code_hash | cell_dep | type_id args | 数据哈希data hash | 部署交易deploy tx |
|---|---|---|---|---|---|
| mainnet | 0x97bf5f760cf72f918f13704d7184933b79d4ddc1fd85075762373e531152d4f9 type | 0xb3d2428eb9…8f3432b1:0 code | 0x0ed09c9930…fcb6f8b4 | 0x238e74e1d2…f5662342 | 0xb3d2428eb9…8f3432b1 #20515925 |
| testnet | 0xe1057caf161b3c720fcdb80190e89c6efc36b6b4256b3c99635fda63a9dd4294 type | 0xec7c069046…26565c77:0 code | 0x6c1931c4df…41d2eba7 | 0x238e74e1d2…f5662342 | 0xec7c069046…26565c77 #22395053 |
链上数据核对于 on-chain data checked 2026-10-21
错误码:1 Encoding,2 BadArgs,3 Arity,4 LockChanged,5 CapacityShrunk,6 BadData,7 Step,8 Cooldown(源码注释写“四分之一 / 一天”,实际常量为 1/16 与 6 小时)Error codes: 1 Encoding, 2 BadArgs, 3 Arity, 4 LockChanged, 5 CapacityShrunk, 6 BadData, 7 Step, 8 Cooldown (enum comments say “a quarter / a day”; the actual constants are 1/16 and 6 h)
account-cell-type 以编译进去的 type hash(主网 0x3f1c…7586)在 cell dep 中找该 cell;缺失或非法时按全价。account-cell-type finds this cell in cell deps by a compiled-in type hash (mainnet 0x3f1c…7586); missing or malformed means full price.
account-cell-type 以编译进去的 type hash(主网 0x3f1c…7586)在 cell dep 中找该 cell;缺失或非法时按全价。account-cell-type finds this cell in cell deps by a compiled-in type hash (mainnet 0x3f1c…7586); missing or malformed means full price.