fix(circle): claim_streak_bonus and claim_referral_bonus now transfer… - #178
Open
prettyjune04-ops wants to merge 1 commit into
Open
fix(circle): claim_streak_bonus and claim_referral_bonus now transfer…#178prettyjune04-ops wants to merge 1 commit into
prettyjune04-ops wants to merge 1 commit into
Conversation
… tokens Both functions computed bonus amounts and emitted events but never performed any on-chain token transfer (issue cocor-tech#103). Changes: - Add CircleError::TokenNotSet = 38 to types.rs - Add `use soroban_sdk::token;` import to contract.rs - claim_referral_bonus: after computing bonus_total, load DataKey::Token and call token::Client::transfer(contract → referrer, bonus_total) - claim_streak_bonus: after computing bonus_div, load DataKey::Token and call token::Client::transfer(contract → member, bonus_div) - Both functions return TokenNotSet if set_token has not been called Tests: - test_claim_referral_bonus_transfers_tokens: verifies referrer balance increases by the exact calculated bonus amount - test_claim_referral_bonus_no_double_claim: second claim errors - test_claim_referral_bonus_no_token_set_returns_error: TokenNotSet path - test_claim_referral_bonus_not_active_circle: rejects non-Active circle - test_claim_streak_bonus_transfers_tokens: verifies member balance increases by the exact calculated streak bonus - test_claim_streak_bonus_below_threshold_fails: streak < 3 errors - test_claim_streak_bonus_no_token_set_returns_error: TokenNotSet path - test_claim_streak_bonus_not_active_circle: rejects non-Active circle Also fixed pre-existing issues blocking compilation: - common/vrf.rs: soroban_sdk::Set does not exist in SDK v26; replaced with Vec<u32> for the used-positions tracking - test.rs: add BytesN + Ledger testutils imports, use BytesN::from_array, switch to register_stellar_asset_contract_v2 + StellarAssetClient::mint
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.
… tokens
Both functions computed bonus amounts and emitted events but never performed any on-chain token transfer (issue #103).
Changes:
use soroban_sdk::token;import to contract.rsTests:
Also fixed pre-existing issues blocking compilation:
closes #103