P2 of the AI-model-tokens plan: a standalone CosmWasm contract giving a model token a constant-product market vs a CLAW reserve — buy/sell it like a stock. contracts/model-vault/ (standalone crate, NOT in the dex workspace; cosmwasm-std 2.x, cw-storage-plus, cw-multi-test): - Fund (owner) / Buy / Sell over a native tokenfactory model-token coin vs uclaw, constant-product k = reserve*inventory (Uint256 intermediates), exactly-one-coin validation, BankMsg::Send payouts, InsufficientInventory/Reserve guards. - reserve + inventory tracked explicitly in STATE (cw-storage-plus Items), NOT inferred from live contract balance — avoids the CosmWasm funds-double-count gotcha (info.funds are credited before execute runs). Documented in state.rs. - Queries: Config / Pool / Quote (pure curve math). - 7 curve unit tests + 11 cw-multi-test integration tests (buy/sell math, price rises after Buy / falls after Sell, insufficient-inventory, wrong-coin, round-trip conservation). clippy + fmt clean. - wasm32 release build: model_vault.wasm 228KB, standard cosmwasm-std only (deployable under the chain's BuiltInCapabilities + token_factory caps). - scripts/testnet/model-vault-demo.sh: live store->instantiate->Fund->Buy->Sell demo. Verified independently: cargo build + cargo test (18 pass) + wasm build all green. v0 is fee-less (dust drift bounded by a round-trip test); revenue/dividend pool is the next P2 slice. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
39 lines
964 B
TOML
39 lines
964 B
TOML
[package]
|
|
name = "model-vault"
|
|
version = "0.1.0"
|
|
authors = ["ClawChain"]
|
|
edition = "2021"
|
|
description = "ModelVault: a constant-product bonding-curve market for an AI model token traded against a CLAW reserve. Trades native tokenfactory model-token coins vs the native reserve coin (uclaw)."
|
|
license = "Apache-2.0"
|
|
|
|
[lib]
|
|
crate-type = ["cdylib", "rlib"]
|
|
|
|
[features]
|
|
# use library feature to disable all instantiate/execute/query exports
|
|
library = []
|
|
|
|
[dependencies]
|
|
cosmwasm-std = "2.2"
|
|
cosmwasm-schema = "2.2"
|
|
cw-storage-plus = "2.0"
|
|
schemars = "0.8"
|
|
serde = { version = "1.0", default-features = false, features = ["derive"] }
|
|
thiserror = "1.0"
|
|
|
|
[dev-dependencies]
|
|
cw-multi-test = "2.3"
|
|
|
|
# Standard CosmWasm release profile: produce a small, deterministic, deployable wasm.
|
|
[profile.release]
|
|
opt-level = "z"
|
|
debug = false
|
|
rpath = false
|
|
lto = true
|
|
debug-assertions = false
|
|
codegen-units = 1
|
|
panic = "abort"
|
|
incremental = false
|
|
overflow-checks = true
|
|
strip = true
|