Overview
ETH Balance
0 ETH
Eth Value
$0.00Token Holdings
More Info
Private Name Tags
ContractCreator
Latest 25 from a total of 62,287 transactions
Transaction Hash |
Method
|
Block
|
From
|
To
|
|||||
---|---|---|---|---|---|---|---|---|---|
Stake End | 21463606 | 43 mins ago | IN | 0 ETH | 0.00047309 | ||||
Stake Start | 21463411 | 1 hr ago | IN | 0 ETH | 0.00058315 | ||||
Stake End | 21463381 | 1 hr ago | IN | 0 ETH | 0.00031093 | ||||
Stake Start | 21463376 | 1 hr ago | IN | 0 ETH | 0.00056264 | ||||
Stake Start | 21463304 | 1 hr ago | IN | 0 ETH | 0.00058182 | ||||
Stake End | 21463243 | 1 hr ago | IN | 0 ETH | 0.00040679 | ||||
Stake End | 21463241 | 1 hr ago | IN | 0 ETH | 0.00033241 | ||||
Stake End | 21463023 | 2 hrs ago | IN | 0 ETH | 0.00033573 | ||||
Stake End | 21461786 | 6 hrs ago | IN | 0 ETH | 0.00041262 | ||||
Stake End | 21461716 | 7 hrs ago | IN | 0 ETH | 0.00049938 | ||||
Stake Start | 21461665 | 7 hrs ago | IN | 0 ETH | 0.00073344 | ||||
Stake End | 21460962 | 9 hrs ago | IN | 0 ETH | 0.00052861 | ||||
Stake End | 21460828 | 10 hrs ago | IN | 0 ETH | 0.00054771 | ||||
Stake End | 21460481 | 11 hrs ago | IN | 0 ETH | 0.00052941 | ||||
Stake Start | 21460125 | 12 hrs ago | IN | 0 ETH | 0.00083394 | ||||
Stake End | 21460113 | 12 hrs ago | IN | 0 ETH | 0.00044699 | ||||
Stake End | 21460105 | 12 hrs ago | IN | 0 ETH | 0.00060731 | ||||
Stake Start | 21459458 | 14 hrs ago | IN | 0 ETH | 0.00099846 | ||||
Stake End | 21459440 | 14 hrs ago | IN | 0 ETH | 0.00047735 | ||||
Stake End | 21459269 | 15 hrs ago | IN | 0 ETH | 0.00061689 | ||||
Stake End | 21458935 | 16 hrs ago | IN | 0 ETH | 0.00054567 | ||||
Stake End | 21458926 | 16 hrs ago | IN | 0 ETH | 0.00066721 | ||||
Stake End | 21458888 | 16 hrs ago | IN | 0 ETH | 0.0006029 | ||||
Stake End | 21458884 | 16 hrs ago | IN | 0 ETH | 0.00076567 | ||||
Stake End | 21458759 | 16 hrs ago | IN | 0 ETH | 0.00078681 |
View more zero value Internal Transactions in Advanced View mode
Advanced mode:
Loading...
Loading
Contract Name:
Staking
Compiler Version
v0.8.4+commit.c7e474f2
Optimization Enabled:
Yes with 200 runs
Other Settings:
default evmVersion
Contract Source Code (Solidity Standard Json-Input format)
//SPDX-License-Identifier: MIT pragma solidity 0.8.4; import "@openzeppelin/contracts/token/ERC20/extensions/IERC20Metadata.sol"; import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol"; import "./GlobalsAndUtility.sol"; import "./helpers/IERC20Burnable.sol"; contract Staking is GlobalsAndUtility { using SafeERC20 for IERC20Burnable; constructor( IERC20Burnable _stakingToken, // MUST BE BURNABLE uint40 _launchTime, address _originAddr ) { require(IERC20Metadata(address(_stakingToken)).decimals() == TOKEN_DECIMALS, "STAKING: incompatible token decimals"); //require(_launchTime >= block.timestamp, "STAKING: launch must be in future"); require(_originAddr != address(0), "STAKING: origin address is 0"); stakingToken = _stakingToken; launchTime = _launchTime; originAddr = _originAddr; /* Initialize global shareRate to 1 */ globals.shareRate = uint40(1 * SHARE_RATE_SCALE); } /** * @dev PUBLIC FACING: Open a stake. * @param newStakedAmount Amount of staking token to stake * @param newStakedDays Number of days to stake */ function stakeStart(uint256 newStakedAmount, uint256 newStakedDays) external { GlobalsCache memory g; _globalsLoad(g); /* Enforce the minimum stake time */ require(newStakedDays >= MIN_STAKE_DAYS, "STAKING: newStakedDays lower than minimum"); /* Enforce the maximum stake time */ require(newStakedDays <= MAX_STAKE_DAYS, "STAKING: newStakedDays higher than maximum"); /* Check if log data needs to be updated */ _dailyDataUpdateAuto(g); _stakeStart(g, newStakedAmount, newStakedDays); /* Remove staked amount from balance of staker */ stakingToken.safeTransferFrom(msg.sender, address(this), newStakedAmount); _globalsSync(g); } /** * @dev PUBLIC FACING: Unlocks a completed stake, distributing the proceeds of any penalty * immediately. The staker must still call stakeEnd() to retrieve their stake return (if any). * @param stakerAddr Address of staker * @param stakeIndex Index of stake within stake list * @param stakeIdParam The stake's id */ function stakeGoodAccounting(address stakerAddr, uint256 stakeIndex, uint40 stakeIdParam) external { GlobalsCache memory g; _globalsLoad(g); /* require() is more informative than the default assert() */ require(stakeLists[stakerAddr].length != 0, "STAKING: Empty stake list"); require(stakeIndex < stakeLists[stakerAddr].length, "STAKING: stakeIndex invalid"); StakeStore storage stRef = stakeLists[stakerAddr][stakeIndex]; /* Get stake copy */ StakeCache memory st; _stakeLoad(stRef, stakeIdParam, st); /* Stake must have served full term */ require(g._currentDay >= st._lockedDay + st._stakedDays, "STAKING: Stake not fully served"); /* Stake must still be locked */ require(st._unlockedDay == 0, "STAKING: Stake already unlocked"); /* Check if log data needs to be updated */ _dailyDataUpdateAuto(g); /* Unlock the completed stake */ _stakeUnlock(g, st); /* stakeReturn value is unused here */ (, uint256 payout, uint256 penalty, uint256 cappedPenalty) = _stakePerformance( st, st._stakedDays ); emit StakeGoodAccounting( stakerAddr, stakeIdParam, msg.sender, uint40(block.timestamp), uint128(st._stakedAmount), uint128(st._stakeShares), uint128(payout), uint128(penalty) ); if (cappedPenalty != 0) { _splitPenaltyProceeds(g, cappedPenalty); } /* st._unlockedDay has changed */ _stakeUpdate(stRef, st); _globalsSync(g); } /** * @dev PUBLIC FACING: Closes a stake. The order of the stake list can change so * a stake id is used to reject stale indexes. * @param stakeIndex Index of stake within stake list * @param stakeIdParam The stake's id * @return stakeReturn payout penalty */ function stakeEnd(uint256 stakeIndex, uint40 stakeIdParam) external returns (uint256 stakeReturn, uint256 payout, uint256 penalty, uint256 cappedPenalty) { GlobalsCache memory g; _globalsLoad(g); StakeStore[] storage stakeListRef = stakeLists[msg.sender]; /* require() is more informative than the default assert() */ require(stakeListRef.length != 0, "STAKING: Empty stake list"); require(stakeIndex < stakeListRef.length, "STAKING: stakeIndex invalid"); /* Get stake copy */ StakeCache memory st; _stakeLoad(stakeListRef[stakeIndex], stakeIdParam, st); /* Check if log data needs to be updated */ _dailyDataUpdateAuto(g); require(g._currentDay >= st._lockedDay + HARD_LOCK_DAYS, "STAKING: hard lock period"); uint256 servedDays = 0; bool prevUnlocked = (st._unlockedDay != 0); if (prevUnlocked) { /* Previously unlocked in stakeGoodAccounting(), so must have served full term */ servedDays = st._stakedDays; } else { _stakeUnlock(g, st); servedDays = g._currentDay - st._lockedDay; if (servedDays > st._stakedDays) { servedDays = st._stakedDays; } } (stakeReturn, payout, penalty, cappedPenalty) = _stakePerformance(st, servedDays); emit StakeEnd( msg.sender, stakeIdParam, uint40(block.timestamp), uint128(st._stakedAmount), uint128(st._stakeShares), uint128(payout), uint128(penalty), uint16(servedDays), prevUnlocked ); if (cappedPenalty != 0 && !prevUnlocked) { /* Split penalty proceeds only if not previously unlocked by stakeGoodAccounting() */ _splitPenaltyProceeds(g, cappedPenalty); } /* Pay the stake return, if any, to the staker */ if (stakeReturn != 0) { stakingToken.safeTransfer(msg.sender, stakeReturn); /* Update the share rate if necessary */ _shareRateUpdate(g, st, stakeReturn); } g._lockedStakeTotal -= st._stakedAmount; _stakeRemove(stakeListRef, stakeIndex); _globalsSync(g); return ( stakeReturn, payout, penalty, cappedPenalty ); } function fundRewards( uint128 amountPerDay, uint16 daysCount, uint16 shiftInDays ) external { require(daysCount <= 365, "STAKING: too many days"); stakingToken.safeTransferFrom(msg.sender, address(this), amountPerDay * daysCount); uint256 currentDay = _currentDay() + 1; uint256 fromDay = currentDay + shiftInDays; for (uint256 day = fromDay; day < fromDay + daysCount; day++) { dailyData[day].dayPayoutTotal += amountPerDay; } emit RewardsFund(amountPerDay, daysCount, shiftInDays); } /** * @dev PUBLIC FACING: Return the current stake count for a staker address * @param stakerAddr Address of staker */ function stakeCount(address stakerAddr) external view returns (uint256) { return stakeLists[stakerAddr].length; } /** * @dev Open a stake. * @param g Cache of stored globals * @param newStakedAmount Amount of staking token to stake * @param newStakedDays Number of days to stake */ function _stakeStart( GlobalsCache memory g, uint256 newStakedAmount, uint256 newStakedDays ) internal { uint256 bonusShares = stakeStartBonusShares(newStakedAmount, newStakedDays); uint256 newStakeShares = (newStakedAmount + bonusShares) * SHARE_RATE_SCALE / g._shareRate; /* Ensure newStakedAmount is enough for at least one stake share */ require(newStakeShares != 0, "STAKING: newStakedAmount must be at least minimum shareRate"); /* The stakeStart timestamp will always be part-way through the current day, so it needs to be rounded-up to the next day to ensure all stakes align with the same fixed calendar days. The current day is already rounded-down, so rounded-up is current day + 1. */ uint256 newLockedDay = g._currentDay + 1; /* Create Stake */ uint40 newStakeId = ++g._latestStakeId; _stakeAdd( stakeLists[msg.sender], newStakeId, newStakedAmount, newStakeShares, newLockedDay, newStakedDays ); emit StakeStart( msg.sender, newStakeId, uint40(block.timestamp), uint128(newStakedAmount), uint128(newStakeShares), uint16(newStakedDays) ); /* Stake is added to total in the next round, not the current round */ g._nextStakeSharesTotal += newStakeShares; /* Track total staked amount for inflation calculations */ g._lockedStakeTotal += newStakedAmount; /* Remove his share from the pool when his stake ends */ dailyData[newLockedDay + newStakedDays].sharesToBeRemoved += uint128(newStakeShares); } /* Returns the same values as function stakeEnd. However, this function makes it possible to anyone view the stakeReturn etc. for any staker. The results can be obsolete if there are no daily updates. */ function getStakeStatus( address staker, uint256 stakeIndex, uint40 stakeIdParam ) external view returns (uint256 stakeReturn, uint256 payout, uint256 penalty, uint256 cappedPenalty) { GlobalsCache memory g; _globalsLoad(g); StakeStore[] storage stakeListRef = stakeLists[staker]; require(stakeListRef.length != 0, "STAKING: Empty stake list"); require(stakeIndex < stakeListRef.length, "STAKING: stakeIndex invalid"); StakeCache memory st; _stakeLoad(stakeListRef[stakeIndex], stakeIdParam, st); require(g._currentDay >= st._lockedDay + HARD_LOCK_DAYS, "STAKING: hard lock period"); uint256 servedDays = 0; bool prevUnlocked = (st._unlockedDay != 0); if (prevUnlocked) { servedDays = st._stakedDays; } else { st._unlockedDay = g._currentDay; servedDays = g._currentDay - st._lockedDay; if (servedDays > st._stakedDays) { servedDays = st._stakedDays; } } (stakeReturn, payout, penalty, cappedPenalty) = _stakePerformance(st, servedDays); } /** * @dev Calculates total stake payout including rewards for a multi-day range * @param stakeSharesParam Param from stake to calculate bonuses for * @param beginDay First day to calculate bonuses for * @param endDay Last day (non-inclusive) of range to calculate bonuses for * @return payout */ function _calcPayoutRewards( uint256 stakeSharesParam, uint256 beginDay, uint256 endDay ) private view returns (uint256 payout) { uint256 accRewardPerShare = dailyData[endDay - 1].accRewardPerShare - dailyData[beginDay - 1].accRewardPerShare; payout = stakeSharesParam * accRewardPerShare / ACC_REWARD_MULTIPLIER; return payout; } /** * @dev Calculate bonus shares for a new stake, if any * @param newStakedAmount Amount of staking token * @param newStakedDays Number of days to stake */ function stakeStartBonusShares(uint256 newStakedAmount, uint256 newStakedDays) public pure returns (uint256 bonusShares) { uint256 cappedExtraDays = 0; /* Must be more than 1 day for Longer-Pays-Better */ if (newStakedDays > 1) { cappedExtraDays = newStakedDays <= LPB_MAX_DAYS ? newStakedDays - 1 : LPB_MAX_DAYS; } uint256 cappedStakedAmount = newStakedAmount >= BPB_FROM_AMOUNT ? newStakedAmount - BPB_FROM_AMOUNT : 0; if (cappedStakedAmount > BPB_MAX) { cappedStakedAmount = BPB_MAX; } bonusShares = cappedExtraDays * BPB + cappedStakedAmount * LPB; bonusShares = newStakedAmount * bonusShares / (LPB * BPB); return bonusShares; } function _stakeUnlock(GlobalsCache memory g, StakeCache memory st) private { st._unlockedDay = g._currentDay; uint256 endDay = st._lockedDay + st._stakedDays; if (g._currentDay <= endDay) { dailyData[endDay].sharesToBeRemoved -= uint128(st._stakeShares); g._stakeSharesTotal -= st._stakeShares; } } function _stakePerformance(StakeCache memory st, uint256 servedDays) private view returns (uint256 stakeReturn, uint256 payout, uint256 penalty, uint256 cappedPenalty) { if (servedDays < st._stakedDays) { (payout, penalty) = _calcPayoutAndEarlyPenalty( st._lockedDay, st._stakedDays, servedDays, st._stakeShares ); stakeReturn = st._stakedAmount + payout; } else { // servedDays must == stakedDays here payout = _calcPayoutRewards( st._stakeShares, st._lockedDay, st._lockedDay + servedDays ); stakeReturn = st._stakedAmount + payout; penalty = _calcLatePenalty(st._lockedDay, st._stakedDays, st._unlockedDay, stakeReturn); } if (penalty != 0) { if (penalty > stakeReturn) { /* Cannot have a negative stake return */ cappedPenalty = stakeReturn; stakeReturn = 0; } else { /* Remove penalty from the stake return */ cappedPenalty = penalty; stakeReturn -= cappedPenalty; } } return (stakeReturn, payout, penalty, cappedPenalty); } function _calcPayoutAndEarlyPenalty( uint256 lockedDayParam, uint256 stakedDaysParam, uint256 servedDays, uint256 stakeSharesParam ) private view returns (uint256 payout, uint256 penalty) { uint256 servedEndDay = lockedDayParam + servedDays; /* 50% of stakedDays (rounded up) with a minimum applied */ uint256 penaltyDays = (stakedDaysParam + 1) / 2; if (penaltyDays < EARLY_PENALTY_MIN_DAYS) { penaltyDays = EARLY_PENALTY_MIN_DAYS; } if (penaltyDays < servedDays) { /* Simplified explanation of intervals where end-day is non-inclusive: penalty: [lockedDay ... penaltyEndDay) delta: [penaltyEndDay ... servedEndDay) payout: [lockedDay ....................... servedEndDay) */ uint256 penaltyEndDay = lockedDayParam + penaltyDays; penalty = _calcPayoutRewards(stakeSharesParam, lockedDayParam, penaltyEndDay); uint256 delta = _calcPayoutRewards(stakeSharesParam, penaltyEndDay, servedEndDay); payout = penalty + delta; return (payout, penalty); } /* penaltyDays >= servedDays */ payout = _calcPayoutRewards(stakeSharesParam, lockedDayParam, servedEndDay); if (penaltyDays == servedDays) { penalty = payout; } else { /* (penaltyDays > servedDays) means not enough days served, so fill the penalty days with the average payout from only the days that were served. */ penalty = payout * penaltyDays / servedDays; } return (payout, penalty); } function _calcLatePenalty( uint256 lockedDayParam, uint256 stakedDaysParam, uint256 unlockedDayParam, uint256 rawStakeReturn ) private pure returns (uint256) { /* Allow grace time before penalties accrue */ uint256 maxUnlockedDay = lockedDayParam + stakedDaysParam + LATE_PENALTY_GRACE_DAYS; if (unlockedDayParam <= maxUnlockedDay) { return 0; } /* Calculate penalty as a percentage of stake return based on time */ return rawStakeReturn * (unlockedDayParam - maxUnlockedDay) / LATE_PENALTY_SCALE_DAYS; } function _splitPenaltyProceeds(GlobalsCache memory g, uint256 penalty) private { /* Split a penalty 50:50 between (Origin + burn) and stakePenaltyTotal */ uint256 splitPenalty = penalty / 2; if (splitPenalty != 0) { //30% of the total penalty is sent to origin address uint256 originPenalty = splitPenalty * 3 / 5; stakingToken.safeTransfer(originAddr, originPenalty); //20% of the total penalty is burned stakingToken.burn(splitPenalty - originPenalty); } /* Use the other half of the penalty to account for an odd-numbered penalty */ splitPenalty = penalty - splitPenalty; g._stakePenaltyTotal += splitPenalty; } function _shareRateUpdate(GlobalsCache memory g, StakeCache memory st, uint256 stakeReturn) private { if (stakeReturn > st._stakedAmount) { /* Calculate the new shareRate that would yield the same number of shares if the user re-staked this stakeReturn, factoring in any bonuses they would receive in stakeStart(). */ uint256 bonusShares = stakeStartBonusShares(stakeReturn, st._stakedDays); uint256 newShareRate = (stakeReturn + bonusShares) * SHARE_RATE_SCALE / st._stakeShares; if (newShareRate > SHARE_RATE_MAX) { /* Realistically this can't happen, but there are contrived theoretical scenarios that can lead to extreme values of newShareRate, so it is capped to prevent them anyway. */ newShareRate = SHARE_RATE_MAX; } if (newShareRate > g._shareRate) { g._shareRate = newShareRate; emit ShareRateChange( st._stakeId, uint40(block.timestamp), uint40(newShareRate) ); } } } }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import "../IERC20.sol"; /** * @dev Interface for the optional metadata functions from the ERC20 standard. * * _Available since v4.1._ */ interface IERC20Metadata is IERC20 { /** * @dev Returns the name of the token. */ function name() external view returns (string memory); /** * @dev Returns the symbol of the token. */ function symbol() external view returns (string memory); /** * @dev Returns the decimals places of the token. */ function decimals() external view returns (uint8); }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import "../IERC20.sol"; import "../../../utils/Address.sol"; /** * @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 IERC20;` statement to your contract, * which allows you to call the safe operations as `token.safeTransfer(...)`, etc. */ library SafeERC20 { using Address for address; 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)); } /** * @dev Deprecated. This function has issues similar to the ones found in * {IERC20-approve}, and its usage is discouraged. * * Whenever possible, use {safeIncreaseAllowance} and * {safeDecreaseAllowance} instead. */ 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' 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)); } function safeIncreaseAllowance( IERC20 token, address spender, uint256 value ) internal { uint256 newAllowance = token.allowance(address(this), spender) + value; _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance)); } function safeDecreaseAllowance( IERC20 token, address spender, uint256 value ) internal { unchecked { uint256 oldAllowance = token.allowance(address(this), spender); require(oldAllowance >= value, "SafeERC20: decreased allowance below zero"); uint256 newAllowance = oldAllowance - value; _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance)); } } /** * @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. We use {Address.functionCall} to perform this call, which verifies that // the target address contains contract code and also asserts for success in the low-level call. bytes memory returndata = address(token).functionCall(data, "SafeERC20: low-level call failed"); if (returndata.length > 0) { // Return data is optional require(abi.decode(returndata, (bool)), "SafeERC20: ERC20 operation did not succeed"); } } }
//SPDX-License-Identifier: MIT pragma solidity 0.8.4; import "./helpers/IERC20Burnable.sol"; abstract contract GlobalsAndUtility { event DailyDataUpdate( address indexed updaterAddr, uint40 timestamp, uint16 beginDay, uint16 endDay, bool isAutoUpdate ); event StakeStart( address indexed stakerAddr, uint40 indexed stakeId, uint40 timestamp, uint128 stakedAmount, uint128 stakeShares, uint16 stakedDays ); event StakeGoodAccounting( address indexed stakerAddr, uint40 indexed stakeId, address indexed senderAddr, uint40 timestamp, uint128 stakedAmount, uint128 stakeShares, uint128 payout, uint128 penalty ); event StakeEnd( address indexed stakerAddr, uint40 indexed stakeId, uint40 timestamp, uint128 stakedAmount, uint128 stakeShares, uint128 payout, uint128 penalty, uint16 servedDays, bool prevUnlocked ); event ShareRateChange( uint40 indexed stakeId, uint40 timestamp, uint40 shareRate ); event RewardsFund( uint128 amountPerDay, uint16 daysCount, uint16 shiftInDays ); IERC20Burnable public stakingToken; uint40 public launchTime; address public originAddr; uint256 internal constant ACC_REWARD_MULTIPLIER = 1e36; uint256 internal constant TOKEN_DECIMALS = 18; /* Stake timing parameters */ uint256 internal constant HARD_LOCK_DAYS = 14; uint256 internal constant MIN_STAKE_DAYS = 30; uint256 internal constant MAX_STAKE_DAYS = 1095; uint256 internal constant EARLY_PENALTY_MIN_DAYS = 30; uint256 internal constant LATE_PENALTY_GRACE_DAYS = 30; uint256 internal constant LATE_PENALTY_SCALE_DAYS = 100; /* Stake shares Longer Pays Better bonus constants used by _stakeStartBonusShares() */ uint256 private constant LPB_BONUS_PERCENT = 600; uint256 private constant LPB_BONUS_MAX_PERCENT = 1800; uint256 internal constant LPB = 364 * 100 / LPB_BONUS_PERCENT; uint256 internal constant LPB_MAX_DAYS = LPB * LPB_BONUS_MAX_PERCENT / 100; /* Stake shares Bigger Pays Better bonus constants used by _stakeStartBonusShares() */ uint256 private constant BPB_BONUS_PERCENT = 50; uint256 internal constant BPB_MAX = 1e6 * 10 ** TOKEN_DECIMALS; uint256 internal constant BPB = BPB_MAX * 100 / BPB_BONUS_PERCENT; uint256 internal constant BPB_FROM_AMOUNT = 50000 * 10 ** TOKEN_DECIMALS; /* Share rate is scaled to increase precision */ uint256 internal constant SHARE_RATE_SCALE = 1e5; /* Share rate max (after scaling) */ uint256 internal constant SHARE_RATE_UINT_SIZE = 40; uint256 internal constant SHARE_RATE_MAX = (1 << SHARE_RATE_UINT_SIZE) - 1; /* Globals expanded for memory (except _latestStakeId) and compact for storage */ struct GlobalsCache { uint256 _lockedStakeTotal; uint256 _nextStakeSharesTotal; uint256 _stakePenaltyTotal; uint256 _stakeSharesTotal; uint40 _latestStakeId; uint256 _shareRate; uint256 _dailyDataCount; uint256 _currentDay; } struct GlobalsStore { uint128 lockedStakeTotal; uint128 nextStakeSharesTotal; uint128 stakePenaltyTotal; uint128 stakeSharesTotal; uint40 latestStakeId; uint40 shareRate; uint16 dailyDataCount; } GlobalsStore public globals; /* Daily data */ struct DailyDataStore { uint128 dayPayoutTotal; uint128 sharesToBeRemoved; uint256 accRewardPerShare; } mapping(uint256 => DailyDataStore) public dailyData; /* Stake expanded for memory (except _stakeId) and compact for storage */ struct StakeCache { uint256 _stakedAmount; uint256 _stakeShares; uint40 _stakeId; uint256 _lockedDay; uint256 _stakedDays; uint256 _unlockedDay; } struct StakeStore { uint128 stakedAmount; uint128 stakeShares; uint40 stakeId; uint16 lockedDay; uint16 stakedDays; uint16 unlockedDay; } mapping(address => StakeStore[]) public stakeLists; /* Temporary state for calculating daily rounds */ struct DailyRoundState { uint256 _payoutTotal; uint256 _accRewardPerShare; } /** * @dev PUBLIC FACING: Optionally update daily data for a smaller * range to reduce gas cost for a subsequent operation * @param beforeDay Only update days before this day number (optional; 0 for current day) */ function dailyDataUpdate(uint256 beforeDay) external { GlobalsCache memory g; _globalsLoad(g); if (beforeDay != 0) { require(beforeDay <= g._currentDay, "STAKING: beforeDay cannot be in the future"); _dailyDataUpdate(g, beforeDay, false); } else { /* Default to updating before current day */ _dailyDataUpdate(g, g._currentDay, false); } _globalsSync(g); } /** * @dev PUBLIC FACING: External helper to return multiple values of daily data with * a single call. Ugly implementation due to limitations of the standard ABI encoder. * @param beginDay First day of data range * @param endDay Last day (non-inclusive) of data range * @return listDayAccRewardPerShare and listDayPayoutTotal */ function dailyDataRange(uint256 beginDay, uint256 endDay) external view returns (uint256[] memory listDayAccRewardPerShare, uint256[] memory listDayPayoutTotal) { require(beginDay < endDay, "STAKING: range invalid"); listDayAccRewardPerShare = new uint256[](endDay - beginDay); listDayPayoutTotal = new uint256[](endDay - beginDay); uint256 src = beginDay; uint256 dst = 0; do { listDayAccRewardPerShare[dst] = dailyData[src].accRewardPerShare; listDayPayoutTotal[dst++] = dailyData[src].dayPayoutTotal; } while (++src < endDay); } /** * @dev PUBLIC FACING: External helper to return most global info with a single call. * @return global variables */ function globalInfo() external view returns (GlobalsCache memory) { GlobalsCache memory g; _globalsLoad(g); return g; } /** * @dev PUBLIC FACING: External helper for the current day number since launch time * @return Current day number (zero-based) */ function currentDay() external view returns (uint256) { return _currentDay(); } function _currentDay() internal view returns (uint256) { return (block.timestamp - launchTime) / 1 days; } function _dailyDataUpdateAuto(GlobalsCache memory g) internal { _dailyDataUpdate(g, g._currentDay, true); } function _globalsLoad(GlobalsCache memory g) internal view { g._lockedStakeTotal = globals.lockedStakeTotal; g._nextStakeSharesTotal = globals.nextStakeSharesTotal; g._stakeSharesTotal = globals.stakeSharesTotal; g._stakePenaltyTotal = globals.stakePenaltyTotal; g._latestStakeId = globals.latestStakeId; g._shareRate = globals.shareRate; g._dailyDataCount = globals.dailyDataCount; g._currentDay = _currentDay(); } function _globalsSync(GlobalsCache memory g) internal { globals.lockedStakeTotal = uint128(g._lockedStakeTotal); globals.nextStakeSharesTotal = uint128(g._nextStakeSharesTotal); globals.stakeSharesTotal = uint128(g._stakeSharesTotal); globals.stakePenaltyTotal = uint128(g._stakePenaltyTotal); globals.latestStakeId = g._latestStakeId; globals.shareRate = uint40(g._shareRate); globals.dailyDataCount = uint16(g._dailyDataCount); } function _stakeLoad(StakeStore storage stRef, uint40 stakeIdParam, StakeCache memory st) internal view { /* Ensure caller's stakeIndex is still current */ require(stakeIdParam == stRef.stakeId, "STAKING: stakeIdParam not in stake"); st._stakedAmount = stRef.stakedAmount; st._stakeShares = stRef.stakeShares; st._stakeId = stRef.stakeId; st._lockedDay = stRef.lockedDay; st._stakedDays = stRef.stakedDays; st._unlockedDay = stRef.unlockedDay; } function _stakeUpdate(StakeStore storage stRef, StakeCache memory st) internal { stRef.stakedAmount = uint128(st._stakedAmount); stRef.stakeShares = uint128(st._stakeShares); stRef.stakeId = st._stakeId; stRef.lockedDay = uint16(st._lockedDay); stRef.stakedDays = uint16(st._stakedDays); stRef.unlockedDay = uint16(st._unlockedDay); } function _stakeAdd( StakeStore[] storage stakeListRef, uint40 newStakeId, uint256 newstakedAmount, uint256 newStakeShares, uint256 newLockedDay, uint256 newStakedDays ) internal { stakeListRef.push( StakeStore( uint128(newstakedAmount), uint128(newStakeShares), newStakeId, uint16(newLockedDay), uint16(newStakedDays), uint16(0) // unlockedDay ) ); } /** * @dev Efficiently delete from an unordered array by moving the last element * to the "hole" and reducing the array length. Can change the order of the list * and invalidate previously held indexes. * @notice stakeListRef length and stakeIndex are already ensured valid in stakeEnd() * @param stakeListRef Reference to stakeLists[stakerAddr] array in storage * @param stakeIndex Index of the element to delete */ function _stakeRemove(StakeStore[] storage stakeListRef, uint256 stakeIndex) internal { uint256 lastIndex = stakeListRef.length - 1; /* Skip the copy if element to be removed is already the last element */ if (stakeIndex != lastIndex) { /* Copy last element to the requested element's "hole" */ stakeListRef[stakeIndex] = stakeListRef[lastIndex]; } stakeListRef.pop(); } function _dailyRoundCalc(GlobalsCache memory g, DailyRoundState memory rs, uint256 day) private view { rs._payoutTotal = dailyData[day].dayPayoutTotal; rs._accRewardPerShare = day == 0 ? 0 : dailyData[day - 1].accRewardPerShare; if (g._stakePenaltyTotal != 0) { rs._payoutTotal += g._stakePenaltyTotal; g._stakePenaltyTotal = 0; } if (g._stakeSharesTotal > 0) { rs._accRewardPerShare += rs._payoutTotal * ACC_REWARD_MULTIPLIER / g._stakeSharesTotal; } } function _dailyRoundCalcAndStore(GlobalsCache memory g, DailyRoundState memory rs, uint256 day) private { g._stakeSharesTotal -= dailyData[day].sharesToBeRemoved; _dailyRoundCalc(g, rs, day); dailyData[day].accRewardPerShare = rs._accRewardPerShare; if (g._stakeSharesTotal > 0) { dailyData[day].dayPayoutTotal = uint128(rs._payoutTotal); } else { // nobody staking that day, move the reward to the next day if any dailyData[day + 1].dayPayoutTotal += uint128(rs._payoutTotal); } } function _dailyDataUpdate(GlobalsCache memory g, uint256 beforeDay, bool isAutoUpdate) private { if (g._dailyDataCount >= beforeDay) { /* Already up-to-date */ return; } DailyRoundState memory rs; uint256 day = g._dailyDataCount; _dailyRoundCalcAndStore(g, rs, day); /* Stakes started during this day are added to the total the next day */ if (g._nextStakeSharesTotal != 0) { g._stakeSharesTotal += g._nextStakeSharesTotal; g._nextStakeSharesTotal = 0; } while (++day < beforeDay) { _dailyRoundCalcAndStore(g, rs, day); } emit DailyDataUpdate( msg.sender, uint40(block.timestamp), uint16(g._dailyDataCount), uint16(day), isAutoUpdate ); g._dailyDataCount = day; } }
//SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import "@openzeppelin/contracts/token/ERC20/IERC20.sol"; interface IERC20Burnable is IERC20 { function burn(uint256 amount) external; }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; /** * @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); /** * @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); /** * @dev Emitted when `value` tokens are moved from one account (`from`) to * another (`to`). * * Note that `value` may be zero. */ event Transfer(address indexed from, address indexed to, uint256 value); /** * @dev Emitted when the allowance of a `spender` for an `owner` is set by * a call to {approve}. `value` is the new allowance. */ event Approval(address indexed owner, address indexed spender, uint256 value); }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; /** * @dev Collection of functions related to the address type */ library Address { /** * @dev Returns true if `account` is a contract. * * [IMPORTANT] * ==== * It is unsafe to assume that an address for which this function returns * false is an externally-owned account (EOA) and not a contract. * * Among others, `isContract` will return false for the following * types of addresses: * * - an externally-owned account * - a contract in construction * - an address where a contract will be created * - an address where a contract lived, but was destroyed * ==== */ function isContract(address account) internal view returns (bool) { // This method relies on extcodesize, which returns 0 for contracts in // construction, since the code is only stored at the end of the // constructor execution. uint256 size; assembly { size := extcodesize(account) } return size > 0; } /** * @dev Replacement for Solidity's `transfer`: sends `amount` wei to * `recipient`, forwarding all available gas and reverting on errors. * * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost * of certain opcodes, possibly making contracts go over the 2300 gas limit * imposed by `transfer`, making them unable to receive funds via * `transfer`. {sendValue} removes this limitation. * * https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more]. * * IMPORTANT: because control is transferred to `recipient`, care must be * taken to not create reentrancy vulnerabilities. Consider using * {ReentrancyGuard} or the * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern]. */ function sendValue(address payable recipient, uint256 amount) internal { require(address(this).balance >= amount, "Address: insufficient balance"); (bool success, ) = recipient.call{value: amount}(""); require(success, "Address: unable to send value, recipient may have reverted"); } /** * @dev Performs a Solidity function call using a low level `call`. A * plain `call` is an unsafe replacement for a function call: use this * function instead. * * If `target` reverts with a revert reason, it is bubbled up by this * function (like regular Solidity function calls). * * Returns the raw returned data. To convert to the expected return value, * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`]. * * Requirements: * * - `target` must be a contract. * - calling `target` with `data` must not revert. * * _Available since v3.1._ */ function functionCall(address target, bytes memory data) internal returns (bytes memory) { return functionCall(target, data, "Address: low-level call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with * `errorMessage` as a fallback revert reason when `target` reverts. * * _Available since v3.1._ */ function functionCall( address target, bytes memory data, string memory errorMessage ) internal returns (bytes memory) { return functionCallWithValue(target, data, 0, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but also transferring `value` wei to `target`. * * Requirements: * * - the calling contract must have an ETH balance of at least `value`. * - the called Solidity function must be `payable`. * * _Available since v3.1._ */ function functionCallWithValue( address target, bytes memory data, uint256 value ) internal returns (bytes memory) { return functionCallWithValue(target, data, value, "Address: low-level call with value failed"); } /** * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but * with `errorMessage` as a fallback revert reason when `target` reverts. * * _Available since v3.1._ */ function functionCallWithValue( address target, bytes memory data, uint256 value, string memory errorMessage ) internal returns (bytes memory) { require(address(this).balance >= value, "Address: insufficient balance for call"); require(isContract(target), "Address: call to non-contract"); (bool success, bytes memory returndata) = target.call{value: value}(data); return verifyCallResult(success, returndata, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but performing a static call. * * _Available since v3.3._ */ function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) { return functionStaticCall(target, data, "Address: low-level static call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`], * but performing a static call. * * _Available since v3.3._ */ function functionStaticCall( address target, bytes memory data, string memory errorMessage ) internal view returns (bytes memory) { require(isContract(target), "Address: static call to non-contract"); (bool success, bytes memory returndata) = target.staticcall(data); return verifyCallResult(success, returndata, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but performing a delegate call. * * _Available since v3.4._ */ function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) { return functionDelegateCall(target, data, "Address: low-level delegate call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`], * but performing a delegate call. * * _Available since v3.4._ */ function functionDelegateCall( address target, bytes memory data, string memory errorMessage ) internal returns (bytes memory) { require(isContract(target), "Address: delegate call to non-contract"); (bool success, bytes memory returndata) = target.delegatecall(data); return verifyCallResult(success, returndata, errorMessage); } /** * @dev Tool to verifies that a low level call was successful, and revert if it wasn't, either by bubbling the * revert reason using the provided one. * * _Available since v4.3._ */ function verifyCallResult( bool success, bytes memory returndata, string memory errorMessage ) internal pure returns (bytes memory) { if (success) { return returndata; } else { // Look for revert reason and bubble it up if present if (returndata.length > 0) { // The easiest way to bubble the revert reason is using memory via assembly assembly { let returndata_size := mload(returndata) revert(add(32, returndata), returndata_size) } } else { revert(errorMessage); } } } }
{ "optimizer": { "enabled": true, "runs": 200 }, "outputSelection": { "*": { "*": [ "evm.bytecode", "evm.deployedBytecode", "devdoc", "userdoc", "metadata", "abi" ] } }, "libraries": {} }
Contract Security Audit
- No Contract Security Audit Submitted- Submit Audit Here
[{"inputs":[{"internalType":"contract IERC20Burnable","name":"_stakingToken","type":"address"},{"internalType":"uint40","name":"_launchTime","type":"uint40"},{"internalType":"address","name":"_originAddr","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"updaterAddr","type":"address"},{"indexed":false,"internalType":"uint40","name":"timestamp","type":"uint40"},{"indexed":false,"internalType":"uint16","name":"beginDay","type":"uint16"},{"indexed":false,"internalType":"uint16","name":"endDay","type":"uint16"},{"indexed":false,"internalType":"bool","name":"isAutoUpdate","type":"bool"}],"name":"DailyDataUpdate","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint128","name":"amountPerDay","type":"uint128"},{"indexed":false,"internalType":"uint16","name":"daysCount","type":"uint16"},{"indexed":false,"internalType":"uint16","name":"shiftInDays","type":"uint16"}],"name":"RewardsFund","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint40","name":"stakeId","type":"uint40"},{"indexed":false,"internalType":"uint40","name":"timestamp","type":"uint40"},{"indexed":false,"internalType":"uint40","name":"shareRate","type":"uint40"}],"name":"ShareRateChange","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"stakerAddr","type":"address"},{"indexed":true,"internalType":"uint40","name":"stakeId","type":"uint40"},{"indexed":false,"internalType":"uint40","name":"timestamp","type":"uint40"},{"indexed":false,"internalType":"uint128","name":"stakedAmount","type":"uint128"},{"indexed":false,"internalType":"uint128","name":"stakeShares","type":"uint128"},{"indexed":false,"internalType":"uint128","name":"payout","type":"uint128"},{"indexed":false,"internalType":"uint128","name":"penalty","type":"uint128"},{"indexed":false,"internalType":"uint16","name":"servedDays","type":"uint16"},{"indexed":false,"internalType":"bool","name":"prevUnlocked","type":"bool"}],"name":"StakeEnd","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"stakerAddr","type":"address"},{"indexed":true,"internalType":"uint40","name":"stakeId","type":"uint40"},{"indexed":true,"internalType":"address","name":"senderAddr","type":"address"},{"indexed":false,"internalType":"uint40","name":"timestamp","type":"uint40"},{"indexed":false,"internalType":"uint128","name":"stakedAmount","type":"uint128"},{"indexed":false,"internalType":"uint128","name":"stakeShares","type":"uint128"},{"indexed":false,"internalType":"uint128","name":"payout","type":"uint128"},{"indexed":false,"internalType":"uint128","name":"penalty","type":"uint128"}],"name":"StakeGoodAccounting","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"stakerAddr","type":"address"},{"indexed":true,"internalType":"uint40","name":"stakeId","type":"uint40"},{"indexed":false,"internalType":"uint40","name":"timestamp","type":"uint40"},{"indexed":false,"internalType":"uint128","name":"stakedAmount","type":"uint128"},{"indexed":false,"internalType":"uint128","name":"stakeShares","type":"uint128"},{"indexed":false,"internalType":"uint16","name":"stakedDays","type":"uint16"}],"name":"StakeStart","type":"event"},{"inputs":[],"name":"currentDay","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"dailyData","outputs":[{"internalType":"uint128","name":"dayPayoutTotal","type":"uint128"},{"internalType":"uint128","name":"sharesToBeRemoved","type":"uint128"},{"internalType":"uint256","name":"accRewardPerShare","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"beginDay","type":"uint256"},{"internalType":"uint256","name":"endDay","type":"uint256"}],"name":"dailyDataRange","outputs":[{"internalType":"uint256[]","name":"listDayAccRewardPerShare","type":"uint256[]"},{"internalType":"uint256[]","name":"listDayPayoutTotal","type":"uint256[]"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"beforeDay","type":"uint256"}],"name":"dailyDataUpdate","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint128","name":"amountPerDay","type":"uint128"},{"internalType":"uint16","name":"daysCount","type":"uint16"},{"internalType":"uint16","name":"shiftInDays","type":"uint16"}],"name":"fundRewards","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"staker","type":"address"},{"internalType":"uint256","name":"stakeIndex","type":"uint256"},{"internalType":"uint40","name":"stakeIdParam","type":"uint40"}],"name":"getStakeStatus","outputs":[{"internalType":"uint256","name":"stakeReturn","type":"uint256"},{"internalType":"uint256","name":"payout","type":"uint256"},{"internalType":"uint256","name":"penalty","type":"uint256"},{"internalType":"uint256","name":"cappedPenalty","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"globalInfo","outputs":[{"components":[{"internalType":"uint256","name":"_lockedStakeTotal","type":"uint256"},{"internalType":"uint256","name":"_nextStakeSharesTotal","type":"uint256"},{"internalType":"uint256","name":"_stakePenaltyTotal","type":"uint256"},{"internalType":"uint256","name":"_stakeSharesTotal","type":"uint256"},{"internalType":"uint40","name":"_latestStakeId","type":"uint40"},{"internalType":"uint256","name":"_shareRate","type":"uint256"},{"internalType":"uint256","name":"_dailyDataCount","type":"uint256"},{"internalType":"uint256","name":"_currentDay","type":"uint256"}],"internalType":"struct GlobalsAndUtility.GlobalsCache","name":"","type":"tuple"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"globals","outputs":[{"internalType":"uint128","name":"lockedStakeTotal","type":"uint128"},{"internalType":"uint128","name":"nextStakeSharesTotal","type":"uint128"},{"internalType":"uint128","name":"stakePenaltyTotal","type":"uint128"},{"internalType":"uint128","name":"stakeSharesTotal","type":"uint128"},{"internalType":"uint40","name":"latestStakeId","type":"uint40"},{"internalType":"uint40","name":"shareRate","type":"uint40"},{"internalType":"uint16","name":"dailyDataCount","type":"uint16"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"launchTime","outputs":[{"internalType":"uint40","name":"","type":"uint40"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"originAddr","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"stakerAddr","type":"address"}],"name":"stakeCount","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"stakeIndex","type":"uint256"},{"internalType":"uint40","name":"stakeIdParam","type":"uint40"}],"name":"stakeEnd","outputs":[{"internalType":"uint256","name":"stakeReturn","type":"uint256"},{"internalType":"uint256","name":"payout","type":"uint256"},{"internalType":"uint256","name":"penalty","type":"uint256"},{"internalType":"uint256","name":"cappedPenalty","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"stakerAddr","type":"address"},{"internalType":"uint256","name":"stakeIndex","type":"uint256"},{"internalType":"uint40","name":"stakeIdParam","type":"uint40"}],"name":"stakeGoodAccounting","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"},{"internalType":"uint256","name":"","type":"uint256"}],"name":"stakeLists","outputs":[{"internalType":"uint128","name":"stakedAmount","type":"uint128"},{"internalType":"uint128","name":"stakeShares","type":"uint128"},{"internalType":"uint40","name":"stakeId","type":"uint40"},{"internalType":"uint16","name":"lockedDay","type":"uint16"},{"internalType":"uint16","name":"stakedDays","type":"uint16"},{"internalType":"uint16","name":"unlockedDay","type":"uint16"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"newStakedAmount","type":"uint256"},{"internalType":"uint256","name":"newStakedDays","type":"uint256"}],"name":"stakeStart","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"newStakedAmount","type":"uint256"},{"internalType":"uint256","name":"newStakedDays","type":"uint256"}],"name":"stakeStartBonusShares","outputs":[{"internalType":"uint256","name":"bonusShares","type":"uint256"}],"stateMutability":"pure","type":"function"},{"inputs":[],"name":"stakingToken","outputs":[{"internalType":"contract IERC20Burnable","name":"","type":"address"}],"stateMutability":"view","type":"function"}]
Contract Creation Code
60806040523480156200001157600080fd5b5060405162002bcd38038062002bcd8339810160408190526200003491620001f0565b6012836001600160a01b031663313ce5676040518163ffffffff1660e01b815260040160206040518083038186803b1580156200007057600080fd5b505afa15801562000085573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190620000ab91906200024b565b60ff16146200010d5760405162461bcd60e51b8152602060048201526024808201527f5354414b494e473a20696e636f6d70617469626c6520746f6b656e20646563696044820152636d616c7360e01b60648201526084015b60405180910390fd5b6001600160a01b038116620001655760405162461bcd60e51b815260206004820152601c60248201527f5354414b494e473a206f726967696e2061646472657373206973203000000000604482015260640162000104565b600080546001600160a01b038581166001600160c81b031990921691909117600160a01b64ffffffffff86160217909155600180546001600160a01b031916918316919091178155620001bd90620186a09062000275565b6004805464ffffffffff92909216650100000000000264ffffffffff60281b1990921691909117905550620002ba915050565b60008060006060848603121562000205578283fd5b83516200021281620002a1565b602085015190935064ffffffffff811681146200022d578283fd5b60408501519092506200024081620002a1565b809150509250925092565b6000602082840312156200025d578081fd5b815160ff811681146200026e578182fd5b9392505050565b60008160001904831182151516156200029c57634e487b7160e01b81526011600452602481fd5b500290565b6001600160a01b0381168114620002b757600080fd5b50565b61290380620002ca6000396000f3fe608060405234801561001057600080fd5b506004361061010b5760003560e01c80636a210a0e116100a257806390de68711161007157806390de6871146102c0578063c312452514610322578063d438e127146103ca578063f02726fe146103dd578063f04b5fa0146103f057600080fd5b80636a210a0e1461023357806372f702f314610254578063790ca4131461027f5780638f1c65c0146102ad57600080fd5b80635c9302c9116100de5780635c9302c9146101f25780635e644556146101fa578063610fb65e1461020d57806365cf71b21461022057600080fd5b80632607443b1461011057806333060d9014610173578063343009a2146101aa57806352a438b8146101dd575b600080fd5b61012361011e366004612426565b610460565b604080516001600160801b03978816815296909516602087015264ffffffffff9093169385019390935261ffff908116606085015291821660808401521660a082015260c0015b60405180910390f35b61019c61018136600461240c565b6001600160a01b031660009081526006602052604090205490565b60405190815260200161016a565b6101bd6101b8366004612529565b6104da565b60408051948552602085019390935291830152606082015260800161016a565b6101f06101eb366004612508565b610754565b005b61019c610867565b61019c610208366004612508565b610876565b6101f061021b3660046124aa565b610a37565b6101f061022e36600461244f565b610ba9565b610246610241366004612508565b610eb4565b60405161016a9291906125aa565b600054610267906001600160a01b031681565b6040516001600160a01b03909116815260200161016a565b60005461029790600160a01b900464ffffffffff1681565b60405164ffffffffff909116815260200161016a565b6101f06102bb3660046124f0565b611067565b6102fc6102ce3660046124f0565b600560205260009081526040902080546001909101546001600160801b0380831692600160801b9004169083565b604080516001600160801b0394851681529390921660208401529082015260600161016a565b600254600354600454610375926001600160801b0380821693600160801b92839004821693828216939091049091169064ffffffffff80821691600160281b810490911690600160501b900461ffff1687565b604080516001600160801b03988916815296881660208801529487169486019490945294909116606084015264ffffffffff908116608084015290921660a082015261ffff90911660c082015260e00161016a565b6101bd6103d836600461244f565b611113565b600154610267906001600160a01b031681565b6103f8611279565b60405161016a91906000610100820190508251825260208301516020830152604083015160408301526060830151606083015264ffffffffff608084015116608083015260a083015160a083015260c083015160c083015260e083015160e083015292915050565b6006602052816000526040600020818154811061047c57600080fd5b6000918252602090912060029091020180546001909101546001600160801b038083169450600160801b909204909116915064ffffffffff81169061ffff600160281b8204811691600160381b8104821691600160481b9091041686565b6000806000806104e8612345565b6104f181611297565b33600090815260066020526040902080546105275760405162461bcd60e51b815260040161051e90612602565b60405180910390fd5b805488106105475760405162461bcd60e51b815260040161051e90612639565b61054f612391565b610587828a8154811061057257634e487b7160e01b600052603260045260246000fd5b90600052602060002090600202018983611308565b610590836113d4565b600e81606001516105a1919061269b565b8360e0015110156105f05760405162461bcd60e51b815260206004820152601960248201527814d51052d25391ce881a185c99081b1bd8dac81c195c9a5bd9603a1b604482015260640161051e565b60a08101516000901580159061060c5782608001519150610640565b61061685846113e7565b82606001518560e0015161062a9190612834565b9150826080015182111561064057826080015191505b61064a838361148b565b86516020808901516040805164ffffffffff42811682526001600160801b0395861694820194909452918416908201528583166060820152918416608083015261ffff881660a083015286151560c0830152949d50929b509099509750908b169033907f1ca44014a5a36217a467507491f4bb0117097c066ab4108946fb579e63db90d99060e00160405180910390a385158015906106e7575080155b156106f6576106f68587611547565b881561071e57600054610713906001600160a01b0316338b611620565b61071e85848b611683565b82518551869061072f908390612834565b90525061073c848c611757565b610745856118ed565b50505050505b92959194509250565b61075c612345565b61076581611297565b601e8210156107c85760405162461bcd60e51b815260206004820152602960248201527f5354414b494e473a206e65775374616b656444617973206c6f776572207468616044820152686e206d696e696d756d60b81b606482015260840161051e565b61044782111561082d5760405162461bcd60e51b815260206004820152602a60248201527f5354414b494e473a206e65775374616b65644461797320686967686572207468604482015269616e206d6178696d756d60b01b606482015260840161051e565b610836816113d4565b610841818484611988565b600054610859906001600160a01b0316333086611c5f565b610862816118ed565b505050565b6000610871611c9d565b905090565b60008060018311156108ea576064610708610895610258618e306126b3565b61089f91906127ed565b6108a991906126b3565b8311156108dc5760646107086108c3610258618e306126b3565b6108cd91906127ed565b6108d791906126b3565b6108e7565b6108e7600184612834565b90505b60006108f86012600a612716565b6109049061c3506127ed565b851015610912576000610934565b61091e6012600a612716565b61092a9061c3506127ed565b6109349086612834565b90506109426012600a612716565b61094f90620f42406127ed565b811115610972576109626012600a612716565b61096f90620f42406127ed565b90505b610980610258618e306126b3565b61098a90826127ed565b60326109986012600a612716565b6109a590620f42406127ed565b6109b09060646127ed565b6109ba91906126b3565b6109c490846127ed565b6109ce919061269b565b925060326109de6012600a612716565b6109eb90620f42406127ed565b6109f69060646127ed565b610a0091906126b3565b610a0e610258618e306126b3565b610a1891906127ed565b610a2284876127ed565b610a2c91906126b3565b925050505b92915050565b61016d8261ffff161115610a865760405162461bcd60e51b81526020600482015260166024820152755354414b494e473a20746f6f206d616e79206461797360501b604482015260640161051e565b610ab63330610a9961ffff8616876127be565b6000546001600160a01b03169291906001600160801b0316611c5f565b6000610ac0611c9d565b610acb90600161269b565b90506000610add61ffff84168361269b565b9050805b610aef61ffff86168361269b565b811015610b545760008181526005602052604081208054889290610b1d9084906001600160801b0316612670565b92506101000a8154816001600160801b0302191690836001600160801b031602179055508080610b4c90612877565b915050610ae1565b50604080516001600160801b038716815261ffff868116602083015285168183015290517fe706f5bbf34ae632280ae6d6411d2d3b922d10d6cd867a24c8493dea376696b49181900360600190a15050505050565b610bb1612345565b610bba81611297565b6001600160a01b038416600090815260066020526040902054610bef5760405162461bcd60e51b815260040161051e90612602565b6001600160a01b0384166000908152600660205260409020548310610c265760405162461bcd60e51b815260040161051e90612639565b6001600160a01b0384166000908152600660205260408120805485908110610c5e57634e487b7160e01b600052603260045260246000fd5b90600052602060002090600202019050610c76612391565b610c81828583611308565b80608001518160600151610c95919061269b565b8360e001511015610ce85760405162461bcd60e51b815260206004820152601f60248201527f5354414b494e473a205374616b65206e6f742066756c6c792073657276656400604482015260640161051e565b60a081015115610d3a5760405162461bcd60e51b815260206004820152601f60248201527f5354414b494e473a205374616b6520616c726561647920756e6c6f636b656400604482015260640161051e565b610d43836113d4565b610d4d83826113e7565b6000806000610d6084856080015161148b565b93509350935050336001600160a01b03168764ffffffffff168a6001600160a01b03167f458d80ef9a762f50dcda80bcb3f4c76ff1f31b1316c391a2716909f984774aee42886000015189602001518989604051610df495949392919064ffffffffff9590951685526001600160801b03938416602086015291831660408501528216606084015216608082015260a00190565b60405180910390a48015610e0c57610e0c8682611547565b835160208501516001600160801b03918216600160801b929091169190910217855560408401516001860180546060870151608088015160a089015164ffffffffff90951666ffffffffffffff1990931692909217600160281b61ffff928316021763ffffffff60381b1916600160381b9282169290920261ffff60481b191691909117600160481b9190931602919091179055610ea9866118ed565b505050505050505050565b606080828410610eff5760405162461bcd60e51b815260206004820152601660248201527514d51052d25391ce881c985b99d9481a5b9d985b1a5960521b604482015260640161051e565b610f098484612834565b67ffffffffffffffff811115610f2f57634e487b7160e01b600052604160045260246000fd5b604051908082528060200260200182016040528015610f58578160200160208202803683370190505b509150610f658484612834565b67ffffffffffffffff811115610f8b57634e487b7160e01b600052604160045260246000fd5b604051908082528060200260200182016040528015610fb4578160200160208202803683370190505b5090508360005b6000828152600560205260409020600101548451859083908110610fef57634e487b7160e01b600052603260045260246000fd5b6020908102919091018101919091526000838152600590915260409020546001600160801b0316838261102181612877565b93508151811061104157634e487b7160e01b600052603260045260246000fd5b60209081029190910101528461105683612877565b92508210610fbb5750509250929050565b61106f612345565b61107881611297565b81156110f6578060e001518211156110e55760405162461bcd60e51b815260206004820152602a60248201527f5354414b494e473a206265666f72654461792063616e6e6f7420626520696e206044820152697468652066757475726560b01b606482015260840161051e565b6110f181836000611cc8565b611106565b611106818260e001516000611cc8565b61110f816118ed565b5050565b600080600080611121612345565b61112a81611297565b6001600160a01b038816600090815260066020526040902080546111605760405162461bcd60e51b815260040161051e90612602565b805488106111805760405162461bcd60e51b815260040161051e90612639565b611188612391565b6111ab828a8154811061057257634e487b7160e01b600052603260045260246000fd5b600e81606001516111bc919061269b565b8360e00151101561120b5760405162461bcd60e51b815260206004820152601960248201527814d51052d25391ce881a185c99081b1bd8dac81c195c9a5bd9603a1b604482015260640161051e565b60a0810151600090158015906112275782608001519150611259565b60e08501805160a0850152606084015190516112439190612834565b9150826080015182111561125957826080015191505b611263838361148b565b929f919e509c50909a5098505050505050505050565b611281612345565b611289612345565b61129281611297565b919050565b6002546001600160801b038082168352600160801b91829004811660208401526003549182048116606084015216604082015260045464ffffffffff8082166080840152600160281b82041660a0830152600160501b900461ffff1660c0820152611300611c9d565b60e090910152565b600183015464ffffffffff8381169116146113705760405162461bcd60e51b815260206004820152602260248201527f5354414b494e473a207374616b654964506172616d206e6f7420696e207374616044820152616b6560f01b606482015260840161051e565b82546001600160801b038082168352600160801b90910416602082015260019092015464ffffffffff8116604084015261ffff600160281b820481166060850152600160381b820481166080850152600160481b9091041660a09092019190915250565b6113e4818260e001516001611cc8565b50565b60e082015160a0820152608081015160608201516000916114079161269b565b9050808360e0015111610862576020828101516000838152600590925260409091208054601090611449908490600160801b90046001600160801b031661280c565b92506101000a8154816001600160801b0302191690836001600160801b031602179055508160200151836060018181516114839190612834565b905250505050565b60008060008085608001518510156114ce576114b586606001518760800151878960200151611db4565b875191945092506114c790849061269b565b9350611519565b602086015160608701516114ec91906114e7888261269b565b611e74565b86519093506114fc90849061269b565b9350611516866060015187608001518860a0015187611ef5565b91505b811561074b5783821115611530575060009261074b565b508061153c8185612834565b935092959194509250565b60006115546002836126b3565b90508015611602576000600561156b8360036127ed565b61157591906126b3565b600154600054919250611595916001600160a01b03908116911683611620565b6000546001600160a01b03166342966c686115b08385612834565b6040518263ffffffff1660e01b81526004016115ce91815260200190565b600060405180830381600087803b1580156115e857600080fd5b505af11580156115fc573d6000803e3d6000fd5b50505050505b61160c8183612834565b90508083604001818151611483919061269b565b6040516001600160a01b03831660248201526044810182905261086290849063a9059cbb60e01b906064015b60408051601f198184030181529190526020810180516001600160e01b03166001600160e01b031990931692909217909152611f4d565b815181111561086257600061169c828460800151610876565b905060008360200151620186a083856116b5919061269b565b6116bf91906127ed565b6116c991906126b3565b90506116da6001600160281b612834565b8111156116f3576116f06001600160281b612834565b90505b8460a001518111156117505760a08501819052604084810151815164ffffffffff42811682528085166020830152909116917e182ba6ffb6284fb8555aafcbd2eb4ef23dd9c0ebc9b0b6011d9912bf42269f910160405180910390a25b5050505050565b815460009061176890600190612834565b905080821461189b5782818154811061179157634e487b7160e01b600052603260045260246000fd5b90600052602060002090600202018383815481106117bf57634e487b7160e01b600052603260045260246000fd5b60009182526020909120825460029092020180546001600160801b0319166001600160801b0392831690811782558354600160801b9081900490931690920290911781556001918201805492909101805464ffffffffff19811664ffffffffff9094169384178255825461ffff600160281b91829004811690910266ffffffffffffff19909216909417178082558254600160381b9081900485160268ffff00000000000000198216811783559254600160481b9081900490941690930261ffff60481b1990921663ffffffff60381b19909316929092171790555b828054806118b957634e487b7160e01b600052603160045260246000fd5b60008281526020812060026000199093019283020190815560010180546affffffffffffffffffffff191690559055505050565b805160208201516001600160801b03908116600160801b9081029282169290921760025560608301516040840151821691169091026001600160801b0319161760035560808101516004805460a084015160c09094015161ffff16600160501b0261ffff60501b1964ffffffffff958616600160281b0269ffffffffffffffffffff1990931695909416949094171791909116919091179055565b60006119948383610876565b905060008460a00151620186a083866119ad919061269b565b6119b791906127ed565b6119c191906126b3565b905080611a365760405162461bcd60e51b815260206004820152603b60248201527f5354414b494e473a206e65775374616b6564416d6f756e74206d75737420626560448201527f206174206c65617374206d696e696d756d207368617265526174650000000000606482015260840161051e565b60008560e001516001611a49919061269b565b90506000866080018051611a5c90612892565b64ffffffffff1690819052336000908152600660205260409020909150611b6790828886868a6040805160c0810182526001600160801b039586168152938516602080860191825264ffffffffff97881692860192835261ffff9485166060870190815293851660808701908152600060a088018181528b5460018181018e559c835293909120975193518916600160801b029390981692909217600290910290950194855590519390960180549151965194518316600160481b0261ffff60481b19958416600160381b029590951663ffffffff60381b1997909316600160281b0266ffffffffffffff199092169390951692909217919091179390931692909217919091179055565b604080514264ffffffffff90811682526001600160801b03898116602084015286168284015261ffff8816606083015291519183169133917fdc5a18c7d77c61a390e121362aef97759e74c60c7af28d64ab9b0317a06fe9d3919081900360800190a38287602001818151611bdc919061269b565b905250865186908890611bf090839061269b565b9052508260056000611c02888661269b565b815260208101919091526040016000208054601090611c32908490600160801b90046001600160801b0316612670565b92506101000a8154816001600160801b0302191690836001600160801b0316021790555050505050505050565b6040516001600160a01b0380851660248301528316604482015260648101829052611c979085906323b872dd60e01b9060840161164c565b50505050565b600080546201518090611cbe90600160a01b900464ffffffffff1642612834565b61087191906126b3565b818360c0015110611cd857505050565b604080518082019091526000808252602082015260c0840151611cfc85838361201f565b602085015115611d2757846020015185606001818151611d1c919061269b565b905250600060208601525b83611d3182612877565b9150811015611d4a57611d4585838361201f565b611d27565b60c08501516040805164ffffffffff4216815261ffff928316602082015291831690820152831515606082015233907fd4720c04932f90db0fa7867ac4febadff49b85d285d84e328b3b477cbac3858b9060800160405180910390a260c090940193909352505050565b60008080611dc2858861269b565b905060006002611dd388600161269b565b611ddd91906126b3565b9050601e811015611dec5750601e5b85811015611e33576000611e00828a61269b565b9050611e0d868a83611e74565b93506000611e1c878386611e74565b9050611e28818661269b565b955050505050611e6b565b611e3e858984611e74565b935085811415611e5057839250611e68565b85611e5b82866127ed565b611e6591906126b3565b92505b50505b94509492505050565b600080600581611e85600187612834565b81526020019081526020016000206001015460056000600186611ea89190612834565b815260200190815260200160002060010154611ec49190612834565b90506ec097ce7bc90715b34b9f1000000000611ee082876127ed565b611eea91906126b3565b9150505b9392505050565b600080601e611f04868861269b565b611f0e919061269b565b9050808411611f21576000915050611f45565b6064611f2d8286612834565b611f3790856127ed565b611f4191906126b3565b9150505b949350505050565b6000611fa2826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b03166121189092919063ffffffff16565b8051909150156108625780806020019051810190611fc0919061248a565b6108625760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b606482015260840161051e565b600081815260056020526040902054606084018051600160801b9092046001600160801b031691612051908390612834565b90525061205f838383612127565b602080830151600083815260059092526040909120600101556060830151156120b357905160009182526005602052604090912080546001600160801b0319166001600160801b0390921691909117905550565b8151600560006120c484600161269b565b81526020810191909152604001600090812080549091906120ef9084906001600160801b0316612670565b92506101000a8154816001600160801b0302191690836001600160801b03160217905550505050565b6060611f4584846000856121e4565b6000818152600560205260409020546001600160801b03168252801561216d5760056000612156600184612834565b815260200190815260200160002060010154612170565b60005b602083015260408301511561219e5760408301518251839061219390839061269b565b905250600060408401525b60608301511561086257606083015182516121c9906ec097ce7bc90715b34b9f1000000000906127ed565b6121d391906126b3565b82602001818151611483919061269b565b6060824710156122455760405162461bcd60e51b815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f6044820152651c8818d85b1b60d21b606482015260840161051e565b843b6122935760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e7472616374000000604482015260640161051e565b600080866001600160a01b031685876040516122af919061258e565b60006040518083038185875af1925050503d80600081146122ec576040519150601f19603f3d011682016040523d82523d6000602084013e6122f1565b606091505b509150915061230182828661230c565b979650505050505050565b6060831561231b575081611eee565b82511561232b5782518084602001fd5b8160405162461bcd60e51b815260040161051e91906125cf565b60405180610100016040528060008152602001600081526020016000815260200160008152602001600064ffffffffff1681526020016000815260200160008152602001600081525090565b6040518060c001604052806000815260200160008152602001600064ffffffffff1681526020016000815260200160008152602001600081525090565b80356001600160a01b038116811461129257600080fd5b803561ffff8116811461129257600080fd5b803564ffffffffff8116811461129257600080fd5b60006020828403121561241d578081fd5b611eee826123ce565b60008060408385031215612438578081fd5b612441836123ce565b946020939093013593505050565b600080600060608486031215612463578081fd5b61246c846123ce565b925060208401359150612481604085016123f7565b90509250925092565b60006020828403121561249b578081fd5b81518015158114611eee578182fd5b6000806000606084860312156124be578283fd5b83356001600160801b03811681146124d4578384fd5b92506124e2602085016123e5565b9150612481604085016123e5565b600060208284031215612501578081fd5b5035919050565b6000806040838503121561251a578182fd5b50508035926020909101359150565b6000806040838503121561253b578182fd5b8235915061254b602084016123f7565b90509250929050565b6000815180845260208085019450808401835b8381101561258357815187529582019590820190600101612567565b509495945050505050565b600082516125a081846020870161284b565b9190910192915050565b6040815260006125bd6040830185612554565b8281036020840152611eea8185612554565b60208152600082518060208401526125ee81604085016020870161284b565b601f01601f19169190910160400192915050565b60208082526019908201527f5354414b494e473a20456d707479207374616b65206c69737400000000000000604082015260600190565b6020808252601b908201527f5354414b494e473a207374616b65496e64657820696e76616c69640000000000604082015260600190565b60006001600160801b03808316818516808303821115612692576126926128b7565b01949350505050565b600082198211156126ae576126ae6128b7565b500190565b6000826126ce57634e487b7160e01b81526012600452602481fd5b500490565b600181815b8085111561270e5781600019048211156126f4576126f46128b7565b8085161561270157918102915b93841c93908002906126d8565b509250929050565b6000611eee838360008261272c57506001610a31565b8161273957506000610a31565b816001811461274f576002811461275957612775565b6001915050610a31565b60ff84111561276a5761276a6128b7565b50506001821b610a31565b5060208310610133831016604e8410600b8410161715612798575081810a610a31565b6127a283836126d3565b80600019048211156127b6576127b66128b7565b029392505050565b60006001600160801b03808316818516818304811182151516156127e4576127e46128b7565b02949350505050565b6000816000190483118215151615612807576128076128b7565b500290565b60006001600160801b038381169083168181101561282c5761282c6128b7565b039392505050565b600082821015612846576128466128b7565b500390565b60005b8381101561286657818101518382015260200161284e565b83811115611c975750506000910152565b600060001982141561288b5761288b6128b7565b5060010190565b600064ffffffffff808316818114156128ad576128ad6128b7565b6001019392505050565b634e487b7160e01b600052601160045260246000fdfea264697066735822122048205796d5c835234798bf6036c169137398f6f7dab0c7aa31e18ce8cdae9a4964736f6c634300080400330000000000000000000000000f51bb10119727a7e5ea3538074fb341f56b09ad0000000000000000000000000000000000000000000000000000000061998c00000000000000000000000000fc31c7d16514e3584d875563122e9db97cf83c0d
Deployed Bytecode
0x608060405234801561001057600080fd5b506004361061010b5760003560e01c80636a210a0e116100a257806390de68711161007157806390de6871146102c0578063c312452514610322578063d438e127146103ca578063f02726fe146103dd578063f04b5fa0146103f057600080fd5b80636a210a0e1461023357806372f702f314610254578063790ca4131461027f5780638f1c65c0146102ad57600080fd5b80635c9302c9116100de5780635c9302c9146101f25780635e644556146101fa578063610fb65e1461020d57806365cf71b21461022057600080fd5b80632607443b1461011057806333060d9014610173578063343009a2146101aa57806352a438b8146101dd575b600080fd5b61012361011e366004612426565b610460565b604080516001600160801b03978816815296909516602087015264ffffffffff9093169385019390935261ffff908116606085015291821660808401521660a082015260c0015b60405180910390f35b61019c61018136600461240c565b6001600160a01b031660009081526006602052604090205490565b60405190815260200161016a565b6101bd6101b8366004612529565b6104da565b60408051948552602085019390935291830152606082015260800161016a565b6101f06101eb366004612508565b610754565b005b61019c610867565b61019c610208366004612508565b610876565b6101f061021b3660046124aa565b610a37565b6101f061022e36600461244f565b610ba9565b610246610241366004612508565b610eb4565b60405161016a9291906125aa565b600054610267906001600160a01b031681565b6040516001600160a01b03909116815260200161016a565b60005461029790600160a01b900464ffffffffff1681565b60405164ffffffffff909116815260200161016a565b6101f06102bb3660046124f0565b611067565b6102fc6102ce3660046124f0565b600560205260009081526040902080546001909101546001600160801b0380831692600160801b9004169083565b604080516001600160801b0394851681529390921660208401529082015260600161016a565b600254600354600454610375926001600160801b0380821693600160801b92839004821693828216939091049091169064ffffffffff80821691600160281b810490911690600160501b900461ffff1687565b604080516001600160801b03988916815296881660208801529487169486019490945294909116606084015264ffffffffff908116608084015290921660a082015261ffff90911660c082015260e00161016a565b6101bd6103d836600461244f565b611113565b600154610267906001600160a01b031681565b6103f8611279565b60405161016a91906000610100820190508251825260208301516020830152604083015160408301526060830151606083015264ffffffffff608084015116608083015260a083015160a083015260c083015160c083015260e083015160e083015292915050565b6006602052816000526040600020818154811061047c57600080fd5b6000918252602090912060029091020180546001909101546001600160801b038083169450600160801b909204909116915064ffffffffff81169061ffff600160281b8204811691600160381b8104821691600160481b9091041686565b6000806000806104e8612345565b6104f181611297565b33600090815260066020526040902080546105275760405162461bcd60e51b815260040161051e90612602565b60405180910390fd5b805488106105475760405162461bcd60e51b815260040161051e90612639565b61054f612391565b610587828a8154811061057257634e487b7160e01b600052603260045260246000fd5b90600052602060002090600202018983611308565b610590836113d4565b600e81606001516105a1919061269b565b8360e0015110156105f05760405162461bcd60e51b815260206004820152601960248201527814d51052d25391ce881a185c99081b1bd8dac81c195c9a5bd9603a1b604482015260640161051e565b60a08101516000901580159061060c5782608001519150610640565b61061685846113e7565b82606001518560e0015161062a9190612834565b9150826080015182111561064057826080015191505b61064a838361148b565b86516020808901516040805164ffffffffff42811682526001600160801b0395861694820194909452918416908201528583166060820152918416608083015261ffff881660a083015286151560c0830152949d50929b509099509750908b169033907f1ca44014a5a36217a467507491f4bb0117097c066ab4108946fb579e63db90d99060e00160405180910390a385158015906106e7575080155b156106f6576106f68587611547565b881561071e57600054610713906001600160a01b0316338b611620565b61071e85848b611683565b82518551869061072f908390612834565b90525061073c848c611757565b610745856118ed565b50505050505b92959194509250565b61075c612345565b61076581611297565b601e8210156107c85760405162461bcd60e51b815260206004820152602960248201527f5354414b494e473a206e65775374616b656444617973206c6f776572207468616044820152686e206d696e696d756d60b81b606482015260840161051e565b61044782111561082d5760405162461bcd60e51b815260206004820152602a60248201527f5354414b494e473a206e65775374616b65644461797320686967686572207468604482015269616e206d6178696d756d60b01b606482015260840161051e565b610836816113d4565b610841818484611988565b600054610859906001600160a01b0316333086611c5f565b610862816118ed565b505050565b6000610871611c9d565b905090565b60008060018311156108ea576064610708610895610258618e306126b3565b61089f91906127ed565b6108a991906126b3565b8311156108dc5760646107086108c3610258618e306126b3565b6108cd91906127ed565b6108d791906126b3565b6108e7565b6108e7600184612834565b90505b60006108f86012600a612716565b6109049061c3506127ed565b851015610912576000610934565b61091e6012600a612716565b61092a9061c3506127ed565b6109349086612834565b90506109426012600a612716565b61094f90620f42406127ed565b811115610972576109626012600a612716565b61096f90620f42406127ed565b90505b610980610258618e306126b3565b61098a90826127ed565b60326109986012600a612716565b6109a590620f42406127ed565b6109b09060646127ed565b6109ba91906126b3565b6109c490846127ed565b6109ce919061269b565b925060326109de6012600a612716565b6109eb90620f42406127ed565b6109f69060646127ed565b610a0091906126b3565b610a0e610258618e306126b3565b610a1891906127ed565b610a2284876127ed565b610a2c91906126b3565b925050505b92915050565b61016d8261ffff161115610a865760405162461bcd60e51b81526020600482015260166024820152755354414b494e473a20746f6f206d616e79206461797360501b604482015260640161051e565b610ab63330610a9961ffff8616876127be565b6000546001600160a01b03169291906001600160801b0316611c5f565b6000610ac0611c9d565b610acb90600161269b565b90506000610add61ffff84168361269b565b9050805b610aef61ffff86168361269b565b811015610b545760008181526005602052604081208054889290610b1d9084906001600160801b0316612670565b92506101000a8154816001600160801b0302191690836001600160801b031602179055508080610b4c90612877565b915050610ae1565b50604080516001600160801b038716815261ffff868116602083015285168183015290517fe706f5bbf34ae632280ae6d6411d2d3b922d10d6cd867a24c8493dea376696b49181900360600190a15050505050565b610bb1612345565b610bba81611297565b6001600160a01b038416600090815260066020526040902054610bef5760405162461bcd60e51b815260040161051e90612602565b6001600160a01b0384166000908152600660205260409020548310610c265760405162461bcd60e51b815260040161051e90612639565b6001600160a01b0384166000908152600660205260408120805485908110610c5e57634e487b7160e01b600052603260045260246000fd5b90600052602060002090600202019050610c76612391565b610c81828583611308565b80608001518160600151610c95919061269b565b8360e001511015610ce85760405162461bcd60e51b815260206004820152601f60248201527f5354414b494e473a205374616b65206e6f742066756c6c792073657276656400604482015260640161051e565b60a081015115610d3a5760405162461bcd60e51b815260206004820152601f60248201527f5354414b494e473a205374616b6520616c726561647920756e6c6f636b656400604482015260640161051e565b610d43836113d4565b610d4d83826113e7565b6000806000610d6084856080015161148b565b93509350935050336001600160a01b03168764ffffffffff168a6001600160a01b03167f458d80ef9a762f50dcda80bcb3f4c76ff1f31b1316c391a2716909f984774aee42886000015189602001518989604051610df495949392919064ffffffffff9590951685526001600160801b03938416602086015291831660408501528216606084015216608082015260a00190565b60405180910390a48015610e0c57610e0c8682611547565b835160208501516001600160801b03918216600160801b929091169190910217855560408401516001860180546060870151608088015160a089015164ffffffffff90951666ffffffffffffff1990931692909217600160281b61ffff928316021763ffffffff60381b1916600160381b9282169290920261ffff60481b191691909117600160481b9190931602919091179055610ea9866118ed565b505050505050505050565b606080828410610eff5760405162461bcd60e51b815260206004820152601660248201527514d51052d25391ce881c985b99d9481a5b9d985b1a5960521b604482015260640161051e565b610f098484612834565b67ffffffffffffffff811115610f2f57634e487b7160e01b600052604160045260246000fd5b604051908082528060200260200182016040528015610f58578160200160208202803683370190505b509150610f658484612834565b67ffffffffffffffff811115610f8b57634e487b7160e01b600052604160045260246000fd5b604051908082528060200260200182016040528015610fb4578160200160208202803683370190505b5090508360005b6000828152600560205260409020600101548451859083908110610fef57634e487b7160e01b600052603260045260246000fd5b6020908102919091018101919091526000838152600590915260409020546001600160801b0316838261102181612877565b93508151811061104157634e487b7160e01b600052603260045260246000fd5b60209081029190910101528461105683612877565b92508210610fbb5750509250929050565b61106f612345565b61107881611297565b81156110f6578060e001518211156110e55760405162461bcd60e51b815260206004820152602a60248201527f5354414b494e473a206265666f72654461792063616e6e6f7420626520696e206044820152697468652066757475726560b01b606482015260840161051e565b6110f181836000611cc8565b611106565b611106818260e001516000611cc8565b61110f816118ed565b5050565b600080600080611121612345565b61112a81611297565b6001600160a01b038816600090815260066020526040902080546111605760405162461bcd60e51b815260040161051e90612602565b805488106111805760405162461bcd60e51b815260040161051e90612639565b611188612391565b6111ab828a8154811061057257634e487b7160e01b600052603260045260246000fd5b600e81606001516111bc919061269b565b8360e00151101561120b5760405162461bcd60e51b815260206004820152601960248201527814d51052d25391ce881a185c99081b1bd8dac81c195c9a5bd9603a1b604482015260640161051e565b60a0810151600090158015906112275782608001519150611259565b60e08501805160a0850152606084015190516112439190612834565b9150826080015182111561125957826080015191505b611263838361148b565b929f919e509c50909a5098505050505050505050565b611281612345565b611289612345565b61129281611297565b919050565b6002546001600160801b038082168352600160801b91829004811660208401526003549182048116606084015216604082015260045464ffffffffff8082166080840152600160281b82041660a0830152600160501b900461ffff1660c0820152611300611c9d565b60e090910152565b600183015464ffffffffff8381169116146113705760405162461bcd60e51b815260206004820152602260248201527f5354414b494e473a207374616b654964506172616d206e6f7420696e207374616044820152616b6560f01b606482015260840161051e565b82546001600160801b038082168352600160801b90910416602082015260019092015464ffffffffff8116604084015261ffff600160281b820481166060850152600160381b820481166080850152600160481b9091041660a09092019190915250565b6113e4818260e001516001611cc8565b50565b60e082015160a0820152608081015160608201516000916114079161269b565b9050808360e0015111610862576020828101516000838152600590925260409091208054601090611449908490600160801b90046001600160801b031661280c565b92506101000a8154816001600160801b0302191690836001600160801b031602179055508160200151836060018181516114839190612834565b905250505050565b60008060008085608001518510156114ce576114b586606001518760800151878960200151611db4565b875191945092506114c790849061269b565b9350611519565b602086015160608701516114ec91906114e7888261269b565b611e74565b86519093506114fc90849061269b565b9350611516866060015187608001518860a0015187611ef5565b91505b811561074b5783821115611530575060009261074b565b508061153c8185612834565b935092959194509250565b60006115546002836126b3565b90508015611602576000600561156b8360036127ed565b61157591906126b3565b600154600054919250611595916001600160a01b03908116911683611620565b6000546001600160a01b03166342966c686115b08385612834565b6040518263ffffffff1660e01b81526004016115ce91815260200190565b600060405180830381600087803b1580156115e857600080fd5b505af11580156115fc573d6000803e3d6000fd5b50505050505b61160c8183612834565b90508083604001818151611483919061269b565b6040516001600160a01b03831660248201526044810182905261086290849063a9059cbb60e01b906064015b60408051601f198184030181529190526020810180516001600160e01b03166001600160e01b031990931692909217909152611f4d565b815181111561086257600061169c828460800151610876565b905060008360200151620186a083856116b5919061269b565b6116bf91906127ed565b6116c991906126b3565b90506116da6001600160281b612834565b8111156116f3576116f06001600160281b612834565b90505b8460a001518111156117505760a08501819052604084810151815164ffffffffff42811682528085166020830152909116917e182ba6ffb6284fb8555aafcbd2eb4ef23dd9c0ebc9b0b6011d9912bf42269f910160405180910390a25b5050505050565b815460009061176890600190612834565b905080821461189b5782818154811061179157634e487b7160e01b600052603260045260246000fd5b90600052602060002090600202018383815481106117bf57634e487b7160e01b600052603260045260246000fd5b60009182526020909120825460029092020180546001600160801b0319166001600160801b0392831690811782558354600160801b9081900490931690920290911781556001918201805492909101805464ffffffffff19811664ffffffffff9094169384178255825461ffff600160281b91829004811690910266ffffffffffffff19909216909417178082558254600160381b9081900485160268ffff00000000000000198216811783559254600160481b9081900490941690930261ffff60481b1990921663ffffffff60381b19909316929092171790555b828054806118b957634e487b7160e01b600052603160045260246000fd5b60008281526020812060026000199093019283020190815560010180546affffffffffffffffffffff191690559055505050565b805160208201516001600160801b03908116600160801b9081029282169290921760025560608301516040840151821691169091026001600160801b0319161760035560808101516004805460a084015160c09094015161ffff16600160501b0261ffff60501b1964ffffffffff958616600160281b0269ffffffffffffffffffff1990931695909416949094171791909116919091179055565b60006119948383610876565b905060008460a00151620186a083866119ad919061269b565b6119b791906127ed565b6119c191906126b3565b905080611a365760405162461bcd60e51b815260206004820152603b60248201527f5354414b494e473a206e65775374616b6564416d6f756e74206d75737420626560448201527f206174206c65617374206d696e696d756d207368617265526174650000000000606482015260840161051e565b60008560e001516001611a49919061269b565b90506000866080018051611a5c90612892565b64ffffffffff1690819052336000908152600660205260409020909150611b6790828886868a6040805160c0810182526001600160801b039586168152938516602080860191825264ffffffffff97881692860192835261ffff9485166060870190815293851660808701908152600060a088018181528b5460018181018e559c835293909120975193518916600160801b029390981692909217600290910290950194855590519390960180549151965194518316600160481b0261ffff60481b19958416600160381b029590951663ffffffff60381b1997909316600160281b0266ffffffffffffff199092169390951692909217919091179390931692909217919091179055565b604080514264ffffffffff90811682526001600160801b03898116602084015286168284015261ffff8816606083015291519183169133917fdc5a18c7d77c61a390e121362aef97759e74c60c7af28d64ab9b0317a06fe9d3919081900360800190a38287602001818151611bdc919061269b565b905250865186908890611bf090839061269b565b9052508260056000611c02888661269b565b815260208101919091526040016000208054601090611c32908490600160801b90046001600160801b0316612670565b92506101000a8154816001600160801b0302191690836001600160801b0316021790555050505050505050565b6040516001600160a01b0380851660248301528316604482015260648101829052611c979085906323b872dd60e01b9060840161164c565b50505050565b600080546201518090611cbe90600160a01b900464ffffffffff1642612834565b61087191906126b3565b818360c0015110611cd857505050565b604080518082019091526000808252602082015260c0840151611cfc85838361201f565b602085015115611d2757846020015185606001818151611d1c919061269b565b905250600060208601525b83611d3182612877565b9150811015611d4a57611d4585838361201f565b611d27565b60c08501516040805164ffffffffff4216815261ffff928316602082015291831690820152831515606082015233907fd4720c04932f90db0fa7867ac4febadff49b85d285d84e328b3b477cbac3858b9060800160405180910390a260c090940193909352505050565b60008080611dc2858861269b565b905060006002611dd388600161269b565b611ddd91906126b3565b9050601e811015611dec5750601e5b85811015611e33576000611e00828a61269b565b9050611e0d868a83611e74565b93506000611e1c878386611e74565b9050611e28818661269b565b955050505050611e6b565b611e3e858984611e74565b935085811415611e5057839250611e68565b85611e5b82866127ed565b611e6591906126b3565b92505b50505b94509492505050565b600080600581611e85600187612834565b81526020019081526020016000206001015460056000600186611ea89190612834565b815260200190815260200160002060010154611ec49190612834565b90506ec097ce7bc90715b34b9f1000000000611ee082876127ed565b611eea91906126b3565b9150505b9392505050565b600080601e611f04868861269b565b611f0e919061269b565b9050808411611f21576000915050611f45565b6064611f2d8286612834565b611f3790856127ed565b611f4191906126b3565b9150505b949350505050565b6000611fa2826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b03166121189092919063ffffffff16565b8051909150156108625780806020019051810190611fc0919061248a565b6108625760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b606482015260840161051e565b600081815260056020526040902054606084018051600160801b9092046001600160801b031691612051908390612834565b90525061205f838383612127565b602080830151600083815260059092526040909120600101556060830151156120b357905160009182526005602052604090912080546001600160801b0319166001600160801b0390921691909117905550565b8151600560006120c484600161269b565b81526020810191909152604001600090812080549091906120ef9084906001600160801b0316612670565b92506101000a8154816001600160801b0302191690836001600160801b03160217905550505050565b6060611f4584846000856121e4565b6000818152600560205260409020546001600160801b03168252801561216d5760056000612156600184612834565b815260200190815260200160002060010154612170565b60005b602083015260408301511561219e5760408301518251839061219390839061269b565b905250600060408401525b60608301511561086257606083015182516121c9906ec097ce7bc90715b34b9f1000000000906127ed565b6121d391906126b3565b82602001818151611483919061269b565b6060824710156122455760405162461bcd60e51b815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f6044820152651c8818d85b1b60d21b606482015260840161051e565b843b6122935760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e7472616374000000604482015260640161051e565b600080866001600160a01b031685876040516122af919061258e565b60006040518083038185875af1925050503d80600081146122ec576040519150601f19603f3d011682016040523d82523d6000602084013e6122f1565b606091505b509150915061230182828661230c565b979650505050505050565b6060831561231b575081611eee565b82511561232b5782518084602001fd5b8160405162461bcd60e51b815260040161051e91906125cf565b60405180610100016040528060008152602001600081526020016000815260200160008152602001600064ffffffffff1681526020016000815260200160008152602001600081525090565b6040518060c001604052806000815260200160008152602001600064ffffffffff1681526020016000815260200160008152602001600081525090565b80356001600160a01b038116811461129257600080fd5b803561ffff8116811461129257600080fd5b803564ffffffffff8116811461129257600080fd5b60006020828403121561241d578081fd5b611eee826123ce565b60008060408385031215612438578081fd5b612441836123ce565b946020939093013593505050565b600080600060608486031215612463578081fd5b61246c846123ce565b925060208401359150612481604085016123f7565b90509250925092565b60006020828403121561249b578081fd5b81518015158114611eee578182fd5b6000806000606084860312156124be578283fd5b83356001600160801b03811681146124d4578384fd5b92506124e2602085016123e5565b9150612481604085016123e5565b600060208284031215612501578081fd5b5035919050565b6000806040838503121561251a578182fd5b50508035926020909101359150565b6000806040838503121561253b578182fd5b8235915061254b602084016123f7565b90509250929050565b6000815180845260208085019450808401835b8381101561258357815187529582019590820190600101612567565b509495945050505050565b600082516125a081846020870161284b565b9190910192915050565b6040815260006125bd6040830185612554565b8281036020840152611eea8185612554565b60208152600082518060208401526125ee81604085016020870161284b565b601f01601f19169190910160400192915050565b60208082526019908201527f5354414b494e473a20456d707479207374616b65206c69737400000000000000604082015260600190565b6020808252601b908201527f5354414b494e473a207374616b65496e64657820696e76616c69640000000000604082015260600190565b60006001600160801b03808316818516808303821115612692576126926128b7565b01949350505050565b600082198211156126ae576126ae6128b7565b500190565b6000826126ce57634e487b7160e01b81526012600452602481fd5b500490565b600181815b8085111561270e5781600019048211156126f4576126f46128b7565b8085161561270157918102915b93841c93908002906126d8565b509250929050565b6000611eee838360008261272c57506001610a31565b8161273957506000610a31565b816001811461274f576002811461275957612775565b6001915050610a31565b60ff84111561276a5761276a6128b7565b50506001821b610a31565b5060208310610133831016604e8410600b8410161715612798575081810a610a31565b6127a283836126d3565b80600019048211156127b6576127b66128b7565b029392505050565b60006001600160801b03808316818516818304811182151516156127e4576127e46128b7565b02949350505050565b6000816000190483118215151615612807576128076128b7565b500290565b60006001600160801b038381169083168181101561282c5761282c6128b7565b039392505050565b600082821015612846576128466128b7565b500390565b60005b8381101561286657818101518382015260200161284e565b83811115611c975750506000910152565b600060001982141561288b5761288b6128b7565b5060010190565b600064ffffffffff808316818114156128ad576128ad6128b7565b6001019392505050565b634e487b7160e01b600052601160045260246000fdfea264697066735822122048205796d5c835234798bf6036c169137398f6f7dab0c7aa31e18ce8cdae9a4964736f6c63430008040033
Constructor Arguments (ABI-Encoded and is the last bytes of the Contract Creation Code above)
0000000000000000000000000f51bb10119727a7e5ea3538074fb341f56b09ad0000000000000000000000000000000000000000000000000000000061998c00000000000000000000000000fc31c7d16514e3584d875563122e9db97cf83c0d
-----Decoded View---------------
Arg [0] : _stakingToken (address): 0x0f51bb10119727a7e5eA3538074fb341F56B09Ad
Arg [1] : _launchTime (uint40): 1637452800
Arg [2] : _originAddr (address): 0xfc31C7d16514E3584D875563122e9Db97Cf83c0d
-----Encoded View---------------
3 Constructor Arguments found :
Arg [0] : 0000000000000000000000000f51bb10119727a7e5ea3538074fb341f56b09ad
Arg [1] : 0000000000000000000000000000000000000000000000000000000061998c00
Arg [2] : 000000000000000000000000fc31c7d16514e3584d875563122e9db97cf83c0d
Loading...
Loading
Loading...
Loading
OVERVIEW
Staking contract developed by DAO Maker to access all features of $DAO.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.