Skip to content

Instantly share code, notes, and snippets.

@astrojarred
Last active October 1, 2021 05:04
Show Gist options
  • Save astrojarred/0a0b630225b9fd9f3f72b7d76e0cac3e to your computer and use it in GitHub Desktop.
Save astrojarred/0a0b630225b9fd9f3f72b7d76e0cac3e to your computer and use it in GitHub Desktop.
Token Sale 1
When
[Case
(Deposit
(Role "seller")
(Role "seller")
(Token "" "")
(Constant 2000000)
)
(When
[Case
(Choice
(ChoiceId
"sale_price"
(Role "seller")
)
[Bound 5 100000000]
)
(When
[Case
(Deposit
(Role "seller")
(Role "seller")
(Token "dddddd" "dexoworld")
(ConstantParam "n_tokens")
)
(When
[Case
(Deposit
(Role "buyer")
(Role "buyer")
(Token "" "")
(MulValue
(AddValue
(Constant 1000000)
(MulValue
(Constant 10000)
(ConstantParam "royalty")
)
)
(ChoiceValue
(ChoiceId
"sale_price"
(Role "seller")
))
)
)
(Pay
(Role "buyer")
(Party (Role "seller"))
(Token "" "")
(MulValue
(Constant 1000000)
(ChoiceValue
(ChoiceId
"sale_price"
(Role "seller")
))
)
(Pay
(Role "seller")
(Party (Role "buyer"))
(Token "dddddd" "dexoworld")
(ConstantParam "n_tokens")
(Pay
(Role "buyer")
(Party (Role "treasury"))
(Token "" "")
(MulValue
(MulValue
(Constant 10000)
(ConstantParam "royalty")
)
(ChoiceValue
(ChoiceId
"sale_price"
(Role "seller")
))
)
Close
)
)
)]
(SlotParam "timeout for completing purchase")
Close
)]
(SlotParam "timeout for token deposit")
Close
)]
(SlotParam "timeout for choosing price")
Close
)]
(SlotParam "timeout for fee payment")
Close
{"valueParameterDescriptions":[["Price","Amount of Lovelace to be paid by the *Buyer* for the item."]],"slotParameterDescriptions":[["Buyer's deposit timeout","Deadline by which the *Buyer* must deposit the selling *Price* in the contract."],["Buyer's dispute timeout","Deadline by which, if the *Buyer* has not opened a dispute, the *Seller* will be paid."],["Seller's response timeout","Deadline by which, if the *Seller* has not responded to the dispute, the *Buyer* will be refunded."],["Timeout for arbitrage","Deadline by which, if the *Arbiter* has not resolved the dispute, the *Buyer* will be refunded."]],"roleDescriptions":[["Arbiter","The party that will choose who gets the money in the event of a disagreement between the *Buyer* and the *Seller* about the outcome."],["Buyer","The party that wants to buy the item. Payment is made to the *Seller* if they acknowledge receiving the item."],["Seller","The party that wants to sell the item. They receive the payment if the exchange is uneventful."]],"contractType":"ES","contractName":"Simple escrow","contractDescription":"Regulates a money exchange between a *Buyer* and a *Seller*. If there is a disagreement, an *Arbiter* will decide whether the money is refunded or paid to the *Seller*.","choiceDescriptions":[["Confirm problem","Acknowledge there was a problem and a refund must be granted."],["Dismiss claim","The *Arbiter* does not see any problem with the exchange and the *Seller* must be paid."],["Dispute problem","The *Seller* disagrees with the *Buyer* about the claim that something went wrong."],["Everything is alright","The transaction was uneventful, *Buyer* agrees to pay the *Seller*."],["Report problem","The *Buyer* claims not having received the product that was paid for as agreed and would like a refund."]]}
When
[Case
(Deposit
(Role "seller")
(Role "seller")
(Token "" "")
(AddValue
(Scale
(1%1000000)
(ConstantParam "world_id")
)
(Constant 5000000)
)
)
(When
[Case
(Choice
(ChoiceId
"sale_price"
(Role "seller")
)
[Bound 5000000 100000000000000]
)
(When
[Case
(Deposit
(Role "seller")
(Role "seller")
(Token "dddddd" "dexoworld")
(ConstantParam "n_tokens")
)
(When
[Case
(Deposit
(Role "buyer")
(Role "buyer")
(Token "" "")
(AddValue
(ChoiceValue
(ChoiceId
"sale_price"
(Role "seller")
))
(Scale
(1%1000000)
(ConstantParam "world_id")
)
)
)
(Pay
(Role "buyer")
(Party (Role "seller"))
(Token "" "")
(ChoiceValue
(ChoiceId
"sale_price"
(Role "seller")
))
(Pay
(Role "seller")
(Party (Role "buyer"))
(Token "dddddd" "dexoworld")
(ConstantParam "n_tokens")
(Pay
(Role "seller")
(Party (Role "treasury"))
(Token "" "")
(AvailableMoney
(Role "buyer")
(Token "" "")
)
(Pay
(Role "seller")
(Party (Role "treasury"))
(Token "" "")
(AvailableMoney
(Role "seller")
(Token "" "")
)
Close
)
)
)
)]
(SlotParam "timeout for completing purchase")
Close
)]
(SlotParam "timeout for token deposit")
Close
)]
(SlotParam "timeout for choosing price")
Close
)]
(SlotParam "timeout for fee payment")
Close
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment