Smart contracts
Overview
The two Soroban contracts, how they relate, and how to call them.
| Contract | Role | Testnet ID |
|---|---|---|
KryptWardenFactory | Deploys one wallet per call, tracks wallets by owner | CBZF662RUYLPS3UCSRQ2XJHMF6YMFZKHBUXHAIDRYNDAAUXWAGEV5XPR |
KryptWardenWallet | Holds USDC, stores agents and holds, enforces policy in __check_auth | One per owner, e.g. the demo wallet CBRS…4NVO |
Both are written in Rust with soroban-sdk and OpenZeppelin Stellar Contracts v0.8.0. Source is in contracts/ in the repo.
Who can call what
| Caller | Functions |
|---|---|
| Owner | register_agent, update_policy, pause_agent, resume_agent, revoke_agent, approve_hold, deny_hold, withdraw, pause, unpause, upgrade, transfer_ownership |
| Agent signature (submitted by anyone, usually the relayer) | request_hold, record_rejected_attempt, and USDC transfers authorised through __check_auth |
| Anyone | expire_hold and every get_* read |
Calling from the Stellar CLI
Reads are free simulations:
stellar contract invoke --network testnet --source any-funded-identity \
--id CBRSOOZPMVB3SX6LPRG6ESCRBOPP6G4OZHVIQUNCVRQPNMCUE5BB4NVO \
-- get_unreserved_balanceAgent keys are passed to contract functions as raw 32-byte hex (BytesN<32>), not as G… strings. Convert with StrKey.decodeEd25519PublicKey(g) in @stellar/stellar-sdk; keygen also writes KW_AGENT_PUBLIC_KEY_HEX.
Verifying the build
Release WASMs are built reproducibly in CI and attested with SEP-55. Compare a wallet's WASM hash (on stellar.expert, or get_wallet_wasm_hash on the factory) with the hash on the matching GitHub release.