pragma solidity ^0.5.9;
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)
{
uint256 c = a / b;
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 OwnerHelper
{
address public owner;
address public manager;
event ChangeOwner(address indexed _from, address indexed _to);
event ChangeManager(address indexed _from, address indexed _to);
modifier onlyOwner
{
require(msg.sender == owner);
_;
}
modifier onlyManager
{
require(msg.sender == manager);
_;
}
constructor() public
{
owner = msg.sender;
}
function transferOwnership(address _to) onlyOwner public
{
require(_to != owner);
require(_to != manager);
require(_to != address(0x0));
address from = owner;
owner = _to;
emit ChangeOwner(from, _to);
}
function transferManager(address _to) onlyOwner public
{
require(_to != owner);
require(_to != manager);
require(_to != address(0x0));
address from = manager;
manager = _to;
emit ChangeManager(from, _to);
}
}
contract ERC20Interface
{
event Transfer( address indexed _from, address indexed _to, uint _value);
event Approval( address indexed _owner, address indexed _spender, uint _value);
function totalSupply() view public returns (uint _supply);
function balanceOf( address _who ) public view returns (uint _value);
function transfer( address _to, uint _value) public returns (bool _success);
function approve( address _spender, uint _value ) public returns (bool _success);
function allowance( address _owner, address _spender ) public view returns (uint _allowance);
function transferFrom( address _from, address _to, uint _value) public returns (bool _success);
}
contract Dvision is ERC20Interface, OwnerHelper
{
using SafeMath for uint;
string public name;
uint public decimals;
string public symbol;
uint constant private E18 = 1000000000000000000;
uint constant private month = 2592000;
// Total 1,000,000,000
uint constant public maxTotalSupply = 1000000000 * E18;
// Sale 200,000,000 (20%)
uint constant public maxSaleSupply = 200000000 * E18;
// Development 250,000,000 (25%)
uint constant public maxDevSupply = 250000000 * E18;
// EcoSystem 170,000,000 (17%)
uint constant public maxEcoSupply = 170000000 * E18;
// Marketing 150,000,000 (15%)
uint constant public maxMktSupply = 150000000 * E18;
// Reserve 100,000,000 (10%)
uint constant public maxReserveSupply = 100000000 * E18;
// Team 100,000,000 (10%)
uint constant public maxTeamSupply = 100000000 * E18;
// Advisors 30,000,000 (3%)
uint constant public maxAdvisorSupply = 30000000 * E18;
// Lock
uint constant public teamVestingSupply = 10000000 * E18;
uint constant public teamVestingLockDate = 12 * month;
uint constant public teamVestingTime = 10;
uint constant public advisorVestingSupply = 7500000 * E18;
uint constant public advisorVestingLockDate = 3 * month;
uint constant public advisorVestingTime = 4;
uint public totalTokenSupply;
uint public tokenIssuedSale;
uint public tokenIssuedDev;
uint public tokenIssuedEco;
uint public tokenIssuedMkt;
uint public tokenIssuedRsv;
uint public tokenIssuedTeam;
uint public tokenIssuedAdv;
uint public burnTokenSupply;
mapping (address => uint) public balances;
mapping (address => mapping ( address => uint )) public approvals;
mapping (uint => uint) public tmVestingTimer;
mapping (uint => uint) public tmVestingBalances;
mapping (uint => uint) public advVestingTimer;
mapping (uint => uint) public advVestingBalances;
bool public tokenLock = true;
bool public saleTime = true;
uint public endSaleTime = 0;
event SaleIssue(address indexed _to, uint _tokens);
event DevIssue(address indexed _to, uint _tokens);
event EcoIssue(address indexed _to, uint _tokens);
event MktIssue(address indexed _to, uint _tokens);
event RsvIssue(address indexed _to, uint _tokens);
event TeamIssue(address indexed _to, uint _tokens);
event AdvIssue(address indexed _to, uint _tokens);
event Burn(address indexed _from, uint _tokens);
event TokenUnlock(address indexed _to, uint _tokens);
event EndSale(uint _date);
constructor() public
{
name = "Dvision";
decimals = 18;
symbol = "DVI";
totalTokenSupply = 1000000000 * E18;
balances[owner] = totalTokenSupply;
tokenIssuedSale = 0;
tokenIssuedDev = 0;
tokenIssuedEco = 0;
tokenIssuedMkt = 0;
tokenIssuedRsv = 0;
tokenIssuedTeam = 0;
tokenIssuedAdv = 0;
burnTokenSupply = 0;
require(maxTeamSupply == teamVestingSupply.mul(teamVestingTime));
require(maxAdvisorSupply == advisorVestingSupply.mul(advisorVestingTime));
require(maxTotalSupply == maxSaleSupply + maxDevSupply + maxEcoSupply + maxMktSupply + maxReserveSupply + maxTeamSupply + maxAdvisorSupply);
}
function totalSupply() view public returns (uint)
{
return totalTokenSupply;
}
function balanceOf(address _who) view public returns (uint)
{
return balances[_who];
}
function transfer(address _to, uint _value) public returns (bool)
{
require(isTransferable() == true);
require(balances[msg.sender] >= _value);
balances[msg.sender] = balances[msg.sender].sub(_value);
balances[_to] = balances[_to].add(_value);
emit Transfer(msg.sender, _to, _value);
return true;
}
function approve(address _spender, uint _value) public returns (bool)
{
require(isTransferable() == true);
require(balances[msg.sender] >= _value);
approvals[msg.sender][_spender] = _value;
emit Approval(msg.sender, _spender, _value);
return true;
}
function allowance(address _owner, address _spender) view public returns (uint)
{
return approvals[_owner][_spender];
}
function transferFrom(address _from, address _to, uint _value) public returns (bool)
{
require(isTransferable() == true);
require(balances[_from] >= _value);
require(approvals[_from][msg.sender] >= _value);
approvals[_from][msg.sender] = approvals[_from][msg.sender].sub(_value);
balances[_from] = balances[_from].sub(_value);
balances[_to] = balances[_to].add(_value);
emit Transfer(_from, _to, _value);
return true;
}
function saleIssue(address _to) onlyOwner public
{
require(tokenIssuedSale == 0);
uint tokens = maxSaleSupply;
balances[msg.sender] = balances[msg.sender].sub(tokens);
balances[_to] = balances[_to].add(tokens);
tokenIssuedSale = tokenIssuedSale.add(tokens);
emit SaleIssue(_to, tokens);
}
function devIssue(address _to) onlyOwner public
{
require(saleTime == false);
require(tokenIssuedDev == 0);
uint tokens = maxDevSupply;
balances[msg.sender] = balances[msg.sender].sub(tokens);
balances[_to] = balances[_to].add(tokens);
tokenIssuedDev = tokenIssuedDev.add(tokens);
emit DevIssue(_to, tokens);
}
function ecoIssue(address _to) onlyOwner public
{
require(saleTime == false);
require(tokenIssuedEco == 0);
uint tokens = maxEcoSupply;
balances[msg.sender] = balances[msg.sender].sub(tokens);
balances[_to] = balances[_to].add(tokens);
tokenIssuedEco = tokenIssuedEco.add(tokens);
emit EcoIssue(_to, tokens);
}
function mktIssue(address _to) onlyOwner public
{
require(saleTime == false);
require(tokenIssuedMkt == 0);
uint tokens = maxMktSupply;
balances[msg.sender] = balances[msg.sender].sub(tokens);
balances[_to] = balances[_to].add(tokens);
tokenIssuedMkt = tokenIssuedMkt.add(tokens);
emit MktIssue(_to, tokens);
}
function rsvIssue(address _to) onlyOwner public
{
require(saleTime == false);
require(tokenIssuedRsv == 0);
uint tokens = maxReserveSupply;
balances[msg.sender] = balances[msg.sender].sub(tokens);
balances[_to] = balances[_to].add(tokens);
tokenIssuedRsv = tokenIssuedRsv.add(tokens);
emit RsvIssue(_to, tokens);
}
function teamIssue(address _to, uint _time) onlyOwner public
{
require(saleTime == false);
require( _time < teamVestingTime);
uint nowTime = now;
require( nowTime > tmVestingTimer[_time] );
uint tokens = teamVestingSupply;
require(tokens == tmVestingBalances[_time]);
require(maxTeamSupply >= tokenIssuedTeam.add(tokens));
balances[msg.sender] = balances[msg.sender].sub(tokens);
balances[_to] = balances[_to].add(tokens);
tmVestingBalances[_time] = 0;
totalTokenSupply = totalTokenSupply.add(tokens);
tokenIssuedTeam = tokenIssuedTeam.add(tokens);
emit TeamIssue(_to, tokens);
}
function advisorIssue(address _to, uint _time) onlyOwner public
{
require(saleTime == false);
require( _time < advisorVestingTime);
uint nowTime = now;
require( nowTime > advVestingTimer[_time] );
uint tokens = advisorVestingSupply;
require(tokens == advVestingBalances[_time]);
require(maxAdvisorSupply >= tokenIssuedAdv.add(tokens));
balances[msg.sender] = balances[msg.sender].sub(tokens);
balances[_to] = balances[_to].add(tokens);
advVestingBalances[_time] = 0;
totalTokenSupply = totalTokenSupply.add(tokens);
tokenIssuedAdv = tokenIssuedAdv.add(tokens);
emit AdvIssue(_to, tokens);
}
function isTransferable() private view returns (bool)
{
if(tokenLock == false)
{
return true;
}
else if(msg.sender == owner)
{
return true;
}
return false;
}
function setTokenUnlock() onlyManager public
{
require(tokenLock == true);
require(saleTime == false);
tokenLock = false;
}
function setTokenLock() onlyManager public
{
require(tokenLock == false);
tokenLock = true;
}
function endSale() onlyOwner public
{
require(saleTime == true);
require(maxSaleSupply == tokenIssuedSale);
saleTime = false;
uint nowTime = now;
endSaleTime = nowTime;
for(uint i = 0; i < teamVestingTime; i++)
{
tmVestingTimer[i] = endSaleTime + teamVestingLockDate + (i * month);
tmVestingBalances[i] = teamVestingSupply;
}
for(uint i = 0; i < advisorVestingTime; i++)
{
advVestingTimer[i] = endSaleTime + advisorVestingLockDate + (3 * i * month);
advVestingBalances[i] = advisorVestingSupply;
}
emit EndSale(endSaleTime);
}
function transferAnyERC20Token(address tokenAddress, uint tokens) onlyOwner public returns (bool success)
{
return ERC20Interface(tokenAddress).transfer(manager, tokens);
}
function burnToken(uint _value) onlyManager public
{
uint tokens = _value * E18;
require(balances[msg.sender] >= tokens);
balances[msg.sender] = balances[msg.sender].sub(tokens);
burnTokenSupply = burnTokenSupply.add(tokens);
totalTokenSupply = totalTokenSupply.sub(tokens);
emit Burn(msg.sender, tokens);
}
function close() onlyOwner public
{
selfdestruct(msg.sender);
}
}
{
"compilationTarget": {
"Dvision.sol": "Dvision"
},
"evmVersion": "petersburg",
"libraries": {},
"optimizer": {
"enabled": false,
"runs": 200
},
"remappings": []
}
[{"constant":true,"inputs":[],"name":"name","outputs":[{"name":"","type":"string"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_spender","type":"address"},{"name":"_value","type":"uint256"}],"name":"approve","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"_to","type":"address"}],"name":"ecoIssue","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"_to","type":"address"}],"name":"mktIssue","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"saleTime","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"totalSupply","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"totalTokenSupply","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"tokenIssuedSale","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"burnTokenSupply","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_from","type":"address"},{"name":"_to","type":"address"},{"name":"_value","type":"uint256"}],"name":"transferFrom","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[{"name":"","type":"uint256"}],"name":"advVestingTimer","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"","type":"address"}],"name":"balances","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"","type":"uint256"}],"name":"tmVestingTimer","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"maxTotalSupply","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_to","type":"address"}],"name":"rsvIssue","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"tokenIssuedEco","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"decimals","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[],"name":"endSale","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"_to","type":"address"}],"name":"saleIssue","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[],"name":"close","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"manager","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"maxTeamSupply","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"","type":"uint256"}],"name":"advVestingBalances","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"tokenIssuedRsv","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"endSaleTime","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_to","type":"address"}],"name":"devIssue","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"advisorVestingTime","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_to","type":"address"},{"name":"_time","type":"uint256"}],"name":"teamIssue","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[{"name":"_who","type":"address"}],"name":"balanceOf","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"teamVestingSupply","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_value","type":"uint256"}],"name":"burnToken","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[],"name":"setTokenUnlock","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"tokenIssuedDev","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"owner","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[],"name":"setTokenLock","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"symbol","outputs":[{"name":"","type":"string"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"advisorVestingLockDate","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"maxDevSupply","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"","type":"address"},{"name":"","type":"address"}],"name":"approvals","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"maxMktSupply","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"maxAdvisorSupply","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_to","type":"address"},{"name":"_value","type":"uint256"}],"name":"transfer","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"maxSaleSupply","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"teamVestingTime","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"","type":"uint256"}],"name":"tmVestingBalances","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_to","type":"address"}],"name":"transferManager","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"tokenIssuedTeam","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"maxReserveSupply","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"tokenAddress","type":"address"},{"name":"tokens","type":"uint256"}],"name":"transferAnyERC20Token","outputs":[{"name":"success","type":"bool"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[{"name":"_owner","type":"address"},{"name":"_spender","type":"address"}],"name":"allowance","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_to","type":"address"},{"name":"_time","type":"uint256"}],"name":"advisorIssue","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"tokenIssuedMkt","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"advisorVestingSupply","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"tokenLock","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"teamVestingLockDate","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_to","type":"address"}],"name":"transferOwnership","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"tokenIssuedAdv","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"maxEcoSupply","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"inputs":[],"payable":false,"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":true,"name":"_to","type":"address"},{"indexed":false,"name":"_tokens","type":"uint256"}],"name":"SaleIssue","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"_to","type":"address"},{"indexed":false,"name":"_tokens","type":"uint256"}],"name":"DevIssue","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"_to","type":"address"},{"indexed":false,"name":"_tokens","type":"uint256"}],"name":"EcoIssue","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"_to","type":"address"},{"indexed":false,"name":"_tokens","type":"uint256"}],"name":"MktIssue","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"_to","type":"address"},{"indexed":false,"name":"_tokens","type":"uint256"}],"name":"RsvIssue","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"_to","type":"address"},{"indexed":false,"name":"_tokens","type":"uint256"}],"name":"TeamIssue","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"_to","type":"address"},{"indexed":false,"name":"_tokens","type":"uint256"}],"name":"AdvIssue","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"_from","type":"address"},{"indexed":false,"name":"_tokens","type":"uint256"}],"name":"Burn","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"_to","type":"address"},{"indexed":false,"name":"_tokens","type":"uint256"}],"name":"TokenUnlock","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"name":"_date","type":"uint256"}],"name":"EndSale","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"_from","type":"address"},{"indexed":true,"name":"_to","type":"address"}],"name":"ChangeOwner","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"_from","type":"address"},{"indexed":true,"name":"_to","type":"address"}],"name":"ChangeManager","type":"event"},{"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"}]