Skip to content

Instantly share code, notes, and snippets.

@simonredfern
Created November 14, 2021 12:05
Show Gist options
  • Save simonredfern/ca24502af13ef4c5d118b4913c36ee84 to your computer and use it in GitHub Desktop.
Save simonredfern/ca24502af13ef4c5d118b4913c36ee84 to your computer and use it in GitHub Desktop.
TCoin
{"valueParameterInfo":[["Collateral amount",{"valueParameterFormat":{"contents":[6,"₳"],"tag":"DecimalFormat"},"valueParameterDescription":"The amount of Lovelace to be deposited by both parties at the start of the contract to serve as an incentive for collaboration."}],["Price",{"valueParameterFormat":{"contents":[6,"₳"],"tag":"DecimalFormat"},"valueParameterDescription":"The amount of Lovelace to be paid by the _**Buyer**_ as part of the exchange."}]],"slotParameterDescriptions":[["Collateral deposit by seller timeout","The deadline by which the _**Seller**_ must deposit the _**Collateral amount**_ in the contract."],["Deposit of collateral by buyer timeout","The deadline by which the _**Buyer**_ must deposit the _**Collateral amount**_ in the contract."],["Deposit of price by buyer timeout","The deadline by which the _**Buyer**_ must deposit the _**Price**_ in the contract."],["Dispute by buyer timeout","The deadline by which, if the _**Buyer**_ has not opened a dispute, the _**Seller**_ will be paid."],["Complaint deadline","The deadline by which, if the _**Seller**_ has not responded to the dispute, the _**Buyer**_ will be refunded."]],"roleDescriptions":[["Buyer","The party that pays for the item on sale."],["Seller","The party that sells the item and gets the money if the exchange is successful."]],"contractType":"Escrow","contractShortDescription":"In this contract a _**seller**_ wants to sell an item (like a bicycle) to a _**buyer**_ for a _price_.","contractName":"Escrow with collateral","contractLongDescription":"In order to incentivise collaboration between the _**seller**_ and the _**buyer**_, at the beginning of the contract both parties deposit the _collateral amount_ that is burned if the parties disagree.","choiceInfo":[["Confirm problem",{"choiceFormat":{"contents":null,"tag":"DefaultFormat"},"choiceDescription":"Acknowledge that there was a problem and a refund must be granted."}],["Dispute problem",{"choiceFormat":{"contents":null,"tag":"DefaultFormat"},"choiceDescription":"The _**Seller**_ disagrees with the _**Buyer**_ about the claim that something went wrong and the collateral will be burnt."}],["Everything is alright",{"choiceFormat":{"contents":null,"tag":"DefaultFormat"},"choiceDescription":"The exchange was successful and the _**Buyer**_ agrees to pay the _**Seller**_."}],["Report problem",{"choiceFormat":{"contents":null,"tag":"DefaultFormat"},"choiceDescription":"The _**Buyer**_ claims not having received the product that was paid for as agreed and would like a refund."}]]}
When
[Case
(Deposit
(Role "To")
(Role "To")
(Token "" "")
(ConstantParam "Collateral amount")
)
(When
[Case
(Deposit
(Role "From")
(Role "From")
(Token "" "")
(ConstantParam "Collateral amount")
)
(When
[Case
(Deposit
(Role "To")
(Role "From")
(Token "" "")
(ConstantParam "Price")
)
(When
[Case
(Choice
(ChoiceId
"Everything is alright"
(Role "From")
)
[Bound 0 0]
)
Close , Case
(Choice
(ChoiceId
"Report problem"
(Role "From")
)
[Bound 1 1]
)
(Pay
(Role "To")
(Account (Role "From"))
(Token "" "")
(ConstantParam "Price")
(When
[Case
(Choice
(ChoiceId
"Confirm problem"
(Role "To")
)
[Bound 1 1]
)
Close , Case
(Choice
(ChoiceId
"Dispute problem"
(Role "To")
)
[Bound 0 0]
)
(Pay
(Role "To")
(Party (PK "0000000000000000000000000000000000000000000000000000000000000000"))
(Token "" "")
(ConstantParam "Collateral amount")
(Pay
(Role "From")
(Party (PK "0000000000000000000000000000000000000000000000000000000000000000"))
(Token "" "")
(ConstantParam "Collateral amount")
Close
)
)]
(SlotParam "Complaint deadline")
Close
)
)]
(SlotParam "Dispute by buyer timeout")
Close
)]
(SlotParam "Deposit of price by buyer timeout")
Close
)]
(SlotParam "Deposit of collateral by buyer timeout")
Close
)]
(SlotParam "Collateral deposit by seller timeout")
Close
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment