Skip to content

feat: add compliance-officer role across all three contracts - #162

Merged
Idaonoli merged 2 commits into
stellar-compliance-kit:mainfrom
odunfemisamuel-maker:feat/compliance-officer-role
Jul 30, 2026
Merged

feat: add compliance-officer role across all three contracts#162
Idaonoli merged 2 commits into
stellar-compliance-kit:mainfrom
odunfemisamuel-maker:feat/compliance-officer-role

Conversation

@odunfemisamuel-maker

Copy link
Copy Markdown
Contributor

Summary

Adds a compliance-officer role across all three contracts (, , ) so day-to-day compliance operations can be performed by a different team/key than the one that controls contract-level admin changes.

Design: Single Address

The compliance officer is stored as a single Address in instance() storage — consistent with the existing Admin/Issuer pattern, O(1) checks, and easy rotation via set_compliance_officer.

Per-contract changes

Contract New functions Modified functions
denylist-gate set_compliance_officer(admin, officer)
revoke_compliance_officer(admin)
add_to_denylist, remove_from_denylist now accept admin or compliance officer
allowlist-token set_compliance_officer(admin, officer)
revoke_compliance_officer(admin)
add_to_allowlist, remove_from_allowlist now accept admin or compliance officer
jurisdiction-flag set_compliance_officer(issuer, officer)
revoke_compliance_officer(issuer)
set_jurisdiction now accepts issuer or compliance officer

Each contract gains a private require_compliance_authority helper that checks admin/issuer first, then falls back to the compliance officer.

  • Admin/issuer retains full access to all operations (this is additive, not a replacement)
  • Only admin/issuer can assign or revoke the compliance-officer role

Tests added (5 per contract = 15 total)

  • ✅ Compliance officer can perform delegated actions
  • ✅ Compliance officer cannot set or revoke the role
  • ✅ Admin/issuer can set and revoke compliance officer
  • ✅ Revoked officer loses access
  • ✅ Admin/issuer retains full access to compliance actions

The denylist-gate-consumer example is unaffected (only calls the read-only check()).

Closes #107

Add a compliance-officer role (single address in instance storage) that
can perform day-to-day compliance operations while reserving role
management to the existing admin/issuer.

- denylist-gate: add_to_denylist/remove_from_denylist now accept admin
  OR compliance officer. New set_compliance_officer/revoke_compliance_officer
  are admin-only.
- allowlist-token: add_to_allowlist/remove_from_allowlist now accept
  admin OR compliance officer. New set_compliance_officer/revoke_compliance_officer
  are admin-only.
- jurisdiction-flag: set_jurisdiction now accepts issuer OR compliance
  officer. New set_compliance_officer/revoke_compliance_officer are issuer-only.

Each contract gains a require_compliance_authority helper that checks
admin/issuer first, then falls back to the compliance officer.
Admin/issuer retains full access to all operations (additive, not a
replacement).

Tests cover: officer can perform delegated actions, officer cannot
set/revoke the role, admin can set/revoke officer, revoked officer
loses access, admin retains access.

Closes stellar-compliance-kit#107
@drips-wave

drips-wave Bot commented Jul 29, 2026

Copy link
Copy Markdown

@odunfemisamuel-maker 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

@Idaonoli
Idaonoli merged commit fe37042 into stellar-compliance-kit:main Jul 30, 2026
1 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.

Add role-based access control (e.g. a compliance-officer role separate from admin) across all three contracts

2 participants