This guide walks you through deploying ACBU Soroban smart contracts to Stellar testnet and mainnet.
-
Rust Toolchain (1.70+)
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
-
Soroban CLI
cargo install --locked soroban-cli
-
Stellar Account
- For testnet: Use Stellar Laboratory to create a test account
- For mainnet: Create an account with XLM for deployment fees
-
Environment Variables
export STELLAR_SECRET_KEY="your-secret-key-here"
Before deployment, build all contracts:
cd contracts
cargo build --target wasm32-unknown-unknown --releaseThis will create WASM files in target/wasm32-unknown-unknown/release/:
minting.wasmburning.wasmoracle.wasmreserve_tracker.wasm
-
Set your secret key:
export STELLAR_SECRET_KEY="your-testnet-secret-key"
-
Run deployment script:
chmod +x scripts/deploy_testnet.sh ./scripts/deploy_testnet.sh
-
Save contract addresses: After deployment, contract addresses are saved to
.soroban/deployment_testnet.json -
Set environment variables for backend:
export CONTRACT_ORACLE_TESTNET="<oracle-contract-id>" export CONTRACT_RESERVE_TRACKER_TESTNET="<reserve-tracker-contract-id>" export CONTRACT_MINTING_TESTNET="<minting-contract-id>" export CONTRACT_BURNING_TESTNET="<burning-contract-id>"
- ✅ Testing on testnet
- ✅ Security audit completion
- ✅ Backup of secret keys
- ✅ Team approval
-
Set your secret key:
export STELLAR_SECRET_KEY="your-mainnet-secret-key"
-
Run deployment script:
chmod +x scripts/deploy_mainnet.sh ./scripts/deploy_mainnet.sh
-
Save contract addresses: Contract addresses are saved to
.soroban/deployment_mainnet.json -
Set environment variables for backend:
export CONTRACT_ORACLE_MAINNET="<oracle-contract-id>" export CONTRACT_RESERVE_TRACKER_MAINNET="<reserve-tracker-contract-id>" export CONTRACT_MINTING_MAINNET="<minting-contract-id>" export CONTRACT_BURNING_MAINNET="<burning-contract-id>"
After deployment, contracts need to be initialized. This is done through the backend services or directly via Soroban CLI.
soroban contract invoke \
--id <oracle-contract-id> \
--network testnet \
--source <admin-secret-key> \
-- initialize \
--admin <admin-address> \
--validators '[<validator1>, <validator2>, ...]' \
--min_signatures 3 \
--currencies '["NGN", "KES", "RWF"]' \
--basket_weights '{"NGN": 1800, "KES": 1200, "RWF": 800}'soroban contract invoke \
--id <reserve-tracker-contract-id> \
--network testnet \
--source <admin-secret-key> \
-- initialize \
--admin <admin-address> \
--acbu_token <acbu-token-contract-id> \
--min_ratio_bps 10200 \
--target_ratio_bps 10500soroban contract invoke \
--id <minting-contract-id> \
--network testnet \
--source <admin-secret-key> \
-- initialize \
--admin <admin-address> \
--oracle <oracle-contract-id> \
--reserve_tracker <reserve-tracker-contract-id> \
--acbu_token <acbu-token-contract-id> \
--usdc_token <usdc-token-contract-id> \
--fee_rate_bps 300soroban contract invoke \
--id <burning-contract-id> \
--network testnet \
--source <admin-secret-key> \
-- initialize \
--admin <admin-address> \
--oracle <oracle-contract-id> \
--reserve_tracker <reserve-tracker-contract-id> \
--acbu_token <acbu-token-contract-id> \
--withdrawal_processor <withdrawal-processor-address> \
--fee_rate_bps 300After deployment and initialization, verify contracts:
-
Check contract state:
soroban contract invoke \ --id <contract-id> \ --network testnet \ -- get_fee_rate
-
Verify on Stellar Explorer:
- Ensure your account has enough XLM for deployment fees
- Testnet: Use friendbot to fund your account
- Contract can only be initialized once
- Deploy a new contract instance if needed
- Ensure you're using the correct admin secret key
- Check that the contract is initialized with your address as admin
- Never commit secret keys to version control
- Use environment variables for all sensitive data
- Backup contract addresses after deployment
- Test thoroughly on testnet before mainnet
- Use multisig for admin operations in production
After deployment:
- Update backend environment variables
- Initialize contracts
- Test contract interactions
- Set up event listeners
- Monitor contract activity