Skip to content

Instantly share code, notes, and snippets.

@bogatyy
Created July 13, 2017 19:56
Show Gist options
  • Save bogatyy/ff38f2623de5eba67ae20f0703c8f09f to your computer and use it in GitHub Desktop.
Save bogatyy/ff38f2623de5eba67ae20f0703c8f09f to your computer and use it in GitHub Desktop.
UberToken ERC-20, lost 1 ETH forever
pragma solidity 0.4.13;
contract UberToken {
string public constant name = "IC3 2017 bootcamp UberToken";
string public constant symbol = "UT3";
uint8 public constant decimals = 18;
uint256 public total_supply;
mapping(address => uint256) public balances;
function UberToken() {
total_supply = 0;
}
function totalSupply() constant returns (uint256 totalSupply) {
return total_supply;
}
function balanceOf(address _owner) constant returns (uint256 balance) {
return balances[_owner];
}
function transfer(address _to, uint _value) returns (bool success) {
if (balances[msg.sender] < _value) return false;
balances[msg.sender] -= _value;
balances[_to] += _value;
return true;
}
function depost() payable returns (bool success) {
if (msg.value < 1) return false;
balances[msg.sender] += 1;
total_supply += 1;
return true;
}
function withdraw(uint256 amount) returns (bool success) {
if (balances[msg.sender] < amount) return false;
balances[msg.sender] -= amount;
total_supply -= amount;
if (!msg.sender.send(amount)) {
balances[msg.sender] += amount;
total_supply += amount;
return false;
}
return true;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment