Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Try to refill custodial accounts #184

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions contracts/TopShot.cdc
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ import FungibleToken from 0xFUNGIBLETOKENADDRESS
import NonFungibleToken from 0xNFTADDRESS
import MetadataViews from 0xMETADATAVIEWSADDRESS
import TopShotLocking from 0xTOPSHOTLOCKINGADDRESS
import DapperStorageRent from 0xDAPPERSTORAGERENTADDRESS

pub contract TopShot: NonFungibleToken {
// -----------------------------------------------------------------------
Expand Down Expand Up @@ -1159,6 +1160,12 @@ pub contract TopShot: NonFungibleToken {
// Get the token's ID
let id = token.id

// For custodial accounts, ensure there is sufficient
// storage capacity to store the token
if self.owner?.address != nil {
DapperStorageRent.tryRefill(self.owner?.address)
}

// Add the new token to the dictionary
let oldToken <- self.ownedNFTs[id] <- token

Expand Down