Skip to content

Fix holder pruning, jurisdiction attestation and revenue-sharing authorization - #1861

Merged
yusuftomilola merged 18 commits into
DistinctCodes:mainfrom
ykargeee-bit:feature/token-compliance-and-revenue-auth
Nov 24, 2026
Merged

yusuftomilola merged 18 commits into
DistinctCodes:mainfrom
ykargeee-bit:feature/token-compliance-and-revenue-auth

Conversation

@ykargeee-bit

Copy link
Copy Markdown
Contributor

Summary

This change closes four issues in the assetsup contract, all in the token-compliance and revenue-sharing area.

#1792 — zero-balance holders are never pruned from TokenHoldersList

tokenization::transfer_tokens now removes the sender from TokenHoldersList when their balance reaches zero after a transfer, and keeps token_holders_count in sync (both pruning and adding a holder). The TokenHolder ownership record is deliberately retained so dividends already accrued remain claimable by an address that no longer holds tokens. A self-transfer is excluded so the credited balance stays represented. Tests cover the resulting holder list, the count, and claiming accrued dividends after pruning.

#1791 — holders self-declare their jurisdiction

set_address_jurisdiction no longer authenticates the subject address. It takes a caller who must authenticate and be either the contract admin or a member of a new admin-managed KYC/compliance attester set, so a holder cannot self-attest a jurisdiction to satisfy a geographic allow-list. The attester set is stored under a new TokenDataKey variant (appended last to preserve existing key discriminants) and is managed through the admin-gated add_jurisdiction_attester / remove_jurisdiction_attester entrypoints, with read-only is_jurisdiction_attester / get_jurisdiction_attesters. Tests prove a signing holder is rejected with Unauthorized, that missing authorization fails, and that attesters/admins can record jurisdictions.

#1790 — set_transfer_restriction wipes the geographic allow-list

transfer_restrictions::set_transfer_restriction now reads the stored restriction and updates only require_accredited, leaving geographic_allowed intact — mirroring set_geographic_restriction. The public wrapper also takes a caller that must authenticate as the token's tokenizer or the admin. Tests assert both fields survive when written in either order, plus the new authorization checks.

#1786 — enable/disable_revenue_sharing have no authorization

Both entrypoints now take a caller that authenticates and must be the token's tokenizer or the contract admin; any other signer gets Unauthorized. A small shared helper in lib.rs centralizes this check for the privileged token-level setters, keeping the module functions unchanged for direct unit tests. All existing call sites were updated, and tests cover success with mocks, missing auth, and rejection of a third party.

Documentation: contracts/AUTHORIZATION.md now records the new required signers and the attester role.

Tests were not run locally per the task instructions.

Closes #1792
Closes #1791
Closes #1790
Closes #1786

Closes DistinctCodes#1792

After a full transfer the sender no longer appears in TokenHoldersList and
token_holders_count is decremented. The TokenHolder ownership record is kept
so unclaimed dividends remain claimable.
Closes DistinctCodes#1791

set_address_jurisdiction now authenticates a caller who must be the admin or
an admin-managed KYC/compliance attester. Holders can no longer self-attest.
Adds admin-gated entrypoints to manage the attester set.
…ted update

Closes DistinctCodes#1790

set_transfer_restriction now reads the stored restriction and changes only
require_accredited, so a previously configured geographic allow-list survives.
Closes DistinctCodes#1786

enable_revenue_sharing and disable_revenue_sharing now authenticate a caller
and allow only the token's tokenizer or the contract admin.
@vercel

vercel Bot commented Nov 23, 2026

Copy link
Copy Markdown

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

A member of the Team first needs to authorize it.

@drips-wave

drips-wave Bot commented Nov 23, 2026

Copy link
Copy Markdown

@ykargeee-bit 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! 🚀

Learn more about application limits

@yusuftomilola
yusuftomilola merged commit 108728a into DistinctCodes:main Nov 24, 2026
1 of 12 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

2 participants