-
-
Save cocreature/641c1a886e081c498a2598f7dbed4a5a to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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