Skip to content

Instantly share code, notes, and snippets.

@aenhsaihan
Created Feb 21, 2020
Embed
What would you like to do?
pragma solidity 0.5.16;
contract Escrow {
uint256 public anteAmount;
address game;
address player1;
address player2;
Escrow addr = Escrow(this);
address payable escrowWallet = address(uint160(address(addr)));
constructor(address _player1, address _player2, address _game) public {
player1 = _player1;
player2 = _player2;
game = _game;
}
function placeAnte(address player) public payable returns (bool) {
require(player == player1 || player == player2, "invalid player address.");
return true;
}
}
contract Game {
function challengeOpponent(address opponent) public {
Escrow escrow = new Escrow(msg.sender, opponent, address(this));
escrow.placeAnte(msg.sender);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment