이더리운 원리 실습해보기
Remix - Ethereum IDE
remix.ethereum.org
pragma solidity >=0.4.0 <0.5.0;
contract first_contract {
uint public balance;
address[] private givers;
address private taker;
address public owner;
modifier onlyOwner() { require (msg.sender == owner); _;}
constructor() public payable {
owner = msg.sender;
}
function setTaker(address _addr) onlyOwner public {
taker = _addr;
}
function deposit() public payable {
balance += msg.value;
givers.push(msg.sender);
}
function sendMoney() onlyOwner public payable {
require (givers.length >= 2);
taker.transfer(balance);
}
}
댓글