Contract Overview
Balance:
0 MATIC
MATIC Value:
$0.00
My Name Tag:
Not Available, login to update
Txn Hash |
Method
|
Block
|
From
|
To
|
Value | [Txn Fee] | |||
---|---|---|---|---|---|---|---|---|---|
0x5cc0eb4de960db839b2466b6a4af27f070a8a86f7f42c487b0da84471f5e357c | 0x60806040 | 36862607 | 44 days 2 hrs ago | 0x5a5d0ad85762979caae341274f0eba22df8ecedd | IN | Create: Deb0xViews | 0 MATIC | 0.226362017736 |
[ Download CSV Export ]
Contract Source Code Verified (Exact Match)
Contract Name:
Deb0xViews
Compiler Version
v0.8.17+commit.8df45f5f
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.17; import "./Deb0x.sol"; import "./Deb0xERC20.sol"; /** * Helper contract used to optimize deb0x state queries made by clients. */ contract Deb0xViews { /** * Main deb0x contract address to get the data from. */ Deb0x deb0x; /** * Reward token address. */ Deb0xERC20 dbxERC20; /** * @param _deb0x Deb0x.sol contract address */ constructor(Deb0x _deb0x) { deb0x = _deb0x; } /** * @return main deb0x contract native coin balance */ function deb0xContractBalance() external view returns (uint256) { return address(deb0x).balance; } /** * @dev Withdrawable stake is the amount of deb0x reward tokens that are currently * 'unlocked' and can be unstaked by a given account. * * @param staker the address to query the withdrawable stake for * @return the amount in wei */ function getAccWithdrawableStake(address staker) external view returns (uint256) { uint256 calculatedCycle = deb0x.getCurrentCycle(); uint256 unlockedStake = 0; if ( deb0x.accFirstStake(staker) != 0 && calculatedCycle > deb0x.accFirstStake(staker) ) { unlockedStake += deb0x.accStakeCycle( staker, deb0x.accFirstStake(staker) ); if ( deb0x.accSecondStake(staker) != 0 && calculatedCycle > deb0x.accSecondStake(staker) ) { unlockedStake += deb0x.accStakeCycle( staker, deb0x.accSecondStake(staker) ); } } return deb0x.accWithdrawableStake(staker) + unlockedStake; } /** * @dev Unclaimed fees represent the native coin amount that has been allocated * to a given account but was not claimed yet. * * @param account the address to query the unclaimed fees for * @return the amount in wei */ function getUnclaimedFees(address account) external view returns (uint256) { uint256 calculatedCycle = deb0x.getCurrentCycle(); uint256 currentAccruedFees = deb0x.accAccruedFees(account); uint256 currentCycleFeesPerStakeSummed; uint256 previousStartedCycleTemp = deb0x.previousStartedCycle(); uint256 lastStartedCycleTemp = deb0x.lastStartedCycle(); if (calculatedCycle != deb0x.currentStartedCycle()) { previousStartedCycleTemp = lastStartedCycleTemp + 1; lastStartedCycleTemp = deb0x.currentStartedCycle(); } if ( calculatedCycle > lastStartedCycleTemp && deb0x.cycleFeesPerStakeSummed(lastStartedCycleTemp + 1) == 0 ) { uint256 feePerStake = 0; if(deb0x.summedCycleStakes(lastStartedCycleTemp) != 0){ feePerStake = ((deb0x.cycleAccruedFees( lastStartedCycleTemp ) + deb0x.pendingFees()) * deb0x.SCALING_FACTOR()) / deb0x.summedCycleStakes(lastStartedCycleTemp); } currentCycleFeesPerStakeSummed = deb0x.cycleFeesPerStakeSummed(previousStartedCycleTemp) + feePerStake; } else { currentCycleFeesPerStakeSummed = deb0x.cycleFeesPerStakeSummed( deb0x.previousStartedCycle() ); } uint256 currentRewards = getUnclaimedRewards(account); if ( calculatedCycle > lastStartedCycleTemp && deb0x.lastFeeUpdateCycle(account) != lastStartedCycleTemp + 1 ) { currentAccruedFees += ( (currentRewards * (currentCycleFeesPerStakeSummed - deb0x.cycleFeesPerStakeSummed( deb0x.lastFeeUpdateCycle(account) ))) ) / deb0x.SCALING_FACTOR(); } if ( deb0x.accFirstStake(account) != 0 && calculatedCycle > deb0x.accFirstStake(account) && lastStartedCycleTemp + 1 > deb0x.accFirstStake(account) ) { currentAccruedFees += ( (deb0x.accStakeCycle(account, deb0x.accFirstStake(account)) * (currentCycleFeesPerStakeSummed - deb0x.cycleFeesPerStakeSummed(deb0x.accFirstStake(account) ))) ) / deb0x.SCALING_FACTOR(); if ( deb0x.accSecondStake(account) != 0 && calculatedCycle > deb0x.accSecondStake(account) && lastStartedCycleTemp + 1 > deb0x.accSecondStake(account) ) { currentAccruedFees += ( (deb0x.accStakeCycle(account, deb0x.accSecondStake(account) ) * (currentCycleFeesPerStakeSummed - deb0x.cycleFeesPerStakeSummed( deb0x.accSecondStake(account) ))) ) / deb0x.SCALING_FACTOR(); } } return currentAccruedFees; } /** * @return the reward token amount allocated for the current cycle */ function calculateCycleReward() public view returns (uint256) { return (deb0x.lastCycleReward() * 10000) / 10020; } /** * @dev Unclaimed rewards represent the amount of deb0x reward tokens * that were allocated but were not withdrawn by a given account. * * @param account the address to query the unclaimed rewards for * @return the amount in wei */ function getUnclaimedRewards(address account) public view returns (uint256) { uint256 currentRewards = deb0x.accRewards(account); uint256 calculatedCycle = deb0x.getCurrentCycle(); if ( calculatedCycle > deb0x.lastActiveCycle(account) && deb0x.accCycleGasUsed(account) != 0 ) { uint256 lastCycleAccReward = (deb0x.accCycleGasUsed(account) * deb0x.rewardPerCycle(deb0x.lastActiveCycle(account))) / deb0x.cycleTotalGasUsed(deb0x.lastActiveCycle(account)); currentRewards += lastCycleAccReward; } return currentRewards; } }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.17; import "@openzeppelin/contracts/metatx/ERC2771Context.sol"; import "@openzeppelin/contracts/security/ReentrancyGuard.sol"; import "./Deb0xERC20.sol"; /** * Main deb0x protocol contract used to send messages, * store public keys, allocate token rewards, * distribute native token fees, stake and unstake. */ contract Deb0x is ERC2771Context, ReentrancyGuard { /** * Deb0x Reward Token contract. * Initialized in constructor. */ Deb0xERC20 public dbx; /** * Basis points (bps) representation of the protocol fee (i.e. 10 percent). * Calls to send function charge 1000 bps of transaction cost. */ uint16 public constant PROTOCOL_FEE = 1000; /** * Basis points representation of 100 percent. */ uint16 public constant MAX_BPS = 10000; /** * Used to minimise division remainder when earned fees are calculated. */ uint256 public constant SCALING_FACTOR = 1e40; /** * Contract creation timestamp. * Initialized in constructor. */ uint256 public immutable i_initialTimestamp; /** * Length of a reward distribution cycle. * Initialized in contstructor to 1 day. */ uint256 public immutable i_periodDuration; /** * Reward token amount allocated for the current cycle. */ uint256 public currentCycleReward; /** * Reward token amount allocated for the previous cycle. */ uint256 public lastCycleReward; /** * Helper variable to store pending stake amount. */ uint256 public pendingStake; /** * Index (0-based) of the current cycle. * * Updated upon cycle setup that is triggered by contract interraction * (account sends message, claims fees, claims rewards, stakes or unstakes). */ uint256 public currentCycle; /** * Helper variable to store the index of the last active cycle. */ uint256 public lastStartedCycle; /** * Stores the index of the penultimate active cycle plus one. */ uint256 public previousStartedCycle; /** * Helper variable to store the index of the last active cycle. */ uint256 public currentStartedCycle; /** * Stores the amount of stake that will be subracted from the total * stake once a new cycle starts. */ uint256 public pendingStakeWithdrawal; /** * Accumulates fees while there are no tokens staked after the * entire token supply has been distributed. Once tokens are * staked again, these fees will be distributed in the next * active cycle. */ uint256 public pendingFees; /** * Message ID that is incremented every time a message is sent. */ uint256 public sentId = 1; /** * Stores the public keys of accounts. */ mapping(address => bytes32) public publicKeys; /** * The amount of gas an account owes towards clients. */ mapping(address => uint256) public accCycleGasOwed; /** * The amount of gas a client has received from owed * account gas. */ mapping(address => uint256) public clientCycleGasEarned; /** * The amount of gas an account has spent sending messages. * Resets during a new cycle when an account performs an action * that updates its stats. */ mapping(address => uint256) public accCycleGasUsed; /** * The total amount of gas all accounts have spent sending * messages per cycle. */ mapping(uint256 => uint256) public cycleTotalGasUsed; /** * The last cycle in which an account has sent messages. */ mapping(address => uint256) public lastActiveCycle; /** * The last cycle in which the client had its reward updated. */ mapping(address => uint256) public clientLastRewardUpdate; /** * The last cycle in which the client had its earned fees updated. */ mapping(address => uint256) public clientLastFeeUpdate; /** * The fee amount the client can withdraw. */ mapping(address => uint256) public clientAccruedFees; /** * Current unclaimed rewards and staked amounts per account. */ mapping(address => uint256) public accRewards; /** * The fee amount the account can withdraw. */ mapping(address => uint256) public accAccruedFees; /** * Current unclaimed rewards per client. */ mapping(address => uint256) public clientRewards; /** * Total token rewards allocated per cycle. */ mapping(uint256 => uint256) public rewardPerCycle; /** * Total unclaimed token reward and stake. * * Updated when a new cycle starts and when an account claims rewards, stakes or unstakes externally owned tokens. */ mapping(uint256 => uint256) public summedCycleStakes; /** * The last cycle in which the account had its fees updated. */ mapping(address => uint256) public lastFeeUpdateCycle; /** * The total amount of accrued fees per cycle. */ mapping(uint256 => uint256) public cycleAccruedFees; /** * Sum of previous total cycle accrued fees divided by cycle stake. */ mapping(uint256 => uint256) public cycleFeesPerStakeSummed; /** * Amount an account has staked and is locked during given cycle. */ mapping(address => mapping(uint256 => uint256)) public accStakeCycle; /** * Stake amount an account can currently withdraw. */ mapping(address => uint256) public accWithdrawableStake; /** * Cycle in which an account's stake is locked and begins generating fees. */ mapping(address => uint256) public accFirstStake; /** * Same as accFirstStake, but stores the second stake seperately * in case the account stakes in two consecutive active cycles. */ mapping(address => uint256) public accSecondStake; /** * @dev Emitted when the client operating `account` claims an amount of `fees` * in native token through {claimClientFees} in `cycle`. */ event ClientFeesClaimed( uint256 indexed cycle, address indexed account, uint256 fees ); /** * @dev Emitted when `account` claims an amount of `fees` in native token * through {claimFees} in `cycle`. */ event FeesClaimed( uint256 indexed cycle, address indexed account, uint256 fees ); /** * @dev Emitted when `account` stakes `amount` DBX tokens through * {stake} in `cycle`. */ event Staked( uint256 indexed cycle, address indexed account, uint256 amount ); /** * @dev Emitted when `account` unstakes `amount` DBX tokens through * {unstake} in `cycle`. */ event Unstaked( uint256 indexed cycle, address indexed account, uint256 amount ); /** * @dev Emitted when client operating `account` claims `amount` DBX * token rewards through {claimRewards} in `cycle`. */ event ClientRewardsClaimed( uint256 indexed cycle, address indexed account, uint256 amount ); /** * @dev Emitted when `account` claims `amount` DBX * token rewards through {claimRewards} in `cycle`. */ event RewardsClaimed( uint256 indexed cycle, address indexed account, uint256 reward ); /** * @dev Emitted when calling {send} marking the new current `cycle`, * `calculatedCycleReward` and `summedCycleStakes`. */ event NewCycleStarted( uint256 indexed cycle, uint256 calculatedCycleReward, uint256 summedCycleStakes ); /** * @dev Emitted when calling {send} in the current `cycle`, * containing the message details such as which `sentId` it has, * who the `feeReceiver` is and what `msgFee` it set, respectively * any additional `nativeTokenFee` that was paid. */ event SendEntryCreated( uint256 indexed cycle, uint256 indexed sentId, address indexed feeReceiver, uint256 msgFee, uint256 nativeTokenFee ); /** * @dev Emitted when calling {send} containing the message * details such as `to` destination address, `from` sender * address, `hash` of the content reference, `sentId`, * `timestamp` and `content`. */ event Sent( address indexed to, address indexed from, bytes32 indexed hash, uint256 sentId, uint256 timestamp, bytes32[] content ); /** * @dev Emitted when calling {setKey}, `to` being assigned this key `value`. */ event KeySet( address indexed to, bytes32 indexed value ); /** * @dev Measures the amount of consummed gas. * In case a fee is applied, the corresponding percentage will be recorded * as consumed by the feeReceiver instead of the caller. * * @param feeReceiver the address of the fee receiver (client). * @param msgFee fee percentage expressed in basis points. */ modifier gasUsed(address feeReceiver, uint256 msgFee) { uint256 startGas = gasleft(); _; uint256 gasConsumed = startGas - gasleft(); cycleTotalGasUsed[currentCycle] += gasConsumed; if (feeReceiver != address(0) && msgFee != 0) { uint256 gasOwed = (gasConsumed * msgFee) / MAX_BPS; gasConsumed -= gasOwed; clientCycleGasEarned[feeReceiver] += gasOwed; } accCycleGasUsed[_msgSender()] += gasConsumed; } /** * @dev Checks that the caller has sent an amount that is equal or greater * than the sum of the protocol fee and the client's native token fee. * The change is sent back to the caller. * * @param nativeTokenFee the amount charged by the client. */ modifier gasWrapper(uint256 nativeTokenFee) { uint256 startGas = gasleft(); _; uint256 fee = ((startGas - gasleft() + 39700) * tx.gasprice * PROTOCOL_FEE) / MAX_BPS; require( msg.value - nativeTokenFee >= fee, "Deb0x: value less than required protocol fee" ); cycleAccruedFees[currentCycle] += fee; sendViaCall(payable(msg.sender), msg.value - fee - nativeTokenFee); } /** * @param forwarder forwarder contract address. */ constructor(address forwarder) ERC2771Context(forwarder) { dbx = new Deb0xERC20(); i_initialTimestamp = block.timestamp; i_periodDuration = 1 days; currentCycleReward = 10000 * 1e18; summedCycleStakes[0] = 10000 * 1e18; rewardPerCycle[0] = 10000 * 1e18; } /** * @dev Stores the public key of the sender account. * * @param publicKey as encoded by the client. */ function setKey(bytes32 publicKey) external { publicKeys[_msgSender()] = publicKey; emit KeySet(_msgSender(), publicKey); } /** * @dev Sends messages to multiple accounts. Triggers helper functions * used to update cycle, rewards and fees related state. * Optionally may include extra reward token fee and native coin fees on-top of the default protocol fee. * These fees are set in the client user intarface the transaction sender interacts with. * * @param to account addresses to send messages to. * @param crefs content references to the messages. * @param feeReceiver client address. * @param msgFee on-top reward token fee charged by the client (in basis points). If 0, no reward token fee applies. * @param nativeTokenFee on-top native coin fee charged by the client. If 0, no native token fee applies. */ function send( address[] memory to, bytes32[][] memory crefs, address feeReceiver, uint256 msgFee, uint256 nativeTokenFee ) external payable nonReentrant() gasWrapper(nativeTokenFee) gasUsed(feeReceiver, msgFee) { require(msgFee <= MAX_BPS, "Deb0x: reward fees exceed 10000 bps"); uint256 _sentId = _send(to, crefs); calculateCycle(); updateCycleFeesPerStakeSummed(); setUpNewCycle(); updateStats(_msgSender()); updateClientStats(feeReceiver); lastActiveCycle[_msgSender()] = currentCycle; emit SendEntryCreated( currentCycle, _sentId, feeReceiver, msgFee, nativeTokenFee ); } /** * @dev Mints newly accrued account rewards and transfers the entire * allocated amount to the transaction sender address. */ function claimRewards() external nonReentrant() { calculateCycle(); updateCycleFeesPerStakeSummed(); updateStats(_msgSender()); uint256 reward = accRewards[_msgSender()] - accWithdrawableStake[_msgSender()]; require(reward > 0, "Deb0x: account has no rewards"); accRewards[_msgSender()] -= reward; if (lastStartedCycle == currentStartedCycle) { pendingStakeWithdrawal += reward; } else { summedCycleStakes[currentCycle] = summedCycleStakes[currentCycle] - reward; } dbx.mintReward(_msgSender(), reward); emit RewardsClaimed(currentCycle, _msgSender(), reward); } /** * @dev Mints newly accrued client rewards share and transfers the entire * allocated amount to the transaction sender address. */ function claimClientRewards() external nonReentrant() { calculateCycle(); updateCycleFeesPerStakeSummed(); updateClientStats(_msgSender()); uint256 reward = clientRewards[_msgSender()]; require(reward > 0, "Deb0x: client has no rewards"); clientRewards[_msgSender()] = 0; if (lastStartedCycle == currentStartedCycle) { pendingStakeWithdrawal += reward; } else { summedCycleStakes[currentCycle] = summedCycleStakes[currentCycle] - reward; } dbx.mintReward(_msgSender(), reward); emit ClientRewardsClaimed(currentCycle, _msgSender(), reward); } /** * @dev Transfers newly accrued fees to sender's address. */ function claimFees() external nonReentrant() { calculateCycle(); updateCycleFeesPerStakeSummed(); updateStats(_msgSender()); uint256 fees = accAccruedFees[_msgSender()]; require(fees > 0, "Deb0x: amount is zero"); accAccruedFees[_msgSender()] = 0; sendViaCall(payable(_msgSender()), fees); emit FeesClaimed(getCurrentCycle(), _msgSender(), fees); } /** * @dev Transfers newly accrued client fee share and transfers * the entire amount to caller address. */ function claimClientFees() external nonReentrant() { calculateCycle(); updateCycleFeesPerStakeSummed(); updateClientStats(_msgSender()); uint256 fees = clientAccruedFees[_msgSender()]; require(fees > 0, "Deb0x: client has no accrued fees"); clientAccruedFees[_msgSender()] = 0; sendViaCall(payable(_msgSender()), fees); emit ClientFeesClaimed(getCurrentCycle(), _msgSender(), fees); } /** * @dev Stakes the given amount and increases the share of the daily allocated fees. * The tokens are transfered from sender account to this contract. * To receive the tokens back, the unstake function must be called by the same account address. * * @param amount token amount to be staked (in wei). */ function stake(uint256 amount) external nonReentrant() { calculateCycle(); updateCycleFeesPerStakeSummed(); updateStats(_msgSender()); require(amount > 0, "Deb0x: amount is zero"); pendingStake += amount; uint256 cycleToSet = currentCycle + 1; if (lastStartedCycle == currentStartedCycle) { cycleToSet = currentCycle; } if ( (cycleToSet != accFirstStake[_msgSender()] && cycleToSet != accSecondStake[_msgSender()]) ) { if (accFirstStake[_msgSender()] == 0) { accFirstStake[_msgSender()] = cycleToSet; } else if (accSecondStake[_msgSender()] == 0) { accSecondStake[_msgSender()] = cycleToSet; } } accStakeCycle[_msgSender()][cycleToSet] += amount; dbx.transferFrom(_msgSender(), address(this), amount); emit Staked(cycleToSet, _msgSender(), amount); } /** * @dev Unstakes the given amount and decreases the share of the daily allocated fees. * If the balance is availabe, the tokens are transfered from this contract to the sender account. * * @param amount token amount to be unstaked (in wei). */ function unstake(uint256 amount) external nonReentrant() { calculateCycle(); updateCycleFeesPerStakeSummed(); updateStats(_msgSender()); require(amount > 0, "Deb0x: amount is zero"); require( amount <= accWithdrawableStake[_msgSender()], "Deb0x: amount greater than withdrawable stake" ); if (lastStartedCycle == currentStartedCycle) { pendingStakeWithdrawal += amount; } else { summedCycleStakes[currentCycle] -= amount; } accWithdrawableStake[_msgSender()] -= amount; accRewards[_msgSender()] -= amount; dbx.transfer(_msgSender(), amount); emit Unstaked(currentCycle, _msgSender(), amount); } /** * @dev Returns the index of the cycle at the current block time. */ function getCurrentCycle() public view returns (uint256) { return (block.timestamp - i_initialTimestamp) / i_periodDuration; } /** * @dev Updates various helper state variables used to compute token rewards * and fees distribution for a given client. * * @param client the address of the client to make the updates for. */ function updateClientStats(address client) internal { if (currentCycle > clientLastRewardUpdate[client]) { uint256 lastUpdatedCycle = clientLastRewardUpdate[client]; if ( clientCycleGasEarned[client] != 0 && cycleTotalGasUsed[lastUpdatedCycle] != 0 ) { uint256 clientRewardsEarned = (clientCycleGasEarned[client] * rewardPerCycle[lastUpdatedCycle]) / cycleTotalGasUsed[lastUpdatedCycle]; clientRewards[client] += clientRewardsEarned; clientCycleGasEarned[client] = 0; } clientLastRewardUpdate[client] = currentCycle; } if ( currentCycle > lastStartedCycle && clientLastFeeUpdate[client] != lastStartedCycle + 1 ) { clientAccruedFees[client] += ( clientRewards[client] * (cycleFeesPerStakeSummed[lastStartedCycle + 1] - cycleFeesPerStakeSummed[clientLastFeeUpdate[client]] ) ) / SCALING_FACTOR; clientLastFeeUpdate[client] = lastStartedCycle + 1; } } /** * @dev Updates the index of the cycle. */ function calculateCycle() internal { uint256 calculatedCycle = getCurrentCycle(); if (calculatedCycle > currentCycle) { currentCycle = calculatedCycle; } } /** * @dev Updates the global helper variables related to fee distribution. */ function updateCycleFeesPerStakeSummed() internal { if (currentCycle != currentStartedCycle) { previousStartedCycle = lastStartedCycle + 1; lastStartedCycle = currentStartedCycle; } if ( currentCycle > lastStartedCycle && cycleFeesPerStakeSummed[lastStartedCycle + 1] == 0 ) { uint256 feePerStake; if(summedCycleStakes[lastStartedCycle] != 0) { feePerStake = ((cycleAccruedFees[lastStartedCycle] + pendingFees) * SCALING_FACTOR) / summedCycleStakes[lastStartedCycle]; pendingFees = 0; } else { pendingFees += cycleAccruedFees[lastStartedCycle]; feePerStake = 0; } cycleFeesPerStakeSummed[lastStartedCycle + 1] = cycleFeesPerStakeSummed[previousStartedCycle] + feePerStake; } } /** * @dev Updates the global state related to starting a new cycle along * with helper state variables used in computation of staking rewards. */ function setUpNewCycle() internal { if (rewardPerCycle[currentCycle] == 0) { lastCycleReward = currentCycleReward; uint256 calculatedCycleReward = (lastCycleReward * 10000) / 10020; currentCycleReward = calculatedCycleReward; rewardPerCycle[currentCycle] = calculatedCycleReward; currentStartedCycle = currentCycle; summedCycleStakes[currentStartedCycle] += summedCycleStakes[lastStartedCycle] + currentCycleReward; if (pendingStake != 0) { summedCycleStakes[currentStartedCycle] += pendingStake; pendingStake = 0; } if (pendingStakeWithdrawal != 0) { summedCycleStakes[currentStartedCycle] -= pendingStakeWithdrawal; pendingStakeWithdrawal = 0; } emit NewCycleStarted( currentCycle, calculatedCycleReward, summedCycleStakes[currentStartedCycle] ); } } /** * @dev Updates various helper state variables used to compute token rewards * and fees distribution for a given account. * * @param account the address of the account to make the updates for. */ function updateStats(address account) internal { if ( currentCycle > lastActiveCycle[account] && accCycleGasUsed[account] != 0 ) { uint256 lastCycleAccReward = (accCycleGasUsed[account] * rewardPerCycle[lastActiveCycle[account]]) / cycleTotalGasUsed[lastActiveCycle[account]]; accRewards[account] += lastCycleAccReward; accCycleGasUsed[account] = 0; } if ( currentCycle > lastStartedCycle && lastFeeUpdateCycle[account] != lastStartedCycle + 1 ) { accAccruedFees[account] = accAccruedFees[account] + ( (accRewards[account] * (cycleFeesPerStakeSummed[lastStartedCycle + 1] - cycleFeesPerStakeSummed[lastFeeUpdateCycle[account]] ) ) ) / SCALING_FACTOR; lastFeeUpdateCycle[account] = lastStartedCycle + 1; } if ( accFirstStake[account] != 0 && currentCycle > accFirstStake[account] ) { uint256 unlockedFirstStake = accStakeCycle[account][accFirstStake[account]]; accRewards[account] += unlockedFirstStake; accWithdrawableStake[account] += unlockedFirstStake; if (lastStartedCycle + 1 > accFirstStake[account]) { accAccruedFees[account] = accAccruedFees[account] + ( (accStakeCycle[account][accFirstStake[account]] * (cycleFeesPerStakeSummed[lastStartedCycle + 1] - cycleFeesPerStakeSummed[accFirstStake[account]] ) ) ) / SCALING_FACTOR; } accStakeCycle[account][accFirstStake[account]] = 0; accFirstStake[account] = 0; if (accSecondStake[account] != 0) { if (currentCycle > accSecondStake[account]) { uint256 unlockedSecondStake = accStakeCycle[account][accSecondStake[account]]; accRewards[account] += unlockedSecondStake; accWithdrawableStake[account] += unlockedSecondStake; if (lastStartedCycle + 1 > accSecondStake[account]) { accAccruedFees[account] = accAccruedFees[account] + ( (accStakeCycle[account][accSecondStake[account]] * (cycleFeesPerStakeSummed[lastStartedCycle + 1] - cycleFeesPerStakeSummed[accSecondStake[account]] ) ) ) / SCALING_FACTOR; } accStakeCycle[account][accSecondStake[account]] = 0; accSecondStake[account] = 0; } else { accFirstStake[account] = accSecondStake[account]; accSecondStake[account] = 0; } } } } /** * @dev For each recipient emits events with correspondig cref. * Lengths of recipients and crefs arrays must match. * All crefs (content references) must be less than 8 bytes32 long and * are purposed to store pointers (e.g. HTTP urls, IPFS CIDs) to messages content. * * @param recipients recipient addresses that messages are stored for. * @param crefs content references to the messages. */ function _send(address[] memory recipients, bytes32[][] memory crefs) internal returns (uint256) { require(recipients.length == crefs.length, "Deb0x: crefs and recipients lengths not equal"); require(recipients.length > 0, "Deb0x: recipients array empty"); for (uint256 idx = 0; idx < recipients.length - 1; idx++) { require(crefs[recipients.length - 1].length > 0 , "Deb0x: empty cref"); require(crefs[recipients.length - 1].length <= 8 , "Deb0x: cref too long"); } for (uint256 idx = 0; idx < recipients.length - 1; idx++) { bytes32 bodyHash = keccak256(abi.encode(crefs[idx])); emit Sent( recipients[idx], _msgSender(), bodyHash, sentId, block.timestamp, crefs[idx] ); } bytes32 selfBodyHash = keccak256( abi.encode(crefs[recipients.length - 1]) ); require(crefs[recipients.length - 1].length > 0 , "Deb0x: empty cref"); require(crefs[recipients.length - 1].length <= 8 , "Deb0x: cref too long"); uint256 oldSentId = sentId; sentId++; emit Sent( _msgSender(), _msgSender(), selfBodyHash, oldSentId, block.timestamp, crefs[recipients.length - 1] ); return oldSentId; } /** * Recommended method to use to send native coins. * * @param to receiving address. * @param amount in wei. */ function sendViaCall(address payable to, uint256 amount) internal { (bool sent, ) = to.call{value: amount}(""); require(sent, "Deb0x: failed to send amount"); } }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.17; import "@openzeppelin/contracts/token/ERC20/extensions/draft-ERC20Permit.sol"; /** * Reward token contract to be used by the deb0x protocol. * The entire amount is minted by the main deb0x contract * (Deb0x.sol - which is the owner of this contract) * directly to an account when it claims rewards. */ contract Deb0xERC20 is ERC20Permit { /** * The address of the Deb0x.sol contract instance. */ address public immutable owner; /** * Sets the owner address. * Called from within the Deb0x.sol constructor. */ constructor() ERC20("Deb0x Reward Token on Polygon", "pDBX") ERC20Permit("Deb0x Reward Token on Polygon") { owner = msg.sender; } /** * The total supply is naturally capped by the distribution algorithm * implemented by the main deb0x contract, however an additional check * that will never be triggered is added to reassure the reader. * * @param account the address of the reward token reciever * @param amount wei to be minted */ function mintReward(address account, uint256 amount) external { require(msg.sender == owner, "DBX: caller is not Deb0x contract."); require(super.totalSupply() < 5010000000000000000000000, "DBX: max supply already minted"); _mint(account, amount); } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.7.0) (metatx/ERC2771Context.sol) pragma solidity ^0.8.9; import "../utils/Context.sol"; /** * @dev Context variant with ERC2771 support. */ abstract contract ERC2771Context is Context { /// @custom:oz-upgrades-unsafe-allow state-variable-immutable address private immutable _trustedForwarder; /// @custom:oz-upgrades-unsafe-allow constructor constructor(address trustedForwarder) { _trustedForwarder = trustedForwarder; } function isTrustedForwarder(address forwarder) public view virtual returns (bool) { return forwarder == _trustedForwarder; } function _msgSender() internal view virtual override returns (address sender) { if (isTrustedForwarder(msg.sender)) { // The assembly code is more direct than the Solidity version using `abi.decode`. /// @solidity memory-safe-assembly assembly { sender := shr(96, calldataload(sub(calldatasize(), 20))) } } else { return super._msgSender(); } } function _msgData() internal view virtual override returns (bytes calldata) { if (isTrustedForwarder(msg.sender)) { return msg.data[:msg.data.length - 20]; } else { return super._msgData(); } } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (security/ReentrancyGuard.sol) pragma solidity ^0.8.0; /** * @dev Contract module that helps prevent reentrant calls to a function. * * Inheriting from `ReentrancyGuard` will make the {nonReentrant} modifier * available, which can be applied to functions to make sure there are no nested * (reentrant) calls to them. * * Note that because there is a single `nonReentrant` guard, functions marked as * `nonReentrant` may not call one another. This can be worked around by making * those functions `private`, and then adding `external` `nonReentrant` entry * points to them. * * TIP: If you would like to learn more about reentrancy and alternative ways * to protect against it, check out our blog post * https://blog.openzeppelin.com/reentrancy-after-istanbul/[Reentrancy After Istanbul]. */ abstract contract ReentrancyGuard { // Booleans are more expensive than uint256 or any type that takes up a full // word because each write operation emits an extra SLOAD to first read the // slot's contents, replace the bits taken up by the boolean, and then write // back. This is the compiler's defense against contract upgrades and // pointer aliasing, and it cannot be disabled. // The values being non-zero value makes deployment a bit more expensive, // but in exchange the refund on every call to nonReentrant will be lower in // amount. Since refunds are capped to a percentage of the total // transaction's gas, it is best to keep them low in cases like this one, to // increase the likelihood of the full refund coming into effect. uint256 private constant _NOT_ENTERED = 1; uint256 private constant _ENTERED = 2; uint256 private _status; constructor() { _status = _NOT_ENTERED; } /** * @dev Prevents a contract from calling itself, directly or indirectly. * Calling a `nonReentrant` function from another `nonReentrant` * function is not supported. It is possible to prevent this from happening * by making the `nonReentrant` function external, and making it call a * `private` function that does the actual work. */ modifier nonReentrant() { // On the first call to nonReentrant, _notEntered will be true require(_status != _ENTERED, "ReentrancyGuard: reentrant call"); // Any calls to nonReentrant after this point will fail _status = _ENTERED; _; // By storing the original value once again, a refund is triggered (see // https://eips.ethereum.org/EIPS/eip-2200) _status = _NOT_ENTERED; } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (utils/Context.sol) pragma solidity ^0.8.0; /** * @dev Provides information about the current execution context, including the * sender of the transaction and its data. While these are generally available * via msg.sender and msg.data, they should not be accessed in such a direct * manner, since when dealing with meta-transactions the account sending and * paying for execution may not be the actual sender (as far as an application * is concerned). * * This contract is only required for intermediate, library-like contracts. */ abstract contract Context { function _msgSender() internal view virtual returns (address) { return msg.sender; } function _msgData() internal view virtual returns (bytes calldata) { return msg.data; } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.6.0) (token/ERC20/extensions/draft-ERC20Permit.sol) pragma solidity ^0.8.0; import "./draft-IERC20Permit.sol"; import "../ERC20.sol"; import "../../../utils/cryptography/draft-EIP712.sol"; import "../../../utils/cryptography/ECDSA.sol"; import "../../../utils/Counters.sol"; /** * @dev Implementation of the ERC20 Permit extension allowing approvals to be made via signatures, as defined in * https://eips.ethereum.org/EIPS/eip-2612[EIP-2612]. * * Adds the {permit} method, which can be used to change an account's ERC20 allowance (see {IERC20-allowance}) by * presenting a message signed by the account. By not relying on `{IERC20-approve}`, the token holder account doesn't * need to send a transaction, and thus is not required to hold Ether at all. * * _Available since v3.4._ */ abstract contract ERC20Permit is ERC20, IERC20Permit, EIP712 { using Counters for Counters.Counter; mapping(address => Counters.Counter) private _nonces; // solhint-disable-next-line var-name-mixedcase bytes32 private constant _PERMIT_TYPEHASH = keccak256("Permit(address owner,address spender,uint256 value,uint256 nonce,uint256 deadline)"); /** * @dev In previous versions `_PERMIT_TYPEHASH` was declared as `immutable`. * However, to ensure consistency with the upgradeable transpiler, we will continue * to reserve a slot. * @custom:oz-renamed-from _PERMIT_TYPEHASH */ // solhint-disable-next-line var-name-mixedcase bytes32 private _PERMIT_TYPEHASH_DEPRECATED_SLOT; /** * @dev Initializes the {EIP712} domain separator using the `name` parameter, and setting `version` to `"1"`. * * It's a good idea to use the same `name` that is defined as the ERC20 token name. */ constructor(string memory name) EIP712(name, "1") {} /** * @dev See {IERC20Permit-permit}. */ function permit( address owner, address spender, uint256 value, uint256 deadline, uint8 v, bytes32 r, bytes32 s ) public virtual override { require(block.timestamp <= deadline, "ERC20Permit: expired deadline"); bytes32 structHash = keccak256(abi.encode(_PERMIT_TYPEHASH, owner, spender, value, _useNonce(owner), deadline)); bytes32 hash = _hashTypedDataV4(structHash); address signer = ECDSA.recover(hash, v, r, s); require(signer == owner, "ERC20Permit: invalid signature"); _approve(owner, spender, value); } /** * @dev See {IERC20Permit-nonces}. */ function nonces(address owner) public view virtual override returns (uint256) { return _nonces[owner].current(); } /** * @dev See {IERC20Permit-DOMAIN_SEPARATOR}. */ // solhint-disable-next-line func-name-mixedcase function DOMAIN_SEPARATOR() external view override returns (bytes32) { return _domainSeparatorV4(); } /** * @dev "Consume a nonce": return the current value and increment. * * _Available since v4.1._ */ function _useNonce(address owner) internal virtual returns (uint256 current) { Counters.Counter storage nonce = _nonces[owner]; current = nonce.current(); nonce.increment(); } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (token/ERC20/extensions/draft-IERC20Permit.sol) pragma solidity ^0.8.0; /** * @dev Interface of the ERC20 Permit extension allowing approvals to be made via signatures, as defined in * https://eips.ethereum.org/EIPS/eip-2612[EIP-2612]. * * Adds the {permit} method, which can be used to change an account's ERC20 allowance (see {IERC20-allowance}) by * presenting a message signed by the account. By not relying on {IERC20-approve}, the token holder account doesn't * need to send a transaction, and thus is not required to hold Ether at all. */ interface IERC20Permit { /** * @dev Sets `value` as the allowance of `spender` over ``owner``'s tokens, * given ``owner``'s signed approval. * * IMPORTANT: The same issues {IERC20-approve} has related to transaction * ordering also apply here. * * Emits an {Approval} event. * * Requirements: * * - `spender` cannot be the zero address. * - `deadline` must be a timestamp in the future. * - `v`, `r` and `s` must be a valid `secp256k1` signature from `owner` * over the EIP712-formatted function arguments. * - the signature must use ``owner``'s current nonce (see {nonces}). * * For more information on the signature format, see the * https://eips.ethereum.org/EIPS/eip-2612#specification[relevant EIP * section]. */ function permit( address owner, address spender, uint256 value, uint256 deadline, uint8 v, bytes32 r, bytes32 s ) external; /** * @dev Returns the current nonce for `owner`. This value must be * included whenever a signature is generated for {permit}. * * Every successful call to {permit} increases ``owner``'s nonce by one. This * prevents a signature from being used multiple times. */ function nonces(address owner) external view returns (uint256); /** * @dev Returns the domain separator used in the encoding of the signature for {permit}, as defined by {EIP712}. */ // solhint-disable-next-line func-name-mixedcase function DOMAIN_SEPARATOR() external view returns (bytes32); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.7.0) (token/ERC20/ERC20.sol) pragma solidity ^0.8.0; import "./IERC20.sol"; import "./extensions/IERC20Metadata.sol"; import "../../utils/Context.sol"; /** * @dev Implementation of the {IERC20} interface. * * This implementation is agnostic to the way tokens are created. This means * that a supply mechanism has to be added in a derived contract using {_mint}. * For a generic mechanism see {ERC20PresetMinterPauser}. * * TIP: For a detailed writeup see our guide * https://forum.zeppelin.solutions/t/how-to-implement-erc20-supply-mechanisms/226[How * to implement supply mechanisms]. * * We have followed general OpenZeppelin Contracts guidelines: functions revert * instead returning `false` on failure. This behavior is nonetheless * conventional and does not conflict with the expectations of ERC20 * applications. * * Additionally, an {Approval} event is emitted on calls to {transferFrom}. * This allows applications to reconstruct the allowance for all accounts just * by listening to said events. Other implementations of the EIP may not emit * these events, as it isn't required by the specification. * * Finally, the non-standard {decreaseAllowance} and {increaseAllowance} * functions have been added to mitigate the well-known issues around setting * allowances. See {IERC20-approve}. */ contract ERC20 is Context, IERC20, IERC20Metadata { mapping(address => uint256) private _balances; mapping(address => mapping(address => uint256)) private _allowances; uint256 private _totalSupply; string private _name; string private _symbol; /** * @dev Sets the values for {name} and {symbol}. * * The default value of {decimals} is 18. To select a different value for * {decimals} you should overload it. * * All two of these values are immutable: they can only be set once during * construction. */ constructor(string memory name_, string memory symbol_) { _name = name_; _symbol = symbol_; } /** * @dev Returns the name of the token. */ function name() public view virtual override returns (string memory) { return _name; } /** * @dev Returns the symbol of the token, usually a shorter version of the * name. */ function symbol() public view virtual override returns (string memory) { return _symbol; } /** * @dev Returns the number of decimals used to get its user representation. * For example, if `decimals` equals `2`, a balance of `505` tokens should * be displayed to a user as `5.05` (`505 / 10 ** 2`). * * Tokens usually opt for a value of 18, imitating the relationship between * Ether and Wei. This is the value {ERC20} uses, unless this function is * overridden; * * NOTE: This information is only used for _display_ purposes: it in * no way affects any of the arithmetic of the contract, including * {IERC20-balanceOf} and {IERC20-transfer}. */ function decimals() public view virtual override returns (uint8) { return 18; } /** * @dev See {IERC20-totalSupply}. */ function totalSupply() public view virtual override returns (uint256) { return _totalSupply; } /** * @dev See {IERC20-balanceOf}. */ function balanceOf(address account) public view virtual override returns (uint256) { return _balances[account]; } /** * @dev See {IERC20-transfer}. * * Requirements: * * - `to` cannot be the zero address. * - the caller must have a balance of at least `amount`. */ function transfer(address to, uint256 amount) public virtual override returns (bool) { address owner = _msgSender(); _transfer(owner, to, amount); return true; } /** * @dev See {IERC20-allowance}. */ function allowance(address owner, address spender) public view virtual override returns (uint256) { return _allowances[owner][spender]; } /** * @dev See {IERC20-approve}. * * NOTE: If `amount` is the maximum `uint256`, the allowance is not updated on * `transferFrom`. This is semantically equivalent to an infinite approval. * * Requirements: * * - `spender` cannot be the zero address. */ function approve(address spender, uint256 amount) public virtual override returns (bool) { address owner = _msgSender(); _approve(owner, spender, amount); return true; } /** * @dev See {IERC20-transferFrom}. * * Emits an {Approval} event indicating the updated allowance. This is not * required by the EIP. See the note at the beginning of {ERC20}. * * NOTE: Does not update the allowance if the current allowance * is the maximum `uint256`. * * Requirements: * * - `from` and `to` cannot be the zero address. * - `from` must have a balance of at least `amount`. * - the caller must have allowance for ``from``'s tokens of at least * `amount`. */ function transferFrom( address from, address to, uint256 amount ) public virtual override returns (bool) { address spender = _msgSender(); _spendAllowance(from, spender, amount); _transfer(from, to, amount); return true; } /** * @dev Atomically increases the allowance granted to `spender` by the caller. * * This is an alternative to {approve} that can be used as a mitigation for * problems described in {IERC20-approve}. * * Emits an {Approval} event indicating the updated allowance. * * Requirements: * * - `spender` cannot be the zero address. */ function increaseAllowance(address spender, uint256 addedValue) public virtual returns (bool) { address owner = _msgSender(); _approve(owner, spender, allowance(owner, spender) + addedValue); return true; } /** * @dev Atomically decreases the allowance granted to `spender` by the caller. * * This is an alternative to {approve} that can be used as a mitigation for * problems described in {IERC20-approve}. * * Emits an {Approval} event indicating the updated allowance. * * Requirements: * * - `spender` cannot be the zero address. * - `spender` must have allowance for the caller of at least * `subtractedValue`. */ function decreaseAllowance(address spender, uint256 subtractedValue) public virtual returns (bool) { address owner = _msgSender(); uint256 currentAllowance = allowance(owner, spender); require(currentAllowance >= subtractedValue, "ERC20: decreased allowance below zero"); unchecked { _approve(owner, spender, currentAllowance - subtractedValue); } return true; } /** * @dev Moves `amount` of tokens from `from` to `to`. * * This internal function is equivalent to {transfer}, and can be used to * e.g. implement automatic token fees, slashing mechanisms, etc. * * Emits a {Transfer} event. * * Requirements: * * - `from` cannot be the zero address. * - `to` cannot be the zero address. * - `from` must have a balance of at least `amount`. */ function _transfer( address from, address to, uint256 amount ) internal virtual { require(from != address(0), "ERC20: transfer from the zero address"); require(to != address(0), "ERC20: transfer to the zero address"); _beforeTokenTransfer(from, to, amount); uint256 fromBalance = _balances[from]; require(fromBalance >= amount, "ERC20: transfer amount exceeds balance"); unchecked { _balances[from] = fromBalance - amount; } _balances[to] += amount; emit Transfer(from, to, amount); _afterTokenTransfer(from, to, amount); } /** @dev Creates `amount` tokens and assigns them to `account`, increasing * the total supply. * * Emits a {Transfer} event with `from` set to the zero address. * * Requirements: * * - `account` cannot be the zero address. */ function _mint(address account, uint256 amount) internal virtual { require(account != address(0), "ERC20: mint to the zero address"); _beforeTokenTransfer(address(0), account, amount); _totalSupply += amount; _balances[account] += amount; emit Transfer(address(0), account, amount); _afterTokenTransfer(address(0), account, amount); } /** * @dev Destroys `amount` tokens from `account`, reducing the * total supply. * * Emits a {Transfer} event with `to` set to the zero address. * * Requirements: * * - `account` cannot be the zero address. * - `account` must have at least `amount` tokens. */ function _burn(address account, uint256 amount) internal virtual { require(account != address(0), "ERC20: burn from the zero address"); _beforeTokenTransfer(account, address(0), amount); uint256 accountBalance = _balances[account]; require(accountBalance >= amount, "ERC20: burn amount exceeds balance"); unchecked { _balances[account] = accountBalance - amount; } _totalSupply -= amount; emit Transfer(account, address(0), amount); _afterTokenTransfer(account, address(0), amount); } /** * @dev Sets `amount` as the allowance of `spender` over the `owner` s tokens. * * This internal function is equivalent to `approve`, and can be used to * e.g. set automatic allowances for certain subsystems, etc. * * Emits an {Approval} event. * * Requirements: * * - `owner` cannot be the zero address. * - `spender` cannot be the zero address. */ function _approve( address owner, address spender, uint256 amount ) internal virtual { require(owner != address(0), "ERC20: approve from the zero address"); require(spender != address(0), "ERC20: approve to the zero address"); _allowances[owner][spender] = amount; emit Approval(owner, spender, amount); } /** * @dev Updates `owner` s allowance for `spender` based on spent `amount`. * * Does not update the allowance amount in case of infinite allowance. * Revert if not enough allowance is available. * * Might emit an {Approval} event. */ function _spendAllowance( address owner, address spender, uint256 amount ) internal virtual { uint256 currentAllowance = allowance(owner, spender); if (currentAllowance != type(uint256).max) { require(currentAllowance >= amount, "ERC20: insufficient allowance"); unchecked { _approve(owner, spender, currentAllowance - amount); } } } /** * @dev Hook that is called before any transfer of tokens. This includes * minting and burning. * * Calling conditions: * * - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens * will be transferred to `to`. * - when `from` is zero, `amount` tokens will be minted for `to`. * - when `to` is zero, `amount` of ``from``'s tokens will be burned. * - `from` and `to` are never both zero. * * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks]. */ function _beforeTokenTransfer( address from, address to, uint256 amount ) internal virtual {} /** * @dev Hook that is called after any transfer of tokens. This includes * minting and burning. * * Calling conditions: * * - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens * has been transferred to `to`. * - when `from` is zero, `amount` tokens have been minted for `to`. * - when `to` is zero, `amount` of ``from``'s tokens have been burned. * - `from` and `to` are never both zero. * * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks]. */ function _afterTokenTransfer( address from, address to, uint256 amount ) internal virtual {} }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (utils/cryptography/draft-EIP712.sol) pragma solidity ^0.8.0; import "./ECDSA.sol"; /** * @dev https://eips.ethereum.org/EIPS/eip-712[EIP 712] is a standard for hashing and signing of typed structured data. * * The encoding specified in the EIP is very generic, and such a generic implementation in Solidity is not feasible, * thus this contract does not implement the encoding itself. Protocols need to implement the type-specific encoding * they need in their contracts using a combination of `abi.encode` and `keccak256`. * * This contract implements the EIP 712 domain separator ({_domainSeparatorV4}) that is used as part of the encoding * scheme, and the final step of the encoding to obtain the message digest that is then signed via ECDSA * ({_hashTypedDataV4}). * * The implementation of the domain separator was designed to be as efficient as possible while still properly updating * the chain id to protect against replay attacks on an eventual fork of the chain. * * NOTE: This contract implements the version of the encoding known as "v4", as implemented by the JSON RPC method * https://docs.metamask.io/guide/signing-data.html[`eth_signTypedDataV4` in MetaMask]. * * _Available since v3.4._ */ abstract contract EIP712 { /* solhint-disable var-name-mixedcase */ // Cache the domain separator as an immutable value, but also store the chain id that it corresponds to, in order to // invalidate the cached domain separator if the chain id changes. bytes32 private immutable _CACHED_DOMAIN_SEPARATOR; uint256 private immutable _CACHED_CHAIN_ID; address private immutable _CACHED_THIS; bytes32 private immutable _HASHED_NAME; bytes32 private immutable _HASHED_VERSION; bytes32 private immutable _TYPE_HASH; /* solhint-enable var-name-mixedcase */ /** * @dev Initializes the domain separator and parameter caches. * * The meaning of `name` and `version` is specified in * https://eips.ethereum.org/EIPS/eip-712#definition-of-domainseparator[EIP 712]: * * - `name`: the user readable name of the signing domain, i.e. the name of the DApp or the protocol. * - `version`: the current major version of the signing domain. * * NOTE: These parameters cannot be changed except through a xref:learn::upgrading-smart-contracts.adoc[smart * contract upgrade]. */ constructor(string memory name, string memory version) { bytes32 hashedName = keccak256(bytes(name)); bytes32 hashedVersion = keccak256(bytes(version)); bytes32 typeHash = keccak256( "EIP712Domain(string name,string version,uint256 chainId,address verifyingContract)" ); _HASHED_NAME = hashedName; _HASHED_VERSION = hashedVersion; _CACHED_CHAIN_ID = block.chainid; _CACHED_DOMAIN_SEPARATOR = _buildDomainSeparator(typeHash, hashedName, hashedVersion); _CACHED_THIS = address(this); _TYPE_HASH = typeHash; } /** * @dev Returns the domain separator for the current chain. */ function _domainSeparatorV4() internal view returns (bytes32) { if (address(this) == _CACHED_THIS && block.chainid == _CACHED_CHAIN_ID) { return _CACHED_DOMAIN_SEPARATOR; } else { return _buildDomainSeparator(_TYPE_HASH, _HASHED_NAME, _HASHED_VERSION); } } function _buildDomainSeparator( bytes32 typeHash, bytes32 nameHash, bytes32 versionHash ) private view returns (bytes32) { return keccak256(abi.encode(typeHash, nameHash, versionHash, block.chainid, address(this))); } /** * @dev Given an already https://eips.ethereum.org/EIPS/eip-712#definition-of-hashstruct[hashed struct], this * function returns the hash of the fully encoded EIP712 message for this domain. * * This hash can be used together with {ECDSA-recover} to obtain the signer of a message. For example: * * ```solidity * bytes32 digest = _hashTypedDataV4(keccak256(abi.encode( * keccak256("Mail(address to,string contents)"), * mailTo, * keccak256(bytes(mailContents)) * ))); * address signer = ECDSA.recover(digest, signature); * ``` */ function _hashTypedDataV4(bytes32 structHash) internal view virtual returns (bytes32) { return ECDSA.toTypedDataHash(_domainSeparatorV4(), structHash); } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.7.3) (utils/cryptography/ECDSA.sol) pragma solidity ^0.8.0; import "../Strings.sol"; /** * @dev Elliptic Curve Digital Signature Algorithm (ECDSA) operations. * * These functions can be used to verify that a message was signed by the holder * of the private keys of a given address. */ library ECDSA { enum RecoverError { NoError, InvalidSignature, InvalidSignatureLength, InvalidSignatureS, InvalidSignatureV } function _throwError(RecoverError error) private pure { if (error == RecoverError.NoError) { return; // no error: do nothing } else if (error == RecoverError.InvalidSignature) { revert("ECDSA: invalid signature"); } else if (error == RecoverError.InvalidSignatureLength) { revert("ECDSA: invalid signature length"); } else if (error == RecoverError.InvalidSignatureS) { revert("ECDSA: invalid signature 's' value"); } else if (error == RecoverError.InvalidSignatureV) { revert("ECDSA: invalid signature 'v' value"); } } /** * @dev Returns the address that signed a hashed message (`hash`) with * `signature` or error string. This address can then be used for verification purposes. * * The `ecrecover` EVM opcode allows for malleable (non-unique) signatures: * this function rejects them by requiring the `s` value to be in the lower * half order, and the `v` value to be either 27 or 28. * * IMPORTANT: `hash` _must_ be the result of a hash operation for the * verification to be secure: it is possible to craft signatures that * recover to arbitrary addresses for non-hashed data. A safe way to ensure * this is by receiving a hash of the original message (which may otherwise * be too long), and then calling {toEthSignedMessageHash} on it. * * Documentation for signature generation: * - with https://web3js.readthedocs.io/en/v1.3.4/web3-eth-accounts.html#sign[Web3.js] * - with https://docs.ethers.io/v5/api/signer/#Signer-signMessage[ethers] * * _Available since v4.3._ */ function tryRecover(bytes32 hash, bytes memory signature) internal pure returns (address, RecoverError) { if (signature.length == 65) { bytes32 r; bytes32 s; uint8 v; // ecrecover takes the signature parameters, and the only way to get them // currently is to use assembly. /// @solidity memory-safe-assembly assembly { r := mload(add(signature, 0x20)) s := mload(add(signature, 0x40)) v := byte(0, mload(add(signature, 0x60))) } return tryRecover(hash, v, r, s); } else { return (address(0), RecoverError.InvalidSignatureLength); } } /** * @dev Returns the address that signed a hashed message (`hash`) with * `signature`. This address can then be used for verification purposes. * * The `ecrecover` EVM opcode allows for malleable (non-unique) signatures: * this function rejects them by requiring the `s` value to be in the lower * half order, and the `v` value to be either 27 or 28. * * IMPORTANT: `hash` _must_ be the result of a hash operation for the * verification to be secure: it is possible to craft signatures that * recover to arbitrary addresses for non-hashed data. A safe way to ensure * this is by receiving a hash of the original message (which may otherwise * be too long), and then calling {toEthSignedMessageHash} on it. */ function recover(bytes32 hash, bytes memory signature) internal pure returns (address) { (address recovered, RecoverError error) = tryRecover(hash, signature); _throwError(error); return recovered; } /** * @dev Overload of {ECDSA-tryRecover} that receives the `r` and `vs` short-signature fields separately. * * See https://eips.ethereum.org/EIPS/eip-2098[EIP-2098 short signatures] * * _Available since v4.3._ */ function tryRecover( bytes32 hash, bytes32 r, bytes32 vs ) internal pure returns (address, RecoverError) { bytes32 s = vs & bytes32(0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff); uint8 v = uint8((uint256(vs) >> 255) + 27); return tryRecover(hash, v, r, s); } /** * @dev Overload of {ECDSA-recover} that receives the `r and `vs` short-signature fields separately. * * _Available since v4.2._ */ function recover( bytes32 hash, bytes32 r, bytes32 vs ) internal pure returns (address) { (address recovered, RecoverError error) = tryRecover(hash, r, vs); _throwError(error); return recovered; } /** * @dev Overload of {ECDSA-tryRecover} that receives the `v`, * `r` and `s` signature fields separately. * * _Available since v4.3._ */ function tryRecover( bytes32 hash, uint8 v, bytes32 r, bytes32 s ) internal pure returns (address, RecoverError) { // EIP-2 still allows signature malleability for ecrecover(). Remove this possibility and make the signature // unique. Appendix F in the Ethereum Yellow paper (https://ethereum.github.io/yellowpaper/paper.pdf), defines // the valid range for s in (301): 0 < s < secp256k1n ÷ 2 + 1, and for v in (302): v ∈ {27, 28}. Most // signatures from current libraries generate a unique signature with an s-value in the lower half order. // // If your library generates malleable signatures, such as s-values in the upper range, calculate a new s-value // with 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEBAAEDCE6AF48A03BBFD25E8CD0364141 - s1 and flip v from 27 to 28 or // vice versa. If your library also generates signatures with 0/1 for v instead 27/28, add 27 to v to accept // these malleable signatures as well. if (uint256(s) > 0x7FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF5D576E7357A4501DDFE92F46681B20A0) { return (address(0), RecoverError.InvalidSignatureS); } if (v != 27 && v != 28) { return (address(0), RecoverError.InvalidSignatureV); } // If the signature is valid (and not malleable), return the signer address address signer = ecrecover(hash, v, r, s); if (signer == address(0)) { return (address(0), RecoverError.InvalidSignature); } return (signer, RecoverError.NoError); } /** * @dev Overload of {ECDSA-recover} that receives the `v`, * `r` and `s` signature fields separately. */ function recover( bytes32 hash, uint8 v, bytes32 r, bytes32 s ) internal pure returns (address) { (address recovered, RecoverError error) = tryRecover(hash, v, r, s); _throwError(error); return recovered; } /** * @dev Returns an Ethereum Signed Message, created from a `hash`. This * produces hash corresponding to the one signed with the * https://eth.wiki/json-rpc/API#eth_sign[`eth_sign`] * JSON-RPC method as part of EIP-191. * * See {recover}. */ function toEthSignedMessageHash(bytes32 hash) internal pure returns (bytes32) { // 32 is the length in bytes of hash, // enforced by the type signature above return keccak256(abi.encodePacked("\x19Ethereum Signed Message:\n32", hash)); } /** * @dev Returns an Ethereum Signed Message, created from `s`. This * produces hash corresponding to the one signed with the * https://eth.wiki/json-rpc/API#eth_sign[`eth_sign`] * JSON-RPC method as part of EIP-191. * * See {recover}. */ function toEthSignedMessageHash(bytes memory s) internal pure returns (bytes32) { return keccak256(abi.encodePacked("\x19Ethereum Signed Message:\n", Strings.toString(s.length), s)); } /** * @dev Returns an Ethereum Signed Typed Data, created from a * `domainSeparator` and a `structHash`. This produces hash corresponding * to the one signed with the * https://eips.ethereum.org/EIPS/eip-712[`eth_signTypedData`] * JSON-RPC method as part of EIP-712. * * See {recover}. */ function toTypedDataHash(bytes32 domainSeparator, bytes32 structHash) internal pure returns (bytes32) { return keccak256(abi.encodePacked("\x19\x01", domainSeparator, structHash)); } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (utils/Counters.sol) pragma solidity ^0.8.0; /** * @title Counters * @author Matt Condon (@shrugs) * @dev Provides counters that can only be incremented, decremented or reset. This can be used e.g. to track the number * of elements in a mapping, issuing ERC721 ids, or counting request ids. * * Include with `using Counters for Counters.Counter;` */ library Counters { struct Counter { // This variable should never be directly accessed by users of the library: interactions must be restricted to // the library's function. As of Solidity v0.5.2, this cannot be enforced, though there is a proposal to add // this feature: see https://github.com/ethereum/solidity/issues/4637 uint256 _value; // default: 0 } function current(Counter storage counter) internal view returns (uint256) { return counter._value; } function increment(Counter storage counter) internal { unchecked { counter._value += 1; } } function decrement(Counter storage counter) internal { uint256 value = counter._value; require(value > 0, "Counter: decrement overflow"); unchecked { counter._value = value - 1; } } function reset(Counter storage counter) internal { counter._value = 0; } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.6.0) (token/ERC20/IERC20.sol) pragma solidity ^0.8.0; /** * @dev Interface of the ERC20 standard as defined in the EIP. */ interface IERC20 { /** * @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); /** * @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 `to`. * * Returns a boolean value indicating whether the operation succeeded. * * Emits a {Transfer} event. */ function transfer(address to, 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 `from` to `to` 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 from, address to, uint256 amount ) external returns (bool); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (token/ERC20/extensions/IERC20Metadata.sol) 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 // OpenZeppelin Contracts (last updated v4.7.0) (utils/Strings.sol) pragma solidity ^0.8.0; /** * @dev String operations. */ library Strings { bytes16 private constant _HEX_SYMBOLS = "0123456789abcdef"; uint8 private constant _ADDRESS_LENGTH = 20; /** * @dev Converts a `uint256` to its ASCII `string` decimal representation. */ function toString(uint256 value) internal pure returns (string memory) { // Inspired by OraclizeAPI's implementation - MIT licence // https://github.com/oraclize/ethereum-api/blob/b42146b063c7d6ee1358846c198246239e9360e8/oraclizeAPI_0.4.25.sol if (value == 0) { return "0"; } uint256 temp = value; uint256 digits; while (temp != 0) { digits++; temp /= 10; } bytes memory buffer = new bytes(digits); while (value != 0) { digits -= 1; buffer[digits] = bytes1(uint8(48 + uint256(value % 10))); value /= 10; } return string(buffer); } /** * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation. */ function toHexString(uint256 value) internal pure returns (string memory) { if (value == 0) { return "0x00"; } uint256 temp = value; uint256 length = 0; while (temp != 0) { length++; temp >>= 8; } return toHexString(value, length); } /** * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation with fixed length. */ function toHexString(uint256 value, uint256 length) internal pure returns (string memory) { bytes memory buffer = new bytes(2 * length + 2); buffer[0] = "0"; buffer[1] = "x"; for (uint256 i = 2 * length + 1; i > 1; --i) { buffer[i] = _HEX_SYMBOLS[value & 0xf]; value >>= 4; } require(value == 0, "Strings: hex length insufficient"); return string(buffer); } /** * @dev Converts an `address` with fixed length of 20 bytes to its not checksummed ASCII `string` hexadecimal representation. */ function toHexString(address addr) internal pure returns (string memory) { return toHexString(uint256(uint160(addr)), _ADDRESS_LENGTH); } }
{ "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 Deb0x","name":"_deb0x","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[],"name":"calculateCycleReward","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"deb0xContractBalance","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"staker","type":"address"}],"name":"getAccWithdrawableStake","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"account","type":"address"}],"name":"getUnclaimedFees","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"account","type":"address"}],"name":"getUnclaimedRewards","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"}]
Contract Creation Code
608060405234801561001057600080fd5b50604051611c5f380380611c5f83398101604081905261002f91610054565b600080546001600160a01b0319166001600160a01b0392909216919091179055610084565b60006020828403121561006657600080fd5b81516001600160a01b038116811461007d57600080fd5b9392505050565b611bcc806100936000396000f3fe608060405234801561001057600080fd5b50600436106100575760003560e01c806369a69e291461005c578063bf992dea14610081578063cdd5c81f14610094578063d6aef1c6146100a7578063e10bf06a146100af575b600080fd5b61006f61006a366004611ad2565b6100c1565b60405190815260200160405180910390f35b61006f61008f366004611ad2565b6104dd565b61006f6100a2366004611ad2565b611598565b61006f611a47565b6000546001600160a01b03163161006f565b6000805460405163ed725e8360e01b81526001600160a01b0384811660048301528392169063ed725e8390602401602060405180830381865afa15801561010c573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906101309190611b02565b905060008060009054906101000a90046001600160a01b03166001600160a01b031663be26ed7f6040518163ffffffff1660e01b8152600401602060405180830381865afa158015610186573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906101aa9190611b02565b60005460405163fa845ca960e01b81526001600160a01b03878116600483015292935091169063fa845ca990602401602060405180830381865afa1580156101f6573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061021a9190611b02565b811180156102945750600054604051631526bda560e21b81526001600160a01b0386811660048301529091169063549af69490602401602060405180830381865afa15801561026d573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906102919190611b02565b15155b156104d6576000805460405163fa845ca960e01b81526001600160a01b038781166004830152909116906313e6589090829063fa845ca990602401602060405180830381865afa1580156102ec573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906103109190611b02565b6040518263ffffffff1660e01b815260040161032e91815260200190565b602060405180830381865afa15801561034b573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061036f9190611b02565b60005460405163fa845ca960e01b81526001600160a01b0388811660048301529091169063adc0f68690829063fa845ca990602401602060405180830381865afa1580156103c1573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906103e59190611b02565b6040518263ffffffff1660e01b815260040161040391815260200190565b602060405180830381865afa158015610420573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906104449190611b02565b600054604051631526bda560e21b81526001600160a01b0389811660048301529091169063549af69490602401602060405180830381865afa15801561048e573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906104b29190611b02565b6104bc9190611b31565b6104c69190611b4e565b90506104d28184611b70565b9250505b5092915050565b600080546040805163be26ed7f60e01b8152905183926001600160a01b03169163be26ed7f9160048083019260209291908290030181865afa158015610527573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061054b9190611b02565b60008054604051630bc7132960e41b81526001600160a01b0387811660048301529394509192169063bc71329090602401602060405180830381865afa158015610599573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906105bd9190611b02565b905060008060008054906101000a90046001600160a01b03166001600160a01b0316635f5080b46040518163ffffffff1660e01b8152600401602060405180830381865afa158015610613573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906106379190611b02565b905060008060009054906101000a90046001600160a01b03166001600160a01b031663436091c16040518163ffffffff1660e01b8152600401602060405180830381865afa15801561068d573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906106b19190611b02565b905060008054906101000a90046001600160a01b03166001600160a01b031663f1b371e26040518163ffffffff1660e01b8152600401602060405180830381865afa158015610704573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906107289190611b02565b85146107b357610739816001611b70565b915060008054906101000a90046001600160a01b03166001600160a01b031663f1b371e26040518163ffffffff1660e01b8152600401602060405180830381865afa15801561078c573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906107b09190611b02565b90505b808511801561083a57506000546001600160a01b031663bebc9dfc6107d9836001611b70565b6040518263ffffffff1660e01b81526004016107f791815260200190565b602060405180830381865afa158015610814573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906108389190611b02565b155b15610b16576000805460405163c4235ae960e01b8152600481018490526001600160a01b039091169063c4235ae990602401602060405180830381865afa158015610889573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906108ad9190611b02565b15610a975760005460405163c4235ae960e01b8152600481018490526001600160a01b039091169063c4235ae990602401602060405180830381865afa1580156108fb573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061091f9190611b02565b60008054906101000a90046001600160a01b03166001600160a01b031663ef4cadc56040518163ffffffff1660e01b8152600401602060405180830381865afa158015610970573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906109949190611b02565b60008054906101000a90046001600160a01b03166001600160a01b031663224438d16040518163ffffffff1660e01b8152600401602060405180830381865afa1580156109e5573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610a099190611b02565b6000546040516303b3885560e21b8152600481018790526001600160a01b0390911690630ece215490602401602060405180830381865afa158015610a52573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610a769190611b02565b610a809190611b70565b610a8a9190611b31565b610a949190611b4e565b90505b600054604051632faf277f60e21b81526004810185905282916001600160a01b03169063bebc9dfc90602401602060405180830381865afa158015610ae0573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610b049190611b02565b610b0e9190611b70565b935050610bee565b600054604080516317d4202d60e21b815290516001600160a01b039092169163bebc9dfc918391635f5080b4916004808201926020929091908290030181865afa158015610b68573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610b8c9190611b02565b6040518263ffffffff1660e01b8152600401610baa91815260200190565b602060405180830381865afa158015610bc7573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610beb9190611b02565b92505b6000610bf9886100c1565b90508186118015610c815750610c10826001611b70565b60005460405163a707140b60e01b81526001600160a01b038b811660048301529091169063a707140b90602401602060405180830381865afa158015610c5a573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610c7e9190611b02565b14155b15610dfb5760008054906101000a90046001600160a01b03166001600160a01b031663ef4cadc56040518163ffffffff1660e01b8152600401602060405180830381865afa158015610cd7573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610cfb9190611b02565b60005460405163a707140b60e01b81526001600160a01b038b811660048301529091169063bebc9dfc90829063a707140b90602401602060405180830381865afa158015610d4d573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610d719190611b02565b6040518263ffffffff1660e01b8152600401610d8f91815260200190565b602060405180830381865afa158015610dac573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610dd09190611b02565b610dda9086611b83565b610de49083611b31565b610dee9190611b4e565b610df89086611b70565b94505b600054604051633983243160e21b81526001600160a01b038a811660048301529091169063e60c90c490602401602060405180830381865afa158015610e45573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e699190611b02565b15801590610ee35750600054604051633983243160e21b81526001600160a01b038a811660048301529091169063e60c90c490602401602060405180830381865afa158015610ebc573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610ee09190611b02565b86115b8015610f655750600054604051633983243160e21b81526001600160a01b038a811660048301529091169063e60c90c490602401602060405180830381865afa158015610f34573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610f589190611b02565b610f63836001611b70565b115b1561158c5760008054906101000a90046001600160a01b03166001600160a01b031663ef4cadc56040518163ffffffff1660e01b8152600401602060405180830381865afa158015610fbb573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610fdf9190611b02565b600054604051633983243160e21b81526001600160a01b038b811660048301529091169063bebc9dfc90829063e60c90c490602401602060405180830381865afa158015611031573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906110559190611b02565b6040518263ffffffff1660e01b815260040161107391815260200190565b602060405180830381865afa158015611090573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906110b49190611b02565b6110be9086611b83565b600054604051633983243160e21b81526001600160a01b038c811660048301529091169063aabbb1bd908c90839063e60c90c490602401602060405180830381865afa158015611112573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906111369190611b02565b6040516001600160e01b031960e085901b1681526001600160a01b0390921660048301526024820152604401602060405180830381865afa15801561117f573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906111a39190611b02565b6111ad9190611b31565b6111b79190611b4e565b6111c19086611b70565b6000546040516336e028a360e21b81526001600160a01b038b8116600483015292975091169063db80a28c90602401602060405180830381865afa15801561120d573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906112319190611b02565b158015906112ab57506000546040516336e028a360e21b81526001600160a01b038a811660048301529091169063db80a28c90602401602060405180830381865afa158015611284573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906112a89190611b02565b86115b801561132d57506000546040516336e028a360e21b81526001600160a01b038a811660048301529091169063db80a28c90602401602060405180830381865afa1580156112fc573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906113209190611b02565b61132b836001611b70565b115b1561158c5760008054906101000a90046001600160a01b03166001600160a01b031663ef4cadc56040518163ffffffff1660e01b8152600401602060405180830381865afa158015611383573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906113a79190611b02565b6000546040516336e028a360e21b81526001600160a01b038b811660048301529091169063bebc9dfc90829063db80a28c90602401602060405180830381865afa1580156113f9573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061141d9190611b02565b6040518263ffffffff1660e01b815260040161143b91815260200190565b602060405180830381865afa158015611458573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061147c9190611b02565b6114869086611b83565b6000546040516336e028a360e21b81526001600160a01b038c811660048301529091169063aabbb1bd908c90839063db80a28c90602401602060405180830381865afa1580156114da573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906114fe9190611b02565b6040516001600160e01b031960e085901b1681526001600160a01b0390921660048301526024820152604401602060405180830381865afa158015611547573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061156b9190611b02565b6115759190611b31565b61157f9190611b4e565b6115899086611b70565b94505b50929695505050505050565b600080546040805163be26ed7f60e01b8152905183926001600160a01b03169163be26ed7f9160048083019260209291908290030181865afa1580156115e2573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906116069190611b02565b60008054604051633983243160e21b81526001600160a01b0387811660048301529394509192169063e60c90c490602401602060405180830381865afa158015611654573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906116789190611b02565b158015906116f25750600054604051633983243160e21b81526001600160a01b0386811660048301529091169063e60c90c490602401602060405180830381865afa1580156116cb573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906116ef9190611b02565b82115b156119c757600054604051633983243160e21b81526001600160a01b0386811660048301529091169063aabbb1bd908690839063e60c90c490602401602060405180830381865afa15801561174b573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061176f9190611b02565b6040516001600160e01b031960e085901b1681526001600160a01b0390921660048301526024820152604401602060405180830381865afa1580156117b8573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906117dc9190611b02565b6117e69082611b70565b6000546040516336e028a360e21b81526001600160a01b03878116600483015292935091169063db80a28c90602401602060405180830381865afa158015611832573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906118569190611b02565b158015906118d057506000546040516336e028a360e21b81526001600160a01b0386811660048301529091169063db80a28c90602401602060405180830381865afa1580156118a9573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906118cd9190611b02565b82115b156119c7576000546040516336e028a360e21b81526001600160a01b0386811660048301529091169063aabbb1bd908690839063db80a28c90602401602060405180830381865afa158015611929573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061194d9190611b02565b6040516001600160e01b031960e085901b1681526001600160a01b0390921660048301526024820152604401602060405180830381865afa158015611996573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906119ba9190611b02565b6119c49082611b70565b90505b600054604051631ed6380f60e01b81526001600160a01b03868116600483015283921690631ed6380f90602401602060405180830381865afa158015611a11573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611a359190611b02565b611a3f9190611b70565b949350505050565b6000805460408051632a57c76b60e21b81529051612724926001600160a01b03169163a95f1dac9160048083019260209291908290030181865afa158015611a93573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611ab79190611b02565b611ac390612710611b31565b611acd9190611b4e565b905090565b600060208284031215611ae457600080fd5b81356001600160a01b0381168114611afb57600080fd5b9392505050565b600060208284031215611b1457600080fd5b5051919050565b634e487b7160e01b600052601160045260246000fd5b8082028115828204841417611b4857611b48611b1b565b92915050565b600082611b6b57634e487b7160e01b600052601260045260246000fd5b500490565b80820180821115611b4857611b48611b1b565b81810381811115611b4857611b48611b1b56fea26469706673582212207cc9d0072bf6d2da74632f812212c522561c5cf82179c7934f14daa19d2c1ed564736f6c63430008110033000000000000000000000000a06735da049041eb523ccf0b8c3fb9d36216c646
Constructor Arguments (ABI-Encoded and is the last bytes of the Contract Creation Code above)
000000000000000000000000a06735da049041eb523ccf0b8c3fb9d36216c646
-----Decoded View---------------
Arg [0] : _deb0x (address): 0xa06735da049041eb523ccf0b8c3fb9d36216c646
-----Encoded View---------------
1 Constructor Arguments found :
Arg [0] : 000000000000000000000000a06735da049041eb523ccf0b8c3fb9d36216c646
Age | Block | Fee Address | BC Fee Address | Voting Power | Jailed | Incoming |
---|
Make sure to use the "Vote Down" button for any spammy posts, and the "Vote Up" for interesting conversations.