Skip to content

test(soroban): add mint_lock example coverage - #1985

Open
salaheldinsoliman wants to merge 1 commit into
mainfrom
test/soroban-mint-lock-example
Open

test(soroban): add mint_lock example coverage#1985
salaheldinsoliman wants to merge 1 commit into
mainfrom
test/soroban-mint-lock-example

Conversation

@salaheldinsoliman

Copy link
Copy Markdown
Contributor

Summary

Maps the upstream stellar/soroban-examples mint-lock example (refs #1901): an admin grants per-minter mint limits; minters mint through a cross-contract call into the token and are reverted past their cap.

Independent of the #1982/#1983/#1984 stack — everything here works on current main.

What's included

  • Mock-VM tests (tests/soroban_testcases/mint_lock.rs): mint up to the limit succeeds; minting over it reverts.
  • Integration test (integration/soroban/mint_lock.sol, ml_token.sol, mint_lock.spec.js).

Fidelity to the upstream example (adaptations disclosed)

The mock-VM contract stays close to upstream: int128 amounts, admin.requireAuth() on set_limit, minter.requireAuth() on mint, cross-contract token mint. Tweaks:

  • upstream's per-epoch minted-amount window is simplified to a cumulative cap;
  • admin is set via set_admin rather than at init;
  • the token call is a low-level abi.encode + .call rather than a typed client.

The integration variant is adapted further, following the existing integration/soroban conventions: auth-free (no auth mocking is available against the test network), uint64 amounts, no admin role, one contract per file.

🤖 Generated with Claude Code

Maps the upstream stellar/soroban-examples mint-lock example: an admin
grants per-minter mint limits and minters mint through a cross-contract
call into the token, reverting past their cap.

Mock-VM tests (tests/soroban_testcases/mint_lock.rs) stay close to the
upstream example: int128 amounts, admin.requireAuth() on set_limit and
minter.requireAuth() on mint. Adaptations: the per-epoch minted-amount
window is simplified to a cumulative cap, the admin is set through
set_admin rather than at init, and the token mint goes through a
low-level abi.encode + call rather than a typed client.

The integration variant (integration/soroban/mint_lock.sol + ml_token.sol
+ spec) follows the existing integration conventions: auth-free (no auth
mocking on the test network), uint64 amounts, and one contract per file.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Signed-off-by: salaheldinsoliman <salaheldin_sameh@aucegypt.edu>
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.

1 participant