Skip to content

Commit

Permalink
add some missing methods to the float raffle source
Browse files Browse the repository at this point in the history
  • Loading branch information
austinkline committed Dec 18, 2023
1 parent 6ade393 commit 9adc7d9
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 9 deletions.
8 changes: 8 additions & 0 deletions contracts/FLOATRaffleSource.cdc
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,14 @@ pub contract FLOATRaffleSource {
return
}

pub fun addEntry(_ v: AnyStruct) {
panic("addEntry is not supported on FLOATRaffleSource")
}

pub fun addEntries(_ v: [AnyStruct]) {
panic("addEntries is not supported on FLOATRaffleSource")
}

pub fun borrowEvent(): &FLOAT.FLOATEvent{FLOAT.FLOATEventPublic} {
let cap = self.eventCap.borrow() ?? panic("eventCap is not valid")
return cap.borrowPublicEventRef(eventId: self.eventId) ?? panic("invalid event id")
Expand Down
16 changes: 8 additions & 8 deletions contracts/FlowtyRaffleSource.cdc
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,14 @@ pub contract FlowtyRaffleSource {
return self.entries[index]
}

pub fun getEntries(): [AnyStruct] {
return self.entries
}

pub fun getEntryCount(): Int {
return self.entries.length
}

pub fun addEntry(_ v: AnyStruct) {
pre {
v.getType() == self.entryType: "incorrect entry type"
Expand All @@ -38,14 +46,6 @@ pub contract FlowtyRaffleSource {
self.entries.remove(at: drawingResult.index)
}

pub fun getEntries(): [AnyStruct] {
return self.entries
}

pub fun getEntryCount(): Int {
return self.entries.length
}

init(entryType: Type, removeAfterReveal: Bool) {
self.entries = []
self.entryType = entryType
Expand Down
2 changes: 1 addition & 1 deletion contracts/FlowtyRaffles.cdc
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ pub contract FlowtyRaffles {
*/
access(contract) fun reveal(_ source: &{RaffleSourcePublic, RaffleSourcePrivate}): DrawingResult {
pre {
self.commitBlock == nil || self.commitBlock! <= getCurrentBlock().height: "receipt cannot be revealed yet"
self.commitBlock! <= getCurrentBlock().height: "receipt cannot be revealed yet"
self.result == nil: "receipt has already been revealed"
}

Expand Down

0 comments on commit 9adc7d9

Please sign in to comment.