Skip to content

Commit

Permalink
Sadie/test hotfix (dapperlabs#122)
Browse files Browse the repository at this point in the history
* test with non-broken contract

* revert and add destroy token

* remove reference to changePercentage

* add comment to destroy buyTokens

* run make ci

* revert to previous v1 sale collection check

* remove panic if no moment for sale

* remove panics
  • Loading branch information
sadief committed Jul 19, 2021
1 parent 67c7ad6 commit ad54f75
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 15 deletions.
18 changes: 8 additions & 10 deletions contracts/TopShotMarketV3.cdc
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,6 @@ pub contract TopShotMarketV3 {
pub event MomentPurchased(id: UInt64, price: UFix64, seller: Address?)
/// emitted when a moment has been withdrawn from the sale
pub event MomentWithdrawn(id: UInt64, owner: Address?)
/// emitted when the cut percentage of the sale has been changed by the owner
pub event CutPercentageChanged(newPercent: UFix64, seller: Address?)

/// Path where the `SaleCollection` is stored
pub let marketStoragePath: StoragePath
Expand Down Expand Up @@ -178,12 +176,7 @@ pub contract TopShotMarketV3 {

// deposit the withdrawn moment into the main collection
ownerCollectionRef.deposit(token: <-token)
} else {
panic("Token with the specified ID is not already for sale in either sale collection")
}

} else {
panic("Token with the specified ID is not already for sale in either sale collection")
}
}

Expand Down Expand Up @@ -228,12 +221,17 @@ pub contract TopShotMarketV3 {
return <-boughtMoment

// If not found in this SaleCollection, check V1
} else if let v1Market = self.marketV1Capability {
let v1MarketRef = v1Market.borrow()!
} else {
if let v1Market = self.marketV1Capability {
let v1MarketRef = v1Market.borrow()!

return <-v1MarketRef.purchase(tokenID: tokenID, buyTokens: <-buyTokens)
return <-v1MarketRef.purchase(tokenID: tokenID, buyTokens: <-buyTokens)
} else {
panic("No token matching this ID for sale!")
}
}

destroy buyTokens // This line can be removed when this issue is released: https://github.com/onflow/cadence/pull/1000
panic("No token matching this ID for sale!")
}

Expand Down
Loading

0 comments on commit ad54f75

Please sign in to comment.