Repository navigation
Back dividend claims with real token transfers and authorize valuation and distribution - #1859
Merged
yusuftomilola merged 11 commits intoNov 24, 2026
Conversation
Closes DistinctCodes#1785: claim_dividends now transfers the configured payment token from the contract to the holder before zeroing the ledger. A failed transfer reverts the invocation, leaving unclaimed dividends intact.
Closes DistinctCodes#1784: distribute_dividends now requires tokenizer/admin authentication, pulls the configured payment token from the caller into the contract before crediting holders, and fails with InvalidInput when no dividend token is configured. Adds set_dividend_token and a get_dividend_token read.
Closes DistinctCodes#1783: update_valuation now takes a caller that must authenticate and be either the asset's tokenizer or the contract admin; anonymous and non-privileged callers fail with Unauthorized.
Closes DistinctCodes#1785, Closes DistinctCodes#1784, Closes DistinctCodes#1783: adds client-level tests with a Stellar Asset Contract covering real transfers on claim, failed-transfer ledger preservation, caller-funded distribution, no-token and unauthorized failures, and tokenizer/admin-only valuation updates.
Closes DistinctCodes#1779: replace the hostname '**' wildcard with a comma-separated NEXT_PUBLIC_IMAGE_HOSTS allowlist read at build time. Protocol is fixed to https and the default allows no remote hosts.
|
@devrabiuhussain is attempting to deploy a commit to the naijabuz's projects Team on Vercel. A member of the Team first needs to authorize it. |
|
@devrabiuhussain 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! 🚀 |
2 tasks
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
This change backs dividend claims with real token transfers, requires authorization for
distribution and valuation updates, and tightens the
next/imageremote-host policy.#1785 — Dividend claims now pay tokens
dividends::claim_dividendspreviously clearedunclaimed_dividendsand emitted an eventwithout moving any funds. A per-asset payment token is now stored under a new
TokenDataKey::DividendToken(u64)variant, configured by an admin/tokenizer-onlyset_dividend_tokenentrypoint. Claims transfer the configured token from the contract tothe holder before zeroing the ledger; a failed transfer reverts the invocation, leaving
the holder's accrued dividends intact. The Stellar Asset Contract testutils are used to
prove the holder's balance increases and that a failed payout leaves the ledger unchanged.
#1784 — Distribution is authorized and funded
distribute_dividendsnow takes acallerthat must authenticate and be the asset'stokenizer or the contract admin (via a shared
require_asset_admin_or_tokenizerhelper),returning
Error::Unauthorizedotherwise. The fulltotal_amountof the configured paymenttoken is pulled from that caller into the contract in the same invocation before any holder
is credited, so dividend liabilities are always backed. With no token configured the call
fails with the typed
InvalidInputerror. Tests cover funded distribution (contract balanceequals the distributed amount), missing-token rejection, unauthenticated rejection and an
authenticated non-privileged caller rejection.
#1783 — Valuation updates are authorized
update_valuationnow takes acallerthat must authenticate and be the asset's tokenizer orthe contract admin; anonymous and non-privileged callers get
Error::Unauthorized. Oracleauth was deliberately not added because
assetsuphas no oracle registry — this decision isdocumented in
contracts/AUTHORIZATION.md, which also replaces the "no auth" rows for thetwo affected entrypoints and records the new
set_dividend_tokensigner. All affected Rusttest call sites were updated.
#1779 —
next/imageremote patterns are an allowlistfrontend/next.config.tsno longer useshostname: "**". Remote hosts are now built atconfig load from a comma-separated
NEXT_PUBLIC_IMAGE_HOSTSenvironment variable, theprotocol is fixed to
https, and the default is an empty allowlist — no remote hosts arepermitted unless explicitly configured.
Tests were not run locally per the task instructions.
Closes #1785
Closes #1784
Closes #1783
Closes #1779