Smart contracts
Factory contract
KryptWardenFactory deploys wallets and keeps a registry of them.
Testnet ID: CBZF662RUYLPS3UCSRQ2XJHMF6YMFZKHBUXHAIDRYNDAAUXWAGEV5XPR
Functions
| Function | Auth | Returns | Notes |
|---|---|---|---|
deploy_wallet(owner: Address, salt: BytesN<32>) | owner | Address | Deploys a wallet from the current WASM hash, with owner and the factory's USDC token |
get_wallets_by_owner(owner: Address) | none | Vec<Address> | Every wallet deployed for this owner, oldest first |
get_all_wallets() | none | Vec<Address> | Every wallet the factory has deployed |
get_wallet_wasm_hash() | none | BytesN<32> | The code new wallets get |
get_usdc_token() | none | Address | The USDC contract wallets are tied to |
set_wallet_wasm_hash(new_wasm_hash) | factory admin | () | Affects future deployments only; existing wallets upgrade themselves |
The wallet's address is derived from sha256(owner XDR ‖ salt), so two owners using the same salt never collide. Use fresh random bytes for each wallet.
Events
| Event | Fields |
|---|---|
WalletDeployed | owner, wallet |
WalletWasmUpdated | new_wasm_hash |
Errors
| Code | Name |
|---|---|
| 200 | NotInitialized |
| 201 | RenounceDisabled |
Example
stellar contract invoke --network testnet --source owner \
--id CBZF662RUYLPS3UCSRQ2XJHMF6YMFZKHBUXHAIDRYNDAAUXWAGEV5XPR \
-- deploy_wallet --owner G...your-address --salt $(openssl rand -hex 32)For a TypeScript version, see Create a wallet.