Skip to content

Commit

Permalink
make minter optional in Pricer.getPrice (#15)
Browse files Browse the repository at this point in the history
  • Loading branch information
austinkline authored Apr 25, 2024
1 parent 746dbc3 commit 3d4bbc0
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
4 changes: 2 additions & 2 deletions contracts/DropTypes.cdc
Original file line number Diff line number Diff line change
Expand Up @@ -146,8 +146,8 @@ pub contract DropTypes {
self.remainingForAddress = nil
}

if minter != nil && paymentIdentifier != nil && minter != nil {
let price = d.pricer.getPrice(num: quantity!, paymentTokenType: CompositeType(paymentIdentifier!)!, minter: minter!)
if paymentIdentifier != nil && quantity != nil {
let price = d.pricer.getPrice(num: quantity!, paymentTokenType: CompositeType(paymentIdentifier!)!, minter: minter)

self.quote = Quote(price: price, quantity: quantity!, paymentIdentifier: paymentIdentifier!, minter: minter!)
} else {
Expand Down
2 changes: 1 addition & 1 deletion contracts/FlowtyDrops.cdc
Original file line number Diff line number Diff line change
Expand Up @@ -298,7 +298,7 @@ pub contract FlowtyDrops {
}

pub struct interface Pricer {
pub fun getPrice(num: Int, paymentTokenType: Type, minter: Address): UFix64
pub fun getPrice(num: Int, paymentTokenType: Type, minter: Address?): UFix64
pub fun getPaymentTypes(): [Type]
}

Expand Down
4 changes: 2 additions & 2 deletions contracts/FlowtyPricers.cdc
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ pub contract FlowtyPricers {
pub var price: UFix64
pub let paymentTokenType: Type

pub fun getPrice(num: Int, paymentTokenType: Type, minter: Address): UFix64 {
pub fun getPrice(num: Int, paymentTokenType: Type, minter: Address?): UFix64 {
return self.price * UFix64(num)
}

Expand All @@ -37,7 +37,7 @@ pub contract FlowtyPricers {
The Free Pricer can be used for a free mint, it has no price and always marks its payment type as @FlowToken.Vault
*/
pub struct Free: FlowtyDrops.Pricer {
pub fun getPrice(num: Int, paymentTokenType: Type, minter: Address): UFix64 {
pub fun getPrice(num: Int, paymentTokenType: Type, minter: Address?): UFix64 {
return 0.0
}

Expand Down

0 comments on commit 3d4bbc0

Please sign in to comment.