feat: Integrate Stellar Asset Interface (SAI) Wrapper#186
Open
emmanuelist wants to merge 1 commit intoStellarDevHub:mainfrom
Open
feat: Integrate Stellar Asset Interface (SAI) Wrapper#186emmanuelist wants to merge 1 commit intoStellarDevHub:mainfrom
emmanuelist wants to merge 1 commit intoStellarDevHub:mainfrom
Conversation
) - Add sai_wrapper.rs: Soroban contract wrapping native Stellar Assets (XLM, USDC) via SAC token interface for premium certificate payments - Implement payment_gateway function with transfer verification - Support multi-asset acceptance with admin-managed asset registry - Pre-flight balance checks prevent failed transfers - Treasury balance verification confirms transfer completion - 14 comprehensive tests: payment flow, insufficient balance, unaccepted asset, multi-asset, admin controls, edge cases - Fix pre-existing syntax errors in token.rs and tests.rs
|
@emmanuelist Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits. You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀 |
Contributor
Author
|
Note on CI failures: The 4 failing checks (Backend CI, Frontend CI, Backend Lint, Frontend Lint) are pre-existing upstream issues unrelated to this PR.
|
Contributor
Author
|
@ayomideadeniran , kindly merge this PR. Thanks |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Implements the Stellar Asset Interface (SAI) Wrapper contract to allow the lab to accept XLM/USDC payments for premium certificates via the Soroban token interface.
Closes #131
Changes
New:
contracts/src/sai_wrapper.rsA standalone Soroban contract that wraps native Stellar Asset Contracts (SAC) to provide a payment gateway for premium certificates:
init(admin, treasury, asset_contract, cert_price)— One-time setup with admin, treasury, initial accepted asset, and pricepayment_gateway(payer, asset_contract)— Core payment function that:cert_pricetokens from payer → treasury via SACtoken::Clienthas_paid(payer)— Query whether a payer has completed paymentget_balance(asset, account)— Wrapped balance lookup via SACadd_accepted_asset/remove_accepted_assetfor admin-managed asset registry (XLM + USDC + any SAC)set_cert_price(admin, asset, price)— Admin-only price updates per assetget_total_collected(asset)— Total payments collected per assetBug fixes (pre-existing)
token.rs: Fixed unclosed delimiter inburn()— duplicate authorization check left theifblock unclosedtoken.rs: Fixed doublerequire_authinupdate_uri()—only_owner()already callsrequire_auth, second call triggeredAuth::ExistingValueerrortests.rs: Fixed unclosed delimiter inbatch_issue_gas_efficiency()— duplicateforloop left a dangling open bracelib.rs: Fixedevents().publish()call inbatch_issue()— was passing 3 arguments instead of 2Tests
14 new tests covering all SAI wrapper requirements:
payment_transfers_tokens_and_records_paidtotal_collected_tracks_paymentshas_paid_returns_false_for_unknown_addresspayment_rejects_insufficient_balancepayment_rejects_unaccepted_assetmulti_asset_paymentsadmin_can_update_cert_pricenon_admin_cannot_update_priceadmin_can_remove_assetdouble_init_panicsget_balance_returns_correct_amountget_treasury_returns_configured_addressinit_rejects_zero_priceset_cert_price_rejects_negativeFull suite: 102 tests pass, 0 failures.