From 9adc7d90683d2ce8da0fcb0df32f7faa5551a150 Mon Sep 17 00:00:00 2001 From: Austin Kline Date: Mon, 18 Dec 2023 09:42:55 -0800 Subject: [PATCH] add some missing methods to the float raffle source --- contracts/FLOATRaffleSource.cdc | 8 ++++++++ contracts/FlowtyRaffleSource.cdc | 16 ++++++++-------- contracts/FlowtyRaffles.cdc | 2 +- 3 files changed, 17 insertions(+), 9 deletions(-) diff --git a/contracts/FLOATRaffleSource.cdc b/contracts/FLOATRaffleSource.cdc index f2eac4a..7d66232 100644 --- a/contracts/FLOATRaffleSource.cdc +++ b/contracts/FLOATRaffleSource.cdc @@ -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") diff --git a/contracts/FlowtyRaffleSource.cdc b/contracts/FlowtyRaffleSource.cdc index cc3c491..2316773 100644 --- a/contracts/FlowtyRaffleSource.cdc +++ b/contracts/FlowtyRaffleSource.cdc @@ -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" @@ -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 diff --git a/contracts/FlowtyRaffles.cdc b/contracts/FlowtyRaffles.cdc index 05d00f3..a94dbc3 100644 --- a/contracts/FlowtyRaffles.cdc +++ b/contracts/FlowtyRaffles.cdc @@ -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" }