Change Network

Use the search box to find a hosted network, or select from the list of available networks below.

All
Mainnet
Testnet
Favorites
No content.

Contract Address Details

0x085B0FDf115aA9E16AE1Bddd396CE1F993c52220

ONEX ONEX Network (ONEX) Last Balance Update: Block #9241782
Created by 0x71ba–be0298 at 0x355c–e34a57

Balance

0 ETC

(@ /ETC)

Fetching tokens...

Contract name:
ONEX




Optimization enabled
true
Compiler version
v0.4.19+commit.c4cbbb05





Contract source code

/**
* Submitted for verification at blockscout.com on 2018-12-18 06:14:12.759967Z
*/
pragma solidity 0.4.19;
/**
* @title SafeMath
* @dev Math operations with safety checks that throw on error
*/
library SafeMath {
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a * b;
assert(a == 0 || c / a == b);
return c;
}
function div(uint256 a, uint256 b) internal pure returns (uint256) {
// assert(b > 0); // Solidity automatically throws when dividing by 0
uint256 c = a / b;
// assert(a == b * c + a % b); // There is no case in which this doesn't hold
return c;
}
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;
}
}
contract ERC223 {
uint public totalSupply;
function balanceOf(address who) constant returns (uint);
function name() constant returns (string _name);
function symbol() constant returns (string _symbol);
function decimals() constant returns (uint8 _decimals);
function totalSupply() constant returns (uint256 _supply);
function transfer(address to, uint value) returns (bool ok);
function transfer(address to, uint value, bytes data) returns (bool ok);
event Transfer(address indexed _from, address indexed _to, uint256 _value);
event ERC223Transfer(address indexed _from, address indexed _to, uint256 _value, bytes _data);
}
contract ContractReceiver {
function tokenFallback(address _from, uint _value, bytes _data);
}
/**
* @title PoSTokenStandard
* @dev the interface of PoSTokenStandard
*/
contract PoSTokenStandard {
uint256 public stakeStartTime;
uint256 public stakeMinAge;
uint256 public stakeMaxAge;
function mint() public returns (bool);
function coinAge(address staker) public view returns (uint256);
function annualInterest() public view returns (uint256);
event Mint(address indexed _address, uint _reward);
}
contract ONEX is ERC223, PoSTokenStandard {
using SafeMath for uint256;
string public name = "ONEX Network";
string public symbol = "ONEX";
uint8 public decimals = 18;
uint public chainStartTime; //chain start time
uint public chainStartBlockNumber; //chain start block number
uint public stakeStartTime; //stake start time
uint public stakeMinAge = 3 days; // minimum age for coin age: 3D
uint public stakeMaxAge = 90 days; // stake age of full weight: 90D
uint public maxMintProofOfStake = 10**17; // default 10% annual interest
uint public totalSupply;
uint public maxTotalSupply;
uint public totalInitialSupply;
struct transferInStruct{
uint128 amount;
uint64 time;
}
mapping(address => uint256) balances;
mapping(address => transferInStruct[]) transferIns;
modifier canPoSMint() {
require(totalSupply < maxTotalSupply);
_;
}
function ONEX() public {
maxTotalSupply = 10**25; // 10 Mil.
totalInitialSupply = 10**24; // 1 Mil.
chainStartTime = now;
stakeStartTime = now + 5 days;
chainStartBlockNumber = block.number;
balances[msg.sender] = totalInitialSupply;
totalSupply = totalInitialSupply;
}
//assemble the given address bytecode. If bytecode exists then the _addr is a contract.
function isContract(address _addr) private returns (bool is_contract) {
uint length;
assembly {
//retrieve the size of the code on target address, this needs assembly
length := extcodesize(_addr)
}
return (length > 0);
}
// Function that is called when a user or another contract wants to transfer funds .
function transfer(address _to, uint _value, bytes _data) returns (bool success) {
if(isContract(_to)) {
return transferToContract(_to, _value, _data);
} else {
return transferToAddress(_to, _value, _data);
}
}
// Standard function transfer similar to ERC20 transfer with no _data .
// Added due to backwards compatibility reasons .
function transfer(address _to, uint _value) returns (bool success) {
//standard function transfer similar to ERC20 transfer with no _data
//added due to backwards compatibility reasons
bytes memory empty;
if(isContract(_to)) {
return transferToContract(_to, _value, empty);
} else {
return transferToAddress(_to, _value, empty);
}
}
function transferToAddress(address _to, uint _value, bytes _data) private returns (bool success) {
if(msg.sender == _to) return mint();
if(balanceOf(msg.sender) < _value) revert();
balances[msg.sender] = balanceOf(msg.sender).sub(_value);
balances[_to] = balanceOf(_to).add(_value);
if(transferIns[msg.sender].length > 0) delete transferIns[msg.sender];
uint64 _now = uint64(now);
transferIns[msg.sender].push(transferInStruct(uint128(balances[msg.sender]),_now));
transferIns[_to].push(transferInStruct(uint128(_value),_now));
Transfer(msg.sender, _to, _value);
ERC223Transfer(msg.sender, _to, _value, _data);
return true;
}
//function that is called when transaction target is a contract
function transferToContract(address _to, uint _value, bytes _data) private returns (bool success) {
if(msg.sender == _to) return mint();
if (balanceOf(msg.sender) < _value) revert();
balances[msg.sender] = balanceOf(msg.sender).sub(_value);
balances[_to] = balanceOf(_to).add(_value);
ContractReceiver reciever = ContractReceiver(_to);
reciever.tokenFallback(msg.sender, _value, _data);
if(transferIns[msg.sender].length > 0) delete transferIns[msg.sender];
uint64 _now = uint64(now);
transferIns[msg.sender].push(transferInStruct(uint128(balances[msg.sender]),_now));
transferIns[_to].push(transferInStruct(uint128(_value),_now));
Transfer(msg.sender, _to, _value);
ERC223Transfer(msg.sender, _to, _value, _data);
return true;
}
function mint() public canPoSMint returns (bool) {
if(balances[msg.sender] <= 0) return false;
if(transferIns[msg.sender].length <= 0) return false;
uint reward = getProofOfStakeReward(msg.sender);
if(reward <= 0) return false;
totalSupply = totalSupply.add(reward);
balances[msg.sender] = balances[msg.sender].add(reward);
delete transferIns[msg.sender];
transferIns[msg.sender].push(transferInStruct(uint128(balances[msg.sender]),uint64(now)));
Mint(msg.sender, reward);
return true;
}
function getBlockNumber() public view returns (uint blockNumber) {
blockNumber = block.number.sub(chainStartBlockNumber);
}
function coinAge(address staker) public view returns (uint256) {
return getCoinAge(staker, now);
}
function annualInterest() public view returns(uint interest) {
uint _now = now;
interest = maxMintProofOfStake;
if((_now.sub(stakeStartTime)).div(365 days) == 0) {
interest = (770 * maxMintProofOfStake).div(100);
} else if((_now.sub(stakeStartTime)).div(365 days) == 1){
interest = (435 * maxMintProofOfStake).div(100);
}
}
function getProofOfStakeReward(address _address) internal view returns (uint) {
require( (now >= stakeStartTime) && (stakeStartTime > 0) );
uint _now = now;
uint _coinAge = getCoinAge(_address, _now);
if(_coinAge <= 0) return 0;
uint interest = maxMintProofOfStake;
// Due to the high interest rate for the first two years, compounding should be taken into account.
// Effective annual interest rate = (1 + (nominal rate / number of compounding periods)) ^ (number of compounding periods) - 1
if((_now.sub(stakeStartTime)).div(365 days) == 0) {
// 1st year effective annual interest rate is 100% when we select the stakeMaxAge (90 days) as the compounding period.
interest = (770 * maxMintProofOfStake).div(100);
} else if((_now.sub(stakeStartTime)).div(365 days) == 1){
// 2nd year effective annual interest rate is 50%
interest = (435 * maxMintProofOfStake).div(100);
}
uint offset = 10**uint(decimals);
return (_coinAge * interest).div(365 * offset);
}
function getCoinAge(address _address, uint _now) internal view returns (uint _coinAge) {
if(transferIns[_address].length <= 0) return 0;
for (uint i = 0; i < transferIns[_address].length; i++){
if( _now < uint(transferIns[_address][i].time).add(stakeMinAge) ) continue;
uint nCoinSeconds = _now.sub(uint(transferIns[_address][i].time));
if( nCoinSeconds > stakeMaxAge ) nCoinSeconds = stakeMaxAge;
_coinAge = _coinAge.add(uint(transferIns[_address][i].amount) * nCoinSeconds.div(1 days));
}
}
function balanceOf(address _owner) constant returns (uint balance) {
return balances[_owner];
}
// Function to access name of token .
function name() constant returns (string _name) {
return name;
}
// Function to access symbol of token .
function symbol() constant returns (string _symbol) {
return symbol;
}
// Function to access decimals of token .
function decimals() constant returns (uint8 _decimals) {
return decimals;
}
// Function to access total supply of tokens .
function totalSupply() constant returns (uint256 _totalSupply) {
return totalSupply;
}
}

