Skip to content

chore: update soroban-sdk from 22.0.8 to 22.0.10#492

Merged
truthixify merged 2 commits intoDistinctCodes:mainfrom
KevinMB0220:feat/dividend-distribution-module
Feb 22, 2026
Merged

chore: update soroban-sdk from 22.0.8 to 22.0.10#492
truthixify merged 2 commits intoDistinctCodes:mainfrom
KevinMB0220:feat/dividend-distribution-module

Conversation

@KevinMB0220
Copy link
Contributor

Summary

Closes #470 — Dividend Distribution and Claiming Module

This PR delivers the complete dividend distribution and claiming module for the AssetUp tokenization contract, implementing all functions specified in the issue along with a full test suite and a dependency fix that unblocked the test runner.


Changes

contracts/assetsup/src/dividends.rs

Full implementation of the dividend module:

  • distribute_dividends(env, asset_id, total_amount)
    Validates total_amount > 0, checks revenue_sharing_enabled, iterates all token holders, computes each share as (holder_balance / total_supply) * total_amount, accumulates into unclaimed_dividends, and emits a ("dividend", "distributed") event.

  • claim_dividends(env, asset_id, holder)
    Requires holder authentication (holder.require_auth() enforced in lib.rs), returns and zeroes the holder’s unclaimed balance, and emits a ("dividend", "claimed") event.

  • get_unclaimed_dividends(env, asset_id, holder)
    Read-only query returning the current unclaimed balance (returns 0 for unknown holders).

  • enable_revenue_sharing(env, asset_id) / disable_revenue_sharing(env, asset_id)
    Toggles the revenue_sharing_enabled flag on the TokenizedAsset.


contracts/assetsup/src/tests/dividends_new.rs

Five tests covering all acceptance criteria:

Test Verifies
test_distribute_dividends_no_revenue_sharing Distribution fails when revenue sharing is disabled
test_distribute_dividends 50/50 split is accurate across two holders
test_proportional_dividend_distribution 40/30/30 split across three holders
test_claim_dividends Claiming returns correct amount and zeroes the balance
test_claim_dividends_insufficient Claiming with 0 unclaimed returns an error

contracts/Cargo.lock

Updated soroban-sdk from 22.0.8 → 22.0.10.
The previous version had internal compilation errors in testutils that prevented the entire test suite from running.


Acceptance Criteria

  • Dividend amounts accurately proportional to ownership
  • Claiming zeroes the holder's unclaimed balance
  • Distribution fails if revenue sharing is disabled

Test Results


running 39 tests
... 39 passed; 0 failed


Notes

  • Integer division truncation is consistent with Soroban’s i128 arithmetic — any dust from rounding stays undistributed (not lost, just not allocated).
  • distribute_dividends does not require auth at the contract level, allowing any caller (e.g., a backend service) to trigger distributions. If stricter access control is desired, tokenizer.require_auth() can be added.

Resolves compilation errors in testutils that prevented the test suite
from running. All 39 tests now pass cleanly.
@vercel
Copy link

vercel bot commented Feb 22, 2026

@KevinMB0220 is attempting to deploy a commit to the naijabuz's projects Team on Vercel.

A member of the Team first needs to authorize it.

Adds comprehensive tests covering all dividend module functions:

- distribute_dividends: zero/negative amount, untokenized asset, equal
  split, multi-round accumulation, disabled after re-disable
- claim_dividends: no double-claim, partial holder claim, claim/reset
  accumulate cycle
- get_unclaimed_dividends: unknown holder returns 0, untokenized fails
- enable/disable_revenue_sharing: success and error paths, toggle cycle
- proportional distribution: sole holder, 3-way split, 4 equal holders
@truthixify truthixify merged commit d3ee01e into DistinctCodes:main Feb 22, 2026
4 of 5 checks passed
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.

[Contract] Build Dividend Distribution and Claiming Module

2 participants