Address Contract Partially Verified
Address
0xC8Fcc48D1454a83589169294470549A2e1713DeC
Balance
0 ETH
Nonce
1
Code Size
4740 bytes
Creator
0x5593b2B8...E391 at tx 0xcac51c4e...3bf19b
Indexed Transactions
0
Contract Bytecode
4740 bytes
0x60806040526004361061012a5760003560e01c806373c4942a116100ab578063ab4b4def1161006f578063ab4b4def1461042c578063c99f335714610441578063d678ba4814610456578063e30c39781461045e578063f2fde38b14610473578063fd090e47146104a65761012a565b806373c4942a146103c35780638da5cb5b146103d85780639852099c146103ed5780639890220b14610402578063a8c499a0146104175761012a565b80634aa66b28116100f25780634aa66b28146103365780634c0a6532146103605780634e71e0c814610391578063587419d5146103a65780636c825035146103bb5761012a565b80630ebb172a146101785780630fc33bb71461019f5780631a6a0999146101b457806336d43c24146102d5578063469e9067146102ea575b60006004541161013957600080fd5b600454421015801561014d57506005544211155b1561015f5761015a6104bb565b610176565b6005544211156101715761015a6108a1565b600080fd5b005b34801561018457600080fd5b5061018d610aca565b60408051918252519081900360200190f35b3480156101ab57600080fd5b5061018d610ad2565b3480156101c057600080fd5b50610176600480360360608110156101d757600080fd5b8101906020810181356401000000008111156101f257600080fd5b82018360208201111561020457600080fd5b8035906020019184602083028401116401000000008311171561022657600080fd5b91939092909160208101903564010000000081111561024457600080fd5b82018360208201111561025657600080fd5b8035906020019184602083028401116401000000008311171561027857600080fd5b91939092909160208101903564010000000081111561029657600080fd5b8201836020820111156102a857600080fd5b803590602001918460208302840111640100000000831117156102ca57600080fd5b509092509050610b51565b3480156102e157600080fd5b5061018d610d66565b3480156102f657600080fd5b5061031d6004803603602081101561030d57600080fd5b50356001600160a01b0316610d6c565b6040805192835260208301919091528051918290030190f35b34801561034257600080fd5b5061018d6004803603602081101561035957600080fd5b5035610d85565b34801561036c57600080fd5b50610375610da7565b604080516001600160a01b039092168252519081900360200190f35b34801561039d57600080fd5b50610176610db6565b3480156103b257600080fd5b5061018d610e7c565b6101766108a1565b3480156103cf57600080fd5b5061018d610e82565b3480156103e457600080fd5b50610375610e88565b3480156103f957600080fd5b5061018d610e97565b34801561040e57600080fd5b50610176610e9d565b34801561042357600080fd5b5061018d610ff5565b34801561043857600080fd5b5061018d610ffb565b34801561044d57600080fd5b5061018d611002565b6101766104bb565b34801561046a57600080fd5b5061037561100a565b34801561047f57600080fd5b506101766004803603602081101561049657600080fd5b50356001600160a01b0316611019565b3480156104b257600080fd5b5061018d611106565b6000600454116105155760408051600160e51b62461bcd02815260206004820152601360248201527f70726f6772616d206e6f74207374617274656400000000000000000000000000604482015290519081900360640190fd5b341561056b5760408051600160e51b62461bcd02815260206004820152601760248201527f6e6f2065746865722073686f756c642062652073656e74000000000000000000604482015290519081900360640190fd5b600454421015801561057f57506005544211155b6105d35760408051600160e51b62461bcd02815260206004820152601a60248201527f6265796f6e64206465706f7369742074696d6520706572696f64000000000000604482015290519081900360640190fd5b60025460408051600160e11b636eb1769f02815233600482015230602482015290516001600160a01b03909216916000916106dc91849163dd62ed3e916044808301926020929190829003018186803b15801561062f57600080fd5b505afa158015610643573d6000803e3d6000fd5b505050506040513d602081101561065957600080fd5b505160408051600160e01b6370a0823102815233600482015290516001600160a01b038616916370a08231916024808301926020929190829003018186803b1580156106a457600080fd5b505afa1580156106b8573d6000803e3d6000fd5b505050506040513d60208110156106ce57600080fd5b50519063ffffffff61110d16565b9050600081116107365760408051600160e51b62461bcd02815260206004820152601560248201527f6c726320616c6c6f77616e6365206973207a65726f0000000000000000000000604482015290519081900360640190fd5b61073e61123e565b503360008181526006602081815260408084208151808301835281548801815242818501908152958790529383528351815593516001948501556003805487019055600780549485019055805193845290830185905280519193927feaa18152488ce5959073c9c79c88ca90b3d96c00de1f118cfaad664c3dab06b9929081900390910190a260408051600160e01b6323b872dd0281523360048201523060248201526044810184905290516001600160a01b038516916323b872dd9160648083019260209291908290030181600087803b15801561081c57600080fd5b505af1158015610830573d6000803e3d6000fd5b505050506040513d602081101561084657600080fd5b505161089c5760408051600160e51b62461bcd02815260206004820152601360248201527f6c7263207472616e73666572206661696c656400000000000000000000000000604482015290519081900360640190fd5b505050565b6000600454116108b057600080fd5b6000600354116108bf57600080fd5b6108c761123e565b5033600090815260066020908152604091829020825180840190935280548352600101549082018190526302c7ea000142101561090357600080fd5b805161090e57600080fd5b8051341561093c5761093961092c346298968063ffffffff61112516565b829063ffffffff61110d16565b90505b600061094782610d85565b90506000610953610ad2565b905060006109698285850163ffffffff61110d16565b600380548690039055855185900380875290915061099c57336000908152600660205260408120818155600101556109bd565b33600090815260066020908152604090912086518155908601516001909101555b60088054600181019091556040805191825260208201839052805133927f37e8063b72a944a76de602f32b82fd8c2a1c6f99564c727ffaf913c7762cd42092908290030190a260025460408051600160e01b63a9059cbb0281523360048201526024810184905290516001600160a01b039092169163a9059cbb916044808201926020929091908290030181600087803b158015610a5a57600080fd5b505af1158015610a6e573d6000803e3d6000fd5b505050506040513d6020811015610a8457600080fd5b5051610a8f57600080fd5b3415610ac35760405133903480156108fc02916000818181858888f19350505050158015610ac1573d6000803e3d6000fd5b505b5050505050565b6302c7ea0081565b60025460408051600160e01b6370a0823102815230600482015290516000926001600160a01b0316916370a08231916024808301926020929190829003018186803b158015610b2057600080fd5b505afa158015610b34573d6000803e3d6000fd5b505050506040513d6020811015610b4a57600080fd5b5051905090565b6000546001600160a01b03163314610ba25760408051600160e51b62461bcd0281526020600482015260096024820152600160b91b682727aa2fa7aba722a902604482015290519081900360640190fd5b848314610bae57600080fd5b848114610bba57600080fd5b60005b85811015610d5d576000878783818110610bd357fe5b905060200201356001600160a01b03166001600160a01b03161415610bf757600080fd5b600454838383818110610c0657fe5b9050602002013510158015610c2f5750600554838383818110610c2557fe5b9050602002013511155b610c3857600080fd5b610c4061123e565b6040518060400160405280878785818110610c5757fe5b905060200201358152602001858585818110610c6f57fe5b90506020020135815250905080600660008a8a86818110610c8c57fe5b602090810292909201356001600160a01b03168352508181019290925260400160002082518155910151600190910155858583818110610cc857fe5b60038054602090920293909301350190915550878783818110610ce757fe5b60078054600181019091556001600160a01b036020909202939093013516917feaa18152488ce5959073c9c79c88ca90b3d96c00de1f118cfaad664c3dab06b99150888886818110610d3557fe5b604080519485526020918202939093013590840152508051918290030190a250600101610bbd565b50505050505050565b60085481565b6006602052600090815260409020805460019091015482565b6000610d9f600354610d95610ad2565b0360035484611145565b90505b919050565b6002546001600160a01b031681565b6001546001600160a01b03163314610e185760408051600160e51b62461bcd02815260206004820152600c60248201527f554e415554484f52495a45440000000000000000000000000000000000000000604482015290519081900360640190fd5b600154600080546040516001600160a01b0393841693909116917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e091a360018054600080546001600160a01b03199081166001600160a01b03841617909155169055565b60045481565b60055481565b6000546001600160a01b031681565b60075481565b6000546001600160a01b03163314610eee5760408051600160e51b62461bcd0281526020600482015260096024820152600160b91b682727aa2fa7aba722a902604482015290519081900360640190fd5b6000600454118015610f08575063058fd400600454014210155b610f1157600080fd5b6000610f1b610ad2565b905060008111610f2a57600080fd5b6002546000805460408051600160e01b63a9059cbb0281526001600160a01b039283166004820152602481018690529051919093169263a9059cbb9260448083019360209390929083900390910190829087803b158015610f8a57600080fd5b505af1158015610f9e573d6000803e3d6000fd5b505050506040513d6020811015610fb457600080fd5b5051610fbf57600080fd5b6040805182815290517fdef931299fe61d176f949118058530c1f3f539dcb6950b4e372c9b835c33ca079181900360200190a150565b60035481565b6298968081565b63058fd40081565b6001546001600160a01b031681565b6000546001600160a01b0316331461106a5760408051600160e51b62461bcd0281526020600482015260096024820152600160b91b682727aa2fa7aba722a902604482015290519081900360640190fd5b6001600160a01b0381161580159061109057506000546001600160a01b03828116911614155b6110e45760408051600160e51b62461bcd02815260206004820152600f60248201527f494e56414c49445f414444524553530000000000000000000000000000000000604482015290519081900360640190fd5b600180546001600160a01b0319166001600160a01b0392909216919091179055565b624f1a0081565b600081831061111c578161111e565b825b9392505050565b600082820283158061113f57508284828161113c57fe5b04145b61111e57fe5b600080831161115357600080fd5b6111bb61117d61117061116b61116b61116b886111c3565b6111c3565b859063ffffffff61112516565b6111af6111a261119561116b61116b61116b896111c3565b869063ffffffff61112516565b879063ffffffff61112516565b9063ffffffff61122916565b949350505050565b6000815b600060028285816111d457fe5b048301816111de57fe5b049050600060028286816111ee57fe5b048301816111f857fe5b049050828114156112205782811015611215579250610da2915050565b829350505050610da2565b91506111c79050565b60008082848161123557fe5b04949350505050565b60405180604001604052806000815260200160008152509056fea165627a7a723058200481505fed913bdffcecca5add98a5d4b29b1f682be48a5333412c3de3637b620029
Verified Source Code Partial Match
Compiler: v0.5.7+commit.6da8b019
EVM: petersburg
Optimization: Yes (200 runs)
NewLRCLongTermHoldingContract.sol 402 lines
/*
Copyright 2017 Loopring Project Ltd (Loopring Foundation).
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
pragma solidity 0.5.7;
/**
* @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;
}
}
/**
* @title Math
* @dev Assorted math operations
*/
library Math {
function max64(uint64 a, uint64 b) internal pure returns (uint64) {
return a >= b ? a : b;
}
function min64(uint64 a, uint64 b) internal pure returns (uint64) {
return a < b ? a : b;
}
function max256(uint256 a, uint256 b) internal pure returns (uint256) {
return a >= b ? a : b;
}
function min256(uint256 a, uint256 b) internal pure returns (uint256) {
return a < b ? a : b;
}
}
// Abstract contract for the full ERC 20 Token standard
// https://github.com/ethereum/EIPs/issues/20
contract Token {
/* This is a slight change to the ERC20 base standard.
function totalSupply() constant returns (uint256 supply);
is replaced with:
uint256 public totalSupply;
This automatically creates a getter function for the totalSupply.
This is moved to the base contract since public getter functions are not
currently recognised as an implementation of the matching abstract
function by the compiler.
*/
/// total amount of tokens
uint256 public totalSupply;
/// @param _owner The address from which the balance will be retrieved
/// @return The balance
function balanceOf(address _owner) view public returns (uint256 balance);
/// @notice send `_value` token to `_to` from `msg.sender`
/// @param _to The address of the recipient
/// @param _value The amount of token to be transferred
/// @return Whether the transfer was successful or not
function transfer(address _to, uint256 _value) public returns (bool success);
/// @notice send `_value` token to `_to` from `_from` on the condition it is approved by `_from`
/// @param _from The address of the sender
/// @param _to The address of the recipient
/// @param _value The amount of token to be transferred
/// @return Whether the transfer was successful or not
function transferFrom(address _from, address _to, uint256 _value) public returns (bool success);
/// @notice `msg.sender` approves `_spender` to spend `_value` tokens
/// @param _spender The address of the account able to transfer the tokens
/// @param _value The amount of tokens to be approved for transfer
/// @return Whether the approval was successful or not
function approve(address _spender, uint256 _value) public returns (bool success);
/// @param _owner The address of the account owning tokens
/// @param _spender The address of the account able to transfer the tokens
/// @return Amount of remaining tokens allowed to spent
function allowance(address _owner, address _spender) view public returns (uint256 remaining);
event Transfer(address indexed _from, address indexed _to, uint256 _value);
event Approval(address indexed _owner, address indexed _spender, uint256 _value);
}
/// @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.
constructor()
public
{
owner = msg.sender;
}
/// @dev Throws if called by any account other than the owner.
modifier onlyOwner()
{
require(msg.sender == owner, "NOT_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(0x0), "ZERO_ADDRESS");
emit OwnershipTransferred(owner, newOwner);
owner = newOwner;
}
}
contract Claimable is Ownable {
address public pendingOwner;
/// @dev Modifier throws if called by any account other than the pendingOwner.
modifier onlyPendingOwner() {
require(msg.sender == pendingOwner, "UNAUTHORIZED");
_;
}
/// @dev Allows the current owner to set the pendingOwner address.
/// @param newOwner The address to transfer ownership to.
function transferOwnership(
address newOwner
)
public
onlyOwner
{
require(newOwner != address(0x0) && newOwner != owner, "INVALID_ADDRESS");
pendingOwner = newOwner;
}
/// @dev Allows the pendingOwner address to finalize the transfer.
function claimOwnership()
public
onlyPendingOwner
{
emit OwnershipTransferred(owner, pendingOwner);
owner = pendingOwner;
pendingOwner = address(0x0);
}
}
/// @title Long-Team Holding Incentive Program
/// @author Daniel Wang - <[email protected]>, Kongliang Zhong - <[email protected]>.
/// For more information, please visit https://loopring.org.
contract NewLRCLongTermHoldingContract is Claimable {
using SafeMath for uint;
using Math for uint;
// During the first 60 days of deployment, this contract opens for deposit of LRC.
uint public constant DEPOSIT_PERIOD = 60 days; // = 2 months
// 18 months after deposit, user can withdrawal all or part of his/her LRC with bonus.
// The bonus is this contract's initial LRC balance.
uint public constant WITHDRAWAL_DELAY = 540 days; // = 1 year and 6 months
// Send 0.001ETH per 10000 LRC partial withdrawal, or 0 for a once-for-all withdrawal.
// All ETH will be returned.
uint public constant WITHDRAWAL_SCALE = 1E7; // 1ETH for withdrawal of 10,000,000 LRC.
// Ower can drain all remaining LRC after 3 years.
uint public constant DRAIN_DELAY = 1080 days; // = 3 years.
address public lrcTokenAddress;
uint public lrcDeposited = 0;
uint public depositStartTime = 1504076273;
uint public depositStopTime = 1509260273;
struct Record {
uint lrcAmount;
uint timestamp;
}
mapping (address => Record) public records;
/*
* EVENTS
*/
/// Emitted when program starts.
event Started(uint _time);
/// Emitted when all LRC are drained.
event Drained(uint _lrcAmount);
/// Emitted for each sucuessful deposit.
uint public depositId = 0;
event Deposit(uint _depositId, address indexed _addr, uint _lrcAmount);
/// Emitted for each sucuessful deposit.
uint public withdrawId = 0;
event Withdrawal(uint _withdrawId, address indexed _addr, uint _lrcAmount);
/// @dev Initialize the contract
/// @param _lrcTokenAddress LRC ERC20 token address
constructor(address _lrcTokenAddress) public {
require(_lrcTokenAddress != address(0));
lrcTokenAddress = _lrcTokenAddress;
}
/*
* PUBLIC FUNCTIONS
*/
/* /// @dev start the program. */
/* function start() public onlyOwner { */
/* require(depositStartTime == 0); */
/* depositStartTime = now; */
/* depositStopTime = depositStartTime + DEPOSIT_PERIOD; */
/* Started(depositStartTime); */
/* } */
/// @dev drain LRC.
function drain() onlyOwner public {
require(depositStartTime > 0 && now >= depositStartTime + DRAIN_DELAY);
uint balance = lrcBalance();
require(balance > 0);
require(Token(lrcTokenAddress).transfer(owner, balance));
emit Drained(balance);
}
function () payable external {
require(depositStartTime > 0);
if (now >= depositStartTime && now <= depositStopTime) {
depositLRC();
} else if (now > depositStopTime){
withdrawLRC();
} else {
revert();
}
}
/// @return Current LRC balance.
function lrcBalance() public view returns (uint) {
return Token(lrcTokenAddress).balanceOf(address(this));
}
function batchAddDepositRecordsByOwner(address[] calldata users, uint[] calldata lrcAmounts, uint[] calldata timestamps) external onlyOwner {
require(users.length == lrcAmounts.length);
require(users.length == timestamps.length);
for (uint i = 0; i < users.length; i++) {
require(users[i] != address(0));
require(timestamps[i] >= depositStartTime && timestamps[i] <= depositStopTime);
Record memory record = Record(lrcAmounts[i], timestamps[i]);
records[users[i]] = record;
lrcDeposited += lrcAmounts[i];
emit Deposit(depositId++, users[i], lrcAmounts[i]);
}
}
/// @dev Deposit LRC.
function depositLRC() payable public {
require(depositStartTime > 0, "program not started");
require(msg.value == 0, "no ether should be sent");
require(now >= depositStartTime && now <= depositStopTime, "beyond deposit time period");
Token lrcToken = Token(lrcTokenAddress);
uint lrcAmount = lrcToken
.balanceOf(msg.sender)
.min256(lrcToken.allowance(msg.sender, address(this)));
require(lrcAmount > 0, "lrc allowance is zero");
Record memory record = records[msg.sender];
record.lrcAmount += lrcAmount;
record.timestamp = now;
records[msg.sender] = record;
lrcDeposited += lrcAmount;
emit Deposit(depositId++, msg.sender, lrcAmount);
require(lrcToken.transferFrom(msg.sender, address(this), lrcAmount), "lrc transfer failed");
}
/// @dev Withdrawal LRC.
function withdrawLRC() payable public {
require(depositStartTime > 0);
require(lrcDeposited > 0);
Record memory record = records[msg.sender];
require(now >= record.timestamp + WITHDRAWAL_DELAY);
require(record.lrcAmount > 0);
uint lrcWithdrawalBase = record.lrcAmount;
if (msg.value > 0) {
lrcWithdrawalBase = lrcWithdrawalBase
.min256(msg.value.mul(WITHDRAWAL_SCALE));
}
uint lrcBonus = getBonus(lrcWithdrawalBase);
uint balance = lrcBalance();
uint lrcAmount = balance.min256(lrcWithdrawalBase + lrcBonus);
lrcDeposited -= lrcWithdrawalBase;
record.lrcAmount -= lrcWithdrawalBase;
if (record.lrcAmount == 0) {
delete records[msg.sender];
} else {
records[msg.sender] = record;
}
emit Withdrawal(withdrawId++, msg.sender, lrcAmount);
require(Token(lrcTokenAddress).transfer(msg.sender, lrcAmount));
if (msg.value > 0) {
msg.sender.transfer(msg.value);
}
}
function getBonus(uint _lrcWithdrawalBase) view public returns (uint) {
return internalCalculateBonus(lrcBalance() - lrcDeposited,lrcDeposited, _lrcWithdrawalBase);
}
function internalCalculateBonus(uint _totalBonusRemaining, uint _lrcDeposited, uint _lrcWithdrawalBase) internal pure returns (uint) {
require(_lrcDeposited > 0);
require(_totalBonusRemaining >= 0);
// The bonus is non-linear function to incentivize later withdrawal.
// bonus = _totalBonusRemaining * power(_lrcWithdrawalBase/_lrcDeposited, 1.0625)
return _totalBonusRemaining
.mul(_lrcWithdrawalBase.mul(sqrt(sqrt(sqrt(sqrt(_lrcWithdrawalBase))))))
.div(_lrcDeposited.mul(sqrt(sqrt(sqrt(sqrt(_lrcDeposited))))));
}
function sqrt(uint x) internal pure returns (uint) {
uint y = x;
while (true) {
uint z = (y + (x / y)) / 2;
uint w = (z + (x / z)) / 2;
if (w == y) {
if (w < y) return w;
else return y;
}
y = w;
}
}
}
Read Contract
DEPOSIT_PERIOD 0xfd090e47 → uint256
DRAIN_DELAY 0xc99f3357 → uint256
WITHDRAWAL_DELAY 0x0ebb172a → uint256
WITHDRAWAL_SCALE 0xab4b4def → uint256
depositId 0x9852099c → uint256
depositStartTime 0x587419d5 → uint256
depositStopTime 0x73c4942a → uint256
getBonus 0x4aa66b28 → uint256
lrcBalance 0x0fc33bb7 → uint256
lrcDeposited 0xa8c499a0 → uint256
lrcTokenAddress 0x4c0a6532 → address
owner 0x8da5cb5b → address
pendingOwner 0xe30c3978 → address
records 0x469e9067 → uint256, uint256
withdrawId 0x36d43c24 → uint256
Write Contract 6 functions
These functions modify contract state and require a wallet transaction to execute.
batchAddDepositRecordsByOwner 0x1a6a0999
address[] users
uint256[] lrcAmounts
uint256[] timestamps
claimOwnership 0x4e71e0c8
No parameters
depositLRC 0xd678ba48
No parameters
drain 0x9890220b
No parameters
transferOwnership 0xf2fde38b
address newOwner
withdrawLRC 0x6c825035
No parameters
Recent Transactions
No transactions found for this address