Skip to content

feat: initial contracts setup - #45

Merged
hpmaxi merged 14 commits into
mainfrom
feat/initial-contracts-setup
Aug 28, 2026
Merged

feat: initial contracts setup#45
hpmaxi merged 14 commits into
mainfrom
feat/initial-contracts-setup

Conversation

@hpmaxi

@hpmaxi hpmaxi commented Aug 25, 2026

Copy link
Copy Markdown
Contributor

Summary

First slice of the reference contracts, plus the deploy wiring so CI can
build the wasms and generate the TS clients.

What's here

  • Shared libs + workspacepricing (deposit/redeem conversion,
    round-trip and overflow invariants) and cross-contract bindings.
  • RWA share token — SEP-57 token: constructor wires 7-decimal
    metadata, admin, the manager role and the two compliance components.
    The privileged surface is RBAC-gated on manager and delegates to the
    audited RWA internals; Pausable is the token's own admin brake.
  • Compliance + identity-verifier stubs — permissive dispatcher and
    an allowlist verifier: the minimal RWA wiring M1 needs.
  • Deploy + client generationenvironments.toml declares the three
    contracts with constructor args, so stellar-scaffold deploys them and
    emits TS clients.

Design notes

  • One token, not a vault. The token fixes ContractType = RWA; the
    async vault lands in Port the async vault #65. A contract can pick only one ContractType, so
    the split is forced, not stylistic.
  • All contractimpl blocks in one module. Soroban's contracttrait
    client generation can't be split across files — cargo test breaks on
    the generated client's private testutils fields.
  • Entry-gated, exit-open. mint and transfer-in check identity; burn
    does not, so a de-listed holder can always be redeemed out.

Verification

  • cargo test: share-token 2/2, pricing 4/4.
  • stellar contract build: three wasms (share_token 35 KB).
  • TS client generates from the spec. Full scaffold deploy + client-gen
    runs in CI (needs the local-network container).

Closes #62, #63, #66.

@hpmaxi hpmaxi changed the title chore: scaffold reproducible dev environment (nix flake + rust toolch… feat: initial contracts setup Aug 25, 2026
@hpmaxi
hpmaxi force-pushed the feat/initial-contracts-setup branch from d06d2ad to ac9645c Compare August 26, 2026 18:56
@hpmaxi
hpmaxi marked this pull request as ready for review August 26, 2026 18:58
@hpmaxi
hpmaxi requested a review from luchobonatti August 26, 2026 18:58
@hpmaxi hpmaxi self-assigned this Aug 26, 2026
hpmaxi added 3 commits August 27, 2026 17:51
Permissive compliance dispatcher (bind/unbind token, add/remove
modules, admin-gated) with no policy modules registered, and an
allowlist identity verifier whose verify_identity reverts with
error 304 for non-listed accounts. Minimal RWA wiring for M1: the
share-token constructor requires both, and mint calls verify_identity.

Closes #63
Add the RWAToken surface (mint/burn/forced_transfer/recover/freeze/…),
each gated on the manager role and delegating to the audited RWA
internals, plus AccessControl and an admin-gated Pausable brake. All
contractimpl blocks live in one module: soroban's contracttrait client
generation can't be split across files without breaking the test build
on the client's private testutils fields. A test asserts the manager
mints to an allowlisted holder.

Closes #62
Declare compliance, identity-verifier and share-token under
[development.contracts] with client generation and constructor args.
Account and contract names resolve to deployed addresses, so the
share-token constructor receives the compliance and identity-verifier
addresses at deploy time. Lets stellar-scaffold deploy the three and
generate their TS clients.

Closes #66
@hpmaxi
hpmaxi force-pushed the feat/initial-contracts-setup branch from 8f6329b to fbc9c6a Compare August 27, 2026 22:17
Add a //! header and a contractmeta entry (stub=testnet-only;
prod=external ERC-3643 ...) to the compliance and identity-verifier
stubs, so the deployed wasm advertises they are placeholders, not part
of the product.

@luchobonatti luchobonatti left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM! 💯

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR lands the first slice of the reference Soroban contracts and the wiring so CI can build the wasms and generate TS clients. It introduces a two-crate shared library layer (pricing, bindings), an RWA (SEP-57 / ERC-3643-style) share-token with RBAC-gated privileged operations, permissive compliance and identity-verifier testnet stubs, and the deploy/client-generation configuration in environments.toml. It also sets up the local toolchain/dev environment (Nix flake, pre-commit hooks, README development docs) and re-establishes the Cargo workspace with a committed Cargo.lock.

Changes:

  • Add the RWA share-token (ContractType = RWA, 7-decimal metadata, manager role, compliance + identity wiring) plus compliance and identity-verifier stubs, and shared pricing/bindings crates.
  • Wire deployment: declare the three contracts with constructor args in environments.toml and populate the workspace/lockfile.
  • Set up developer tooling: Nix flake devshell, prek/gitleaks pre-commit hooks, README build instructions, and toolchain/gitignore updates.

Reviewed changes

Copilot reviewed 20 out of 24 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
Cargo.toml Re-establishes the workspace (crates/*, contracts/*), edition 2021, pinned deps, release profile.
Cargo.lock Newly committed generated lockfile for the workspace.
rust-toolchain.toml Switches channel to stable and adds components — removes the version pin (flagged).
flake.nix / flake.lock Nix devshell pinning stellar-cli 27.0.0 plus Rust/TLA+/hook tooling.
README.md Adds a Development section (Nix and non-Nix toolchain setup).
.pre-commit-config.yaml Adds cargo-fmt and gitleaks hooks via prek.
.gitignore Adds .stellar, TLA+ artifacts; consolidates agent-tooling entries.
environments.toml Declares compliance, identity_verifier, share_token with constructor args.
crates/pricing/* Deposit/redeem conversion math with par/round-trip/overflow tests.
crates/bindings/* Cross-contract OracleFeed/Share client trait bindings.
contracts/share-token/* RWA share token: constructor wiring, RBAC-gated RWA surface, Pausable, tests (Spanish comments flagged).
contracts/compliance/* Permissive compliance dispatcher stub with token binder.
contracts/identity-verifier/* Allowlist identity-verifier stub gating verify_identity.
contracts/.gitkeep Placeholder removed/retained for the contracts directory.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread rust-toolchain.toml Outdated
@@ -1,3 +1,4 @@
[toolchain]
channel = "1.93.0"
channel = "stable"
Comment thread contracts/share-token/src/test.rs Outdated
Comment on lines +34 to +37
compliance.bind_token(&token.address, &admin); // el token debe estar bound
identity.allow(&receiver, &true, &admin); // allowlist del receptor

token.mint(&receiver, &100, &manager); // ← no existe todavía → ROJO
Restore an explicit rust toolchain pin (1.97.0); the PR had loosened it to stable, which breaks reproducibility and risks the experimental spec_shaking_v2 feature. In the mint test, translate the one load-bearing comment to English and drop two slop/stale ones.
@hpmaxi
hpmaxi merged commit 09e892b into main Aug 28, 2026
1 check passed
@hpmaxi
hpmaxi deleted the feat/initial-contracts-setup branch August 28, 2026 17:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Port the RWA share token

3 participants