Skip to content

Commit

Permalink
add remove option inside setChildAccountDisplay
Browse files Browse the repository at this point in the history
  • Loading branch information
Felipe Ribeiro authored and sisyphusSmiling committed Jul 7, 2023
1 parent df1d5fd commit 676bfbc
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions contracts/HybridCustody.cdc
Original file line number Diff line number Diff line change
Expand Up @@ -271,15 +271,19 @@ pub contract HybridCustody {
/// Dapper Wallet parent account's should not be able to retrieve any FungibleToken Provider capabilities.
pub var filter: Capability<&{CapabilityFilter.Filter}>?

// display is its own field on the ChildAccount resource because only the parent should be able to set this
// field.
// display metadata for a child account exists on its parent
pub let childAccountDisplays: {Address: MetadataViews.Display}

pub fun setChildAccountDisplay(address: Address, _ d: MetadataViews.Display) {
pub fun setChildAccountDisplay(address: Address, _ d: MetadataViews.Display?) {
pre {
self.childAccounts[address] != nil: "There is no child account with this address"
}

if d == nil {
self.childAccountDisplays.remove(key: address)
return
}

self.childAccountDisplays[address] = d
}

Expand Down

0 comments on commit 676bfbc

Please sign in to comment.