Skip to content

Instantly share code, notes, and snippets.

Keybase proof

I hereby claim:

  • I am markpattinson on github.
  • I am markpkb (https://keybase.io/markpkb) on keybase.
  • I have a public key ASDOI3vy5BFdQzSlt0lpWQOiJoKn0pRqdtgGVkwWSbBo7Ao

To claim this, I am signing this object:

Keybase proof

I hereby claim:

  • I am markpattinson on github.
  • I am markpattinson (https://keybase.io/markpattinson) on keybase.
  • I have a public key ASAoOcTe0lpg32C9njTDFuZVhAiYqzFHzbfCk988x8toAQo

To claim this, I am signing this object:

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
Code Line Code Description
contract transactionEscrow Defines the name of the contract as Transaction Escrow
address party1 = 0x0000000000001; A variable which stores the address of the first party involved
address party2 = 0x0000000000002; A variable which stores the address of the second party involved
address tokenAddress; A variable which stores the address of the token contract
ERC20I e = ERC20I(tokenAddress); A variable which stores a way to interact with the token
int party1PayableEther = 100; A variable which stores what party 1 needs to pay to execute the contract
int party2PayableTokens = 1000; A variable which stores what party 2 needs to pay to execute the contract
int party1EtherBalance = 0; A variable which stores what party 1 has paid currently
int party2TokenBalance = 0; A variable which stores what party 2 has paid currently