Source Code
View more zero value Internal Transactions in Advanced View mode
Advanced mode:
Loading...
Loading
Loading...
Loading
Cross-Chain Transactions
Loading...
Loading
Contract Name:
TeamAndEarlyInvestorsVesting
Compiler Version
v0.4.24+commit.e67f0147
Optimization Enabled:
Yes with 200 runs
Other Settings:
default evmVersion
Contract Source Code (Solidity)
/**
*Submitted for verification at Etherscan.io on 2018-06-21
*/
pragma solidity 0.4.24;
contract ERC20TokenInterface {
function totalSupply () external constant returns (uint);
function balanceOf (address tokenOwner) external constant returns (uint balance);
function transfer (address to, uint tokens) external returns (bool success);
function transferFrom (address from, address to, uint tokens) external returns (bool success);
}
/**
* Math operations with safety checks that throw on overflows.
*/
library SafeMath {
function mul (uint256 a, uint256 b) internal pure returns (uint256 c) {
if (a == 0) {
return 0;
}
c = a * b;
require(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 a / b;
}
function sub (uint256 a, uint256 b) internal pure returns (uint256) {
require(b <= a);
return a - b;
}
function add (uint256 a, uint256 b) internal pure returns (uint256 c) {
c = a + b;
require(c >= a);
return c;
}
}
/**
* DreamTeam tokens vesting contract.
*
* According to the DreamTeam token distribution structure, there are two parties that should
* be provided with corresponding token amounts during the 2 years after TGE:
* Teams and Tournament Organizers: 15%
* Team and Early Investors: 10%
*
* The DreamTeam "Vesting" smart contract should be in place to ensure meeting the token sale commitments.
*
* Two instances of the contract will be deployed for holding tokens.
* First instance for "Teams and Tournament Organizers" tokens and second for "Team and Early Investors".
*/
contract DreamTokensVesting {
using SafeMath for uint256;
/**
* Address of DreamToken.
*/
ERC20TokenInterface public dreamToken;
/**
* Address for receiving tokens.
*/
address public withdrawAddress;
/**
* Tokens vesting stage structure with vesting date and tokens allowed to unlock.
*/
struct VestingStage {
uint256 date;
uint256 tokensUnlockedPercentage;
}
/**
* Array for storing all vesting stages with structure defined above.
*/
VestingStage[5] public stages;
/**
* Starting timestamp of the first stage of vesting (Tuesday, 19 June 2018, 09:00:00 GMT).
* Will be used as a starting point for all dates calculations.
*/
uint256 public vestingStartTimestamp = 1529398800;
/**
* Total amount of tokens sent.
*/
uint256 public initialTokensBalance;
/**
* Amount of tokens already sent.
*/
uint256 public tokensSent;
/**
* Event raised on each successful withdraw.
*/
event Withdraw(uint256 amount, uint256 timestamp);
/**
* Could be called only from withdraw address.
*/
modifier onlyWithdrawAddress () {
require(msg.sender == withdrawAddress);
_;
}
/**
* We are filling vesting stages array right when the contract is deployed.
*
* @param token Address of DreamToken that will be locked on contract.
* @param withdraw Address of tokens receiver when it is unlocked.
*/
constructor (ERC20TokenInterface token, address withdraw) public {
dreamToken = token;
withdrawAddress = withdraw;
initVestingStages();
}
/**
* Fallback
*/
function () external {
withdrawTokens();
}
/**
* Calculate tokens amount that is sent to withdrawAddress.
*
* @return Amount of tokens that can be sent.
*/
function getAvailableTokensToWithdraw () public view returns (uint256 tokensToSend) {
uint256 tokensUnlockedPercentage = getTokensUnlockedPercentage();
// In the case of stuck tokens we allow the withdrawal of them all after vesting period ends.
if (tokensUnlockedPercentage >= 100) {
tokensToSend = dreamToken.balanceOf(this);
} else {
tokensToSend = getTokensAmountAllowedToWithdraw(tokensUnlockedPercentage);
}
}
/**
* Get detailed info about stage.
* Provides ability to get attributes of every stage from external callers, ie Web3, truffle tests, etc.
*
* @param index Vesting stage number. Ordered by ascending date and starting from zero.
*
* @return {
* "date": "Date of stage in unix timestamp format.",
* "tokensUnlockedPercentage": "Percent of tokens allowed to be withdrawn."
* }
*/
function getStageAttributes (uint8 index) public view returns (uint256 date, uint256 tokensUnlockedPercentage) {
return (stages[index].date, stages[index].tokensUnlockedPercentage);
}
/**
* Setup array with vesting stages dates and percents.
*/
function initVestingStages () internal {
uint256 halfOfYear = 183 days;
uint256 year = halfOfYear * 2;
stages[0].date = vestingStartTimestamp;
stages[1].date = vestingStartTimestamp + halfOfYear;
stages[2].date = vestingStartTimestamp + year;
stages[3].date = vestingStartTimestamp + year + halfOfYear;
stages[4].date = vestingStartTimestamp + year * 2;
stages[0].tokensUnlockedPercentage = 25;
stages[1].tokensUnlockedPercentage = 50;
stages[2].tokensUnlockedPercentage = 75;
stages[3].tokensUnlockedPercentage = 88;
stages[4].tokensUnlockedPercentage = 100;
}
/**
* Main method for withdraw tokens from vesting.
*/
function withdrawTokens () onlyWithdrawAddress private {
// Setting initial tokens balance on a first withdraw.
if (initialTokensBalance == 0) {
setInitialTokensBalance();
}
uint256 tokensToSend = getAvailableTokensToWithdraw();
sendTokens(tokensToSend);
}
/**
* Set initial tokens balance when making the first withdrawal.
*/
function setInitialTokensBalance () private {
initialTokensBalance = dreamToken.balanceOf(this);
}
/**
* Send tokens to withdrawAddress.
*
* @param tokensToSend Amount of tokens will be sent.
*/
function sendTokens (uint256 tokensToSend) private {
if (tokensToSend > 0) {
// Updating tokens sent counter
tokensSent = tokensSent.add(tokensToSend);
// Sending allowed tokens amount
dreamToken.transfer(withdrawAddress, tokensToSend);
// Raising event
emit Withdraw(tokensToSend, now);
}
}
/**
* Calculate tokens available for withdrawal.
*
* @param tokensUnlockedPercentage Percent of tokens that are allowed to be sent.
*
* @return Amount of tokens that can be sent according to provided percentage.
*/
function getTokensAmountAllowedToWithdraw (uint256 tokensUnlockedPercentage) private view returns (uint256) {
uint256 totalTokensAllowedToWithdraw = initialTokensBalance.mul(tokensUnlockedPercentage).div(100);
uint256 unsentTokensAmount = totalTokensAllowedToWithdraw.sub(tokensSent);
return unsentTokensAmount;
}
/**
* Get tokens unlocked percentage on current stage.
*
* @return Percent of tokens allowed to be sent.
*/
function getTokensUnlockedPercentage () private view returns (uint256) {
uint256 allowedPercent;
for (uint8 i = 0; i < stages.length; i++) {
if (now >= stages[i].date) {
allowedPercent = stages[i].tokensUnlockedPercentage;
}
}
return allowedPercent;
}
}
contract TeamAndEarlyInvestorsVesting is DreamTokensVesting {
constructor(ERC20TokenInterface token, address withdraw) DreamTokensVesting(token, withdraw) public {}
}Contract Security Audit
- No Contract Security Audit Submitted- Submit Audit Here
Contract ABI
API[{"constant":true,"inputs":[],"name":"getAvailableTokensToWithdraw","outputs":[{"name":"tokensToSend","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"withdrawAddress","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"tokensSent","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"initialTokensBalance","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"dreamToken","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"","type":"uint256"}],"name":"stages","outputs":[{"name":"date","type":"uint256"},{"name":"tokensUnlockedPercentage","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"index","type":"uint8"}],"name":"getStageAttributes","outputs":[{"name":"date","type":"uint256"},{"name":"tokensUnlockedPercentage","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"vestingStartTimestamp","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"inputs":[{"name":"token","type":"address"},{"name":"withdraw","type":"address"}],"payable":false,"stateMutability":"nonpayable","type":"constructor"},{"payable":false,"stateMutability":"nonpayable","type":"fallback"},{"anonymous":false,"inputs":[{"indexed":false,"name":"amount","type":"uint256"},{"indexed":false,"name":"timestamp","type":"uint256"}],"name":"Withdraw","type":"event"}]Contract Creation Code
6080604052635b28c610600c5534801561001857600080fd5b506040516040806106ca83398101604052805160209091015160008054600160a060020a03808516600160a060020a0319928316179092556001805492841692909116919091179055818161007464010000000061007d810204565b505050506100c6565b600c54600281905562f1428081016004556301e2850081016006556302d3c78081016008556303c50a0001600a5560196003556032600555604b60075560586009556064600b55565b6105f5806100d56000396000f30060806040526004361061008d5763ffffffff7c0100000000000000000000000000000000000000000000000000000000600035041663045e240f81146100a45780631581b600146100cb5780631f130761146100fc5780633c72f0701461011157806341c1f5b414610126578063845ddcb21461013b578063b9588adc1461016c578063d6ddd21b14610187575b34801561009957600080fd5b506100a261019c565b005b3480156100b057600080fd5b506100b96101dd565b60408051918252519081900360200190f35b3480156100d757600080fd5b506100e061029c565b60408051600160a060020a039092168252519081900360200190f35b34801561010857600080fd5b506100b96102ab565b34801561011d57600080fd5b506100b96102b1565b34801561013257600080fd5b506100e06102b7565b34801561014757600080fd5b506101536004356102c6565b6040805192835260208301919091528051918290030190f35b34801561017857600080fd5b5061015360ff600435166102e5565b34801561019357600080fd5b506100b9610323565b600154600090600160a060020a031633146101b657600080fd5b600d5415156101c7576101c7610329565b6101cf6101dd565b90506101da816103c1565b50565b6000806101e86104be565b90506064811061028c5760008054604080517f70a082310000000000000000000000000000000000000000000000000000000081523060048201529051600160a060020a03909216926370a08231926024808401936020939083900390910190829087803b15801561025957600080fd5b505af115801561026d573d6000803e3d6000fd5b505050506040513d602081101561028357600080fd5b50519150610298565b61029581610513565b91505b5090565b600154600160a060020a031681565b600e5481565b600d5481565b600054600160a060020a031681565b600281600581106102d357fe5b60020201805460019091015490915082565b600080600260ff8416600581106102f857fe5b600202016000015460028460ff1660058110151561031257fe5b600202016001015491509150915091565b600c5481565b60008054604080517f70a082310000000000000000000000000000000000000000000000000000000081523060048201529051600160a060020a03909216926370a08231926024808401936020939083900390910190829087803b15801561039057600080fd5b505af11580156103a4573d6000803e3d6000fd5b505050506040513d60208110156103ba57600080fd5b5051600d55565b60008111156101da57600e546103dd908263ffffffff61055d16565b600e5560008054600154604080517fa9059cbb000000000000000000000000000000000000000000000000000000008152600160a060020a039283166004820152602481018690529051919092169263a9059cbb92604480820193602093909283900390910190829087803b15801561045557600080fd5b505af1158015610469573d6000803e3d6000fd5b505050506040513d602081101561047f57600080fd5b50506040805182815242602082015281517f56ca301a9219608c91e7bcee90e083c19671d2cdcc96752c7af291cee5f9c8c8929181900390910190a150565b600080805b60058160ff16101561050d57600260ff8216600581106104df57fe5b6002020154421061050557600260ff8216600581106104fa57fe5b600202016001015491505b6001016104c3565b50919050565b600080600061053e606461053286600d5461057390919063ffffffff16565b9063ffffffff61059f16565b9150610555600e54836105b490919063ffffffff16565b949350505050565b8181018281101561056d57600080fd5b92915050565b60008215156105845750600061056d565b5081810281838281151561059457fe5b041461056d57600080fd5b600081838115156105ac57fe5b049392505050565b6000828211156105c357600080fd5b509003905600a165627a7a72305820cef4b134b0a2e29a52a721ebc86c4fed7d0ef6837d551f8ea7fbd67cec08f8c3002900000000000000000000000082f4ded9cec9b5750fbff5c2185aee35afc16587000000000000000000000000cf056a3ddcaf265c54da2984adfdca450bfeca7b
Deployed Bytecode
0x60806040526004361061008d5763ffffffff7c0100000000000000000000000000000000000000000000000000000000600035041663045e240f81146100a45780631581b600146100cb5780631f130761146100fc5780633c72f0701461011157806341c1f5b414610126578063845ddcb21461013b578063b9588adc1461016c578063d6ddd21b14610187575b34801561009957600080fd5b506100a261019c565b005b3480156100b057600080fd5b506100b96101dd565b60408051918252519081900360200190f35b3480156100d757600080fd5b506100e061029c565b60408051600160a060020a039092168252519081900360200190f35b34801561010857600080fd5b506100b96102ab565b34801561011d57600080fd5b506100b96102b1565b34801561013257600080fd5b506100e06102b7565b34801561014757600080fd5b506101536004356102c6565b6040805192835260208301919091528051918290030190f35b34801561017857600080fd5b5061015360ff600435166102e5565b34801561019357600080fd5b506100b9610323565b600154600090600160a060020a031633146101b657600080fd5b600d5415156101c7576101c7610329565b6101cf6101dd565b90506101da816103c1565b50565b6000806101e86104be565b90506064811061028c5760008054604080517f70a082310000000000000000000000000000000000000000000000000000000081523060048201529051600160a060020a03909216926370a08231926024808401936020939083900390910190829087803b15801561025957600080fd5b505af115801561026d573d6000803e3d6000fd5b505050506040513d602081101561028357600080fd5b50519150610298565b61029581610513565b91505b5090565b600154600160a060020a031681565b600e5481565b600d5481565b600054600160a060020a031681565b600281600581106102d357fe5b60020201805460019091015490915082565b600080600260ff8416600581106102f857fe5b600202016000015460028460ff1660058110151561031257fe5b600202016001015491509150915091565b600c5481565b60008054604080517f70a082310000000000000000000000000000000000000000000000000000000081523060048201529051600160a060020a03909216926370a08231926024808401936020939083900390910190829087803b15801561039057600080fd5b505af11580156103a4573d6000803e3d6000fd5b505050506040513d60208110156103ba57600080fd5b5051600d55565b60008111156101da57600e546103dd908263ffffffff61055d16565b600e5560008054600154604080517fa9059cbb000000000000000000000000000000000000000000000000000000008152600160a060020a039283166004820152602481018690529051919092169263a9059cbb92604480820193602093909283900390910190829087803b15801561045557600080fd5b505af1158015610469573d6000803e3d6000fd5b505050506040513d602081101561047f57600080fd5b50506040805182815242602082015281517f56ca301a9219608c91e7bcee90e083c19671d2cdcc96752c7af291cee5f9c8c8929181900390910190a150565b600080805b60058160ff16101561050d57600260ff8216600581106104df57fe5b6002020154421061050557600260ff8216600581106104fa57fe5b600202016001015491505b6001016104c3565b50919050565b600080600061053e606461053286600d5461057390919063ffffffff16565b9063ffffffff61059f16565b9150610555600e54836105b490919063ffffffff16565b949350505050565b8181018281101561056d57600080fd5b92915050565b60008215156105845750600061056d565b5081810281838281151561059457fe5b041461056d57600080fd5b600081838115156105ac57fe5b049392505050565b6000828211156105c357600080fd5b509003905600a165627a7a72305820cef4b134b0a2e29a52a721ebc86c4fed7d0ef6837d551f8ea7fbd67cec08f8c30029
Constructor Arguments (ABI-Encoded and is the last bytes of the Contract Creation Code above)
00000000000000000000000082f4ded9cec9b5750fbff5c2185aee35afc16587000000000000000000000000cf056a3ddcaf265c54da2984adfdca450bfeca7b
-----Decoded View---------------
Arg [0] : token (address): 0x82f4dED9Cec9B5750FBFf5C2185AEe35AfC16587
Arg [1] : withdraw (address): 0xcF056A3dDCaF265c54da2984aDfDCA450bFeca7B
-----Encoded View---------------
2 Constructor Arguments found :
Arg [0] : 00000000000000000000000082f4ded9cec9b5750fbff5c2185aee35afc16587
Arg [1] : 000000000000000000000000cf056a3ddcaf265c54da2984adfdca450bfeca7b
Swarm Source
bzzr://cef4b134b0a2e29a52a721ebc86c4fed7d0ef6837d551f8ea7fbd67cec08f8c3
Loading...
Loading
Loading...
Loading
Net Worth in USD
$0.00
Net Worth in ETH
0
Multichain Portfolio | 33 Chains
| Chain | Token | Portfolio % | Price | Amount | Value |
|---|
Loading...
Loading
Loading...
Loading
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.