Skip to content

Instantly share code, notes, and snippets.

@jhotson
Created May 14, 2021 03:40
Show Gist options
  • Save jhotson/43e27f2890bbdf951cd8d8802c7b7b99 to your computer and use it in GitHub Desktop.
Save jhotson/43e27f2890bbdf951cd8d8802c7b7b99 to your computer and use it in GitHub Desktop.
Swap of Ada and dollar tokens
When
[Case
(Deposit
(Role "Ada provider")
(Role "Ada provider")
(Token "" "")
(MulValue
(Constant 1000000)
(ConstantParam "Amount of Ada")
)
)
(When
[Case
(Deposit
(Role "Dollar provider")
(Role "Dollar provider")
(Token "85bb65" "dollar")
(ConstantParam "Amount of dollars")
)
(Pay
(Role "Ada provider")
(Party (Role "Dollar provider"))
(Token "" "")
(MulValue
(Constant 1000000)
(ConstantParam "Amount of Ada")
)
(Pay
(Role "Dollar provider")
(Party (Role "Ada provider"))
(Token "85bb65" "dollar")
(ConstantParam "Amount of dollars")
Close
)
)]
(SlotParam "Timeout for dollar deposit")
Close
)]
(SlotParam "Timeout for Ada deposit")
Close
{"valueParameterDescriptions":[["Amount of Ada","Amount of Ada to be exchanged for dollars."],["Amount of dollars","Amount of dollar tokens to be exchanged for Ada."]],"slotParameterDescriptions":[["Timeout for Ada deposit","Deadline by which Ada must be deposited."],["Timeout for dollar deposit","Deadline by which dollar tokens must be deposited (must be after the deadline for Ada deposit)."]],"roleDescriptions":[["Ada provider","The party that provides the Ada."],["Dollar provider","The party that provides the dollar tokens."]],"contractType":"S","contractName":"Swap of Ada and dollar tokens","contractDescription":"Takes Ada from one party and dollar tokens from another party, and it swaps them atomically.","choiceDescriptions":[]}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment