Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Change minter to optional in Quote Struct #16

Merged
merged 1 commit into from
Apr 30, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions contracts/DropTypes.cdc
Original file line number Diff line number Diff line change
Expand Up @@ -81,9 +81,9 @@ pub contract DropTypes {
pub let price: UFix64
pub let quantity: Int
pub let paymentIdentifier: String
pub let minter: Address
pub let minter: Address?

init(price: UFix64, quantity: Int, paymentIdentifier: String, minter: Address) {
init(price: UFix64, quantity: Int, paymentIdentifier: String, minter: Address?) {
self.price = price
self.quantity = quantity
self.paymentIdentifier = paymentIdentifier
Expand Down Expand Up @@ -149,7 +149,7 @@ pub contract DropTypes {
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!)
self.quote = Quote(price: price, quantity: quantity!, paymentIdentifier: paymentIdentifier!, minter: minter)
} else {
self.quote = nil
}
Expand Down
9 changes: 9 additions & 0 deletions tests/FlowtyDrops_tests.cdc
Original file line number Diff line number Diff line change
Expand Up @@ -185,6 +185,15 @@ pub fun test_OpenEditionNFT_getDropSummary() {
Test.assertEqual(1, summaries[0].phases.length)
}

pub fun test_OpenEditionNFT_getDropSummary_noMinter() {
let dropID = createDefaultTimeBasedOpenEditionDrop()

let summaries = scriptExecutor("get_drop_summaries.cdc", [openEditionAccount.address, "OpenEditionNFT", nil, 1, exampleTokenIdentifier()])! as! [DropTypes.DropSummary]
Test.assertEqual(1, summaries.length)
Test.assertEqual(summaries[0].totalMinted, 0)
Test.assertEqual(summaries[0].mintedByAddress, nil)
Test.assertEqual(1, summaries[0].phases.length)
}
// ------------------------------------------------------------------------
// Helper functions section

Expand Down
Loading