-
-
Save ajuggler/a39b2da0cca24489c18369ae72d095cb 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