Skip to content

Commit

Permalink
percent check (#115)
Browse files Browse the repository at this point in the history
  • Loading branch information
joshuahannan authored Jun 1, 2021
1 parent 8762d9c commit 9e76cff
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 7 deletions.
3 changes: 3 additions & 0 deletions contracts/MarketTopShot.cdc
Original file line number Diff line number Diff line change
Expand Up @@ -229,6 +229,9 @@ pub contract Market {
//
// Parameters: newPercent: The new cut percentage for the sale
pub fun changePercentage(_ newPercent: UFix64) {
pre {
newPercent <= 1.0: "Cannot set cut percentage to greater than 100%"
}
self.cutPercentage = newPercent

emit CutPercentageChanged(newPercent: newPercent, seller: self.owner?.address)
Expand Down
3 changes: 3 additions & 0 deletions contracts/TopShotMarketV2.cdc
Original file line number Diff line number Diff line change
Expand Up @@ -221,6 +221,9 @@ pub contract TopShotMarketV2 {
//
// Parameters: newPercent: The new cut percentage for the sale
pub fun changePercentage(_ newPercent: UFix64) {
pre {
newPercent <= 1.0: "Cannot set cut percentage to greater than 100%"
}
self.cutPercentage = newPercent

emit CutPercentageChanged(newPercent: newPercent, seller: self.owner?.address)
Expand Down
Loading

0 comments on commit 9e76cff

Please sign in to comment.