Expand description
Smart contract SDK for the Kalvora Network.
Write contracts in Rust, compile to wasm32-unknown-unknown, and deploy
to Kalvora validators. kal-sc wraps the native host ABI exposed by
validators in a safe, idiomatic Rust API, handling serialization, memory
management, and the different execution contexts (direct calls,
delegatecall, derived wallets, etc.).
§Quick start
ⓘ
use kal_sc::{emit, wasmedge_bindgen};
#[wasmedge_bindgen]
pub fn hello(name: String) {
emit(&format!("hello, {}", name));
}§Modules
transfer— move tokens:send,send_multi,send_all,deposit,burn,mintstate— persist data:save,load,clear,existsquery— read network state: balances, token metadata, contract existencecall— invoke other contracts:executeordelegatetxn— submit raw network transactionswallet— derive wallets owned by this contractcontext— read the current frame: sender, block time, contract identitycrypto— hashing primitives:sha256,sha512,blake3,shake
§Non-WASM targets
On targets other than wasm32, every host function is stubbed to panic,
so the crate compiles (and docs build) everywhere, but contract logic can
only be exercised inside a validator.
Modules§
Structs§
- Coin
Denomination - CoinTXN
- Full coin-transfer transaction, mirroring the network’s
CoinTXNproto (minusbase, which the network fills in from the transaction context). - Compliance
- Contract
Fees - Contract
UpdateTXN - Expense
Ratio - Governance
- Input
Transfers - Describes which signer (by index into
TransferAuthentication.public_key) is sending, how much, and how fees are split. MirrorsInputTransfers. - Instrument
ContractTXN - KeyValue
Pair - MaxSupply
Release - MintTXN
- Full mint transaction, mirroring the network’s
MintTXNproto (minusbase, which the network fills in). - Multi
Key - Multi
Patterns - Output
Transfers - A single coin-transfer output. Mirrors
OutputTransfers. - PreMint
Wallet - Proto
Timestamp - Public
Key - Restricted
Key - Stage
- Token
Compliance - Transfer
Authentication - Sender authentication for a
CoinTXN. Mirrors the network’sTransferAuthenticationproto. Each position inpublic_key,signature, andnoncerefers to the same signer. - U256
- Little-endian large integer type
Enums§
Constants§
- BRIDGE_
GUARDIANS_ CONTRACT_ ID - The BridgeGuardians contract identifier.
- BRIDGE_
TOKENS_ CONTRACT_ ID - The BridgeTokens contract identifier.
- KALVORA_
NETWORK_ CONTRACT_ ID - The canonical Kalvora Network contract identifier.
- KIP_
CONTRACT_ ID - The Kip contract identifier.
- LEGAL_
CONTRACT_ ID - The Legal contract identifier.
- MARKETING_
CONTRACT_ ID - The Marketing contract identifier.
- MINT_
CONTRACT_ ID - The Mint contract identifier.
- PREGOV_
CONTRACT_ ID - The PreGov contract identifier.
- SMART_
CONTRACT_ MAINTENANCE_ CONTRACT_ ID - The Smart Contract Maintenance contract identifier.
- TECH_
CONTRACT_ ID - The Tech contract identifier.
- TREASURY_
CONTRACT_ ID - The Treasury contract identifier.
- TREASURY_
WALLET - The Treasury wallet address.
Functions§
- decode
- Decode a postcard-serialized, base64-encoded string back into
T. - emit
- Emit a log message from the contract. Visible in transaction results.
- emit_
block - Emit a block-level log message from the contract.
- encode
- Encode
valueas a postcard-serialized, base64-encoded string. - is_
valid_ u256 - string_
to_ u256 - u256_
to_ string