Last active
August 23, 2018 00:38
-
-
Save markpattinson/586327dd216d09b7fe3402eef2b29d55 to your computer and use it in GitHub Desktop.
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
Code Line | Code Description | |
---|---|---|
function () public payable onlyParticipants() | Defines a function only accessible to parties involved | |
if (msg.sender == party1) | checks if it is party 1 interacting with the contract | |
party1EtherBalance += msg.value; | adds the value of the sent funds to the stored amount | |
else if (msg.sender == party2) | checks if it is party 2 interacting with the contract | |
party2TokenBalance = e.balanceOf(this); | updates the token balance according to the amount present | |
if (party1EtherBalance >= party1PayableEther | checks for satisfaction of party 1's payable funds | |
&& party2TokenBalance >= party2PayableTokens) | checks for satisfaction of party 2's payable funds | |
e.transfer(party1 party2PayableTokens); | transfers the payable funds to party 1 | |
party2.transfer(party1EtherBalance); | transfers the payable funds to party 2 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment