Skip to content

Instantly share code, notes, and snippets.

@simondlr
Last active January 19, 2017 14:55
Show Gist options
  • Save simondlr/b08f32eeb8f9eec52ec4124d13c18242 to your computer and use it in GitHub Desktop.
Save simondlr/b08f32eeb8f9eec52ec4124d13c18242 to your computer and use it in GitHub Desktop.
Barclays Prague Comms. Communicate here.
Barclays Prague Comms:
-> Paste address and other things in the comments.
@janstafa
Copy link

97.0.248.180

@simondlr
Copy link
Author

simondlr commented Jan 17, 2017

On Android hotspot:

admin.addPeer("enode://426db9b9f9e49ff53f256e91a8f024d611477ac47b94a82285473b58a18ee55be058df083021b3ae440ddd99eb42286863d9c96eb51af56b10c3f007f6c7457a@192.168.43.19:20010?discport=0");

@simondlr
Copy link
Author

simondlr commented Jan 17, 2017

@VictorGil
Copy link

I am 192.168.43.254

@tomasekjan
Copy link

0x24396580B5db8bF04cb2467B04a8260cD10dd5B7 Jan

@janstafa
Copy link

0xf3081cb21e8ee1a8ee7c3a9117780d4527e29f07

@spmichal
Copy link

0x93A0b7780dad967746c10444E48fcabA2278f74B

@simondlr
Copy link
Author

pragma solidity ^0.4.8;

contract Owner {
    address owner;
    
    function Owner() {
        owner = msg.sender;
    }
    
    modifier isOwner() {
        if(msg.sender == owner) {
            _;
        }
    }
}

contract ERC20Asset is Owner {
    
    mapping(address => uint256) public balances;
    mapping(address => mapping(address => uint256)) public allowed;

    function ERC20Asset() {
        //balances[msg.sender] = 10000;
    }
    
    function deposit() payable {
        balances[msg.sender] += msg.value;
    }
    
    function withdraw() {
        if(!msg.sender.send(balances[msg.sender])) {
            throw;    
        }
        
        balances[msg.sender] = 0;

    }
    
    /*function mint(address _for, uint256 _value) isOwner {
        balances[_for] += _value;
    }
    
    function destroy(address _for, uint256 _value) isOwner {
        if(balances[_for] >= _value) {
            balances[_for] -= _value;
        } else {
            balances[_for] = 0;
        }
    }*/
    
    function balanceOf(address _owner) constant returns (uint256 balance) {
        return balances[_owner];
    }
    
    function transfer(address _to, uint256 _value) returns (bool success) {
        //msg.sender
        //tx.origin [BAD]
        if(balances[msg.sender] >= _value) {
            balances[msg.sender] -= _value;
            balances[_to] += _value;
            Transfer(msg.sender, _to, _value);
            return true;
        } else {
            throw;
        }
    }
    
    //function internalTransfer()
    
    function transferFrom(address _from, address _to, uint256 _value) returns (bool success) {
        //spender == msg.sender
        if(allowed[_from][msg.sender] >= _value && balances[_from] >= _value) {
            balances[_from] -= _value;
            balances[_to] += _value;
            allowed[_from][msg.sender] -= _value;
            Transfer(_from, _to, _value);
            return true;
        }
        return false;
    }
    
    function allowance(address _owner, address _spender) constant returns (uint amount) {
        return allowed[_owner][_spender];
        
    }
    
    function approve(address _spender, uint256 _value) returns (bool success) {
        allowed[msg.sender][_spender] = _value;
        Approval(msg.sender, _spender, _value);
        return true;
    } 
    
    event Approval(address indexed _owner, address indexed _spender, uint256 _value);
    event Transfer(address indexed _from, address indexed _to, uint256 _value);
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment