Soroban contracts that answer one question about a Stellar-issued asset: how much of what is circulating is backed, according to whom, and how recently?
Circulating supply is computed from public ledger data and posted on-chain with a hash of its breakdown. Reserve figures are posted by the issuer's own account, a registered auditor, or a registered transcriber, and the signer sets the report's tier. Any contract can then call:
is_covered(asset, min_bps, max_age, min_tier) -> booland refuse an asset that is under-backed or whose figures are out of date. docs/INTEGRATING.md walks through gating your own contract on it: the dependency, the call, choosing each parameter, and the edge cases.
| Repo | What it is |
|---|---|
| plimsoll-contracts (this repo) | Rust/Soroban contracts |
| plimsoll-app | Web app and TypeScript SDK |
| plimsoll-indexer | Go service: supply poster, event indexer, read API |
Live app: https://plimsoll-app-gths-amber.vercel.app/ (mirror: https://plimsoll-protocol.github.io/plimsoll-app/)
Docs: https://plimsoll-protocol.gitbook.io/plimsoll-protocol-docs/
| Maintainer | GitHub | Contact |
|---|---|---|
| dunnidev | @dunnidev | GitHub Discussions |
Questions, ideas and contributor coordination happen in Discussions.
| Contract | Responsibility |
|---|---|
reporter-registry |
Who may speak: auditors, transcribers and supply posters, managed by an admin. |
coverage-ledger |
What was said: asset listings, supply snapshots, reserve reports, and the coverage / is_covered queries. |
covered-vault |
Reference consumer: refuses deposits while the asset is not covered; never blocks withdrawals. |
plimsoll-types |
Shared types, basis-point math and cross-contract client traits. |
reporter-registry ◀── role_of ── coverage-ledger ◀── is_covered ── covered-vault
│
└── name() ──▶ Stellar Asset Contract
The full function-by-function specification is in docs/SPEC.md,
and the event topic and data layouts every off-chain reader depends on are in
docs/EVENTS.md. What each error code means, from
Error(Contract, #1) up, and what a caller should do about it is in
docs/ERRORS.md.
What each actor (admins, supply poster, reporters, issuers, anyone) can make the ledger say, what limits them and what an integrator should do about it is in docs/THREAT_MODEL.md. Every admin operation (upgrades, moving admin to a multisig, onboarding and revoking reporters) is a tested, step-by-step procedure in docs/RUNBOOK.md.
- Issued assets are a protocol feature. Supply for any classic asset can be summed from trustlines, claimable balances, liquidity pools and contract balances, with no cooperation from the issuer.
- The issuer account can sign Soroban auth. A report signed by
asset.issueris unforgeable, which is what the Issuer-signed tier relies on. - Every asset has a built-in Stellar Asset Contract whose
name()isCODE:ISSUER.list_assetaccepts only genuine SACs and parses that name, so a look-alike token cannot be listed under a real issuer.
| Tier | Value | Who signs |
|---|---|---|
| Auditor-signed | 3 | Address registered with the Auditor role |
| Issuer-signed | 2 | The asset's issuer account |
| Transcribed | 1 | Address registered with the Transcriber role |
| Contract | Address |
|---|---|
| reporter-registry | CCZCBR7MGSW5LGIEUQR5TU5Z7JQWBDEESB3RGPTRPMCBUMOISRPY7GOB |
| coverage-ledger | CC2QQ7R4FLPHZP7KA5AO4IASXXICTG6N4GQXCXITTEBNYQEYTYXKMN4D |
| covered-vault | CC3SUECAJSAC4PBV4QLUII7X5Y4WNVL5YGTBAQ4CHCAH6R3QLRYJUZHQ |
Listed demo assets: PUSD (demo issuer, SAC CCHPT4…HIM7S) and Circle's testnet USDC
(SAC CBIELT…DAMA). Full record: deployments/testnet.json.
Requirements: Rust at the exact version pinned in
rust-toolchain.toml (rustup installs it, with the
wasm32v1-none target, the first time you run cargo here), and
Stellar CLI 28 or later. To
reproduce CI's wasm hashes exactly, use the CLI version CI pins (see
Bumping the Rust toolchain and the Stellar CLI).
git clone https://github.com/plimsoll-protocol/plimsoll-contracts
cd plimsoll-contracts
stellar contract build # wasm in target/wasm32v1-none/release/
cargo test # 72 tests across all crates
python3 scripts/check_wasm_sizes.py # each wasm against its size budgetThe size budgets live in size-budgets.json and CI enforces them, so a contract cannot quietly grow towards the install limit. Raising one is fine; doing it in the commit that needs the room is the point.
The per-call CPU and memory ceilings live in
resource-budgets.json. The tests in
contracts/coverage-ledger measure is_covered, post_supply and
post_reserve with env.cost_estimate() and fail if a call grows past its
ceiling, printing what it used against what it is allowed. Raise a ceiling
deliberately, in the commit that needs the room, and say why; otherwise a new
storage read or cross-contract call can slip onto another contract's hot path
unnoticed.
Deploy your own copy to testnet. deploy-testnet.sh remains the one-command
demo path and is a thin wrapper around the two scripts below:
./scripts/deploy-testnet.shDeployment and demo seeding are separate:
./scripts/deploy.sh <network> # contracts only, writes deployments/<network>.json
./scripts/seed-demo.sh <network> # demo identities, PUSD and its vaultdeploy.sh creates no identities, funds nothing and seeds no demo data. It
needs a funded identity named plimsoll-admin (override with
ADMIN_IDENTITY), builds the wasm, and writes the deployment record. testnet,
futurenet and local are built into the Stellar CLI; add any other network
with stellar network add. For a network whose built-in entry has no RPC URL
(mainnet), set STELLAR_RPC_URL. seed-demo.sh refuses to run on mainnet,
by name or by passphrase.
A local quickstart network works end to end:
# terminal 1: a local Stellar network with Soroban RPC on localhost:8000
docker run --rm -p 8000:8000 --name stellar stellar/quickstart:latest --local
# terminal 2: from the repository
stellar keys generate plimsoll-admin --network local --fund
./scripts/deploy.sh local
./scripts/seed-demo.sh localThe ids of the local deployment, including the demo vault, are written to
deployments/local.json.
Query the live deployment:
stellar contract invoke --network testnet --send=no \
--id CC2QQ7R4FLPHZP7KA5AO4IASXXICTG6N4GQXCXITTEBNYQEYTYXKMN4D -- \
coverage --sac CCHPT4TEJDPZQDSUVW3NP6A35ROGV4WEFZKT45SKWYCFZSUB7R5HIM7S --min_tier 1Every v* tag publishes a GitHub release containing the three wasm files,
their interface specs (*.spec.json) and SHA256SUMS. Download a release and
check it before comparing it with what is deployed:
gh release download v0.1.0 --pattern '*'
sha256sum -c SHA256SUMS
stellar contract info hash --wasm coverage_ledger.wasm
stellar contract info hash --id CC2QQ7R4FLPHZP7KA5AO4IASXXICTG6N4GQXCXITTEBNYQEYTYXKMN4D --network testnetThe two hashes must match. deployments/testnet.json records the wasm hash
currently installed under liveWasm whenever a contract has been upgraded past
its first deployment; for contracts not listed there, the release that matches
the deployment is the one whose wasm hash matches contract info hash --id.
The spec JSON is what SDK authors should generate bindings from, so they do not
need to build the wasm to know a release's interface.
scripts/verify-deployment.sh does the comparison above for every contract in
a deployments file at once, against a local build of whatever is checked out:
./scripts/verify-deployment.sh testnet # reads deployments/testnet.json, needs no keysIt prints ok or MISMATCH per contract, with the expected (local) and actual
(on-chain) hashes, and exits non-zero on any mismatch. The wasm is identical
across Linux and macOS for the same inputs, but the Stellar CLI writes its own
version into the wasm, so build with the CLI version CI pins. On a mismatch the
script prints the rustc, soroban-sdk and stellar-cli versions each side was
built with, so a toolchain difference is not mistaken for a code difference.
The Verify deployment workflow runs
it on demand with CI's pinned toolchain.
A reserve report expires. The PUSD vault asks for one at most 7 days old, so
the demo needs its reserves restated or it quietly stops demonstrating
anything — is_covered starts answering false for a well-backed asset, and
both demo vaults refuse deposits for different reasons that look identical
from outside.
./scripts/refresh-demo-reserves.sh verify # does the demo still say what it claims?
./scripts/refresh-demo-reserves.sh post # restate the reserves (needs the reporter keys)verify needs no keys: it asks the contract whether PUSD is covered and QUSD
is refused, and checks that every report's doc_hash still matches the
document it points at. The Demo coverage workflow
runs it twice a day and restates the reserves when they are more than three
days old, which keeps the standing statements in
docs/demo matching what is on chain.
The per-contract tests run natively. tests/e2e instead loads the three
compiled contracts from target/wasm32v1-none/release/, the same files the
deploy scripts upload, and runs the whole flow: register reporters, list an
asset, post supply and reserves, deposit, let the report go stale, deposit
refused, withdraw still works. It only compiles once the wasm exists, so it is
not part of a plain cargo test:
stellar contract build
cargo test -p plimsoll-e2eCI runs it straight after the wasm build.
CI measures which contract lines the tests reach with
cargo-llvm-cov. Every pull request
gets a per-crate table in the coverage job's log and on the run's summary
page, and the full lcov report as the coverage-lcov artifact. To produce the
same report locally:
rustup component add llvm-tools-preview
cargo install cargo-llvm-cov --locked
./scripts/coverage.sh # target/coverage/lcov.info + per-crate summary
./scripts/coverage.sh --html # also target/coverage/html/index.htmlTest files are left out of the figures, and so are tests/e2e (it runs the
compiled wasm, which carries no coverage instrumentation) and
examples/coverage-gate (documentation, not a deployed contract).
Both are pinned, so the compiler and CLI that check the size budgets, run clippy and build the release wasm only change in a commit.
Rust. The version lives only in rust-toolchain.toml.
Locally rustup reads it, and in CI
.github/actions/setup-rust installs it
and fails if any other rustc ends up active. To bump:
- Set
channelinrust-toolchain.tomlto the new exact version (for example"1.101.0"; a barestableis rejected by CI). - Run the full check locally:
cargo fmt --all --check,cargo clippy --all-targets -- -D warnings,stellar contract build --locked,python3 scripts/check_wasm_sizes.py,cargo test. - If a size or resource budget moves, adjust it in the same commit and say why.
- Commit as
ci: bump Rust to <version>.
Stellar CLI. The version and the SHA-256 of its Linux archive live only in
.github/actions/install-stellar-cli/action.yml,
which every workflow uses. CI refuses to extract an archive whose checksum does
not match. To bump:
-
Read the new release's checksum from GitHub:
gh api repos/stellar/stellar-cli/releases/tags/v<version> \ -q '.assets[] | select(.name | test("x86_64-unknown-linux-gnu.tar.gz")) | .digest'
-
Confirm it independently against the archive itself:
curl -sSfLO https://github.com/stellar/stellar-cli/releases/download/v<version>/stellar-cli-<version>-x86_64-unknown-linux-gnu.tar.gz sha256sum stellar-cli-<version>-x86_64-unknown-linux-gnu.tar.gz
-
Set
STELLAR_CLI_VERSIONandSTELLAR_CLI_SHA256in the action to the new version and the matching hash, and update the CLI row in AGENTS.md. -
Commit as
ci: bump Stellar CLI to <version>. The wasm hashes change with the CLI version, so note it in the next release.
Issues labelled good first issue
are scoped for a first pull request. Read CONTRIBUTING.md before you start,
and comment on an issue to have it assigned.
Security reports: see SECURITY.md. Do not open public issues for vulnerabilities. Trust assumptions per actor: docs/THREAT_MODEL.md.