feat(contracts): retire asset, audit log, owner registry and admin fu…#725
Merged
yusuftomilola merged 1 commit intoDistinctCodes:mainfrom Apr 26, 2026
Conversation
…nctions - feat(DistinctCodes#645): implement retire_asset and get_asset_info functions · retire_asset(env, asset_id) — requires auth from asset owner · Sets status to AssetStatus::Retired on successful call · Panics if asset is already retired — no double-retire allowed · Emits retirement event on successful state change · get_asset_info(env, asset_id) -> Asset — reads asset from storage · Panics with 'Asset not found' if asset_id does not exist in storage · Both functions check contract is not paused before executing · Unit tests for retire success, already-retired panic, get found, get not found - feat(DistinctCodes#649): implement on-chain audit log system · AuditLog struct: log_id: u64, asset_id: BytesN<32>, action: String, actor: Address, timestamp: u64, details: String in audit.rs · append_audit_log(env, asset_id, action, actor, details) creates entry, appends to asset log list in storage, increments global log counter · get_audit_logs(env, asset_id) -> Vec<AuditLog> returns all logs per asset · Called internally by register_asset, transfer_asset and retire_asset · Unit tests verifying log entries recorded correctly per action - feat(DistinctCodes#646): implement owner registry address-to-asset-IDs index · get_assets_by_owner(env, owner) -> Vec<BytesN<32>> returns all asset IDs · add_to_owner_registry(env, owner, asset_id) appends asset ID to owner list · remove_from_owner_registry(env, owner, asset_id) removes asset ID from list · Both helpers called automatically in register_asset and transfer_asset · Registry stored under DataKey::OwnerAssets(Address) in contract storage - feat(DistinctCodes#647): implement contract initialization and admin functions · initialize(env, admin: Address) sets admin under DataKey::Admin in storage · Panics if contract already initialized — no re-init allowed · get_admin(env) -> Address returns stored admin address · add_registrar(env, registrar: Address) admin-only, adds to registrars list · remove_registrar(env, registrar: Address) admin-only, removes from list · is_authorized_registrar(env, address: Address) -> bool checks registrar status · get_total_asset_count(env) -> u64 returns total registered asset count Closes DistinctCodes#645, Closes DistinctCodes#646, Closes DistinctCodes#647, Closes DistinctCodes#649
|
@lynaDev2 is attempting to deploy a commit to the naijabuz's projects Team on Vercel. A member of the Team first needs to authorize it. |
|
@Uyoxy 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! 🚀 |
yusuftomilola
approved these changes
Apr 26, 2026
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
Implements four core smart contract features for DistinctCodes/AssetsUp
inside `contracts/contrib/src/` only. No files outside this path were modified.
Changes
#645 — retire_asset and get_asset_info [SC-05]
#649 — On-Chain Audit Log System [SC-09]
#646 — Owner Registry [SC-06]
#647 — Contract Initialization & Admin Functions [SC-07]
Test Coverage
Checklist
Closes
Closes #645
Closes #646
Closes #647
Closes #649