ETH Price: $2,289.02 (+5.36%)

Contract

0xB5B67b0BD9F0F188E900D6a50cD1D66a6D9932f7
 

Overview

ETH Balance

0 ETH

Eth Value

$0.00

Multichain Info

No addresses found
Transaction Hash
Method
Block
From
To
Transfer Ownersh...67903282018-11-28 21:03:452289 days ago1543439025IN
Dragonereum: Distribution
0 ETH0.001521450
Set External Dep...67903172018-11-28 21:00:412289 days ago1543438841IN
Dragonereum: Distribution
0 ETH0.0063757550

View more zero value Internal Transactions in Advanced View mode

Advanced mode:
Loading...
Loading

Contract Source Code Verified (Exact Match)

Contract Name:
Distribution

Compiler Version
v0.4.25+commit.59dbf8f1

Optimization Enabled:
No with 0 runs

Other Settings:
default evmVersion
/**
 *Submitted for verification at Etherscan.io on 2018-11-28
*/

pragma solidity 0.4.25;

library SafeConvert {

    function toUint8(uint256 _value) internal pure returns (uint8) {
        assert(_value <= 255);
        return uint8(_value);
    }

    function toUint16(uint256 _value) internal pure returns (uint16) {
        assert(_value <= 2**16 - 1);
        return uint16(_value);
    }

    function toUint32(uint256 _value) internal pure returns (uint32) {
        assert(_value <= 2**32 - 1);
        return uint32(_value);
    }
}

library SafeMath256 {

    function mul(uint256 a, uint256 b) internal pure returns (uint256) {
        if (a == 0) {
            return 0;
        }
        uint256 c = a * b;
        assert(c / a == b);
        return c;
    }

    function div(uint256 a, uint256 b) internal pure returns (uint256) {
        return a / b;
    }

    function sub(uint256 a, uint256 b) internal pure returns (uint256) {
        assert(b <= a);
        return a - b;
    }

    function add(uint256 a, uint256 b) internal pure returns (uint256) {
        uint256 c = a + b;
        assert(c >= a);
        return c;
    }

    function pow(uint256 a, uint256 b) internal pure returns (uint256) {
        if (a == 0) return 0;
        if (b == 0) return 1;

        uint256 c = a ** b;
        assert(c / (a ** (b - 1)) == a);
        return c;
    }
}

contract Ownable {
    address public owner;

    event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);

    function _validateAddress(address _addr) internal pure {
        require(_addr != address(0), "invalid address");
    }

    constructor() public {
        owner = msg.sender;
    }

    modifier onlyOwner() {
        require(msg.sender == owner, "not a contract owner");
        _;
    }

    function transferOwnership(address newOwner) public onlyOwner {
        _validateAddress(newOwner);
        emit OwnershipTransferred(owner, newOwner);
        owner = newOwner;
    }

}

contract Controllable is Ownable {
    mapping(address => bool) controllers;

    modifier onlyController {
        require(_isController(msg.sender), "no controller rights");
        _;
    }

    function _isController(address _controller) internal view returns (bool) {
        return controllers[_controller];
    }

    function _setControllers(address[] _controllers) internal {
        for (uint256 i = 0; i < _controllers.length; i++) {
            _validateAddress(_controllers[i]);
            controllers[_controllers[i]] = true;
        }
    }
}

contract Upgradable is Controllable {
    address[] internalDependencies;
    address[] externalDependencies;

    function getInternalDependencies() public view returns(address[]) {
        return internalDependencies;
    }

    function getExternalDependencies() public view returns(address[]) {
        return externalDependencies;
    }

    function setInternalDependencies(address[] _newDependencies) public onlyOwner {
        for (uint256 i = 0; i < _newDependencies.length; i++) {
            _validateAddress(_newDependencies[i]);
        }
        internalDependencies = _newDependencies;
    }

    function setExternalDependencies(address[] _newDependencies) public onlyOwner {
        externalDependencies = _newDependencies;
        _setControllers(_newDependencies);
    }
}




//////////////CONTRACT//////////////



contract Distribution is Upgradable {
    using SafeMath256 for uint256;
    using SafeConvert for uint256;

    uint256 restAmount;
    uint256 releasedAmount;
    uint256 lastBlock;
    uint256 interval; // in blocks

    uint256 constant NUMBER_OF_DRAGON_TYPES = 5; // [0..4]

    constructor() public {
        releasedAmount = 10000; // released amount of eggs
        restAmount = releasedAmount;
        lastBlock = 6790679; // start block number
        interval = 1;
    }

    function _updateInterval() internal {
        if (restAmount == 5000) {
            interval = 2;
        } else if (restAmount == 3750) {
            interval = 4;
        } else if (restAmount == 2500) {
            interval = 8;
        } else if (restAmount == 1250) {
            interval = 16;
        }
    }

    function _burnGas() internal pure {
        uint256[26950] memory _local;
        for (uint256 i = 0; i < _local.length; i++) {
            _local[i] = i;
        }
    }

    function claim(uint8 _requestedType) external onlyController returns (uint256, uint256, uint256) {
        require(restAmount > 0, "eggs are over");
        require(lastBlock.add(interval) <= block.number, "too early");
        uint256 _index = releasedAmount.sub(restAmount); // next egg index
        uint8 currentType = (_index % NUMBER_OF_DRAGON_TYPES).toUint8();
        require(currentType == _requestedType, "not a current type of dragon");
        lastBlock = block.number;
        restAmount = restAmount.sub(1);
        _updateInterval();
        _burnGas();
        return (restAmount, lastBlock, interval);
    }

    function getInfo() external view returns (uint256, uint256, uint256, uint256, uint256) {
        return (
            restAmount,
            releasedAmount,
            lastBlock,
            interval,
            NUMBER_OF_DRAGON_TYPES
        );
    }
}

Contract Security Audit

Contract ABI

API
[{"constant":true,"inputs":[],"name":"getInfo","outputs":[{"name":"","type":"uint256"},{"name":"","type":"uint256"},{"name":"","type":"uint256"},{"name":"","type":"uint256"},{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_newDependencies","type":"address[]"}],"name":"setExternalDependencies","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"_newDependencies","type":"address[]"}],"name":"setInternalDependencies","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"owner","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_requestedType","type":"uint8"}],"name":"claim","outputs":[{"name":"","type":"uint256"},{"name":"","type":"uint256"},{"name":"","type":"uint256"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"getInternalDependencies","outputs":[{"name":"","type":"address[]"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"getExternalDependencies","outputs":[{"name":"","type":"address[]"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"inputs":[],"payable":false,"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":true,"name":"previousOwner","type":"address"},{"indexed":true,"name":"newOwner","type":"address"}],"name":"OwnershipTransferred","type":"event"}]

608060405234801561001057600080fd5b50336000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555061271060058190555060055460048190555062679e176006819055506001600781905550610ea5806100846000396000f30060806040526004361061008e576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff1680635a9b0b891461009357806365fc1253146100da57806369c0ad93146101405780638da5cb5b146101a657806395d4063f146101fd578063b75c4f801461024f578063e6458f6e146102bb578063f2fde38b14610327575b600080fd5b34801561009f57600080fd5b506100a861036a565b604051808681526020018581526020018481526020018381526020018281526020019550505050505060405180910390f35b3480156100e657600080fd5b5061013e60048036038101908080359060200190820180359060200190808060200260200160405190810160405280939291908181526020018383602002808284378201915050505050509192919290505050610391565b005b34801561014c57600080fd5b506101a460048036038101908080359060200190820180359060200190808060200260200160405190810160405280939291908181526020018383602002808284378201915050505050509192919290505050610478565b005b3480156101b257600080fd5b506101bb610594565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b34801561020957600080fd5b5061022b600480360381019080803560ff1690602001909291905050506105b9565b60405180848152602001838152602001828152602001935050505060405180910390f35b34801561025b57600080fd5b5061026461083e565b6040518080602001828103825283818151815260200191508051906020019060200280838360005b838110156102a757808201518184015260208101905061028c565b505050509050019250505060405180910390f35b3480156102c757600080fd5b506102d06108cc565b6040518080602001828103825283818151815260200191508051906020019060200280838360005b838110156103135780820151818401526020810190506102f8565b505050509050019250505060405180910390f35b34801561033357600080fd5b50610368600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919050505061095a565b005b60008060008060006004546005546006546007546005945094509450945094509091929394565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515610455576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260148152602001807f6e6f74206120636f6e7472616374206f776e657200000000000000000000000081525060200191505060405180910390fd5b806003908051906020019061046b929190610d86565b5061047581610ae5565b50565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561053e576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260148152602001807f6e6f74206120636f6e7472616374206f776e657200000000000000000000000081525060200191505060405180910390fd5b600090505b81518110156105795761056c828281518110151561055d57fe5b90602001906020020151610b93565b8080600101915050610543565b816002908051906020019061058f929190610d86565b505050565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60008060008060006105ca33610c3b565b151561063e576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260148152602001807f6e6f20636f6e74726f6c6c65722072696768747300000000000000000000000081525060200191505060405180910390fd5b60006004541115156106b8576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252600d8152602001807f6567677320617265206f7665720000000000000000000000000000000000000081525060200191505060405180910390fd5b436106d0600754600654610c9190919063ffffffff16565b11151515610746576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260098152602001807f746f6f206561726c79000000000000000000000000000000000000000000000081525060200191505060405180910390fd5b61075d600454600554610caf90919063ffffffff16565b915061077460058381151561076e57fe5b06610cc8565b90508560ff168160ff161415156107f3576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601c8152602001807f6e6f7420612063757272656e742074797065206f6620647261676f6e0000000081525060200191505060405180910390fd5b436006819055506108106001600454610caf90919063ffffffff16565b60048190555061081e610cdf565b610826610d44565b60045460065460075494509450945050509193909250565b606060028054806020026020016040519081016040528092919081815260200182805480156108c257602002820191906000526020600020905b8160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019060010190808311610878575b5050505050905090565b6060600380548060200260200160405190810160405280929190818152602001828054801561095057602002820191906000526020600020905b8160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019060010190808311610906575b5050505050905090565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515610a1e576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260148152602001807f6e6f74206120636f6e7472616374206f776e657200000000000000000000000081525060200191505060405180910390fd5b610a2781610b93565b8073ffffffffffffffffffffffffffffffffffffffff166000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a3806000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b60008090505b8151811015610b8f57610b148282815181101515610b0557fe5b90602001906020020151610b93565b60018060008484815181101515610b2757fe5b9060200190602002015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055508080600101915050610aeb565b5050565b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1614151515610c38576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252600f8152602001807f696e76616c69642061646472657373000000000000000000000000000000000081525060200191505060405180910390fd5b50565b6000600160008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff169050919050565b6000808284019050838110151515610ca557fe5b8091505092915050565b6000828211151515610cbd57fe5b818303905092915050565b600060ff8211151515610cd757fe5b819050919050565b6113886004541415610cf8576002600781905550610d42565b610ea66004541415610d11576004600781905550610d41565b6109c46004541415610d2a576008600781905550610d40565b6104e26004541415610d3f5760106007819055505b5b5b5b565b610d4c610e10565b60008090505b616946811015610d825780828261694681101515610d6c57fe5b6020020181815250508080600101915050610d52565b5050565b828054828255906000526020600020908101928215610dff579160200282015b82811115610dfe5782518260006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555091602001919060010190610da6565b5b509050610e0c9190610e36565b5090565b620d28c06040519081016040528061694690602082028038833980820191505090505090565b610e7691905b80821115610e7257600081816101000a81549073ffffffffffffffffffffffffffffffffffffffff021916905550600101610e3c565b5090565b905600a165627a7a7230582060859d1bdcf298db0e764886ed8f66d27aaf3941d035cf36aa68b7f8467f27350029

Deployed Bytecode

0x60806040526004361061008e576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff1680635a9b0b891461009357806365fc1253146100da57806369c0ad93146101405780638da5cb5b146101a657806395d4063f146101fd578063b75c4f801461024f578063e6458f6e146102bb578063f2fde38b14610327575b600080fd5b34801561009f57600080fd5b506100a861036a565b604051808681526020018581526020018481526020018381526020018281526020019550505050505060405180910390f35b3480156100e657600080fd5b5061013e60048036038101908080359060200190820180359060200190808060200260200160405190810160405280939291908181526020018383602002808284378201915050505050509192919290505050610391565b005b34801561014c57600080fd5b506101a460048036038101908080359060200190820180359060200190808060200260200160405190810160405280939291908181526020018383602002808284378201915050505050509192919290505050610478565b005b3480156101b257600080fd5b506101bb610594565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b34801561020957600080fd5b5061022b600480360381019080803560ff1690602001909291905050506105b9565b60405180848152602001838152602001828152602001935050505060405180910390f35b34801561025b57600080fd5b5061026461083e565b6040518080602001828103825283818151815260200191508051906020019060200280838360005b838110156102a757808201518184015260208101905061028c565b505050509050019250505060405180910390f35b3480156102c757600080fd5b506102d06108cc565b6040518080602001828103825283818151815260200191508051906020019060200280838360005b838110156103135780820151818401526020810190506102f8565b505050509050019250505060405180910390f35b34801561033357600080fd5b50610368600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919050505061095a565b005b60008060008060006004546005546006546007546005945094509450945094509091929394565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515610455576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260148152602001807f6e6f74206120636f6e7472616374206f776e657200000000000000000000000081525060200191505060405180910390fd5b806003908051906020019061046b929190610d86565b5061047581610ae5565b50565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561053e576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260148152602001807f6e6f74206120636f6e7472616374206f776e657200000000000000000000000081525060200191505060405180910390fd5b600090505b81518110156105795761056c828281518110151561055d57fe5b90602001906020020151610b93565b8080600101915050610543565b816002908051906020019061058f929190610d86565b505050565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60008060008060006105ca33610c3b565b151561063e576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260148152602001807f6e6f20636f6e74726f6c6c65722072696768747300000000000000000000000081525060200191505060405180910390fd5b60006004541115156106b8576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252600d8152602001807f6567677320617265206f7665720000000000000000000000000000000000000081525060200191505060405180910390fd5b436106d0600754600654610c9190919063ffffffff16565b11151515610746576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260098152602001807f746f6f206561726c79000000000000000000000000000000000000000000000081525060200191505060405180910390fd5b61075d600454600554610caf90919063ffffffff16565b915061077460058381151561076e57fe5b06610cc8565b90508560ff168160ff161415156107f3576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601c8152602001807f6e6f7420612063757272656e742074797065206f6620647261676f6e0000000081525060200191505060405180910390fd5b436006819055506108106001600454610caf90919063ffffffff16565b60048190555061081e610cdf565b610826610d44565b60045460065460075494509450945050509193909250565b606060028054806020026020016040519081016040528092919081815260200182805480156108c257602002820191906000526020600020905b8160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019060010190808311610878575b5050505050905090565b6060600380548060200260200160405190810160405280929190818152602001828054801561095057602002820191906000526020600020905b8160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019060010190808311610906575b5050505050905090565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515610a1e576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260148152602001807f6e6f74206120636f6e7472616374206f776e657200000000000000000000000081525060200191505060405180910390fd5b610a2781610b93565b8073ffffffffffffffffffffffffffffffffffffffff166000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a3806000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b60008090505b8151811015610b8f57610b148282815181101515610b0557fe5b90602001906020020151610b93565b60018060008484815181101515610b2757fe5b9060200190602002015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055508080600101915050610aeb565b5050565b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1614151515610c38576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252600f8152602001807f696e76616c69642061646472657373000000000000000000000000000000000081525060200191505060405180910390fd5b50565b6000600160008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff169050919050565b6000808284019050838110151515610ca557fe5b8091505092915050565b6000828211151515610cbd57fe5b818303905092915050565b600060ff8211151515610cd757fe5b819050919050565b6113886004541415610cf8576002600781905550610d42565b610ea66004541415610d11576004600781905550610d41565b6109c46004541415610d2a576008600781905550610d40565b6104e26004541415610d3f5760106007819055505b5b5b5b565b610d4c610e10565b60008090505b616946811015610d825780828261694681101515610d6c57fe5b6020020181815250508080600101915050610d52565b5050565b828054828255906000526020600020908101928215610dff579160200282015b82811115610dfe5782518260006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555091602001919060010190610da6565b5b509050610e0c9190610e36565b5090565b620d28c06040519081016040528061694690602082028038833980820191505090505090565b610e7691905b80821115610e7257600081816101000a81549073ffffffffffffffffffffffffffffffffffffffff021916905550600101610e3c565b5090565b905600a165627a7a7230582060859d1bdcf298db0e764886ed8f66d27aaf3941d035cf36aa68b7f8467f27350029

Swarm Source

bzzr://60859d1bdcf298db0e764886ed8f66d27aaf3941d035cf36aa68b7f8467f2735

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  ]

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.