Skip to content

Instantly share code, notes, and snippets.

@simonjohnthompson
Created March 23, 2021 17:48
Show Gist options
  • Save simonjohnthompson/d6f0f11c73eca2b2079360de06a93b39 to your computer and use it in GitHub Desktop.
Save simonjohnthompson/d6f0f11c73eca2b2079360de06a93b39 to your computer and use it in GitHub Desktop.
Escrow with collateral - SJT revised.
{"valueParameterDescriptions":[["Collateral amount","The amount to be deposited by both parties at the start of the contract to serve as an incentive for collaboration."],["Price","The amount 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."],["Seller's response timeout","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":"ES","contractName":"Escrow with collateral","contractDescription":"Regulates a money exchange between a \"Buyer\" and a \"Seller\" using a collateral from both parties to incentivize collaboration. If there is a disagreement the collateral is burned.","choiceDescriptions":[["Confirm problem","Acknowledge that there was a problem and a refund must be granted."],["Dispute problem","The \"Seller\" disagrees with the \"Buyer\" about the claim that something went wrong and the collateral will be burnt."],["Everything is alright","The exchange was successful and the \"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 "" "")
(ConstantParam "Collateral amount")
)
(When
[Case
(Deposit
(Role "Buyer")
(Role "Buyer")
(Token "" "")
(ConstantParam "Collateral amount")
)
(When
[Case
(Deposit
(Role "Seller")
(Role "Buyer")
(Token "" "")
(ConstantParam "Price")
)
(When
[Case
(Choice
(ChoiceId
"Everything is alright"
(Role "Buyer")
)
[Bound 0 0]
)
Close , Case
(Choice
(ChoiceId
"Report problem"
(Role "Buyer")
)
[Bound 1 1]
)
(Pay
(Role "Seller")
(Account (Role "Buyer"))
(Token "" "")
(ConstantParam "Price")
(When
[Case
(Choice
(ChoiceId
"Confirm problem"
(Role "Seller")
)
[Bound 1 1]
)
Close , Case
(Choice
(ChoiceId
"Dispute problem"
(Role "Seller")
)
[Bound 0 0]
)
(Pay
(Role "Seller")
(Party (PK "0000000000000000000000000000000000000000000000000000000000000000"))
(Token "" "")
(ConstantParam "Collateral amount")
(Pay
(Role "Buyer")
(Party (PK "0000000000000000000000000000000000000000000000000000000000000000"))
(Token "" "")
(ConstantParam "Collateral amount")
Close
)
)]
(SlotParam "Seller's response timeout")
Close
)
)]
(SlotParam "Dispute by buyer timeout")
Close
)]
(SlotParam "Deposit of price by buyer timeout")
Close
)]
(SlotParam "Deposit of collateral by buyer timeout")
(Pay
(Role "Seller")
(Party (Role "Seller"))
(Token "" "")
(ConstantParam "Collateral amount")
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