Repository navigation
feat(regulated_token): store freeze, recovery and owner pinning - #599
Draft
JohnChangUK wants to merge 9 commits into
Draft
JohnChangUK wants to merge 9 commits into
JohnChangUK wants to merge 9 commits into
Conversation
Port of the chainlink-ccip-aptos change (smartcontractkit/chainlink-ccip-aptos#296): - Hooks check the root owner of the store instead of the direct owner, so nested stores behind a controller object are covered. - New store-level operations: freeze_stores, unfreeze_stores, burn_frozen_stores, recover_frozen_stores and the is_store_frozen view. - One adaptation: fungible_asset::transfer_ref_metadata comparison keeps the 1.6 form (no references).
Second half of the chainlink-ccip-aptos port (smartcontractkit/chainlink-ccip-aptos#296). StoreOwnerPins records each store's root owner on first credit; credits repin empty stores, debits and funded-store credits require a matching pin, so a frozen holder cannot move funds by reparenting the store. Funded stores predating the pin stay locked until operator recovery. Empty stores skip the debit pin check: nothing can leave them, and zero-amount debits must keep working. Adaptations for the 1.6 toolchain (CLI 9.1.0 resolves receiver calls only to self-named first parameters): object::root_owner, object::object_address, fungible_asset::transfer_ref_metadata, object::generate_signer_for_extending and signer::address_of are called in classic form.
Register freeze_stores, unfreeze_stores, burn_frozen_stores and recover_frozen_stores in the regulated_token MCMS registrar so MCMS-owned deployments can reach the new store-level operations.
The hooks now check only the root owner, so freeze_account on the object holding a store no longer stopped that store. Check the direct owner too, as the code did before the root-owner change.
The frozen-store requirement aborted with the bare constant; wrap it in error::invalid_state per the style guide, so clients see 0x30010 next to the module's other categorized codes.
A store funded before StoreOwnerPins existed has no pin, so after an in-place upgrade every deposit and withdrawal aborted E_STORE_NOT_PINNED. An account's primary store cannot change owner, so skip the pin check for it. StoreOwnershipPinned becomes a module event, and the tests cover the upgrade cases.
This branch has not been deployed
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.
Description
object::root_owner(store)instead of the direct owner, so an account freeze reaches nested stores.freeze_stores,unfreeze_stores,burn_frozen_stores,recover_frozen_stores; the MCMS registrar dispatches all four.Rollout
cbBTC (
0xbb705952..., MCMS-owned) and USD1 (0x6febdb56..., external owner).E_STORE_NOT_PINNED. Account primary stores, empty stores and new stores are unaffected.freeze_stores([store])thenrecover_frozen_stores([store], destination).Ticket: https://smartcontract-it.atlassian.net/browse/NONEVM-6394