Address Contract Partially Verified
Address
0x0e504D3E053885a82bD1CB5c29cBAae5B3673be4
Balance
0 ETH
Nonce
1
Code Size
3929 bytes
Creator
0x17Dbfa50...FdF7 at tx 0xf75d0e2d...b4ede0
Indexed Transactions
0
Contract Bytecode
3929 bytes
0x608060405234801561001057600080fd5b50600436106101365760003560e01c8063710475f6116100b8578063ca4305191161007c578063ca43051914610232578063cf0e80fe14610245578063d182849614610258578063e5612b3b1461026b578063ef90364214610273578063f2fde38b1461027b57610136565b8063710475f6146101dc5780637db41eae146101f15780638456db1514610204578063b6b55f251461020c578063c2ae16801461021f57610136565b80632a8b0480116100ff5780632a8b04801461019c5780632e1a7d4d146101a457806334520c47146101b95780634e71d92d146101cc5780634e71e0c8146101d457610136565b80621bf8f61461013b57806306def8021461016457806316048bc41461017757806324b327411461018c578063294dafc014610194575b600080fd5b61014e610149366004610bd8565b61028e565b60405161015b9190610f1a565b60405180910390f35b61014e610172366004610bd8565b610355565b61017f6103c3565b60405161015b9190610cd9565b61014e6103d2565b61014e6103d8565b61014e6103de565b6101b76101b2366004610c88565b6103e4565b005b61017f6101c7366004610bd8565b610446565b6101b7610464565b6101b76104ae565b6101e461053c565b60405161015b9190610d2a565b6101b76101ff366004610bd8565b610545565b61017f6105e9565b6101b761021a366004610c88565b6105f8565b6101b761022d366004610bff565b610651565b6101b7610240366004610bd8565b610793565b61014e610253366004610bd8565b610817565b61014e610266366004610bd8565b610832565b6101b761084d565b61014e610886565b6101b7610289366004610bd8565b61088c565b600754600090819081906102a990429063ffffffff61093716565b905060085481101561034c576008546000906102cb908363ffffffff61093716565b905061034860085461033c8361033061030b600360008c6001600160a01b03166001600160a01b0316815260200190815260200160002054600954610964565b6001600160a01b038b166000908152600360205260409020549063ffffffff61093716565b9063ffffffff61098e16565b9063ffffffff6109c816565b9250505b5090505b919050565b600060075442101561036957506000610350565b60006103748361028e565b6001600160a01b0384166000908152600460209081526040808320546003909252909120549192506103bc916103b0908463ffffffff61093716565b9063ffffffff61093716565b9392505050565b6000546001600160a01b031681565b60065481565b60095481565b60075481565b6000546001600160a01b031633146104175760405162461bcd60e51b815260040161040e90610e30565b60405180910390fd5b60065461042a908263ffffffff61093716565b600655600054610443906001600160a01b0316826109f2565b50565b6001600160a01b039081166000908152600560205260409020541690565b600061046f33610355565b905061047b33826109f2565b3360009081526004602052604090205461049b908263ffffffff610a1316565b3360009081526004602052604090205550565b6001546001600160a01b031633146104d85760405162461bcd60e51b815260040161040e90610d35565b600154600080546040516001600160a01b0393841693909116917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e091a360018054600080546001600160a01b03199081166001600160a01b03841617909155169055565b600a5460ff1681565b33600090815260036020526040808220546001600160a01b03841683529120546105749163ffffffff610a1316565b6001600160a01b038216600081815260036020908152604080832094909455338252600490528281205491815291909120546105b59163ffffffff610a1316565b6001600160a01b03909116600090815260046020818152604080842094909455338352600381528383208390555290812055565b6001546001600160a01b031681565b6000546001600160a01b031633146106225760405162461bcd60e51b815260040161040e90610e30565b600054610638906001600160a01b031682610a38565b60065461064b908263ffffffff610a1316565b60065550565b6000546001600160a01b0316331461067b5760405162461bcd60e51b815260040161040e90610e30565b82811461069a5760405162461bcd60e51b815260040161040e90610ee3565b6000805b84811015610775576107078484838181106106b557fe5b90506020020135600360008989868181106106cc57fe5b90506020020160208101906106e19190610bd8565b6001600160a01b031681526020810191909152604001600020549063ffffffff610a1316565b6003600088888581811061071757fe5b905060200201602081019061072c9190610bd8565b6001600160a01b0316815260208101919091526040016000205561076b84848381811061075557fe5b9050602002013583610a1390919063ffffffff16565b915060010161069e565b50600654610789908263ffffffff61093716565b6006555050505050565b6000546001600160a01b031633146107bd5760405162461bcd60e51b815260040161040e90610e30565b600a5460ff16156107e05760405162461bcd60e51b815260040161040e90610d5c565b6001600160a01b03811660009081526003602052604081208054919055600654610810908263ffffffff610a1316565b6006555050565b6001600160a01b031660009081526004602052604090205490565b6001600160a01b031660009081526003602052604090205490565b6000546001600160a01b031633146108775760405162461bcd60e51b815260040161040e90610e30565b600a805460ff19166001179055565b60085481565b6000546001600160a01b031633146108b65760405162461bcd60e51b815260040161040e90610e30565b6001600160a01b0381166108dc5760405162461bcd60e51b815260040161040e90610e09565b600080546040516001600160a01b03808516939216917fdcf55418cee3220104fef63f979ff3c4097ad240c0c43dcb33ce837748983e6291a3600180546001600160a01b0319166001600160a01b0392909216919091179055565b6000828211156109595760405162461bcd60e51b815260040161040e90610de6565b508082035b92915050565b6000670de0b6b3a764000061097f848463ffffffff61098e16565b8161098657fe5b049392505050565b60008261099d5750600061095e565b828202828482816109aa57fe5b04146103bc5760405162461bcd60e51b815260040161040e90610ec0565b60008082116109e95760405162461bcd60e51b815260040161040e90610dbe565b81838161098657fe5b600254610a0f906001600160a01b0316838363ffffffff610a5616565b5050565b6000828201838110156103bc5760405162461bcd60e51b815260040161040e90610e53565b600254610a0f906001600160a01b031683308463ffffffff610ab116565b610aac8363a9059cbb60e01b8484604051602401610a75929190610d11565b60408051601f198184030181529190526020810180516001600160e01b03166001600160e01b031990931692909217909152610ad8565b505050565b610ad2846323b872dd60e01b858585604051602401610a7593929190610ced565b50505050565b60006060836001600160a01b031683604051610af49190610ca0565b6000604051808303816000865af19150503d8060008114610b31576040519150601f19603f3d011682016040523d82523d6000602084013e610b36565b606091505b509150915081610b585760405162461bcd60e51b815260040161040e90610d89565b805115610ad25780806020019051810190610b739190610c68565b610ad25760405162461bcd60e51b815260040161040e90610e76565b60008083601f840112610ba0578182fd5b50813567ffffffffffffffff811115610bb7578182fd5b6020830191508360208083028501011115610bd157600080fd5b9250929050565b600060208284031215610be9578081fd5b81356001600160a01b03811681146103bc578182fd5b60008060008060408587031215610c14578283fd5b843567ffffffffffffffff80821115610c2b578485fd5b610c3788838901610b8f565b90965094506020870135915080821115610c4f578384fd5b50610c5c87828801610b8f565b95989497509550505050565b600060208284031215610c79578081fd5b815180151581146103bc578182fd5b600060208284031215610c99578081fd5b5035919050565b60008251815b81811015610cc05760208186018101518583015201610ca6565b81811115610cce5782828501525b509190910192915050565b6001600160a01b0391909116815260200190565b6001600160a01b039384168152919092166020820152604081019190915260600190565b6001600160a01b03929092168252602082015260400190565b901515815260200190565b6020808252600d908201526c494e56414c49445f434c41494d60981b604082015260600190565b602080825260139082015272111254d5149250955511481192539254d21151606a1b604082015260600190565b6020808252818101527f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564604082015260600190565b6020808252600e908201526d2224ab24a224a723afa2a92927a960911b604082015260600190565b60208082526009908201526829aaa12fa2a92927a960b91b604082015260600190565b6020808252600d908201526c24a72b20a624a22fa7aba722a960991b604082015260600190565b6020808252600990820152682727aa2fa7aba722a960b91b604082015260600190565b60208082526009908201526820a2222fa2a92927a960b91b604082015260600190565b6020808252602a908201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6040820152691bdd081cdd58d8d9595960b21b606082015260800190565b60208082526009908201526826aaa62fa2a92927a960b91b604082015260600190565b6020808252601c908201527f6261746368206772616e74206c656e677468206e6f74206d6174636800000000604082015260600190565b9081526020019056fea2646970667358221220f5aa5ef46b7627b0a1007d3878c3c551a5c40d6441b2f9c4fb03c850b2211d2a64736f6c63430006090033
Verified Source Code Partial Match
Compiler: v0.6.9+commit.3e3065ac
EVM: istanbul
Optimization: Yes (200 runs)
LockedTokenVault.sol 473 lines
// File: contracts/lib/SafeMath.sol
/*
Copyright 2020 DODO ZOO.
SPDX-License-Identifier: Apache-2.0
*/
pragma solidity 0.6.9;
pragma experimental ABIEncoderV2;
/**
* @title SafeMath
* @author DODO Breeder
*
* @notice Math operations with safety checks that revert on error
*/
library SafeMath {
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
uint256 c = a * b;
require(c / a == b, "MUL_ERROR");
return c;
}
function div(uint256 a, uint256 b) internal pure returns (uint256) {
require(b > 0, "DIVIDING_ERROR");
return a / b;
}
function divCeil(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 quotient = div(a, b);
uint256 remainder = a - quotient * b;
if (remainder > 0) {
return quotient + 1;
} else {
return quotient;
}
}
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
require(b <= a, "SUB_ERROR");
return a - b;
}
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a, "ADD_ERROR");
return c;
}
function sqrt(uint256 x) internal pure returns (uint256 y) {
uint256 z = x / 2 + 1;
y = x;
while (z < y) {
y = z;
z = (x / z + z) / 2;
}
}
}
// File: contracts/lib/DecimalMath.sol
/*
Copyright 2020 DODO ZOO.
*/
/**
* @title DecimalMath
* @author DODO Breeder
*
* @notice Functions for fixed point number with 18 decimals
*/
library DecimalMath {
using SafeMath for uint256;
uint256 constant ONE = 10**18;
function mul(uint256 target, uint256 d) internal pure returns (uint256) {
return target.mul(d) / ONE;
}
function divFloor(uint256 target, uint256 d) internal pure returns (uint256) {
return target.mul(ONE).div(d);
}
function divCeil(uint256 target, uint256 d) internal pure returns (uint256) {
return target.mul(ONE).divCeil(d);
}
}
// File: contracts/lib/Ownable.sol
/*
Copyright 2020 DODO ZOO.
*/
/**
* @title Ownable
* @author DODO Breeder
*
* @notice Ownership related functions
*/
contract Ownable {
address public _OWNER_;
address public _NEW_OWNER_;
// ============ Events ============
event OwnershipTransferPrepared(address indexed previousOwner, address indexed newOwner);
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
// ============ Modifiers ============
modifier onlyOwner() {
require(msg.sender == _OWNER_, "NOT_OWNER");
_;
}
// ============ Functions ============
constructor() internal {
_OWNER_ = msg.sender;
emit OwnershipTransferred(address(0), _OWNER_);
}
function transferOwnership(address newOwner) external onlyOwner {
require(newOwner != address(0), "INVALID_OWNER");
emit OwnershipTransferPrepared(_OWNER_, newOwner);
_NEW_OWNER_ = newOwner;
}
function claimOwnership() external {
require(msg.sender == _NEW_OWNER_, "INVALID_CLAIM");
emit OwnershipTransferred(_OWNER_, _NEW_OWNER_);
_OWNER_ = _NEW_OWNER_;
_NEW_OWNER_ = address(0);
}
}
// File: contracts/intf/IERC20.sol
// This is a file copied from https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/token/ERC20/IERC20.sol
/**
* @dev Interface of the ERC20 standard as defined in the EIP.
*/
interface IERC20 {
/**
* @dev Returns the amount of tokens in existence.
*/
function totalSupply() external view returns (uint256);
function decimals() external view returns (uint8);
function name() external view returns (string memory);
/**
* @dev Returns the amount of tokens owned by `account`.
*/
function balanceOf(address account) external view returns (uint256);
/**
* @dev Moves `amount` tokens from the caller's account to `recipient`.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* Emits a {Transfer} event.
*/
function transfer(address recipient, uint256 amount) external returns (bool);
/**
* @dev Returns the remaining number of tokens that `spender` will be
* allowed to spend on behalf of `owner` through {transferFrom}. This is
* zero by default.
*
* This value changes when {approve} or {transferFrom} are called.
*/
function allowance(address owner, address spender) external view returns (uint256);
/**
* @dev Sets `amount` as the allowance of `spender` over the caller's tokens.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* IMPORTANT: Beware that changing an allowance with this method brings the risk
* that someone may use both the old and the new allowance by unfortunate
* transaction ordering. One possible solution to mitigate this race
* condition is to first reduce the spender's allowance to 0 and set the
* desired value afterwards:
* https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729
*
* Emits an {Approval} event.
*/
function approve(address spender, uint256 amount) external returns (bool);
/**
* @dev Moves `amount` tokens from `sender` to `recipient` using the
* allowance mechanism. `amount` is then deducted from the caller's
* allowance.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* Emits a {Transfer} event.
*/
function transferFrom(
address sender,
address recipient,
uint256 amount
) external returns (bool);
}
// File: contracts/lib/SafeERC20.sol
/*
Copyright 2020 DODO ZOO.
This is a simplified version of OpenZepplin's SafeERC20 library
*/
/**
* @title SafeERC20
* @dev Wrappers around ERC20 operations that throw on failure (when the token
* contract returns false). Tokens that return no value (and instead revert or
* throw on failure) are also supported, non-reverting calls are assumed to be
* successful.
* 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 {
using SafeMath for uint256;
function safeTransfer(
IERC20 token,
address to,
uint256 value
) internal {
_callOptionalReturn(token, abi.encodeWithSelector(token.transfer.selector, to, value));
}
function safeTransferFrom(
IERC20 token,
address from,
address to,
uint256 value
) internal {
_callOptionalReturn(
token,
abi.encodeWithSelector(token.transferFrom.selector, from, to, value)
);
}
function safeApprove(
IERC20 token,
address spender,
uint256 value
) internal {
// safeApprove should only be called when setting an initial allowance,
// or when resetting it to zero. To increase and decrease it, use
// 'safeIncreaseAllowance' and 'safeDecreaseAllowance'
// solhint-disable-next-line max-line-length
require(
(value == 0) || (token.allowance(address(this), spender) == 0),
"SafeERC20: approve from non-zero to non-zero allowance"
);
_callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, value));
}
/**
* @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement
* on the return value: the return value is optional (but if data is returned, it must not be false).
* @param token The token targeted by the call.
* @param data The call data (encoded using abi.encode or one of its variants).
*/
function _callOptionalReturn(IERC20 token, bytes memory data) private {
// We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since
// we're implementing it ourselves.
// A Solidity high level call has three parts:
// 1. The target address is checked to verify it contains contract code
// 2. The call itself is made, and success asserted
// 3. The return value is decoded, which in turn checks the size of the returned data.
// solhint-disable-next-line max-line-length
// solhint-disable-next-line avoid-low-level-calls
(bool success, bytes memory returndata) = address(token).call(data);
require(success, "SafeERC20: low-level call failed");
if (returndata.length > 0) {
// Return data is optional
// solhint-disable-next-line max-line-length
require(abi.decode(returndata, (bool)), "SafeERC20: ERC20 operation did not succeed");
}
}
}
// File: contracts/token/LockedTokenVault.sol
/*
Copyright 2020 DODO ZOO.
*/
/**
* @title LockedTokenVault
* @author DODO Breeder
*
* @notice Lock Token and release it linearly
*/
contract LockedTokenVault is Ownable {
using SafeMath for uint256;
using SafeERC20 for IERC20;
address _TOKEN_;
mapping(address => uint256) internal originBalances;
mapping(address => uint256) internal claimedBalances;
mapping(address => address) internal holderTransferRequest;
uint256 public _UNDISTRIBUTED_AMOUNT_;
uint256 public _START_RELEASE_TIME_;
uint256 public _RELEASE_DURATION_;
uint256 public _CLIFF_RATE_;
bool public _DISTRIBUTE_FINISHED_;
// ============ Modifiers ============
modifier beforeStartRelease() {
require(block.timestamp < _START_RELEASE_TIME_, "RELEASE START");
_;
}
modifier afterStartRelease() {
require(block.timestamp > _START_RELEASE_TIME_, "RELEASE NOT START");
_;
}
modifier distributeNotFinished() {
require(!_DISTRIBUTE_FINISHED_, "DISTRIBUTE FINISHED");
_;
}
// ============ Init Functions ============
constructor(
address _token,
uint256 _startReleaseTime,
uint256 _releaseDuration,
uint256 _cliffRate
) public {
_TOKEN_ = _token;
_START_RELEASE_TIME_ = _startReleaseTime;
_RELEASE_DURATION_ = _releaseDuration;
_CLIFF_RATE_ = _cliffRate;
}
function deposit(uint256 amount) external onlyOwner {
_tokenTransferIn(_OWNER_, amount);
_UNDISTRIBUTED_AMOUNT_ = _UNDISTRIBUTED_AMOUNT_.add(amount);
}
function withdraw(uint256 amount) external onlyOwner {
_UNDISTRIBUTED_AMOUNT_ = _UNDISTRIBUTED_AMOUNT_.sub(amount);
_tokenTransferOut(_OWNER_, amount);
}
function finishDistribute() external onlyOwner {
_DISTRIBUTE_FINISHED_ = true;
}
// ============ For Owner ============
function grant(address[] calldata holderList, uint256[] calldata amountList)
external
onlyOwner
{
require(holderList.length == amountList.length, "batch grant length not match");
uint256 amount = 0;
for (uint256 i = 0; i < holderList.length; ++i) {
originBalances[holderList[i]] = originBalances[holderList[i]].add(amountList[i]);
amount = amount.add(amountList[i]);
}
_UNDISTRIBUTED_AMOUNT_ = _UNDISTRIBUTED_AMOUNT_.sub(amount);
}
function recall(address holder) external onlyOwner distributeNotFinished {
uint256 amount = originBalances[holder];
originBalances[holder] = 0;
_UNDISTRIBUTED_AMOUNT_ = _UNDISTRIBUTED_AMOUNT_.add(amount);
}
// ============ For Holder ============
function transferLockedToken(address to) external {
originBalances[to] = originBalances[to].add(originBalances[msg.sender]);
claimedBalances[to] = claimedBalances[to].add(claimedBalances[msg.sender]);
originBalances[msg.sender] = 0;
claimedBalances[msg.sender] = 0;
}
function claim() external {
uint256 claimableToken = getClaimableBalance(msg.sender);
_tokenTransferOut(msg.sender, claimableToken);
claimedBalances[msg.sender] = claimedBalances[msg.sender].add(claimableToken);
}
// ============ View ============
function getOriginBalance(address holder) external view returns (uint256) {
return originBalances[holder];
}
function getClaimedBalance(address holder) external view returns (uint256) {
return claimedBalances[holder];
}
function getHolderTransferRequest(address holder) external view returns (address) {
return holderTransferRequest[holder];
}
function getClaimableBalance(address holder) public view returns (uint256) {
if (block.timestamp < _START_RELEASE_TIME_) {
return 0;
}
uint256 remainingToken = getRemainingBalance(holder);
return originBalances[holder].sub(remainingToken).sub(claimedBalances[holder]);
}
function getRemainingBalance(address holder) public view returns (uint256) {
uint256 remainingToken = 0;
uint256 timePast = block.timestamp.sub(_START_RELEASE_TIME_);
if (timePast < _RELEASE_DURATION_) {
uint256 remainingTime = _RELEASE_DURATION_.sub(timePast);
remainingToken = originBalances[holder]
.sub(DecimalMath.mul(originBalances[holder], _CLIFF_RATE_))
.mul(remainingTime)
.div(_RELEASE_DURATION_);
}
return remainingToken;
}
// ============ Internal Helper ============
function _tokenTransferIn(address from, uint256 amount) internal {
IERC20(_TOKEN_).safeTransferFrom(from, address(this), amount);
}
function _tokenTransferOut(address to, uint256 amount) internal {
IERC20(_TOKEN_).safeTransfer(to, amount);
}
}
Read Contract
_CLIFF_RATE_ 0x294dafc0 → uint256
_DISTRIBUTE_FINISHED_ 0x710475f6 → bool
_NEW_OWNER_ 0x8456db15 → address
_OWNER_ 0x16048bc4 → address
_RELEASE_DURATION_ 0xef903642 → uint256
_START_RELEASE_TIME_ 0x2a8b0480 → uint256
_UNDISTRIBUTED_AMOUNT_ 0x24b32741 → uint256
getClaimableBalance 0x06def802 → uint256
getClaimedBalance 0xcf0e80fe → uint256
getHolderTransferRequest 0x34520c47 → address
getOriginBalance 0xd1828496 → uint256
getRemainingBalance 0x001bf8f6 → uint256
Write Contract 9 functions
These functions modify contract state and require a wallet transaction to execute.
claim 0x4e71d92d
No parameters
claimOwnership 0x4e71e0c8
No parameters
deposit 0xb6b55f25
uint256 amount
finishDistribute 0xe5612b3b
No parameters
grant 0xc2ae1680
address[] holderList
uint256[] amountList
recall 0xca430519
address holder
transferLockedToken 0x7db41eae
address to
transferOwnership 0xf2fde38b
address newOwner
withdraw 0x2e1a7d4d
uint256 amount
Recent Transactions
No transactions found for this address