Last active
June 14, 2022 15:53
-
-
Save marco-martins/a8ef71ef055a359c6764fcc14146dab1 to your computer and use it in GitHub Desktop.
simple-payment-pay.js
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
{"valueParameterInfo":[["Deposit",{"valueParameterFormat":{"contents":[6,""],"tag":"DecimalFormat"},"valueParameterDescription":""}]],"timeParameterDescriptions":[],"roleDescriptions":[["Giver1",""]],"contractType":"Other","contractShortDescription":"","contractName":"Double Pay","contractLongDescription":"We couldn't find information about this contract","choiceInfo":[]} |
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
function deposit (g: Party, amount: Value): Action { | |
return Deposit(g, g, ada, amount) | |
} | |
function pay (g: Party, r: Party, amount: Value): Contract { | |
return Pay(g, Party(r), ada, amount, Close) | |
} | |
// main function | |
function payment (giver: Party, receiver: Party, amount: Value, deadline: Timeout): Contract { | |
return When([ | |
Case( | |
deposit(giver, amount), | |
pay(giver, receiver, amount) | |
) | |
], deadline, Close) | |
} | |
return payment( | |
Role("Giver"), | |
Role("Receiver"), | |
Constant(100000000), | |
TimeParam("Deadline") | |
) |
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
{} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment