This guide walks a new contributor through everything needed to build, test, and deploy the ILN smart contracts from a fresh machine.
| Tool | Minimum version |
|---|---|
| Rust | 1.74 |
| Git | any recent |
| curl | any recent |
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
source "$HOME/.cargo/env"Soroban contracts compile to wasm32v1-none (Wasm 2.0, no WASI):
rustup target add wasm32v1-nonerustc --version # should be ≥ 1.74
cargo --version
rustup target list --installed | grep wasm32v1The Stellar CLI is required for deploying and invoking contracts on-chain.
cargo install --locked stellar-cli --features opt
stellar --versionNote: If you already have an older version installed, re-run the command above to upgrade.
git clone https://github.com/Invoice-Liquidity-Network/ILN-Smart-Contract.git
cd ILN-Smart-Contract
cargo buildThe build step compiles all workspace members in debug mode (no WASM output
yet) and verifies that the dependency graph resolves correctly.
All unit and integration tests run on your native architecture (no WASM
required) via the soroban-sdk test utilities:
# Run every test in the workspace
cargo test
# Run tests for a single contract
cargo test -p invoice_liquidity
cargo test -p iln_governance
cargo test -p reputation_bonus
cargo test -p iln_distribution# Show stdout from tests (useful with proptest failure output)
cargo test -p invoice_liquidity -- --nocapture
# Filter by test name
cargo test -p invoice_liquidity test_update_max_discount
# Run a specific test file / module
cargo test -p invoice_liquidity tests_discount_invariants
cargo test -p invoice_liquidity governance_main_integration_testThe property tests (tests_fuzz, tests_discount_invariants) run thousands of
random cases and may take a minute or two. To run only the fast suite during
development, filter them out:
cargo test -p invoice_liquidity -- --skip prop_The iln_fuzz crate runs proptest-based fuzzing against submit_invoice:
cargo test -p iln_fuzzCompile all contracts to optimised WASM using the workspace alias defined in
.cargo/config.toml:
cargo build-wasmThis is equivalent to:
cargo build --target wasm32v1-none --releaseOutput files appear in target/wasm32v1-none/release/*.wasm.
Tip: The release profile enables LTO and size optimisation (
opt-level = "z"); binary sizes are typically 10–80 KB per contract.
stellar network add \
--global testnet \
--rpc-url https://soroban-testnet.stellar.org \
--network-passphrase "Test SDF Network ; September 2015"stellar keys generate --global alice
stellar keys address alice # prints the public key
stellar network fund alice --network testnet # airdrops 10 000 XLMstellar contract upload \
--network testnet \
--source alice \
--wasm target/wasm32v1-none/release/invoice_liquidity.wasm
# prints the WASM hash — save itstellar contract deploy \
--network testnet \
--source alice \
--wasm-hash <WASM_HASH_FROM_ABOVE>
# prints the contract ID — save itReplace the placeholder addresses with real testnet contract IDs:
stellar contract invoke \
--network testnet \
--source alice \
--id <CONTRACT_ID> \
-- initialize \
--admin <ALICE_ADDRESS> \
--usdc_token <USDC_SAC_ADDRESS> \
--xlm_sac <XLM_SAC_ADDRESS>XLM and USDC Stellar Asset Contract (SAC) addresses for testnet can be found in the Stellar documentation or by querying the Horizon API.
You are missing the wasm32v1-none target. Run:
rustup target add wasm32v1-noneInstall or update the default toolchain:
rustup update stableEnsure ~/.cargo/bin is on your PATH:
export PATH="$HOME/.cargo/bin:$PATH"Add the line to your shell profile (~/.bashrc, ~/.zshrc, etc.) to persist it.
Property-based tests (prop_*) generate thousands of cases. You can limit
the case count with an environment variable:
PROPTEST_CASES=100 cargo test -p invoice_liquidityInstall the C build toolchain:
sudo apt-get install build-essential # Debian / Ubuntu
sudo dnf install gcc # Fedora / RHELRe-add the network configuration (see step 7.1).
- Architecture overview —
docs/Architecture.md - Contract ABI —
docs/contract-abi.md - Governance protocol —
docs/governance.md - Reputation model —
docs/reputation.md - Storage layout —
docs/storage-layout.md - Threat model —
docs/threat-model.md - Contributing guide —
CONTRIBUTING.md