Last active
June 9, 2022 23:07
-
-
Save brunjlar/93c51197a5e491d7f98c68c167138558 to your computer and use it in GitHub Desktop.
MPP - Double Pay
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":[],"timeParameterDescriptions":[],"roleDescriptions":[],"contractType":"Other","contractShortDescription":"Unknown","contractName":"Unknown","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 doublePay (giver1: Party, giver2: Party, receiver: Party, amount: Value, deadline: Timeout): Contract { | |
const pay: Contract = Pay( | |
giver1, | |
Party(receiver), | |
ada, | |
amount, | |
Pay( | |
giver2, | |
Party(receiver), | |
ada, | |
amount, | |
Close)); | |
function deposit (party: Party): Action { | |
return Deposit(party, party, ada, amount); | |
} | |
function deposits (p1: Party, p2: Party): Case { | |
return Case( | |
deposit(p1), | |
When( | |
[Case( | |
deposit(p2), | |
pay)], | |
deadline, | |
Close)); | |
} | |
return When( | |
[deposits(giver1, giver2), deposits(giver2, giver1)], | |
deadline, | |
Close); | |
} | |
return doublePay( | |
Role("Giver1"), | |
Role("Giver2"), | |
Role("Receiver"), | |
ConstantParam("Deposit"), | |
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