Skip to content

Commit

Permalink
add comments to burnCallback methods
Browse files Browse the repository at this point in the history
  • Loading branch information
austinkline committed Apr 3, 2024
1 parent 2d12790 commit 0336192
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions contracts/HybridCustody.cdc
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ import "CapabilityFilter"
/// Repo reference: https://github.com/onflow/hybrid-custody
///
access(all) contract HybridCustody {

access(all) entitlement Owner
access(all) entitlement Child
access(all) entitlement Publish
Expand Down Expand Up @@ -330,7 +329,7 @@ access(all) contract HybridCustody {

self.filter = cap
}

/// Sets the Filter Capability for this Manager, propagating to the specified child account
///
access(Manage) fun setManagerCapabilityFilter(cap: Capability<&{CapabilityFilter.Filter}>?, childAddress: Address) {
Expand Down Expand Up @@ -501,6 +500,10 @@ access(all) contract HybridCustody {
self.resources <- {}
}

// When a manager resource is destroyed, attempt to remove this parent from every
// child account it currently has
//
// Destruction will fail if there are any owned account to prevent loss of access to an account
access(contract) fun burnCallback() {
pre {
// Prevent accidental burning of a resource that has ownership of other accounts
Expand Down Expand Up @@ -776,6 +779,7 @@ access(all) contract HybridCustody {
return child!.getControllerIDForType(type: type, forPath: forPath)
}

// When a ChildAccount is destroyed, attempt to remove it from the parent account as well
access(contract) fun burnCallback() {
self.parentRemoveChildCallback(parent: self.parent)
}
Expand Down Expand Up @@ -1200,6 +1204,7 @@ access(all) contract HybridCustody {
self.display = nil
}

// When an OwnedAccount is destroyed, remove it from every configured parent account
access(contract) fun burnCallback() {
for p in self.parents.keys {
self.removeParent(parent: p)
Expand Down

0 comments on commit 0336192

Please sign in to comment.