af39ec27b8
* unknown return types should not be treated as errors from WaitForMessage * simplecoin FEVM smoke test * add itest-fevm to circle matrix * use a named error for metadata lookup failures * hand-write the fevm basic test * make gen * address nits
32 lines
823 B
Solidity
32 lines
823 B
Solidity
// SPDX-License-Identifier: MIT
|
|
pragma solidity >=0.4.2;
|
|
|
|
contract SimpleCoin {
|
|
mapping(address => uint256) balances;
|
|
|
|
event Transfer(address indexed _from, address indexed _to, uint256 _value);
|
|
|
|
constructor() {
|
|
balances[tx.origin] = 10000;
|
|
}
|
|
|
|
function sendCoin(address receiver, uint256 amount)
|
|
public
|
|
returns (bool sufficient)
|
|
{
|
|
if (balances[msg.sender] < amount) return false;
|
|
balances[msg.sender] -= amount;
|
|
balances[receiver] += amount;
|
|
emit Transfer(msg.sender, receiver, amount);
|
|
return true;
|
|
}
|
|
|
|
function getBalanceInEth(address addr) public view returns (uint256) {
|
|
return getBalance(addr) * 2;
|
|
}
|
|
|
|
function getBalance(address addr) public view returns (uint256) {
|
|
return balances[addr];
|
|
}
|
|
}
|