You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
59 lines
1.5 KiB
59 lines
1.5 KiB
5 years ago
|
pragma solidity >=0.4.22 <0.6.0;
|
||
|
|
||
|
contract Test {
|
||
|
mapping (address => uint) balances;
|
||
|
|
||
|
event Transfer(address indexed _from, address indexed _to, uint256 _value);
|
||
|
|
||
|
constructor() public {
|
||
|
balances[tx.origin] = 10000;
|
||
|
}
|
||
|
|
||
|
function sendCoin(address receiver, uint amount) public returns(bool sufficient) {
|
||
|
if (balances[msg.sender] < amount)
|
||
|
return false;
|
||
|
else if (amount == 1)
|
||
|
return false;
|
||
|
else if (amount == 2 || amount == 3 || amount == 4)
|
||
|
return false;
|
||
|
else if (amount == 5)
|
||
|
return false;
|
||
|
else if (amount == 1)
|
||
|
return false;
|
||
|
else if (amount == 2 || amount == 3 || amount == 4)
|
||
|
return false;
|
||
|
else if (amount == 5)
|
||
|
return false;
|
||
|
else if (amount == 1)
|
||
|
return false;
|
||
|
else if (amount == 2 || amount == 3 || amount == 4)
|
||
|
return false;
|
||
|
else if (amount == 5)
|
||
|
return false;
|
||
|
else if (amount == 1)
|
||
|
return false;
|
||
|
else if (amount == 2 || amount == 3 || amount == 4)
|
||
|
return false;
|
||
|
else if (amount == 5)
|
||
|
return false;
|
||
|
else if (amount == 1)
|
||
|
return false;
|
||
|
else if (amount == 2 || amount == 3 || amount == 4)
|
||
|
return false;
|
||
|
else if (amount == 5)
|
||
|
return false;
|
||
|
|
||
|
balances[msg.sender] -= amount;
|
||
|
balances[receiver] += amount;
|
||
|
emit Transfer(msg.sender, receiver, amount);
|
||
|
|
||
|
if(balances[receiver] >= amount)
|
||
|
sufficient = true;
|
||
|
}
|
||
|
|
||
|
function getBalance(address addr) public view returns(uint) {
|
||
|
return balances[addr];
|
||
|
}
|
||
|
}
|
||
5 years ago
|
|