Skip to content

feat(soroban): add example compliant token and deploy scripts#61

Open
alex-predicate wants to merge 2 commits intomainfrom
feat/example-compliant-token
Open

feat(soroban): add example compliant token and deploy scripts#61
alex-predicate wants to merge 2 commits intomainfrom
feat/example-compliant-token

Conversation

@alex-predicate
Copy link
Copy Markdown
Contributor

Summary

  • Adds example-compliant-token — a minimal Soroban token contract demonstrating predicate-client integration. Transfers require a valid Predicate attestation, showing the end-to-end application compliance flow.
  • Adds deploy scripts for the Predicate Registry and compliant token contracts on Stellar testnet.

Details

example-compliant-token contract

  • mint() — admin-only, no attestation needed
  • transfer() — requires a valid Attestation argument; calls predicate_client::authorize_transaction() before moving tokens
  • Constructor auto-registers the contract's policy ID with the registry

Deploy scripts

  • scripts/deploy-registry.sh — builds + deploys predicate-registry, optionally registers an attester
  • scripts/deploy-compliant-token.sh — builds + deploys example-compliant-token wired to a registry + policy

Test plan

  • test_compliant_transfer — end-to-end: deploy registry, register attester, deploy token, mint, transfer with valid attestation
  • test_transfer_without_valid_attestation — transfer with garbage attestation is rejected
  • All 37 workspace tests pass

🤖 Generated with Claude Code

- example-compliant-token: minimal token contract that requires
  Predicate attestation for transfers, demonstrating predicate-client
  integration (2 tests: compliant transfer + invalid attestation rejection)
- deploy-registry.sh: deploy PredicateRegistry with optional attester registration
- deploy-compliant-token.sh: deploy compliant token wired to a registry

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Copy link
Copy Markdown

@claude claude bot left a comment

Choose a reason for hiding this comment

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

⚠️ Code review skipped — your organization's overage spend limit has been reached.

Code review is billed via overage credits. To resume reviews, an organization admin can raise the monthly limit at claude.ai/admin-settings/claude-code.

Once credits are available, reopen this pull request to trigger a review.

- Move types (Statement, Attestation, RegistryError) into predicate-client
  directly instead of re-exporting from predicate-registry. This prevents
  the registry's #[contract] and #[contractimpl] from leaking into
  downstream cdylib crates (which caused duplicate __constructor exports).
- predicate-registry is now a dev-dependency only for both predicate-client
  and example-compliant-token
- Extract policy registration from constructor into separate register_policy()
  function (cross-contract calls not supported during construction)
- Deploy scripts updated to call register_policy after deployment

Tested on Stellar testnet:
  Registry: CAZYOJMAAQEH3R4DVIHJLWTLLDAT45FEX2QXZQXKNF3YO4QTUKJEKYZC
  Token:    CAWHQ5EUC5MTWBHOUMMIVFDHZ37BXOD6GRG5OARGXG26UFASIQLE3HXV

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
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.

2 participants