You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
contracts/assetsup/src/dividends.rs implements lump-sum dividend distribution but does not support continuous streaming. Token holders must wait for periodic distributions rather than earning dividends proportionally per second.
Proposed Solution
Create contracts/opsce/src/dividend_stream.rs. Implement a streaming dividend mechanism where a pool of funds is distributed linearly over a defined period, and holders can claim their accrued share at any time.
Acceptance Criteria
start_dividend_stream(env, asset_id, total_amount, duration_seconds) initiates a stream (admin only)
calculate_claimable(env, asset_id, holder) returns tokens earned since last claim based on proportional share and elapsed time
claim_stream_dividends(env, asset_id) transfers accrued amount to caller and updates last-claim timestamp
end_dividend_stream(env, asset_id) stops the stream and returns unclaimed funds to admin
Emits stream_started, dividends_claimed, and stream_ended events
Unit tests cover: proportional share calculation, multiple claims, zero-balance holder, stream end
Problem
contracts/assetsup/src/dividends.rsimplements lump-sum dividend distribution but does not support continuous streaming. Token holders must wait for periodic distributions rather than earning dividends proportionally per second.Proposed Solution
Create
contracts/opsce/src/dividend_stream.rs. Implement a streaming dividend mechanism where a pool of funds is distributed linearly over a defined period, and holders can claim their accrued share at any time.Acceptance Criteria
start_dividend_stream(env, asset_id, total_amount, duration_seconds)initiates a stream (admin only)calculate_claimable(env, asset_id, holder)returns tokens earned since last claim based on proportional share and elapsed timeclaim_stream_dividends(env, asset_id)transfers accrued amount to caller and updates last-claim timestampend_dividend_stream(env, asset_id)stops the stream and returns unclaimed funds to adminstream_started,dividends_claimed, andstream_endedevents