Skip to content

Commit

Permalink
creator methods
Browse files Browse the repository at this point in the history
  • Loading branch information
austinkline committed Dec 15, 2023
1 parent 9a0f2d4 commit fbc8456
Showing 1 changed file with 15 additions and 4 deletions.
19 changes: 15 additions & 4 deletions contracts/Raffles.cdc
Original file line number Diff line number Diff line change
Expand Up @@ -57,12 +57,10 @@ pub contract Raffles {

init(
source: @{RaffleSource},
start: UInt64?,
end: UInt64,
display: MetadataViews.Display
details: Details
) {
self.source <- source
self.details = Details(start, end, display)
self.details = details
}

destroy() {
Expand Down Expand Up @@ -134,6 +132,19 @@ pub contract Raffles {
return <- create Manager()
}

pub fun createRaffle(source: @{RaffleSource}, details: Details): @Raffle {
return <- create Raffle(source: <- source, details: details)
}

pub fun createRaffleSource(_ type: Type): @{RaffleSource} {
switch type {
case Type<@AddressRaffleSource>():
return <- create AddressRaffleSource()
}

panic("raffle source type ".concat(type.identifier).concat(" is not valid"))
}

init() {
let identifier = "Raffle_".concat(self.account.address.toString())
self.ManagerStoragePath = StoragePath(identifier: identifier)!
Expand Down

0 comments on commit fbc8456

Please sign in to comment.