Contract ABI

[{"type":"function","stateMutability":"view","payable":false,"outputs":[{"type":"string","name":"_name"}],"name":"name","inputs":[],"constant":true},{"type":"function","stateMutability":"nonpayable","payable":false,"outputs":[{"type":"bool","name":""}],"name":"mint","inputs":[],"constant":false},{"type":"function","stateMutability":"view","payable":false,"outputs":[{"type":"uint256","name":"_totalSupply"}],"name":"totalSupply","inputs":[],"constant":true},{"type":"function","stateMutability":"view","payable":false,"outputs":[{"type":"uint256","name":""}],"name":"maxTotalSupply","inputs":[],"constant":true},{"type":"function","stateMutability":"view","payable":false,"outputs":[{"type":"uint8","name":"_decimals"}],"name":"decimals","inputs":[],"constant":true},{"type":"function","stateMutability":"view","payable":false,"outputs":[{"type":"uint256","name":"blockNumber"}],"name":"getBlockNumber","inputs":[],"constant":true},{"type":"function","stateMutability":"view","payable":false,"outputs":[{"type":"uint256","name":""}],"name":"chainStartTime","inputs":[],"constant":true},{"type":"function","stateMutability":"view","payable":false,"outputs":[{"type":"uint256","name":"balance"}],"name":"balanceOf","inputs":[{"type":"address","name":"_owner"}],"constant":true},{"type":"function","stateMutability":"view","payable":false,"outputs":[{"type":"uint256","name":""}],"name":"stakeStartTime","inputs":[],"constant":true},{"type":"function","stateMutability":"view","payable":false,"outputs":[{"type":"string","name":"_symbol"}],"name":"symbol","inputs":[],"constant":true},{"type":"function","stateMutability":"view","payable":false,"outputs":[{"type":"uint256","name":""}],"name":"totalInitialSupply","inputs":[],"constant":true},{"type":"function","stateMutability":"nonpayable","payable":false,"outputs":[{"type":"bool","name":"success"}],"name":"transfer","inputs":[{"type":"address","name":"_to"},{"type":"uint256","name":"_value"}],"constant":false},{"type":"function","stateMutability":"view","payable":false,"outputs":[{"type":"uint256","name":""}],"name":"coinAge","inputs":[{"type":"address","name":"staker"}],"constant":true},{"type":"function","stateMutability":"view","payable":false,"outputs":[{"type":"uint256","name":"interest"}],"name":"annualInterest","inputs":[],"constant":true},{"type":"function","stateMutability":"nonpayable","payable":false,"outputs":[{"type":"bool","name":"success"}],"name":"transfer","inputs":[{"type":"address","name":"_to"},{"type":"uint256","name":"_value"},{"type":"bytes","name":"_data"}],"constant":false},{"type":"function","stateMutability":"view","payable":false,"outputs":[{"type":"uint256","name":""}],"name":"stakeMinAge","inputs":[],"constant":true},{"type":"function","stateMutability":"view","payable":false,"outputs":[{"type":"uint256","name":""}],"name":"chainStartBlockNumber","inputs":[],"constant":true},{"type":"function","stateMutability":"view","payable":false,"outputs":[{"type":"uint256","name":""}],"name":"stakeMaxAge","inputs":[],"constant":true},{"type":"function","stateMutability":"view","payable":false,"outputs":[{"type":"uint256","name":""}],"name":"maxMintProofOfStake","inputs":[],"constant":true},{"type":"constructor","stateMutability":"nonpayable","payable":false,"inputs":[]},{"type":"event","name":"Mint","inputs":[{"type":"address","name":"_address","indexed":true},{"type":"uint256","name":"_reward","indexed":false}],"anonymous":false},{"type":"event","name":"Transfer","inputs":[{"type":"address","name":"_from","indexed":true},{"type":"address","name":"_to","indexed":true},{"type":"uint256","name":"_value","indexed":false}],"anonymous":false},{"type":"event","name":"ERC223Transfer","inputs":[{"type":"address","name":"_from","indexed":true},{"type":"address","name":"_to","indexed":true},{"type":"uint256","name":"_value","indexed":false},{"type":"bytes","name":"_data","indexed":false}],"anonymous":false}]
            

