Contract Overview
Balance:
0 CRO
CRO Value:
$0.00
My Name Tag:
Not Available, login to update
Txn Hash | Method |
Block
|
From
|
To
|
Value | [Txn Fee] | |||
---|---|---|---|---|---|---|---|---|---|
0x02fcbd759450c92a86f084c6e7c6634ebb3a6624faa6cab594dbb760c90e3174 | Setup Staking Ad... | 5584477 | 124 days 23 hrs ago | Cronos ID: Deployer | IN | 0xa79eee7a9af3790545bf45b2f8b448423771393c | 0 CRO | 0.23753004499 | |
0x4118fa8882a59b92f514af172a6777b468c76f394ecb13fa0f2d67c62bba4c26 | 0x60e06040 | 5584446 | 124 days 23 hrs ago | Cronos ID: Deployer | IN | Create: TokenDistributor | 0 CRO | 4.766037244459 |
[ Download CSV Export ]
Contract Name:
TokenDistributor
Compiler Version
v0.8.13+commit.abaa5c0e
Optimization Enabled:
Yes with 10000 runs
Other Settings:
default evmVersion
Contract Source Code (Solidity Standard Json-Input format)
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import {ReentrancyGuard} from "@openzeppelin/contracts/security/ReentrancyGuard.sol"; import {IERC20, SafeERC20} from "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol"; import "../tokens/ICROIDToken.sol"; import "@openzeppelin/contracts/access/Ownable.sol"; /** * @title TokenDistributor * @notice It handles the distribution of CROID token. * It auto-adjusts block rewards over a set number of periods. */ contract TokenDistributor is Ownable, ReentrancyGuard { using SafeERC20 for IERC20; using SafeERC20 for ICROIDToken; uint256 public constant PRECISION_FACTOR = 10**18; struct StakingPeriod { uint256 rewardPerBlockForStaking; uint256 periodLengthInBlock; } ICROIDToken public immutable croidToken; address public stakingIncentivesAddress; address public stakingAddr; // Number of reward periods uint256 public immutable NUMBER_PERIODS; // Block number when rewards start uint256 public immutable START_BLOCK; // Current phase for rewards uint256 public currentPhase; // Block number when rewards end uint256 public endBlock; // Block number of the last update uint256 public lastRewardBlock; // Tokens distributed per block for staking uint256 public rewardPerBlockForStaking; mapping(uint256 => StakingPeriod) public stakingPeriod; event NewRewardsPerBlock( uint256 indexed currentPhase, uint256 startBlock, uint256 rewardPerBlockForStaking ); event SetupStakingAddress(address stakingAddr); /** * @notice Constructor * @param _croidToken CROID token address * @param _startBlock start block for reward program * @param _rewardsPerBlockForStaking array of rewards per block for staking * @param _periodLengthesInBlocks array of period lengthes * @param _numberPeriods number of periods with different rewards/lengthes (e.g., if 3 changes --> 4 periods) */ constructor( address _croidToken, address _stakingIncentivesAddress, uint256 _startBlock, uint256[] memory _rewardsPerBlockForStaking, uint256[] memory _periodLengthesInBlocks, uint256 _numberPeriods, uint256 slippage ) { require(_croidToken != address(0), "Distributor: croidToken must not be address(0)"); require( (_periodLengthesInBlocks.length == _numberPeriods) && (_rewardsPerBlockForStaking.length == _numberPeriods), "Distributor: lengths must match numberPeriods" ); // 1. Operational checks for supply uint256 totalStakingRewards = ICROIDToken(_croidToken).balanceOf(_stakingIncentivesAddress); uint256 totalAmountToBeDistributed; for (uint256 i = 0; i < _numberPeriods; i++) { totalAmountToBeDistributed += (_rewardsPerBlockForStaking[i] * _periodLengthesInBlocks[i]); stakingPeriod[i] = StakingPeriod({ rewardPerBlockForStaking: _rewardsPerBlockForStaking[i], periodLengthInBlock: _periodLengthesInBlocks[i] }); } require(totalAmountToBeDistributed <= totalStakingRewards, "Distributor: rewards exceeds supply"); uint256 residueAmt = totalStakingRewards - totalAmountToBeDistributed; uint256 rewardSlippage = (residueAmt * 100 * PRECISION_FACTOR) / totalStakingRewards; // require(rewardSlippage <= slippage, "Distributor: slippage exceeds"); // 2. Store values croidToken = ICROIDToken(_croidToken); stakingIncentivesAddress = _stakingIncentivesAddress; rewardPerBlockForStaking = _rewardsPerBlockForStaking[0]; START_BLOCK = _startBlock; endBlock = _startBlock + _periodLengthesInBlocks[0]; NUMBER_PERIODS = _numberPeriods; // Set the lastRewardBlock as the startBlock lastRewardBlock = _startBlock; } /** * @dev updates the staking adddress as a CROIDVault contract address once it is deployed. */ function setupStakingAddress(address _stakingAddr) external onlyOwner { require(_stakingAddr != address(0), "invalid address"); stakingAddr = _stakingAddr; emit SetupStakingAddress(stakingAddr); } /** * @notice Update pool rewards */ function updatePool() external nonReentrant { _updatePool(); } /** * @notice Update reward variables of the pool */ function _updatePool() internal { require(stakingAddr != address(0), "staking address not setup"); if (block.number <= lastRewardBlock) { return; } uint256 tokenRewardForStaking = _calculatePendingRewards(); // transfer tokens only if token rewards for staking are not null if (tokenRewardForStaking > 0) { // It allows protection against potential issues to prevent funds from being locked croidToken.transferFrom(stakingIncentivesAddress, stakingAddr, tokenRewardForStaking); } // Update last reward block only if it wasn't updated after or at the end block if (lastRewardBlock <= endBlock) { lastRewardBlock = block.number; } } function _calculatePendingRewards() internal returns (uint256) { if (block.number <= lastRewardBlock) { return 0; } // Calculate multiplier uint256 multiplier = _getMultiplier(lastRewardBlock, block.number, endBlock); // Calculate rewards for staking uint256 tokenRewardForStaking = multiplier * rewardPerBlockForStaking; // Check whether to adjust multipliers and reward per block while ((block.number > endBlock) && (currentPhase < (NUMBER_PERIODS - 1))) { // Update rewards per block _updateRewardsPerBlock(endBlock); uint256 previousEndBlock = endBlock; // Adjust the end block endBlock += stakingPeriod[currentPhase].periodLengthInBlock; // Adjust multiplier to cover the missing periods with other lower inflation schedule uint256 newMultiplier = _getMultiplier(previousEndBlock, block.number, endBlock); // Adjust token rewards tokenRewardForStaking += (newMultiplier * rewardPerBlockForStaking); } return tokenRewardForStaking; } function getPendingRewards() external view returns (uint256) { if (block.number <= lastRewardBlock) { return 0; } // shadow state vars to avoid updates uint256 tEndBlock = endBlock; uint256 tCurrentPhase = currentPhase; uint256 tRewardPerBlockForStaking = rewardPerBlockForStaking; // Calculate multiplier uint256 multiplier = _getMultiplier(lastRewardBlock, block.number, tEndBlock); // Calculate rewards for staking uint256 tokenRewardForStaking = multiplier * tRewardPerBlockForStaking; // Check whether to adjust multipliers and reward per block while ((block.number > tEndBlock) && (tCurrentPhase < (NUMBER_PERIODS - 1))) { // Update rewards per block tCurrentPhase++; tRewardPerBlockForStaking = stakingPeriod[tCurrentPhase].rewardPerBlockForStaking; uint256 previousEndBlock = tEndBlock; // Adjust the end block tEndBlock += stakingPeriod[tCurrentPhase].periodLengthInBlock; // Adjust multiplier to cover the missing periods with other lower inflation schedule uint256 newMultiplier = _getMultiplier(previousEndBlock, block.number, tEndBlock); // Adjust token rewards tokenRewardForStaking += (newMultiplier * tRewardPerBlockForStaking); } return tokenRewardForStaking; } /** * @notice Update rewards per block * @dev Rewards are halved by 2 for staking */ function _updateRewardsPerBlock(uint256 _newStartBlock) internal { // Update current phase currentPhase++; // Update rewards per block rewardPerBlockForStaking = stakingPeriod[currentPhase].rewardPerBlockForStaking; emit NewRewardsPerBlock( currentPhase, _newStartBlock, rewardPerBlockForStaking ); } /** * @notice Return reward multiplier over the given "from" to "to" block. * @param from block to start calculating reward * @param to block to finish calculating reward * @return the multiplier for the period */ function _getMultiplier( uint256 from, uint256 to, uint256 tEndBlock ) internal pure returns (uint256) { if (to <= tEndBlock) { return to - from; } else if (from >= tEndBlock) { return 0; } else { return tEndBlock - from; } } }
// SPDX-License-Identifier: MIT pragma solidity >=0.8.4; import "@openzeppelin/contracts/token/ERC20/IERC20.sol"; import "@openzeppelin/contracts/token/ERC20/extensions/IERC20Metadata.sol"; import "@openzeppelin/contracts/token/ERC20/extensions/draft-IERC20Permit.sol"; interface ICROIDToken is IERC20, IERC20Metadata, IERC20Permit { function getDeploymentStartTime() external view returns (uint256); function burn(uint256 amount) external; }
// 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 (access/Ownable.sol) pragma solidity ^0.8.0; import "../utils/Context.sol"; /** * @dev Contract module which provides a basic access control mechanism, where * there is an account (an owner) that can be granted exclusive access to * specific functions. * * By default, the owner account will be the one that deploys the contract. This * can later be changed with {transferOwnership}. * * This module is used through inheritance. It will make available the modifier * `onlyOwner`, which can be applied to your functions to restrict their use to * the owner. */ abstract contract Ownable is Context { address private _owner; event OwnershipTransferred(address indexed previousOwner, address indexed newOwner); /** * @dev Initializes the contract setting the deployer as the initial owner. */ constructor() { _transferOwnership(_msgSender()); } /** * @dev Returns the address of the current owner. */ function owner() public view virtual returns (address) { return _owner; } /** * @dev Throws if called by any account other than the owner. */ modifier onlyOwner() { require(owner() == _msgSender(), "Ownable: caller is not the owner"); _; } /** * @dev Leaves the contract without owner. It will not be possible to call * `onlyOwner` functions anymore. Can only be called by the current owner. * * NOTE: Renouncing ownership will leave the contract without an owner, * thereby removing any functionality that is only available to the owner. */ function renounceOwnership() public virtual onlyOwner { _transferOwnership(address(0)); } /** * @dev Transfers ownership of the contract to a new account (`newOwner`). * Can only be called by the current owner. */ function transferOwnership(address newOwner) public virtual onlyOwner { require(newOwner != address(0), "Ownable: new owner is the zero address"); _transferOwnership(newOwner); } /** * @dev Transfers ownership of the contract to a new account (`newOwner`). * Internal function without access restriction. */ function _transferOwnership(address newOwner) internal virtual { address oldOwner = _owner; _owner = newOwner; emit OwnershipTransferred(oldOwner, newOwner); } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (token/ERC20/utils/SafeERC20.sol) 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 // 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/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 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 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.5.0) (utils/Address.sol) pragma solidity ^0.8.1; /** * @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 * ==== * * [IMPORTANT] * ==== * You shouldn't rely on `isContract` to protect against flash loan attacks! * * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract * constructor. * ==== */ function isContract(address account) internal view returns (bool) { // This method relies on extcodesize/address.code.length, which returns 0 // for contracts in construction, since the code is only stored at the end // of the constructor execution. return account.code.length > 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": 10000 }, "outputSelection": { "*": { "*": [ "evm.bytecode", "evm.deployedBytecode", "devdoc", "userdoc", "metadata", "abi" ] } }, "metadata": { "useLiteralContent": true }, "libraries": {} }
[{"inputs":[{"internalType":"address","name":"_croidToken","type":"address"},{"internalType":"address","name":"_stakingIncentivesAddress","type":"address"},{"internalType":"uint256","name":"_startBlock","type":"uint256"},{"internalType":"uint256[]","name":"_rewardsPerBlockForStaking","type":"uint256[]"},{"internalType":"uint256[]","name":"_periodLengthesInBlocks","type":"uint256[]"},{"internalType":"uint256","name":"_numberPeriods","type":"uint256"},{"internalType":"uint256","name":"slippage","type":"uint256"}],"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"currentPhase","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"startBlock","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"rewardPerBlockForStaking","type":"uint256"}],"name":"NewRewardsPerBlock","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"previousOwner","type":"address"},{"indexed":true,"internalType":"address","name":"newOwner","type":"address"}],"name":"OwnershipTransferred","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"stakingAddr","type":"address"}],"name":"SetupStakingAddress","type":"event"},{"inputs":[],"name":"NUMBER_PERIODS","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"PRECISION_FACTOR","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"START_BLOCK","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"croidToken","outputs":[{"internalType":"contract ICROIDToken","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"currentPhase","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"endBlock","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getPendingRewards","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"lastRewardBlock","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"renounceOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"rewardPerBlockForStaking","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_stakingAddr","type":"address"}],"name":"setupStakingAddress","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"stakingAddr","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"stakingIncentivesAddress","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"stakingPeriod","outputs":[{"internalType":"uint256","name":"rewardPerBlockForStaking","type":"uint256"},{"internalType":"uint256","name":"periodLengthInBlock","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"updatePool","outputs":[],"stateMutability":"nonpayable","type":"function"}]
Contract Creation Code
60e06040523480156200001157600080fd5b5060405162001317380380620013178339810160408190526200003491620004e4565b6200003f33620003bd565b600180556001600160a01b038716620000b65760405162461bcd60e51b815260206004820152602e60248201527f4469737472696275746f723a2063726f6964546f6b656e206d757374206e6f7460448201526d206265206164647265737328302960901b60648201526084015b60405180910390fd5b818351148015620000c75750818451145b6200012b5760405162461bcd60e51b815260206004820152602d60248201527f4469737472696275746f723a206c656e67746873206d757374206d617463682060448201526c6e756d626572506572696f647360981b6064820152608401620000ad565b6040516370a0823160e01b81526001600160a01b038781166004830152600091908916906370a0823190602401602060405180830381865afa15801562000176573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906200019c919062000591565b90506000805b848110156200027f57858181518110620001c057620001c0620005ab565b6020026020010151878281518110620001dd57620001dd620005ab565b6020026020010151620001f19190620005d7565b620001fd9083620005f9565b915060405180604001604052808883815181106200021f576200021f620005ab565b60200260200101518152602001878381518110620002415762000241620005ab565b602090810291909101810151909152600083815260088252604090208251815591015160019091015580620002768162000614565b915050620001a2565b5081811115620002de5760405162461bcd60e51b815260206004820152602360248201527f4469737472696275746f723a2072657761726473206578636565647320737570604482015262706c7960e81b6064820152608401620000ad565b6000620002ec828462000630565b9050600083670de0b6b3a764000062000307846064620005d7565b620003139190620005d7565b6200031f91906200064a565b6001600160a01b038c8116608052600280546001600160a01b031916918d16919091179055885190915088906000906200035d576200035d620005ab565b60200260200101516007819055508860c0818152505086600081518110620003895762000389620005ab565b6020026020010151896200039e9190620005f9565b60055550505060a092909252505050600691909155506200066d915050565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b80516001600160a01b03811681146200042557600080fd5b919050565b634e487b7160e01b600052604160045260246000fd5b600082601f8301126200045257600080fd5b815160206001600160401b03808311156200047157620004716200042a565b8260051b604051601f19603f830116810181811084821117156200049957620004996200042a565b604052938452858101830193838101925087851115620004b857600080fd5b83870191505b84821015620004d957815183529183019190830190620004be565b979650505050505050565b600080600080600080600060e0888a0312156200050057600080fd5b6200050b886200040d565b96506200051b602089016200040d565b604089015160608a015191975095506001600160401b03808211156200054057600080fd5b6200054e8b838c0162000440565b955060808a01519150808211156200056557600080fd5b50620005748a828b0162000440565b93505060a0880151915060c0880151905092959891949750929550565b600060208284031215620005a457600080fd5b5051919050565b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052601160045260246000fd5b6000816000190483118215151615620005f457620005f4620005c1565b500290565b600082198211156200060f576200060f620005c1565b500190565b600060018201620006295762000629620005c1565b5060010190565b600082821015620006455762000645620005c1565b500390565b6000826200066857634e487b7160e01b600052601260045260246000fd5b500490565b60805160a05160c051610c65620006b2600039600061018f0152600081816101b60152818161053001526109e60152600081816102b801526109190152610c656000f3fe608060405234801561001057600080fd5b506004361061011b5760003560e01c80638da5cb5b116100b2578063ccd34cd511610081578063e3161ddd11610066578063e3161ddd14610298578063f2fde38b146102a0578063fbff3fae146102b357600080fd5b8063ccd34cd514610281578063d9621f9e1461029057600080fd5b80638da5cb5b146101fe578063a9f8d1811461021c578063b016116814610225578063c1027c981461024557600080fd5b806352bf348c116100ee57806352bf348c146101b15780635a9477e9146101d8578063715018a6146101e157806386b49207146101eb57600080fd5b8063055ad42e14610120578063083c63231461013c578063110ea3891461014557806339b3e8261461018a575b600080fd5b61012960045481565b6040519081526020015b60405180910390f35b61012960055481565b6003546101659073ffffffffffffffffffffffffffffffffffffffff1681565b60405173ffffffffffffffffffffffffffffffffffffffff9091168152602001610133565b6101297f000000000000000000000000000000000000000000000000000000000000000081565b6101297f000000000000000000000000000000000000000000000000000000000000000081565b61012960075481565b6101e96102da565b005b6101e96101f9366004610aeb565b61036c565b60005473ffffffffffffffffffffffffffffffffffffffff16610165565b61012960065481565b6002546101659073ffffffffffffffffffffffffffffffffffffffff1681565b61026c610253366004610b21565b6008602052600090815260409020805460019091015482565b60408051928352602083019190915201610133565b610129670de0b6b3a764000081565b6101296104e3565b6101e96105c5565b6101e96102ae366004610aeb565b610644565b6101657f000000000000000000000000000000000000000000000000000000000000000081565b60005473ffffffffffffffffffffffffffffffffffffffff163314610360576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657260448201526064015b60405180910390fd5b61036a6000610774565b565b60005473ffffffffffffffffffffffffffffffffffffffff1633146103ed576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610357565b73ffffffffffffffffffffffffffffffffffffffff811661046a576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600f60248201527f696e76616c6964206164647265737300000000000000000000000000000000006044820152606401610357565b600380547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff83169081179091556040519081527f0a114df666e75a21eeb2797384cea25799a5242c1d8105f49f5e046e0f8a6e079060200160405180910390a150565b600060065443116104f45750600090565b60055460045460075460065460009061050e9043866107e9565b9050600061051c8383610b69565b90505b8443118015610557575061055460017f0000000000000000000000000000000000000000000000000000000000000000610ba6565b84105b156105bc578361056681610bbd565b60008181526008602052604090208054600190910154919650945086915061058e9082610bf5565b9550600061059d8243896107e9565b90506105a98582610b69565b6105b39084610bf5565b9250505061051f565b95945050505050565b600260015403610631576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c006044820152606401610357565b600260015561063e610823565b60018055565b60005473ffffffffffffffffffffffffffffffffffffffff1633146106c5576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610357565b73ffffffffffffffffffffffffffffffffffffffff8116610768576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201527f64647265737300000000000000000000000000000000000000000000000000006064820152608401610357565b61077181610774565b50565b6000805473ffffffffffffffffffffffffffffffffffffffff8381167fffffffffffffffffffffffff0000000000000000000000000000000000000000831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b6000818311610803576107fc8484610ba6565b905061081c565b8184106108125750600061081c565b6107fc8483610ba6565b9392505050565b60035473ffffffffffffffffffffffffffffffffffffffff166108a2576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601960248201527f7374616b696e672061646472657373206e6f74207365747570000000000000006044820152606401610357565b60065443116108ad57565b60006108b761099c565b9050801561098a576002546003546040517f23b872dd00000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff92831660048201529082166024820152604481018390527f0000000000000000000000000000000000000000000000000000000000000000909116906323b872dd906064016020604051808303816000875af1158015610964573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906109889190610c0d565b505b60055460065411610771574360065550565b600060065443116109ad5750600090565b60006109be600654436005546107e9565b90506000600754826109d09190610b69565b90505b60055443118015610a0f5750610a0a60017f0000000000000000000000000000000000000000000000000000000000000000610ba6565b600454105b15610a7e57610a1f600554610a84565b60058054600454600090815260086020526040812060010154919290610a458385610bf5565b925050819055506000610a5b82436005546107e9565b905060075481610a6b9190610b69565b610a759084610bf5565b925050506109d3565b92915050565b60048054906000610a9483610bbd565b90915550506004546000818152600860209081526040918290205460078190558251858152918201527ffd164a2750ac60520fd2bf20907c4b88078e5459466a72af00e977d5fc92b0e6910160405180910390a250565b600060208284031215610afd57600080fd5b813573ffffffffffffffffffffffffffffffffffffffff8116811461081c57600080fd5b600060208284031215610b3357600080fd5b5035919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b6000817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0483118215151615610ba157610ba1610b3a565b500290565b600082821015610bb857610bb8610b3a565b500390565b60007fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8203610bee57610bee610b3a565b5060010190565b60008219821115610c0857610c08610b3a565b500190565b600060208284031215610c1f57600080fd5b8151801515811461081c57600080fdfea2646970667358221220824acf02c42ae796b48ecdf2bb3e1f1ddb724913cfec273aba75e86b7e8db06364736f6c634300080d0033000000000000000000000000cbf0adea24fd5f32c6e7f0474f0d1b94ace4e2e700000000000000000000000093b709ee5fcdb89714a62ec93cef5d1eac28d164000000000000000000000000000000000000000000000000000000000055af7800000000000000000000000000000000000000000000000000000000000000e000000000000000000000000000000000000000000000000000000000000001400000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000003b9aca0000000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000001a675944a9a10a2c00000000000000000000000000000000000000000000000034ceb28953421070000000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000005033400000000000000000000000000000000000000000000000000000000000f099c0
Constructor Arguments (ABI-Encoded and is the last bytes of the Contract Creation Code above)
000000000000000000000000cbf0adea24fd5f32c6e7f0474f0d1b94ace4e2e700000000000000000000000093b709ee5fcdb89714a62ec93cef5d1eac28d164000000000000000000000000000000000000000000000000000000000055af7800000000000000000000000000000000000000000000000000000000000000e000000000000000000000000000000000000000000000000000000000000001400000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000003b9aca0000000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000001a675944a9a10a2c00000000000000000000000000000000000000000000000034ceb28953421070000000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000005033400000000000000000000000000000000000000000000000000000000000f099c0
-----Decoded View---------------
Arg [0] : _croidToken (address): 0xcbf0adea24fd5f32c6e7f0474f0d1b94ace4e2e7
Arg [1] : _stakingIncentivesAddress (address): 0x93b709ee5fcdb89714a62ec93cef5d1eac28d164
Arg [2] : _startBlock (uint256): 5615480
Arg [3] : _rewardsPerBlockForStaking (uint256[]): 1902587519025875500,3805175038051750000
Arg [4] : _periodLengthesInBlocks (uint256[]): 5256000,15768000
Arg [5] : _numberPeriods (uint256): 2
Arg [6] : slippage (uint256): 1000000000
-----Encoded View---------------
13 Constructor Arguments found :
Arg [0] : 000000000000000000000000cbf0adea24fd5f32c6e7f0474f0d1b94ace4e2e7
Arg [1] : 00000000000000000000000093b709ee5fcdb89714a62ec93cef5d1eac28d164
Arg [2] : 000000000000000000000000000000000000000000000000000000000055af78
Arg [3] : 00000000000000000000000000000000000000000000000000000000000000e0
Arg [4] : 0000000000000000000000000000000000000000000000000000000000000140
Arg [5] : 0000000000000000000000000000000000000000000000000000000000000002
Arg [6] : 000000000000000000000000000000000000000000000000000000003b9aca00
Arg [7] : 0000000000000000000000000000000000000000000000000000000000000002
Arg [8] : 0000000000000000000000000000000000000000000000001a675944a9a10a2c
Arg [9] : 00000000000000000000000000000000000000000000000034ceb28953421070
Arg [10] : 0000000000000000000000000000000000000000000000000000000000000002
Arg [11] : 0000000000000000000000000000000000000000000000000000000000503340
Arg [12] : 0000000000000000000000000000000000000000000000000000000000f099c0
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.