Axionvera Network is a Soroban (Stellar) vault and reward distribution project. This repository contains:
- a Soroban smart contract for deposits, withdrawals, and rewards
- a Rust network node service around the contract
- deployment scripts and infrastructure code
- tests and contributor documentation
The vault contract supports four main user actions:
- Deposit a token into the vault.
- Withdraw deposited funds later.
- Receive proportional rewards when an admin distributes them.
- Claim accrued rewards.
The reward model is index-based, which means the contract updates a global reward index instead of looping through every user during a distribution.
If you are onboarding as a contributor, these are the best first reads:
- docs/contract-spec.md
- docs/contract-storage.md
- contracts/vault-contract/src/lib.rs
- contracts/vault-contract/src/storage.rs
- ARCHITECTURE.md
Key ideas:
total_depositstracks the total deposited amount.reward_indextracks cumulative rewards per deposited unit.- each user stores a personal reward index snapshot and accrued rewards.
- rewards are realized lazily on user interaction.
Core public functions:
initialize(admin, deposit_token, reward_token)deposit(from, amount)withdraw(to, amount)distribute_rewards(amount)claim_rewards(user)balance(user)total_deposits()reward_index()pending_rewards(user)
The contract stores both global and per-user state.
Global keys:
- initialization flag
- admin address
- deposit token address
- reward token address
- total deposits
- reward index
Per-user keys:
- deposited balance
- last synced reward index
- accrued but unclaimed rewards
Read the full walkthrough in docs/contract-storage.md.
vault.initialize(&admin, &deposit_token_id, &reward_token_id);
vault.deposit(&alice, &100);
vault.deposit(&bob, &300);
vault.distribute_rewards(&400);
assert_eq!(vault.pending_rewards(&alice), 100);
assert_eq!(vault.pending_rewards(&bob), 300);
assert_eq!(vault.claim_rewards(&alice), 100);
assert_eq!(vault.claim_rewards(&bob), 300);- contracts/vault-contract - Soroban vault contract in Rust
- network-node - network service and API layer
- docs - contract and architecture documentation
- scripts - deployment and helper scripts
- tests - integration and TypeScript tests
- terraform - infrastructure as code
Prerequisites:
- Rust stable
wasm32-unknown-unknowntarget- Soroban CLI
- Node.js 18+
Basic setup:
git clone https://github.com/your-org/axionvera-network.git
cd axionvera-network
npm install
rustup target add wasm32-unknown-unknownBuild the contract:
npm run build:contractsContract tests:
cargo test -p axionvera-vault-contractProject-level shortcuts:
npm run test:rust
npm test- Start with the tests if you want executable examples of the contract behavior.
- Read storage docs before changing accounting logic.
- If you touch deposits, withdrawals, or rewards, verify both state changes and emitted events.