Skip to content

Instantly share code, notes, and snippets.

@cocreature
Last active October 28, 2021 11:31
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save cocreature/641c1a886e081c498a2598f7dbed4a5a to your computer and use it in GitHub Desktop.
Save cocreature/641c1a886e081c498a2598f7dbed4a5a to your computer and use it in GitHub Desktop.
module Auction2 where
import DA.Date
template Auction2
with
auctioneer : Party
bidder : Party
object: Text
bid: Decimal
limit: Decimal
currency: Text
start: Time
end: Time
dateAuction: Date
where
signatory auctioneer, bidder
ensure limit > 0.0 && start < end
template AuctionBid
with
auctioneer: Party
bidder: Party
object: Text
bid: Decimal
currency: Text
limit: Decimal
start: Time
end: Time
where
signatory auctioneer
controller bidder can
MakeABid: ContractId Auction2
with
limitArg: Decimal
startArg: Time
endArg: Time
bidArg: Decimal
currencyArg: Text
do
currentTime <- getTime
create Auction2
with
limit = limitArg
start = startArg
end = endArg
bid= bidArg
currency = currencyArg
dateAuction = toDateUTC currentTime
..
Decline: ContractId DeclineBid
with
reason: Text
do
create DeclineBid with ..
template DeclineBid
with
auctioneer: Party
bidder: Party
object: Text
bid: Decimal
currency: Text
limit: Decimal
start: Time
end: Time
reason: Text
where
signatory auctioneer, bidder
controller bidder can
MakeNewBid: ContractId AuctionBid
do
create AuctionBid with ..
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment