ETH Price: $3,612.25 (-1.54%)

Contract

0x3b912FB1B5B9e07E50E43F0404feE038f9a0353C
 

Overview

ETH Balance

0 ETH

Eth Value

$0.00

Multichain Info

No addresses found
Transaction Hash
Method
Block
From
To
Vote41289602017-08-07 17:46:072674 days ago1502127967IN
0x3b912FB1...8f9a0353C
0 ETH0.0023271929
Vote41289582017-08-07 17:45:252674 days ago1502127925IN
0x3b912FB1...8f9a0353C
0 ETH0.0023253329
Vote41289562017-08-07 17:44:112674 days ago1502127851IN
0x3b912FB1...8f9a0353C
0 ETH0.0023271929
Withdraw41288462017-08-07 17:09:102674 days ago1502125750IN
0x3b912FB1...8f9a0353C
0 ETH0.0008697129
Transfer41288392017-08-07 17:06:402674 days ago1502125600IN
0x3b912FB1...8f9a0353C
0.055 ETH0.0009303429
Vote41271372017-08-07 7:15:172675 days ago1502090117IN
0x3b912FB1...8f9a0353C
0 ETH0.0016838621
Vote41155702017-08-04 10:31:492677 days ago1501842709IN
0x3b912FB1...8f9a0353C
0 ETH0.0031957429
Transfer41153512017-08-04 9:17:242677 days ago1501838244IN
0x3b912FB1...8f9a0353C
0.01 ETH0.000988721

Latest 1 internal transaction

Advanced mode:
Parent Transaction Hash Block From To
41288462017-08-07 17:09:102674 days ago1502125750
0x3b912FB1...8f9a0353C
0.065 ETH
Loading...
Loading

Contract Source Code Verified (Exact Match)

Contract Name:
CountryCoin

Compiler Version
v0.4.14+commit.c2215d46

Optimization Enabled:
Yes with 200 runs

Other Settings:
default evmVersion
/**
 *Submitted for verification at Etherscan.io on 2017-08-04
*/

pragma solidity ^0.4.4;

contract CountryCoin {

    string public constant name = "CountryCoin";
    string public constant symbol = "CCN";
    uint public constant decimals = 8;
    uint public totalSupply;

    mapping (address => uint) balances;
    mapping (address => mapping (address => uint)) allowed;
    event Transfer(address indexed _from, address indexed _to, uint _value);
    event Approval(address indexed _owner, address indexed _spender, uint _value);

    uint constant oneCent = 4642857142857;
    mapping (uint16 => uint) rating;
    mapping (uint16 => mapping( address => uint)) votes;
    mapping (address => uint16[]) history;

    address owner;

    function CountryCoin() {
        totalSupply = 750000000000000000;
        balances[this] = totalSupply;
        owner = msg.sender;
    }

    function balanceOf(address _owner) constant returns (uint balance) {
        return balances[_owner];
    }

    function transfer(address _to, uint _value) returns (bool success) {
        require(balances[msg.sender] >= _value);
        require(balances[_to] + _value > balances[_to]);
        balances[msg.sender] -= _value;
        balances[_to] += _value;
        Transfer(msg.sender, _to, _value);
        return true;
    }

    function transferFrom(address _from, address _to, uint _value) returns (bool success) {
        require(balances[msg.sender] >= _value);
        require(allowed[_from][_to] >= _value);
        require(balances[_to] + _value > balances[_to]);

        balances[_from] -= _value;
        balances[_to] += _value;
        allowed[_from][_to] -= _value;

        Transfer(_from, _to, _value);

        return true;
    }

    function approve(address _spender, uint _value) returns (bool success) {
        allowed[msg.sender][_spender] = _value;
        Approval(msg.sender, _spender, _value);
        return true;
    }

    function allowance(address _owner, address _spender) constant returns (uint remaining) {
        return allowed[_owner][_spender];
    }

    function () payable {
        uint tokenAmount = msg.value*100000000 / oneCent;
        require(tokenAmount <= balances[this]);

        balances[this] -= tokenAmount;
        balances[msg.sender] += tokenAmount;
    }

    function vote(uint16 _country, uint _amount) {
        require(balances[msg.sender] >= _amount);
        require(_country < 1000);

        if (votes[_country][msg.sender] == 0) {
            history[msg.sender].push(_country);
        }
        balances[msg.sender] -= _amount;
        rating[_country] += _amount;
        votes[_country][msg.sender] += _amount;
    }

    function reset() {
        for(uint16 i=0; i<history[msg.sender].length; i++) {
            uint16 country = history[msg.sender][i];
            uint amount = votes[country][msg.sender];
            balances[msg.sender] += amount;
            rating[country] -= amount;
            votes[country][msg.sender] = 0;
        }
        history[msg.sender].length = 0;
    }

    function ratingOf(uint16 _country) constant returns (uint) {
        require(_country < 1000);
        return rating[_country];
    }

    function ratingList() constant returns (uint[] memory r) {
        r = new uint[](1000);
        for(uint16 i=0; i<r.length; i++) {
            r[i] = rating[i];
        }
    }

    function withdraw() {
        require(msg.sender == owner);
        owner.transfer(this.balance);
    }

}

Contract Security Audit

Contract ABI

[{"constant":true,"inputs":[],"name":"name","outputs":[{"name":"","type":"string"}],"payable":false,"type":"function"},{"constant":false,"inputs":[{"name":"_spender","type":"address"},{"name":"_value","type":"uint256"}],"name":"approve","outputs":[{"name":"success","type":"bool"}],"payable":false,"type":"function"},{"constant":true,"inputs":[],"name":"totalSupply","outputs":[{"name":"","type":"uint256"}],"payable":false,"type":"function"},{"constant":false,"inputs":[{"name":"_from","type":"address"},{"name":"_to","type":"address"},{"name":"_value","type":"uint256"}],"name":"transferFrom","outputs":[{"name":"success","type":"bool"}],"payable":false,"type":"function"},{"constant":true,"inputs":[],"name":"decimals","outputs":[{"name":"","type":"uint256"}],"payable":false,"type":"function"},{"constant":false,"inputs":[],"name":"withdraw","outputs":[],"payable":false,"type":"function"},{"constant":true,"inputs":[],"name":"ratingList","outputs":[{"name":"r","type":"uint256[]"}],"payable":false,"type":"function"},{"constant":true,"inputs":[{"name":"_country","type":"uint16"}],"name":"ratingOf","outputs":[{"name":"","type":"uint256"}],"payable":false,"type":"function"},{"constant":true,"inputs":[{"name":"_owner","type":"address"}],"name":"balanceOf","outputs":[{"name":"balance","type":"uint256"}],"payable":false,"type":"function"},{"constant":false,"inputs":[{"name":"_country","type":"uint16"},{"name":"_amount","type":"uint256"}],"name":"vote","outputs":[],"payable":false,"type":"function"},{"constant":true,"inputs":[],"name":"symbol","outputs":[{"name":"","type":"string"}],"payable":false,"type":"function"},{"constant":false,"inputs":[{"name":"_to","type":"address"},{"name":"_value","type":"uint256"}],"name":"transfer","outputs":[{"name":"success","type":"bool"}],"payable":false,"type":"function"},{"constant":false,"inputs":[],"name":"reset","outputs":[],"payable":false,"type":"function"},{"constant":true,"inputs":[{"name":"_owner","type":"address"},{"name":"_spender","type":"address"}],"name":"allowance","outputs":[{"name":"remaining","type":"uint256"}],"payable":false,"type":"function"},{"inputs":[],"payable":false,"type":"constructor"},{"payable":true,"type":"fallback"},{"anonymous":false,"inputs":[{"indexed":true,"name":"_from","type":"address"},{"indexed":true,"name":"_to","type":"address"},{"indexed":false,"name":"_value","type":"uint256"}],"name":"Transfer","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"_owner","type":"address"},{"indexed":true,"name":"_spender","type":"address"},{"indexed":false,"name":"_value","type":"uint256"}],"name":"Approval","type":"event"}]

6060604052341561000f57600080fd5b5b670a688906bd8b0000600081815530600160a060020a039081168252600160205260409091209190915560068054600160a060020a031916339092169190911790555b5b610b5f806100636000396000f300606060405236156100cd5763ffffffff7c010000000000000000000000000000000000000000000000000000000060003504166306fdde03811461013b578063095ea7b3146101c657806318160ddd146101fc57806323b872dd14610221578063313ce5671461025d5780633ccfd60b1461028257806345df925f1461029757806363d2be9d146102fe57806370a082311461032a5780637de576cd1461035b57806395d89b411461037a578063a9059cbb14610405578063d826f88f1461043b578063dd62ed3e14610450575b5b6000650438ffd9ca496305f5e10034025b600160a060020a033016600090815260016020526040902054919004915081111561010957600080fd5b600160a060020a0330811660009081526001602052604080822080548590039055339092168152208054820190555b50005b341561014657600080fd5b61014e610487565b60405160208082528190810183818151815260200191508051906020019080838360005b8381101561018b5780820151818401525b602001610172565b50505050905090810190601f1680156101b85780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34156101d157600080fd5b6101e8600160a060020a03600435166024356104be565b604051901515815260200160405180910390f35b341561020757600080fd5b61020f61052b565b60405190815260200160405180910390f35b341561022c57600080fd5b6101e8600160a060020a0360043581169060243516604435610531565b604051901515815260200160405180910390f35b341561026857600080fd5b61020f61063c565b60405190815260200160405180910390f35b341561028d57600080fd5b610295610641565b005b34156102a257600080fd5b6102aa610698565b60405160208082528190810183818151815260200191508051906020019060200280838360005b838110156102ea5780820151818401525b6020016102d1565b505050509050019250505060405180910390f35b341561030957600080fd5b61020f61ffff60043516610711565b60405190815260200160405180910390f35b341561033557600080fd5b61020f600160a060020a0360043516610740565b60405190815260200160405180910390f35b341561036657600080fd5b61029561ffff6004351660243561075f565b005b341561038557600080fd5b61014e61086f565b60405160208082528190810183818151815260200191508051906020019080838360005b8381101561018b5780820151818401525b602001610172565b50505050905090810190601f1680156101b85780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b341561041057600080fd5b6101e8600160a060020a03600435166024356108a6565b604051901515815260200160405180910390f35b341561044657600080fd5b610295610961565b005b341561045b57600080fd5b61020f600160a060020a0360043581169060243516610a5f565b60405190815260200160405180910390f35b60408051908101604052600b81527f436f756e747279436f696e000000000000000000000000000000000000000000602082015281565b600160a060020a03338116600081815260026020908152604080832094871680845294909152808220859055909291907f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b9259085905190815260200160405180910390a35060015b92915050565b60005481565b600160a060020a0333166000908152600160205260408120548290101561055757600080fd5b600160a060020a038085166000908152600260209081526040808320938716835292905220548290101561058a57600080fd5b600160a060020a038316600090815260016020526040902054828101116105b057600080fd5b600160a060020a03808516600081815260016020908152604080832080548890039055938716808352848320805488019055838352600282528483208184529091529083902080548690039055917fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9085905190815260200160405180910390a35060015b9392505050565b600881565b60065433600160a060020a0390811691161461065c57600080fd5b600654600160a060020a039081169030163180156108fc0290604051600060405180830381858888f19350505050151561069557600080fd5b5b565b6106a0610a8c565b60006103e86040518059106106b25750595b908082528060200260200182016040525b509150600090505b81518161ffff16101561070c5761ffff8116600081815260036020526040902054908390815181106106f957fe5b602090810290910101525b6001016106cb565b5b5090565b60006103e861ffff83161061072557600080fd5b5061ffff81166000908152600360205260409020545b919050565b600160a060020a0381166000908152600160205260409020545b919050565b600160a060020a0333166000908152600160205260409020548190101561078557600080fd5b6103e861ffff83161061079757600080fd5b61ffff82166000908152600460209081526040808320600160a060020a0333168452909152902054151561082057600160a060020a03331660009081526005602052604090208054600181016107ed8382610a9e565b91600052602060002090601091828204019190066002025b815461ffff8087166101009390930a92830292021916179055505b600160a060020a03331660008181526001602090815260408083208054869003905561ffff861683526003825280832080548601905560048252808320938352929052208054820190555b5050565b60408051908101604052600381527f43434e0000000000000000000000000000000000000000000000000000000000602082015281565b600160a060020a033316600090815260016020526040812054829010156108cc57600080fd5b600160a060020a038316600090815260016020526040902054828101116108f257600080fd5b600160a060020a033381166000818152600160205260408082208054879003905592861680825290839020805486019055917fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9085905190815260200160405180910390a35060015b92915050565b600080805b600160a060020a03331660009081526005602052604090205461ffff84161015610a3657600160a060020a0333166000908152600560205260409020805461ffff85169081106109b257fe5b90600052602060002090601091828204019190066002025b905461ffff6101009290920a9004166000818152600460209081526040808320600160a060020a0333168085528184528285208054600186528487208054820190558787526003865293862080548590039055908552925291905590925090505b600190920191610966565b600160a060020a0333166000908152600560205260408120610a589082610a9e565b505b505050565b600160a060020a038083166000908152600260209081526040808320938516835292905220545b92915050565b60206040519081016040526000815290565b815481835581811511610a5a57600f016010900481600f01601090048360005260206000209182019101610a5a9190610b12565b5b505050565b815481835581811511610a5a57600f016010900481600f01601090048360005260206000209182019101610a5a9190610b12565b5b505050565b610b3091905b8082111561070c5760008155600101610b18565b5090565b905600a165627a7a72305820e4543909f97c23cd401b24de0a1394be9a47b9a416e96ec6dc1f159732203c5d0029

Deployed Bytecode

0x606060405236156100cd5763ffffffff7c010000000000000000000000000000000000000000000000000000000060003504166306fdde03811461013b578063095ea7b3146101c657806318160ddd146101fc57806323b872dd14610221578063313ce5671461025d5780633ccfd60b1461028257806345df925f1461029757806363d2be9d146102fe57806370a082311461032a5780637de576cd1461035b57806395d89b411461037a578063a9059cbb14610405578063d826f88f1461043b578063dd62ed3e14610450575b5b6000650438ffd9ca496305f5e10034025b600160a060020a033016600090815260016020526040902054919004915081111561010957600080fd5b600160a060020a0330811660009081526001602052604080822080548590039055339092168152208054820190555b50005b341561014657600080fd5b61014e610487565b60405160208082528190810183818151815260200191508051906020019080838360005b8381101561018b5780820151818401525b602001610172565b50505050905090810190601f1680156101b85780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34156101d157600080fd5b6101e8600160a060020a03600435166024356104be565b604051901515815260200160405180910390f35b341561020757600080fd5b61020f61052b565b60405190815260200160405180910390f35b341561022c57600080fd5b6101e8600160a060020a0360043581169060243516604435610531565b604051901515815260200160405180910390f35b341561026857600080fd5b61020f61063c565b60405190815260200160405180910390f35b341561028d57600080fd5b610295610641565b005b34156102a257600080fd5b6102aa610698565b60405160208082528190810183818151815260200191508051906020019060200280838360005b838110156102ea5780820151818401525b6020016102d1565b505050509050019250505060405180910390f35b341561030957600080fd5b61020f61ffff60043516610711565b60405190815260200160405180910390f35b341561033557600080fd5b61020f600160a060020a0360043516610740565b60405190815260200160405180910390f35b341561036657600080fd5b61029561ffff6004351660243561075f565b005b341561038557600080fd5b61014e61086f565b60405160208082528190810183818151815260200191508051906020019080838360005b8381101561018b5780820151818401525b602001610172565b50505050905090810190601f1680156101b85780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b341561041057600080fd5b6101e8600160a060020a03600435166024356108a6565b604051901515815260200160405180910390f35b341561044657600080fd5b610295610961565b005b341561045b57600080fd5b61020f600160a060020a0360043581169060243516610a5f565b60405190815260200160405180910390f35b60408051908101604052600b81527f436f756e747279436f696e000000000000000000000000000000000000000000602082015281565b600160a060020a03338116600081815260026020908152604080832094871680845294909152808220859055909291907f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b9259085905190815260200160405180910390a35060015b92915050565b60005481565b600160a060020a0333166000908152600160205260408120548290101561055757600080fd5b600160a060020a038085166000908152600260209081526040808320938716835292905220548290101561058a57600080fd5b600160a060020a038316600090815260016020526040902054828101116105b057600080fd5b600160a060020a03808516600081815260016020908152604080832080548890039055938716808352848320805488019055838352600282528483208184529091529083902080548690039055917fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9085905190815260200160405180910390a35060015b9392505050565b600881565b60065433600160a060020a0390811691161461065c57600080fd5b600654600160a060020a039081169030163180156108fc0290604051600060405180830381858888f19350505050151561069557600080fd5b5b565b6106a0610a8c565b60006103e86040518059106106b25750595b908082528060200260200182016040525b509150600090505b81518161ffff16101561070c5761ffff8116600081815260036020526040902054908390815181106106f957fe5b602090810290910101525b6001016106cb565b5b5090565b60006103e861ffff83161061072557600080fd5b5061ffff81166000908152600360205260409020545b919050565b600160a060020a0381166000908152600160205260409020545b919050565b600160a060020a0333166000908152600160205260409020548190101561078557600080fd5b6103e861ffff83161061079757600080fd5b61ffff82166000908152600460209081526040808320600160a060020a0333168452909152902054151561082057600160a060020a03331660009081526005602052604090208054600181016107ed8382610a9e565b91600052602060002090601091828204019190066002025b815461ffff8087166101009390930a92830292021916179055505b600160a060020a03331660008181526001602090815260408083208054869003905561ffff861683526003825280832080548601905560048252808320938352929052208054820190555b5050565b60408051908101604052600381527f43434e0000000000000000000000000000000000000000000000000000000000602082015281565b600160a060020a033316600090815260016020526040812054829010156108cc57600080fd5b600160a060020a038316600090815260016020526040902054828101116108f257600080fd5b600160a060020a033381166000818152600160205260408082208054879003905592861680825290839020805486019055917fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9085905190815260200160405180910390a35060015b92915050565b600080805b600160a060020a03331660009081526005602052604090205461ffff84161015610a3657600160a060020a0333166000908152600560205260409020805461ffff85169081106109b257fe5b90600052602060002090601091828204019190066002025b905461ffff6101009290920a9004166000818152600460209081526040808320600160a060020a0333168085528184528285208054600186528487208054820190558787526003865293862080548590039055908552925291905590925090505b600190920191610966565b600160a060020a0333166000908152600560205260408120610a589082610a9e565b505b505050565b600160a060020a038083166000908152600260209081526040808320938516835292905220545b92915050565b60206040519081016040526000815290565b815481835581811511610a5a57600f016010900481600f01601090048360005260206000209182019101610a5a9190610b12565b5b505050565b815481835581811511610a5a57600f016010900481600f01601090048360005260206000209182019101610a5a9190610b12565b5b505050565b610b3091905b8082111561070c5760008155600101610b18565b5090565b905600a165627a7a72305820e4543909f97c23cd401b24de0a1394be9a47b9a416e96ec6dc1f159732203c5d0029

Swarm Source

bzzr://e4543909f97c23cd401b24de0a1394be9a47b9a416e96ec6dc1f159732203c5d

Block Transaction Difficulty Gas Used Reward
View All Blocks Produced

Block Uncle Number Difficulty Gas Used Reward
View All Uncles
Loading...
Loading
Loading...
Loading

Validator Index Block Amount
View All Withdrawals

Transaction Hash Block Value Eth2 PubKey Valid
View All Deposits
Loading...
Loading
[ Download: CSV Export  ]
[ Download: CSV Export  ]

A contract address hosts a smart contract, which is a set of code stored on the blockchain that runs when predetermined conditions are met. Learn more about addresses in our Knowledge Base.