Repository navigation
feat(contracts): yield accrue events, payment nonces, exit fee, naira checks (#992 #996 #998 #999) - #1104
Merged
Conversation
Implements Fracverse#992, Fracverse#996, Fracverse#998, and Fracverse#999 across yield vault, social payment, and naira token contracts. Co-authored-by: Cursor <cursoragent@cursor.com>
|
@that-girl-kate 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! 🚀 |
ONEONUORA
approved these changes
Sep 28, 2026
ONEONUORA
left a comment
Contributor
There was a problem hiding this comment.
Great job @that-girl-kate
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 four smart-contract issues for Zaps:
accrue_yieldevents when the yield index compounds#992 — Detailed yield accrual events
Problem: Indexers and UIs needed a clear on-chain signal when the vault interest index compounds, including enough context to reason about depositor share value.
Changes (
contracts/contracts/yield_vault/src/lib.rs):checkpoint_indexpublishesenv.events().publish((Symbol::new(&env, "accrue_yield"),), (old_index, new_index, total_assets))new_index != old_index), so no-op checkpoints stay quiettotal_assetsfor share-value updatesAcceptance mapping: Soroban
accrue_yieldevent ·old_index·new_index·total_assets· usesenv.events().publish()#996 — Signature nonce verification (social payment)
Problem: Off-chain signed payment authorizations must not be replayable.
Changes (
contracts/contracts/social_payment/src/lib.rs):DataKey::Nonce(Address)in persistent storageget_nonce(user)returns the current counter (default0)pay_with_signaturerequiresauth.nonce == current_nonce, then increments tocurrent_nonce + 1on successError::NonceAlreadyUsedbefore signature verificationAcceptance mapping:
Nonce(Address)in storage · increment on successful execution · reject reused nonces#998 — Naira token decimal / amount checks
Problem: Transfer amounts must follow Stellar’s 7-decimal standard and never accept zero or negative values.
Changes (
contracts/contracts/naira_token/src/lib.rs):STELLAR_DECIMALS = 7;initializeassertsdecimals == 7require_positive_amounthelper (assert!(amount > 0)) used bymint,burn,transfer,transfer_from, andburn_fromAcceptance mapping: Reject zero/negative transfer values ·
amount > 0· Stellar 7-decimal precision enforced at init#999 — Yield vault exit fee on withdrawal
Problem: Protocol needed an optional 0.1% exit fee on vault withdrawals, routed to a treasury.
Changes (
contracts/contracts/yield_vault/src/lib.rs):initializewithdraw:fee = (assets_out * fee_bps) / 10000, net sent to caller, fee to treasuryset_treasury,set_exit_fee_bps(cap 100 bps), plustreasury/exit_fee_bpsviewsYieldWithdrawnevent now carries the actualfee(was hardcoded0)set_exit_fee_bps(0); emergency exit paths remain fee-free rescue routesAcceptance mapping:
fee = (amount * fee_bps) / 10000· fee → treasury · remaining → callerTest plan
cargo +1.85.0 test -p zaps-yield-vault --lib -- test_withdraw_exit_fee test_withdraw_zero_exit test_withdraw_returns_principal test_accrue_yield_emits_accruecargo +1.85.0 test -p zaps-social-payment --lib -- test_signed_payment_rejects_reused_nonce test_signed_payment_rejects_future_nonce test_get_nonce test_signed_payment_different_userscargo +1.85.0 test -p zaps-naira-token --lib -- --skip blacklisted(decimals + positive-amount paths)accrue_yield→ confirmaccrue_yieldevent topics/datapay_with_signaturewith stale nonce →NonceAlreadyUsedCloses #992
Closes #996
Closes #998
Closes #999