From fc038835bbe7eb01e5a2ebd947ca5b33691d1bdd Mon Sep 17 00:00:00 2001 From: Jamil Khan Date: Wed, 30 Nov 2022 01:08:09 -0500 Subject: [PATCH] Try to refill custodial accounts --- contracts/TopShot.cdc | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/contracts/TopShot.cdc b/contracts/TopShot.cdc index 7bd3efc3..00d16cd4 100644 --- a/contracts/TopShot.cdc +++ b/contracts/TopShot.cdc @@ -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 { // ----------------------------------------------------------------------- @@ -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