Skip to content

Commit

Permalink
more pre conditions on safe destroy, remove NFT.Receiver interface
Browse files Browse the repository at this point in the history
  • Loading branch information
austinkline committed Jan 11, 2024
1 parent 0f56094 commit 7588739
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions contracts/LostAndFound.cdc
Original file line number Diff line number Diff line change
Expand Up @@ -380,6 +380,8 @@ access(all) contract LostAndFound {
let vault <- provider.withdraw(amount: LostAndFound.storageFees[uuid]!)
flowTokenRepayment!.borrow()!.deposit(from: <-vault)
}

bin.safeDestroy()
destroy bin
}
}
Expand Down Expand Up @@ -605,8 +607,9 @@ access(all) contract LostAndFound {
}

access(contract) fun safeDestroy() {
let v <- self.flowTokenVault.withdraw(amount: self.flowTokenVault.balance)
self.flowTokenRepayment.borrow()!.deposit(from: <-v)
pre {
self.flowTokenVault.balance == 0.0: "depositor still has flow tokens to be withdrawn"

Check warning on line 611 in contracts/LostAndFound.cdc

View check run for this annotation

Codecov / codecov/patch

contracts/LostAndFound.cdc#L611

Added line #L611 was not covered by tests
}
}
}

Expand Down Expand Up @@ -736,9 +739,6 @@ access(all) contract LostAndFound {
if cap.check<&{NonFungibleToken.Collection}>() {
let nft <- item as! @{NonFungibleToken.NFT}
cap.borrow<&{NonFungibleToken.Collection}>()!.deposit(token: <-nft)
} else if cap.check<&{NonFungibleToken.Receiver}>() {
let nft <- item as! @{NonFungibleToken.NFT}
cap.borrow<&{NonFungibleToken.Receiver}>()!.deposit(token: <-nft)
} else if cap.check<&{FungibleToken.Receiver}>() {
let vault <- item as! @{FungibleToken.Vault}
cap.borrow<&{FungibleToken.Receiver}>()!.deposit(from: <-vault)
Expand Down

0 comments on commit 7588739

Please sign in to comment.