Contract Byte Code

0x6060604052600436106101065763ffffffff7c010000000000000000000000000000000000000000000000000000000060003504166306fdde03811461010b5780631249c58b1461019557806318160ddd146101bc5780632ab4d052146101e1578063313ce567146101f457806342cbb15c1461021d5780635b054f9b1461023057806370a08231146102435780637419f1901461026257806395d89b41146102755780639fd4da4014610288578063a9059cbb1461029b578063aa9cdaf4146102bd578063b2552fc4146102dc578063be45fd62146102ef578063cbd8877e14610354578063cd474b0414610367578063e1c3bac61461037a578063f2bb5ce11461038d575b600080fd5b341561011657600080fd5b61011e6103a0565b60405160208082528190810183818151815260200191508051906020019080838360005b8381101561015a578082015183820152602001610142565b50505050905090810190601f1680156101875780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34156101a057600080fd5b6101a8610449565b604051901515815260200160405180910390f35b34156101c757600080fd5b6101cf610656565b60405190815260200160405180910390f35b34156101ec57600080fd5b6101cf61065c565b34156101ff57600080fd5b610207610662565b60405160ff909116815260200160405180910390f35b341561022857600080fd5b6101cf61066b565b341561023b57600080fd5b6101cf610687565b341561024e57600080fd5b6101cf600160a060020a036004351661068d565b341561026d57600080fd5b6101cf6106a8565b341561028057600080fd5b61011e6106ae565b341561029357600080fd5b6101cf610721565b34156102a657600080fd5b6101a8600160a060020a0360043516602435610727565b34156102c857600080fd5b6101cf600160a060020a0360043516610763565b34156102e757600080fd5b6101cf610775565b34156102fa57600080fd5b6101a860048035600160a060020a03169060248035919060649060443590810190830135806020601f8201819004810201604051908101604052818152929190602084018383808284375094965061080c95505050505050565b341561035f57600080fd5b6101cf610840565b341561037257600080fd5b6101cf610846565b341561038557600080fd5b6101cf61084c565b341561039857600080fd5b6101cf610852565b6103a86112ff565b60048054600181600116156101000203166002900480601f01602080910402602001604051908101604052809291908181526020018280546001816001161561010002031660029004801561043e5780601f106104135761010080835404028352916020019161043e565b820191906000526020600020905b81548152906001019060200180831161042157829003601f168201915b505050505090505b90565b600080600e54600d5410151561045e57600080fd5b600160a060020a033316600090815260106020526040812054116104855760009150610652565b600160a060020a033316600090815260116020526040812054116104ac5760009150610652565b6104b533610858565b9050600081116104c85760009150610652565b600d546104db908263ffffffff61095216565b600d55600160a060020a033316600090815260106020526040902054610507908263ffffffff61095216565b600160a060020a0333166000908152601060209081526040808320939093556011905290812061053691611311565b600160a060020a033316600090815260116020526040902080546001810161055e8382611332565b91600052602060002090016000604080519081016040908152600160a060020a033316600090815260106020908152919020546001608060020a0316825267ffffffffffffffff421690820152919050815181546fffffffffffffffffffffffffffffffff19166001608060020a03919091161781556020820151815467ffffffffffffffff91909116608060020a0277ffffffffffffffff00000000000000000000000000000000199091161790555050600160a060020a0333167f0f6798a560793a54c3bcfe86a93cde1e73087d944c0ea20544137d41213968858260405190815260200160405180910390a2600191505b5090565b600d5490565b600e5481565b60065460ff1690565b60006106826008544361096190919063ffffffff16565b905090565b60075481565b600160a060020a031660009081526010602052604090205490565b60095481565b6106b66112ff565b60058054600181600116156101000203166002900480601f01602080910402602001604051908101604052809291908181526020018280546001816001161561010002031660029004801561043e5780601f106104135761010080835404028352916020019161043e565b600f5481565b60006107316112ff565b61073a84610973565b156107515761074a84848361097b565b915061075c565b61074a848483610dfd565b5092915050565b600061076f8242611167565b92915050565b600c5460095442906107a4906301e133809061079890849063ffffffff61096116565b9063ffffffff6112e816565b15156107c957600c546107c29061030202606463ffffffff6112e816565b9150610652565b6107e66301e133806107986009548461096190919063ffffffff16565b6001141561065257600c54610806906101b302606463ffffffff6112e816565b91505090565b600061081784610973565b1561082e5761082784848461097b565b9050610839565b610827848484610dfd565b9392505050565b600a5481565b60085481565b600b5481565b600c5481565b6000806000806000600954421015801561087457506000600954115b151561087f57600080fd5b42935061088c8685611167565b92506000831161089f5760009450610949565b600c5491506108c16301e133806107986009548761096190919063ffffffff16565b15156108e657600c546108df9061030202606463ffffffff6112e816565b9150610926565b6109036301e133806107986009548761096190919063ffffffff16565b6001141561092657600c54610923906101b302606463ffffffff6112e816565b91505b5060065460ff16600a0a61094683830261016d830263ffffffff6112e816565b94505b50505050919050565b60008282018381101561083957fe5b60008282111561096d57fe5b50900390565b6000903b1190565b600080600085600160a060020a031633600160a060020a031614156109a9576109a2610449565b9250610df4565b846109b33361068d565b10156109be57600080fd5b6109d7856109cb3361068d565b9063ffffffff61096116565b600160a060020a033316600090815260106020526040902055610a09856109fd8861068d565b9063ffffffff61095216565b600160a060020a03871660008181526010602052604090819020929092558793509063c0ee0b8a90339088908890518463ffffffff167c01000000000000000000000000000000000000000000000000000000000281526004018084600160a060020a0316600160a060020a0316815260200183815260200180602001828103825283818151815260200191508051906020019080838360005b83811015610abb578082015183820152602001610aa3565b50505050905090810190601f168015610ae85780820380516001836020036101000a031916815260200191505b50945050505050600060405180830381600087803b1515610b0857600080fd5b6102c65a03f11515610b1957600080fd5b505050600160a060020a0333166000908152601160205260408120541115610b5c57600160a060020a0333166000908152601160205260408120610b5c91611311565b50600160a060020a0333166000908152601160205260409020805442919060018101610b888382611332565b91600052602060002090016000604080519081016040908152600160a060020a033316600090815260106020908152919020546001608060020a0316825267ffffffffffffffff861690820152919050815181546fffffffffffffffffffffffffffffffff19166001608060020a03919091161781556020820151815467ffffffffffffffff91909116608060020a0277ffffffffffffffff00000000000000000000000000000000199091161790555050600160a060020a0386166000908152601160205260409020805460018101610c628382611332565b91600052602060002090016000604080519081016040526001608060020a038916815267ffffffffffffffff85166020820152919050815181546fffffffffffffffffffffffffffffffff19166001608060020a03919091161781556020820151815467ffffffffffffffff91909116608060020a0277ffffffffffffffff00000000000000000000000000000000199091161790555050600160a060020a038087169033167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8760405190815260200160405180910390a385600160a060020a031633600160a060020a03167f9bfafdc2ae8835972d7b64ef3f8f307165ac22ceffde4a742c52da5487f45fd1878760405182815260406020820181815290820183818151815260200191508051906020019080838360005b83811015610db4578082015183820152602001610d9c565b50505050905090810190601f168015610de15780820380516001836020036101000a031916815260200191505b50935050505060405180910390a3600192505b50509392505050565b60008084600160a060020a031633600160a060020a03161415610e2957610e22610449565b915061115f565b83610e333361068d565b1015610e3e57600080fd5b610e4b846109cb3361068d565b600160a060020a033316600090815260106020526040902055610e71846109fd8761068d565b600160a060020a038087166000908152601060209081526040808320949094553390921681526011909152908120541115610ec757600160a060020a0333166000908152601160205260408120610ec791611311565b50600160a060020a0333166000908152601160205260409020805442919060018101610ef38382611332565b91600052602060002090016000604080519081016040908152600160a060020a033316600090815260106020908152919020546001608060020a0316825267ffffffffffffffff861690820152919050815181546fffffffffffffffffffffffffffffffff19166001608060020a03919091161781556020820151815467ffffffffffffffff91909116608060020a0277ffffffffffffffff00000000000000000000000000000000199091161790555050600160a060020a0385166000908152601160205260409020805460018101610fcd8382611332565b91600052602060002090016000604080519081016040526001608060020a038816815267ffffffffffffffff85166020820152919050815181546fffffffffffffffffffffffffffffffff19166001608060020a03919091161781556020820151815467ffffffffffffffff91909116608060020a0277ffffffffffffffff00000000000000000000000000000000199091161790555050600160a060020a038086169033167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8660405190815260200160405180910390a384600160a060020a031633600160a060020a03167f9bfafdc2ae8835972d7b64ef3f8f307165ac22ceffde4a742c52da5487f45fd1868660405182815260406020820181815290820183818151815260200191508051906020019080838360005b8381101561111f578082015183820152602001611107565b50505050905090810190601f16801561114c5780820380516001836020036101000a031916815260200191505b50935050505060405180910390a3600191505b509392505050565b600160a060020a0382166000908152601160205260408120548190819081901161119457600092506112e0565b600091505b600160a060020a0385166000908152601160205260409020548210156112e057600a54600160a060020a03861660009081526011602052604090208054611209929190859081106111e657fe5b600091825260209091200154608060020a900467ffffffffffffffff1690610952565b841015611215576112d5565b600160a060020a0385166000908152601160205260409020805461126291908490811061123e57fe5b6000918252602090912001548590608060020a900467ffffffffffffffff16610961565b9050600b548111156112735750600b545b6112d2611289826201518063ffffffff6112e816565b600160a060020a03871660009081526011602052604090208054859081106112ad57fe5b60009182526020909120015485916001608060020a039091160263ffffffff61095216565b92505b600190910190611199565b505092915050565b60008082848115156112f657fe5b04949350505050565b60206040519081016040526000815290565b508054600082559060005260206000209081019061132f919061135b565b50565b8154818355818115116113565760008381526020902061135691810190830161135b565b505050565b61044691905b8082111561065257805477ffffffffffffffffffffffffffffffffffffffffffffffff191681556001016113615600a165627a7a72305820b68d4fed66cb57577dcf0e8dc190d39ebf8c4eeedce7302ae99f83e9dea159e60029