Source Code
View more zero value Internal Transactions in Advanced View mode
Advanced mode:
Loading...
Loading
Cross-Chain Transactions
Loading...
Loading
Contract Name:
LiteXTokenVesting
Compiler Version
v0.4.18-nightly.2017.10.18+commit.e854da1a
Optimization Enabled:
Yes with 200 runs
Other Settings:
default evmVersion
Contract Source Code (Solidity)
/**
*Submitted for verification at Etherscan.io on 2018-04-05
*/
pragma solidity ^0.4.18;
// File: zeppelin-solidity/contracts/math/SafeMath.sol
/**
* @title SafeMath
* @dev Math operations with safety checks that throw on error
*/
library SafeMath {
/**
* @dev Multiplies two numbers, throws on overflow.
*/
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;
}
/**
* @dev Integer division of two numbers, truncating the quotient.
*/
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;
}
/**
* @dev Substracts two numbers, throws on overflow (i.e. if subtrahend is greater than minuend).
*/
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
assert(b <= a);
return a - b;
}
/**
* @dev Adds two numbers, throws on overflow.
*/
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
assert(c >= a);
return c;
}
function ceil(uint256 a, uint256 m) internal pure returns (uint256) {
uint256 c = ((a + m - 1) / m) * m;
return c;
}
}
// File: zeppelin-solidity/contracts/ownership/Ownable.sol
/**
* @title Ownable
* @dev The Ownable contract has an owner address, and provides basic authorization control
* functions, this simplifies the implementation of "user permissions".
*/
contract Ownable {
address public owner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
/**
* @dev The Ownable constructor sets the original `owner` of the contract to the sender
* account.
*/
function Ownable() public {
owner = msg.sender;
}
/**
* @dev Throws if called by any account other than the owner.
*/
modifier onlyOwner() {
require(msg.sender == owner);
_;
}
/**
* @dev Allows the current owner to transfer control of the contract to a newOwner.
* @param newOwner The address to transfer ownership to.
*/
function transferOwnership(address newOwner) public onlyOwner {
require(newOwner != address(0));
OwnershipTransferred(owner, newOwner);
owner = newOwner;
}
}
// File: zeppelin-solidity/contracts/token/ERC20/ERC20Basic.sol
/**
* @title ERC20Basic
* @dev Simpler version of ERC20 interface
* @dev see https://github.com/ethereum/EIPs/issues/179
*/
contract ERC20Basic {
function totalSupply() public view returns (uint256);
function balanceOf(address who) public view returns (uint256);
function transfer(address to, uint256 value) public returns (bool);
event Transfer(address indexed from, address indexed to, uint256 value);
}
// File: zeppelin-solidity/contracts/token/ERC20/ERC20.sol
/**
* @title ERC20 interface
* @dev see https://github.com/ethereum/EIPs/issues/20
*/
contract ERC20 is ERC20Basic {
function allowance(address owner, address spender) public view returns (uint256);
function transferFrom(address from, address to, uint256 value) public returns (bool);
function approve(address spender, uint256 value) public returns (bool);
event Approval(address indexed owner, address indexed spender, uint256 value);
}
// File: zeppelin-solidity/contracts/token/ERC20/SafeERC20.sol
/**
* @title SafeERC20
* @dev Wrappers around ERC20 operations that throw on failure.
* To use this library you can add a `using SafeERC20 for ERC20;` statement to your contract,
* which allows you to call the safe operations as `token.safeTransfer(...)`, etc.
*/
library SafeERC20 {
function safeTransfer(ERC20Basic token, address to, uint256 value) internal {
assert(token.transfer(to, value));
}
function safeTransferFrom(ERC20 token, address from, address to, uint256 value) internal {
assert(token.transferFrom(from, to, value));
}
function safeApprove(ERC20 token, address spender, uint256 value) internal {
assert(token.approve(spender, value));
}
}
// File: zeppelin-solidity/contracts/token/ERC20/TokenVesting.sol
/**
* @title TokenVesting
* @dev A token holder contract that can release its token balance gradually like a
* typical vesting scheme, with a cliff and vesting period. Optionally revocable by the
* owner.
*/
contract TokenVesting is Ownable {
using SafeMath for uint256;
using SafeERC20 for ERC20Basic;
event Released(uint256 amount);
event Revoked();
// beneficiary of tokens after they are released
address public beneficiary;
uint256 public cliff;
uint256 public start;
uint256 public duration;
bool revocable;
mapping (address => uint256) public released;
mapping (address => bool) public revoked;
/**
* @dev Creates a vesting contract that vests its balance of any ERC20 token to the
* _beneficiary, gradually in a linear fashion until _start + _duration. By then all
* of the balance will have vested.
* @param _beneficiary address of the beneficiary to whom vested tokens are transferred
* @param _cliff duration in seconds of the cliff in which tokens will begin to vest
* @param _duration duration in seconds of the period in which the tokens will vest
* @param _revocable whether the vesting is revocable or not
*/
function TokenVesting(address _beneficiary, uint256 _start, uint256 _cliff, uint256 _duration, bool _revocable) public {
require(_beneficiary != address(0));
require(_cliff <= _duration);
beneficiary = _beneficiary;
revocable = _revocable;
duration = _duration;
cliff = _start.add(_cliff);
start = _start;
}
/**
* @notice Transfers vested tokens to beneficiary.
* @param token ERC20 token which is being vested
*/
function release(ERC20Basic token) public {
uint256 unreleased = releasableAmount(token);
require(unreleased > 0);
released[token] = released[token].add(unreleased);
token.safeTransfer(beneficiary, unreleased);
Released(unreleased);
}
/**
* @notice Allows the owner to revoke the vesting. Tokens already vested
* remain in the contract, the rest are returned to the owner.
* @param token ERC20 token which is being vested
*/
function revoke(ERC20Basic token) public onlyOwner {
require(revocable);
require(!revoked[token]);
uint256 balance = token.balanceOf(this);
uint256 unreleased = releasableAmount(token);
uint256 refund = balance.sub(unreleased);
revoked[token] = true;
token.safeTransfer(owner, refund);
Revoked();
}
/**
* @dev Calculates the amount that has already vested but hasn't been released yet.
* @param token ERC20 token which is being vested
*/
function releasableAmount(ERC20Basic token) public view returns (uint256) {
return vestedAmount(token).sub(released[token]);
}
/**
* @dev Calculates the amount that has already vested.
* @param token ERC20 token which is being vested
*/
function vestedAmount(ERC20Basic token) public view returns (uint256) {
uint256 currentBalance = token.balanceOf(this);
uint256 totalBalance = currentBalance.add(released[token]);
if (now < cliff) {
return 0;
} else if (now >= start.add(duration) || revoked[token]) {
return totalBalance;
} else {
return totalBalance.mul(now.sub(start)).div(duration);
}
}
}
// File: contracts/LiteXTokenVesting.sol
/**
* token will released by divider like this:
*
* if divider is one month, _cliff is zero, _duration is one year, total vesting token is 12000
* Jan 30th will not release any token
* Jan 31st will release 1000
* Feb 1 will not release any token
* Feb 28th will release 1000
* ………………
* ………………
* Dec 31st will release 1000
*/
contract LiteXTokenVesting is TokenVesting {
uint256 public divider;
function LiteXTokenVesting(address _beneficiary, uint256 _start, uint256 _cliff, uint256 _duration, uint256 _divider, bool _revocable) TokenVesting(_beneficiary, _start, _cliff, _duration, _revocable) public {
require(_beneficiary != address(0));
require(_cliff <= _duration);
require(_divider <= duration);
divider = _divider;
}
/**
* @dev Calculates the amount that has already vested.
* @param token ERC20 token which is being vested
*/
function vestedAmount(ERC20Basic token) public view returns (uint256) {
uint256 currentBalance = token.balanceOf(this);
uint256 totalBalance = currentBalance.add(released[token]);
if (now < cliff) {
return 0;
}
if (now >= start.add(duration) || revoked[token]) {
return totalBalance;
}
return totalBalance.mul(now.sub(start).div(divider).mul(divider)).div(duration).div(10**18).mul(10**18);
}
}Contract Security Audit
- No Contract Security Audit Submitted- Submit Audit Here
Contract ABI
API[{"constant":true,"inputs":[],"name":"duration","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"cliff","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"token","type":"address"}],"name":"releasableAmount","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"token","type":"address"}],"name":"release","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"divider","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"token","type":"address"}],"name":"vestedAmount","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"beneficiary","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"token","type":"address"}],"name":"revoke","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"owner","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"","type":"address"}],"name":"released","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"start","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[{"name":"","type":"address"}],"name":"revoked","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"inputs":[{"name":"_beneficiary","type":"address"},{"name":"_start","type":"uint256"},{"name":"_cliff","type":"uint256"},{"name":"_duration","type":"uint256"},{"name":"_divider","type":"uint256"},{"name":"_revocable","type":"bool"}],"payable":false,"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":false,"name":"amount","type":"uint256"}],"name":"Released","type":"event"},{"anonymous":false,"inputs":[],"name":"Revoked","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"previousOwner","type":"address"},{"indexed":true,"name":"newOwner","type":"address"}],"name":"OwnershipTransferred","type":"event"}]Contract Creation Code
6060604052341561000f57600080fd5b60405160c08061093f83398101604052808051919060200180519190602001805191906020018051919060200180519190602001805160008054600160a060020a03191633600160a060020a039081169190911790915590925087915086908690869085908516151561008157600080fd5b8183111561008e57600080fd5b60018054600160a060020a031916600160a060020a0387161790556005805460ff191682151517905560048290556100d3848464010000000061011c81026106f11704565b60025550505060035550600160a060020a03861615156100f257600080fd5b828411156100ff57600080fd5b60045482111561010e57600080fd5b506008555061013292505050565b60008282018381101561012b57fe5b9392505050565b6107fe806101416000396000f3006060604052600436106100ab5763ffffffff60e060020a6000350416630fb5a6b481146100b057806313d033c0146100d55780631726cbc8146100e85780631916558714610107578063378efa3714610128578063384711cc1461013b57806338af3eed1461015a57806374a8f103146101895780638da5cb5b146101a85780639852595c146101bb578063be9a6555146101da578063f2fde38b146101ed578063fa01dc061461020c575b600080fd5b34156100bb57600080fd5b6100c361023f565b60405190815260200160405180910390f35b34156100e057600080fd5b6100c3610245565b34156100f357600080fd5b6100c3600160a060020a036004351661024b565b341561011257600080fd5b610126600160a060020a0360043516610283565b005b341561013357600080fd5b6100c361032f565b341561014657600080fd5b6100c3600160a060020a0360043516610335565b341561016557600080fd5b61016d6104a6565b604051600160a060020a03909116815260200160405180910390f35b341561019457600080fd5b610126600160a060020a03600435166104b5565b34156101b357600080fd5b61016d610608565b34156101c657600080fd5b6100c3600160a060020a0360043516610617565b34156101e557600080fd5b6100c3610629565b34156101f857600080fd5b610126600160a060020a036004351661062f565b341561021757600080fd5b61022b600160a060020a03600435166106ca565b604051901515815260200160405180910390f35b60045481565b60025481565b600160a060020a03811660009081526006602052604081205461027d9061027184610335565b9063ffffffff6106df16565b92915050565b600061028e8261024b565b90506000811161029d57600080fd5b600160a060020a0382166000908152600660205260409020546102c6908263ffffffff6106f116565b600160a060020a038084166000818152600660205260409020929092556001546102f89291168363ffffffff61070b16565b7ffb81f9b30d73d830c3544b34d827c08142579ee75710b490bab0b3995468c5658160405190815260200160405180910390a15050565b60085481565b600080600083600160a060020a03166370a082313060006040516020015260405160e060020a63ffffffff8416028152600160a060020a039091166004820152602401602060405180830381600087803b151561039157600080fd5b6102c65a03f115156103a257600080fd5b5050506040518051600160a060020a0386166000908152600660205260409020549093506103d89150839063ffffffff6106f116565b90506002544210156103ed576000925061049f565b6004546003546104029163ffffffff6106f116565b421015806104285750600160a060020a03841660009081526007602052604090205460ff165b156104355780925061049f565b61049c670de0b6b3a7640000610483670de0b6b3a764000061047760045461047761048f600854610483600854610477600354426106df90919063ffffffff16565b9063ffffffff61079016565b9063ffffffff6107a716565b889063ffffffff6107a716565b92505b5050919050565b600154600160a060020a031681565b600080548190819033600160a060020a039081169116146104d557600080fd5b60055460ff1615156104e657600080fd5b600160a060020a03841660009081526007602052604090205460ff161561050c57600080fd5b83600160a060020a03166370a082313060006040516020015260405160e060020a63ffffffff8416028152600160a060020a039091166004820152602401602060405180830381600087803b151561056357600080fd5b6102c65a03f1151561057457600080fd5b5050506040518051905092506105898461024b565b915061059b838363ffffffff6106df16565b600160a060020a038086166000818152600760205260408120805460ff19166001179055549293506105d6929091168363ffffffff61070b16565b7f44825a4b2df8acb19ce4e1afba9aa850c8b65cdb7942e2078f27d0b0960efee660405160405180910390a150505050565b600054600160a060020a031681565b60066020526000908152604090205481565b60035481565b60005433600160a060020a0390811691161461064a57600080fd5b600160a060020a038116151561065f57600080fd5b600054600160a060020a0380831691167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a36000805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a0392909216919091179055565b60076020526000908152604090205460ff1681565b6000828211156106eb57fe5b50900390565b60008282018381101561070057fe5b8091505b5092915050565b82600160a060020a031663a9059cbb838360006040516020015260405160e060020a63ffffffff8516028152600160a060020a0390921660048301526024820152604401602060405180830381600087803b151561076857600080fd5b6102c65a03f1151561077957600080fd5b50505060405180519050151561078b57fe5b505050565b600080828481151561079e57fe5b04949350505050565b6000808315156107ba5760009150610704565b508282028284828115156107ca57fe5b041461070057fe00a165627a7a723058204f8d96a96ab19ed92ad7ee764bc4f5deb28aa4059a5569d3ac89a6922b1b6fdb0029000000000000000000000000f6677b7782ceefed28b3055eeca535f06e0a8c4a000000000000000000000000000000000000000000000000000000005ac95b80000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000009e3400000000000000000000000000000000000000000000000000000000000034bc000000000000000000000000000000000000000000000000000000000000000001
Deployed Bytecode
0x6060604052600436106100ab5763ffffffff60e060020a6000350416630fb5a6b481146100b057806313d033c0146100d55780631726cbc8146100e85780631916558714610107578063378efa3714610128578063384711cc1461013b57806338af3eed1461015a57806374a8f103146101895780638da5cb5b146101a85780639852595c146101bb578063be9a6555146101da578063f2fde38b146101ed578063fa01dc061461020c575b600080fd5b34156100bb57600080fd5b6100c361023f565b60405190815260200160405180910390f35b34156100e057600080fd5b6100c3610245565b34156100f357600080fd5b6100c3600160a060020a036004351661024b565b341561011257600080fd5b610126600160a060020a0360043516610283565b005b341561013357600080fd5b6100c361032f565b341561014657600080fd5b6100c3600160a060020a0360043516610335565b341561016557600080fd5b61016d6104a6565b604051600160a060020a03909116815260200160405180910390f35b341561019457600080fd5b610126600160a060020a03600435166104b5565b34156101b357600080fd5b61016d610608565b34156101c657600080fd5b6100c3600160a060020a0360043516610617565b34156101e557600080fd5b6100c3610629565b34156101f857600080fd5b610126600160a060020a036004351661062f565b341561021757600080fd5b61022b600160a060020a03600435166106ca565b604051901515815260200160405180910390f35b60045481565b60025481565b600160a060020a03811660009081526006602052604081205461027d9061027184610335565b9063ffffffff6106df16565b92915050565b600061028e8261024b565b90506000811161029d57600080fd5b600160a060020a0382166000908152600660205260409020546102c6908263ffffffff6106f116565b600160a060020a038084166000818152600660205260409020929092556001546102f89291168363ffffffff61070b16565b7ffb81f9b30d73d830c3544b34d827c08142579ee75710b490bab0b3995468c5658160405190815260200160405180910390a15050565b60085481565b600080600083600160a060020a03166370a082313060006040516020015260405160e060020a63ffffffff8416028152600160a060020a039091166004820152602401602060405180830381600087803b151561039157600080fd5b6102c65a03f115156103a257600080fd5b5050506040518051600160a060020a0386166000908152600660205260409020549093506103d89150839063ffffffff6106f116565b90506002544210156103ed576000925061049f565b6004546003546104029163ffffffff6106f116565b421015806104285750600160a060020a03841660009081526007602052604090205460ff165b156104355780925061049f565b61049c670de0b6b3a7640000610483670de0b6b3a764000061047760045461047761048f600854610483600854610477600354426106df90919063ffffffff16565b9063ffffffff61079016565b9063ffffffff6107a716565b889063ffffffff6107a716565b92505b5050919050565b600154600160a060020a031681565b600080548190819033600160a060020a039081169116146104d557600080fd5b60055460ff1615156104e657600080fd5b600160a060020a03841660009081526007602052604090205460ff161561050c57600080fd5b83600160a060020a03166370a082313060006040516020015260405160e060020a63ffffffff8416028152600160a060020a039091166004820152602401602060405180830381600087803b151561056357600080fd5b6102c65a03f1151561057457600080fd5b5050506040518051905092506105898461024b565b915061059b838363ffffffff6106df16565b600160a060020a038086166000818152600760205260408120805460ff19166001179055549293506105d6929091168363ffffffff61070b16565b7f44825a4b2df8acb19ce4e1afba9aa850c8b65cdb7942e2078f27d0b0960efee660405160405180910390a150505050565b600054600160a060020a031681565b60066020526000908152604090205481565b60035481565b60005433600160a060020a0390811691161461064a57600080fd5b600160a060020a038116151561065f57600080fd5b600054600160a060020a0380831691167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a36000805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a0392909216919091179055565b60076020526000908152604090205460ff1681565b6000828211156106eb57fe5b50900390565b60008282018381101561070057fe5b8091505b5092915050565b82600160a060020a031663a9059cbb838360006040516020015260405160e060020a63ffffffff8516028152600160a060020a0390921660048301526024820152604401602060405180830381600087803b151561076857600080fd5b6102c65a03f1151561077957600080fd5b50505060405180519050151561078b57fe5b505050565b600080828481151561079e57fe5b04949350505050565b6000808315156107ba5760009150610704565b508282028284828115156107ca57fe5b041461070057fe00a165627a7a723058204f8d96a96ab19ed92ad7ee764bc4f5deb28aa4059a5569d3ac89a6922b1b6fdb0029
Constructor Arguments (ABI-Encoded and is the last bytes of the Contract Creation Code above)
000000000000000000000000f6677b7782ceefed28b3055eeca535f06e0a8c4a000000000000000000000000000000000000000000000000000000005ac95b80000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000009e3400000000000000000000000000000000000000000000000000000000000034bc000000000000000000000000000000000000000000000000000000000000000001
-----Decoded View---------------
Arg [0] : _beneficiary (address): 0xF6677b7782CeeFED28b3055EEcA535F06E0A8c4a
Arg [1] : _start (uint256): 1523145600
Arg [2] : _cliff (uint256): 0
Arg [3] : _duration (uint256): 10368000
Arg [4] : _divider (uint256): 3456000
Arg [5] : _revocable (bool): True
-----Encoded View---------------
6 Constructor Arguments found :
Arg [0] : 000000000000000000000000f6677b7782ceefed28b3055eeca535f06e0a8c4a
Arg [1] : 000000000000000000000000000000000000000000000000000000005ac95b80
Arg [2] : 0000000000000000000000000000000000000000000000000000000000000000
Arg [3] : 00000000000000000000000000000000000000000000000000000000009e3400
Arg [4] : 000000000000000000000000000000000000000000000000000000000034bc00
Arg [5] : 0000000000000000000000000000000000000000000000000000000000000001
Swarm Source
bzzr://4f8d96a96ab19ed92ad7ee764bc4f5deb28aa4059a5569d3ac89a6922b1b6fdb
Loading...
Loading
Loading...
Loading
Multichain Portfolio | 34 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.