Skip to content

Commit

Permalink
added post check
Browse files Browse the repository at this point in the history
  • Loading branch information
joshuahannan committed May 25, 2020
1 parent 3c95a0c commit 16ffd24
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions contracts/TopShotShardedCollection.cdc
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,9 @@ pub contract TopShotShardedCollection {

// withdraw removes an Moment from the collection and moves it to the caller
pub fun withdraw(withdrawID: UInt64): @NonFungibleToken.NFT {
post {
result.id == withdrawID: "The ID of the withdrawn NFT is incorrect"
}
// find the bucket it should be withdrawn from
let bucket = withdrawID % self.numBuckets

Expand Down Expand Up @@ -111,6 +114,9 @@ pub contract TopShotShardedCollection {
// borrowNFT Returns a borrowed reference to a Moment in the collection
// so that the caller can read data and call methods from it
pub fun borrowNFT(id: UInt64): &NonFungibleToken.NFT {
post {
result.id == id: "The ID of the reference is incorrect"
}

let bucket = id % self.numBuckets

Expand Down

0 comments on commit 16ffd24

Please sign in to comment.