Source Code
Overview
ETH Balance
0 ETH
ETH Value
$0.00View more zero value Internal Transactions in Advanced View mode
Advanced mode:
Cross-Chain Transactions
Loading...
Loading
Contract Name:
PrimeLiquidityProvider
Compiler Version
v0.8.25+commit.b61c2a91
Contract Source Code (Solidity Standard Json-Input format)
// SPDX-License-Identifier: BSD-3-Clause
pragma solidity 0.8.25;
import { PrimeLiquidityProviderStorageV1 } from "./PrimeLiquidityProviderStorage.sol";
import { SafeERC20Upgradeable, IERC20Upgradeable } from "@openzeppelin/contracts-upgradeable/token/ERC20/utils/SafeERC20Upgradeable.sol";
import { AccessControlledV8 } from "@venusprotocol/governance-contracts/contracts/Governance/AccessControlledV8.sol";
import { PausableUpgradeable } from "@openzeppelin/contracts-upgradeable/security/PausableUpgradeable.sol";
import { IPrimeLiquidityProvider } from "./Interfaces/IPrimeLiquidityProvider.sol";
import { MaxLoopsLimitHelper } from "@venusprotocol/solidity-utilities/contracts/MaxLoopsLimitHelper.sol";
import { TimeManagerV8 } from "@venusprotocol/solidity-utilities/contracts/TimeManagerV8.sol";
/**
* @title PrimeLiquidityProvider
* @author Venus
* @notice PrimeLiquidityProvider is used to fund Prime
*/
contract PrimeLiquidityProvider is
IPrimeLiquidityProvider,
AccessControlledV8,
PausableUpgradeable,
MaxLoopsLimitHelper,
PrimeLiquidityProviderStorageV1,
TimeManagerV8
{
using SafeERC20Upgradeable for IERC20Upgradeable;
/// @notice The default max token distribution speed
uint256 public constant DEFAULT_MAX_DISTRIBUTION_SPEED = 1e18;
/// @notice Emitted when a token distribution is initialized
event TokenDistributionInitialized(address indexed token);
/// @notice Emitted when a new token distribution speed is set
event TokenDistributionSpeedUpdated(address indexed token, uint256 oldSpeed, uint256 newSpeed);
/// @notice Emitted when a new max distribution speed for token is set
event MaxTokenDistributionSpeedUpdated(address indexed token, uint256 oldSpeed, uint256 newSpeed);
/// @notice Emitted when prime token contract address is changed
event PrimeTokenUpdated(address indexed oldPrimeToken, address indexed newPrimeToken);
/// @notice Emitted when distribution state(Index and block or second) is updated
event TokensAccrued(address indexed token, uint256 amount);
/// @notice Emitted when token is transferred to the prime contract
event TokenTransferredToPrime(address indexed token, uint256 amount);
/// @notice Emitted on sweep token success
event SweepToken(address indexed token, address indexed to, uint256 sweepAmount);
/// @notice Thrown when arguments are passed are invalid
error InvalidArguments();
/// @notice Thrown when distribution speed is greater than maxTokenDistributionSpeeds[tokenAddress]
error InvalidDistributionSpeed(uint256 speed, uint256 maxSpeed);
/// @notice Thrown when caller is not the desired caller
error InvalidCaller();
/// @notice Thrown when token is initialized
error TokenAlreadyInitialized(address token);
///@notice Error thrown when PrimeLiquidityProvider's balance is less than sweep amount
error InsufficientBalance(uint256 sweepAmount, uint256 balance);
/// @notice Error thrown when funds transfer is paused
error FundsTransferIsPaused();
/// @notice Error thrown when accrueTokens is called for an uninitialized token
error TokenNotInitialized(address token_);
/// @notice Error thrown when argument value in setter is same as previous value
error AddressesMustDiffer();
/**
* @notice Compares two addresses to ensure they are different
* @param oldAddress The original address to compare
* @param newAddress The new address to compare
*/
modifier compareAddress(address oldAddress, address newAddress) {
if (newAddress == oldAddress) {
revert AddressesMustDiffer();
}
_;
}
/**
* @notice Prime Liquidity Provider constructor
* @param _timeBased A boolean indicating whether the contract is based on time or block.
* @param _blocksPerYear total blocks per year
*/
/// @custom:oz-upgrades-unsafe-allow constructor
constructor(bool _timeBased, uint256 _blocksPerYear) TimeManagerV8(_timeBased, _blocksPerYear) {
_disableInitializers();
}
/**
* @notice PrimeLiquidityProvider initializer
* @dev Initializes the deployer to owner
* @param accessControlManager_ AccessControlManager contract address
* @param tokens_ Array of addresses of the tokens
* @param distributionSpeeds_ New distribution speeds for tokens
* @param loopsLimit_ Maximum number of loops allowed in a single transaction
* @custom:error Throw InvalidArguments on different length of tokens and speeds array
*/
function initialize(
address accessControlManager_,
address[] calldata tokens_,
uint256[] calldata distributionSpeeds_,
uint256[] calldata maxDistributionSpeeds_,
uint256 loopsLimit_
) external initializer {
_ensureZeroAddress(accessControlManager_);
__AccessControlled_init(accessControlManager_);
__Pausable_init();
_setMaxLoopsLimit(loopsLimit_);
uint256 numTokens = tokens_.length;
_ensureMaxLoops(numTokens);
if ((numTokens != distributionSpeeds_.length) || (numTokens != maxDistributionSpeeds_.length)) {
revert InvalidArguments();
}
for (uint256 i; i < numTokens; ) {
_initializeToken(tokens_[i]);
_setMaxTokenDistributionSpeed(tokens_[i], maxDistributionSpeeds_[i]);
_setTokenDistributionSpeed(tokens_[i], distributionSpeeds_[i]);
unchecked {
++i;
}
}
}
/**
* @notice Initialize the distribution of the token
* @param tokens_ Array of addresses of the tokens to be intialized
* @custom:access Only Governance
*/
function initializeTokens(address[] calldata tokens_) external onlyOwner {
uint256 tokensLength = tokens_.length;
_ensureMaxLoops(tokensLength);
for (uint256 i; i < tokensLength; ) {
_initializeToken(tokens_[i]);
unchecked {
++i;
}
}
}
/**
* @notice Pause fund transfer of tokens to Prime contract
* @custom:access Controlled by ACM
*/
function pauseFundsTransfer() external {
_checkAccessAllowed("pauseFundsTransfer()");
_pause();
}
/**
* @notice Resume fund transfer of tokens to Prime contract
* @custom:access Controlled by ACM
*/
function resumeFundsTransfer() external {
_checkAccessAllowed("resumeFundsTransfer()");
_unpause();
}
/**
* @notice Set distribution speed (amount of token distribute per block or second)
* @param tokens_ Array of addresses of the tokens
* @param distributionSpeeds_ New distribution speeds for tokens
* @custom:access Controlled by ACM
* @custom:error Throw InvalidArguments on different length of tokens and speeds array
*/
function setTokensDistributionSpeed(address[] calldata tokens_, uint256[] calldata distributionSpeeds_) external {
_checkAccessAllowed("setTokensDistributionSpeed(address[],uint256[])");
uint256 numTokens = tokens_.length;
_ensureMaxLoops(numTokens);
if (numTokens != distributionSpeeds_.length) {
revert InvalidArguments();
}
for (uint256 i; i < numTokens; ) {
_ensureTokenInitialized(tokens_[i]);
_setTokenDistributionSpeed(tokens_[i], distributionSpeeds_[i]);
unchecked {
++i;
}
}
}
/**
* @notice Set max distribution speed for token (amount of maximum token distribute per block or second)
* @param tokens_ Array of addresses of the tokens
* @param maxDistributionSpeeds_ New distribution speeds for tokens
* @custom:access Controlled by ACM
* @custom:error Throw InvalidArguments on different length of tokens and speeds array
*/
function setMaxTokensDistributionSpeed(
address[] calldata tokens_,
uint256[] calldata maxDistributionSpeeds_
) external {
_checkAccessAllowed("setMaxTokensDistributionSpeed(address[],uint256[])");
uint256 numTokens = tokens_.length;
_ensureMaxLoops(numTokens);
if (numTokens != maxDistributionSpeeds_.length) {
revert InvalidArguments();
}
for (uint256 i; i < numTokens; ) {
_setMaxTokenDistributionSpeed(tokens_[i], maxDistributionSpeeds_[i]);
unchecked {
++i;
}
}
}
/**
* @notice Set the prime token contract address
* @param prime_ The new address of the prime token contract
* @custom:event Emits PrimeTokenUpdated event
* @custom:access Only owner
*/
function setPrimeToken(address prime_) external onlyOwner compareAddress(prime, prime_) {
_ensureZeroAddress(prime_);
emit PrimeTokenUpdated(prime, prime_);
prime = prime_;
}
/**
* @notice Set the limit for the loops can iterate to avoid the DOS
* @param loopsLimit Limit for the max loops can execute at a time
* @custom:event Emits MaxLoopsLimitUpdated event on success
* @custom:access Controlled by ACM
*/
function setMaxLoopsLimit(uint256 loopsLimit) external {
_checkAccessAllowed("setMaxLoopsLimit(uint256)");
_setMaxLoopsLimit(loopsLimit);
}
/**
* @notice Claim all the token accrued till last block or second
* @param token_ The token to release to the Prime contract
* @custom:event Emits TokenTransferredToPrime event
* @custom:error Throw InvalidArguments on Zero address(token)
* @custom:error Throw FundsTransferIsPaused is paused
* @custom:error Throw InvalidCaller if the sender is not the Prime contract
*/
function releaseFunds(address token_) external {
address _prime = prime;
if (msg.sender != _prime) revert InvalidCaller();
if (paused()) {
revert FundsTransferIsPaused();
}
accrueTokens(token_);
uint256 accruedAmount = _tokenAmountAccrued[token_];
delete _tokenAmountAccrued[token_];
emit TokenTransferredToPrime(token_, accruedAmount);
IERC20Upgradeable(token_).safeTransfer(_prime, accruedAmount);
}
/**
* @notice A public function to sweep accidental ERC-20 transfers to this contract. Tokens are sent to user
* @param token_ The address of the ERC-20 token to sweep
* @param to_ The address of the recipient
* @param amount_ The amount of tokens needs to transfer
* @custom:event Emits SweepToken event
* @custom:error Throw InsufficientBalance if amount_ is greater than the available balance of the token in the contract
* @custom:access Only Governance
*/
function sweepToken(IERC20Upgradeable token_, address to_, uint256 amount_) external onlyOwner {
uint256 balance = token_.balanceOf(address(this));
if (amount_ > balance) {
revert InsufficientBalance(amount_, balance);
}
emit SweepToken(address(token_), to_, amount_);
token_.safeTransfer(to_, amount_);
}
/**
* @notice Get rewards per block or second for token
* @param token_ Address of the token
* @return speed returns the per block or second reward
*/
function getEffectiveDistributionSpeed(address token_) external view returns (uint256) {
uint256 distributionSpeed = tokenDistributionSpeeds[token_];
uint256 balance = IERC20Upgradeable(token_).balanceOf(address(this));
uint256 accrued = _tokenAmountAccrued[token_];
if (balance > accrued) {
return distributionSpeed;
}
return 0;
}
/**
* @notice Accrue token by updating the distribution state
* @param token_ Address of the token
* @custom:event Emits TokensAccrued event
*/
function accrueTokens(address token_) public {
_ensureZeroAddress(token_);
_ensureTokenInitialized(token_);
uint256 blockNumberOrSecond = getBlockNumberOrTimestamp();
uint256 deltaBlocksOrSeconds;
unchecked {
deltaBlocksOrSeconds = blockNumberOrSecond - lastAccruedBlockOrSecond[token_];
}
if (deltaBlocksOrSeconds != 0) {
uint256 distributionSpeed = tokenDistributionSpeeds[token_];
uint256 balance = IERC20Upgradeable(token_).balanceOf(address(this));
uint256 balanceDiff = balance - _tokenAmountAccrued[token_];
if (distributionSpeed != 0 && balanceDiff != 0) {
uint256 accruedSinceUpdate = deltaBlocksOrSeconds * distributionSpeed;
uint256 tokenAccrued = (balanceDiff <= accruedSinceUpdate ? balanceDiff : accruedSinceUpdate);
_tokenAmountAccrued[token_] += tokenAccrued;
emit TokensAccrued(token_, tokenAccrued);
}
lastAccruedBlockOrSecond[token_] = blockNumberOrSecond;
}
}
/**
* @notice Get the last accrued block or second for token
* @param token_ Address of the token
* @return blockNumberOrSecond returns the last accrued block or second
*/
function lastAccruedBlock(address token_) external view returns (uint256) {
return lastAccruedBlockOrSecond[token_];
}
/**
* @notice Get the tokens accrued
* @param token_ Address of the token
* @return returns the amount of accrued tokens for the token provided
*/
function tokenAmountAccrued(address token_) external view returns (uint256) {
return _tokenAmountAccrued[token_];
}
/**
* @notice Initialize the distribution of the token
* @param token_ Address of the token to be intialized
* @custom:event Emits TokenDistributionInitialized event
* @custom:error Throw TokenAlreadyInitialized if token is already initialized
*/
function _initializeToken(address token_) internal {
_ensureZeroAddress(token_);
uint256 blockNumberOrSecond = getBlockNumberOrTimestamp();
uint256 initializedBlockOrSecond = lastAccruedBlockOrSecond[token_];
if (initializedBlockOrSecond != 0) {
revert TokenAlreadyInitialized(token_);
}
/*
* Update token state block number or second
*/
lastAccruedBlockOrSecond[token_] = blockNumberOrSecond;
emit TokenDistributionInitialized(token_);
}
/**
* @notice Set distribution speed (amount of token distribute per block or second)
* @param token_ Address of the token
* @param distributionSpeed_ New distribution speed for token
* @custom:event Emits TokenDistributionSpeedUpdated event
* @custom:error Throw InvalidDistributionSpeed if speed is greater than max speed
*/
function _setTokenDistributionSpeed(address token_, uint256 distributionSpeed_) internal {
uint256 maxDistributionSpeed = maxTokenDistributionSpeeds[token_];
if (maxDistributionSpeed == 0) {
maxTokenDistributionSpeeds[token_] = maxDistributionSpeed = DEFAULT_MAX_DISTRIBUTION_SPEED;
}
if (distributionSpeed_ > maxDistributionSpeed) {
revert InvalidDistributionSpeed(distributionSpeed_, maxDistributionSpeed);
}
uint256 oldDistributionSpeed = tokenDistributionSpeeds[token_];
if (oldDistributionSpeed != distributionSpeed_) {
// Distribution speed updated so let's update distribution state to ensure that
// 1. Token accrued properly for the old speed, and
// 2. Token accrued at the new speed starts after this block or second.
accrueTokens(token_);
// Update speed
tokenDistributionSpeeds[token_] = distributionSpeed_;
emit TokenDistributionSpeedUpdated(token_, oldDistributionSpeed, distributionSpeed_);
}
}
/**
* @notice Set max distribution speed (amount of maximum token distribute per block or second)
* @param token_ Address of the token
* @param maxDistributionSpeed_ New max distribution speed for token
* @custom:event Emits MaxTokenDistributionSpeedUpdated event
*/
function _setMaxTokenDistributionSpeed(address token_, uint256 maxDistributionSpeed_) internal {
emit MaxTokenDistributionSpeedUpdated(token_, tokenDistributionSpeeds[token_], maxDistributionSpeed_);
maxTokenDistributionSpeeds[token_] = maxDistributionSpeed_;
}
/**
* @notice Revert on non initialized token
* @param token_ Token Address to be verified for
*/
function _ensureTokenInitialized(address token_) internal view {
uint256 lastBlockOrSecondAccrued = lastAccruedBlockOrSecond[token_];
if (lastBlockOrSecondAccrued == 0) {
revert TokenNotInitialized(token_);
}
}
/**
* @notice Revert on zero address
* @param address_ Address to be verified
*/
function _ensureZeroAddress(address address_) internal pure {
if (address_ == address(0)) {
revert InvalidArguments();
}
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (access/Ownable2Step.sol)
pragma solidity ^0.8.0;
import "./OwnableUpgradeable.sol";
import {Initializable} from "../proxy/utils/Initializable.sol";
/**
* @dev Contract module which provides 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} and {acceptOwnership}.
*
* This module is used through inheritance. It will make available all functions
* from parent (Ownable).
*/
abstract contract Ownable2StepUpgradeable is Initializable, OwnableUpgradeable {
address private _pendingOwner;
event OwnershipTransferStarted(address indexed previousOwner, address indexed newOwner);
function __Ownable2Step_init() internal onlyInitializing {
__Ownable_init_unchained();
}
function __Ownable2Step_init_unchained() internal onlyInitializing {
}
/**
* @dev Returns the address of the pending owner.
*/
function pendingOwner() public view virtual returns (address) {
return _pendingOwner;
}
/**
* @dev Starts the ownership transfer of the contract to a new account. Replaces the pending transfer if there is one.
* Can only be called by the current owner.
*/
function transferOwnership(address newOwner) public virtual override onlyOwner {
_pendingOwner = newOwner;
emit OwnershipTransferStarted(owner(), newOwner);
}
/**
* @dev Transfers ownership of the contract to a new account (`newOwner`) and deletes any pending owner.
* Internal function without access restriction.
*/
function _transferOwnership(address newOwner) internal virtual override {
delete _pendingOwner;
super._transferOwnership(newOwner);
}
/**
* @dev The new owner accepts the ownership transfer.
*/
function acceptOwnership() public virtual {
address sender = _msgSender();
require(pendingOwner() == sender, "Ownable2Step: caller is not the new owner");
_transferOwnership(sender);
}
/**
* @dev This empty reserved space is put in place to allow future versions to add new
* variables without shifting down storage in the inheritance chain.
* See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps
*/
uint256[49] private __gap;
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (access/Ownable.sol)
pragma solidity ^0.8.0;
import "../utils/ContextUpgradeable.sol";
import {Initializable} from "../proxy/utils/Initializable.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 OwnableUpgradeable is Initializable, ContextUpgradeable {
address private _owner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
/**
* @dev Initializes the contract setting the deployer as the initial owner.
*/
function __Ownable_init() internal onlyInitializing {
__Ownable_init_unchained();
}
function __Ownable_init_unchained() internal onlyInitializing {
_transferOwnership(_msgSender());
}
/**
* @dev Throws if called by any account other than the owner.
*/
modifier onlyOwner() {
_checkOwner();
_;
}
/**
* @dev Returns the address of the current owner.
*/
function owner() public view virtual returns (address) {
return _owner;
}
/**
* @dev Throws if the sender is not the owner.
*/
function _checkOwner() internal view virtual {
require(owner() == _msgSender(), "Ownable: caller is not the owner");
}
/**
* @dev Leaves the contract without owner. It will not be possible to call
* `onlyOwner` functions. Can only be called by the current owner.
*
* NOTE: Renouncing ownership will leave the contract without an owner,
* thereby disabling 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);
}
/**
* @dev This empty reserved space is put in place to allow future versions to add new
* variables without shifting down storage in the inheritance chain.
* See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps
*/
uint256[49] private __gap;
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (proxy/utils/Initializable.sol)
pragma solidity ^0.8.2;
import "../../utils/AddressUpgradeable.sol";
/**
* @dev This is a base contract to aid in writing upgradeable contracts, or any kind of contract that will be deployed
* behind a proxy. Since proxied contracts do not make use of a constructor, it's common to move constructor logic to an
* external initializer function, usually called `initialize`. It then becomes necessary to protect this initializer
* function so it can only be called once. The {initializer} modifier provided by this contract will have this effect.
*
* The initialization functions use a version number. Once a version number is used, it is consumed and cannot be
* reused. This mechanism prevents re-execution of each "step" but allows the creation of new initialization steps in
* case an upgrade adds a module that needs to be initialized.
*
* For example:
*
* [.hljs-theme-light.nopadding]
* ```solidity
* contract MyToken is ERC20Upgradeable {
* function initialize() initializer public {
* __ERC20_init("MyToken", "MTK");
* }
* }
*
* contract MyTokenV2 is MyToken, ERC20PermitUpgradeable {
* function initializeV2() reinitializer(2) public {
* __ERC20Permit_init("MyToken");
* }
* }
* ```
*
* TIP: To avoid leaving the proxy in an uninitialized state, the initializer function should be called as early as
* possible by providing the encoded function call as the `_data` argument to {ERC1967Proxy-constructor}.
*
* CAUTION: When used with inheritance, manual care must be taken to not invoke a parent initializer twice, or to ensure
* that all initializers are idempotent. This is not verified automatically as constructors are by Solidity.
*
* [CAUTION]
* ====
* Avoid leaving a contract uninitialized.
*
* An uninitialized contract can be taken over by an attacker. This applies to both a proxy and its implementation
* contract, which may impact the proxy. To prevent the implementation contract from being used, you should invoke
* the {_disableInitializers} function in the constructor to automatically lock it when it is deployed:
*
* [.hljs-theme-light.nopadding]
* ```
* /// @custom:oz-upgrades-unsafe-allow constructor
* constructor() {
* _disableInitializers();
* }
* ```
* ====
*/
abstract contract Initializable {
/**
* @dev Indicates that the contract has been initialized.
* @custom:oz-retyped-from bool
*/
uint8 private _initialized;
/**
* @dev Indicates that the contract is in the process of being initialized.
*/
bool private _initializing;
/**
* @dev Triggered when the contract has been initialized or reinitialized.
*/
event Initialized(uint8 version);
/**
* @dev A modifier that defines a protected initializer function that can be invoked at most once. In its scope,
* `onlyInitializing` functions can be used to initialize parent contracts.
*
* Similar to `reinitializer(1)`, except that functions marked with `initializer` can be nested in the context of a
* constructor.
*
* Emits an {Initialized} event.
*/
modifier initializer() {
bool isTopLevelCall = !_initializing;
require(
(isTopLevelCall && _initialized < 1) || (!AddressUpgradeable.isContract(address(this)) && _initialized == 1),
"Initializable: contract is already initialized"
);
_initialized = 1;
if (isTopLevelCall) {
_initializing = true;
}
_;
if (isTopLevelCall) {
_initializing = false;
emit Initialized(1);
}
}
/**
* @dev A modifier that defines a protected reinitializer function that can be invoked at most once, and only if the
* contract hasn't been initialized to a greater version before. In its scope, `onlyInitializing` functions can be
* used to initialize parent contracts.
*
* A reinitializer may be used after the original initialization step. This is essential to configure modules that
* are added through upgrades and that require initialization.
*
* When `version` is 1, this modifier is similar to `initializer`, except that functions marked with `reinitializer`
* cannot be nested. If one is invoked in the context of another, execution will revert.
*
* Note that versions can jump in increments greater than 1; this implies that if multiple reinitializers coexist in
* a contract, executing them in the right order is up to the developer or operator.
*
* WARNING: setting the version to 255 will prevent any future reinitialization.
*
* Emits an {Initialized} event.
*/
modifier reinitializer(uint8 version) {
require(!_initializing && _initialized < version, "Initializable: contract is already initialized");
_initialized = version;
_initializing = true;
_;
_initializing = false;
emit Initialized(version);
}
/**
* @dev Modifier to protect an initialization function so that it can only be invoked by functions with the
* {initializer} and {reinitializer} modifiers, directly or indirectly.
*/
modifier onlyInitializing() {
require(_initializing, "Initializable: contract is not initializing");
_;
}
/**
* @dev Locks the contract, preventing any future reinitialization. This cannot be part of an initializer call.
* Calling this in the constructor of a contract will prevent that contract from being initialized or reinitialized
* to any version. It is recommended to use this to lock implementation contracts that are designed to be called
* through proxies.
*
* Emits an {Initialized} event the first time it is successfully executed.
*/
function _disableInitializers() internal virtual {
require(!_initializing, "Initializable: contract is initializing");
if (_initialized != type(uint8).max) {
_initialized = type(uint8).max;
emit Initialized(type(uint8).max);
}
}
/**
* @dev Returns the highest version that has been initialized. See {reinitializer}.
*/
function _getInitializedVersion() internal view returns (uint8) {
return _initialized;
}
/**
* @dev Returns `true` if the contract is currently initializing. See {onlyInitializing}.
*/
function _isInitializing() internal view returns (bool) {
return _initializing;
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.7.0) (security/Pausable.sol)
pragma solidity ^0.8.0;
import "../utils/ContextUpgradeable.sol";
import {Initializable} from "../proxy/utils/Initializable.sol";
/**
* @dev Contract module which allows children to implement an emergency stop
* mechanism that can be triggered by an authorized account.
*
* This module is used through inheritance. It will make available the
* modifiers `whenNotPaused` and `whenPaused`, which can be applied to
* the functions of your contract. Note that they will not be pausable by
* simply including this module, only once the modifiers are put in place.
*/
abstract contract PausableUpgradeable is Initializable, ContextUpgradeable {
/**
* @dev Emitted when the pause is triggered by `account`.
*/
event Paused(address account);
/**
* @dev Emitted when the pause is lifted by `account`.
*/
event Unpaused(address account);
bool private _paused;
/**
* @dev Initializes the contract in unpaused state.
*/
function __Pausable_init() internal onlyInitializing {
__Pausable_init_unchained();
}
function __Pausable_init_unchained() internal onlyInitializing {
_paused = false;
}
/**
* @dev Modifier to make a function callable only when the contract is not paused.
*
* Requirements:
*
* - The contract must not be paused.
*/
modifier whenNotPaused() {
_requireNotPaused();
_;
}
/**
* @dev Modifier to make a function callable only when the contract is paused.
*
* Requirements:
*
* - The contract must be paused.
*/
modifier whenPaused() {
_requirePaused();
_;
}
/**
* @dev Returns true if the contract is paused, and false otherwise.
*/
function paused() public view virtual returns (bool) {
return _paused;
}
/**
* @dev Throws if the contract is paused.
*/
function _requireNotPaused() internal view virtual {
require(!paused(), "Pausable: paused");
}
/**
* @dev Throws if the contract is not paused.
*/
function _requirePaused() internal view virtual {
require(paused(), "Pausable: not paused");
}
/**
* @dev Triggers stopped state.
*
* Requirements:
*
* - The contract must not be paused.
*/
function _pause() internal virtual whenNotPaused {
_paused = true;
emit Paused(_msgSender());
}
/**
* @dev Returns to normal state.
*
* Requirements:
*
* - The contract must be paused.
*/
function _unpause() internal virtual whenPaused {
_paused = false;
emit Unpaused(_msgSender());
}
/**
* @dev This empty reserved space is put in place to allow future versions to add new
* variables without shifting down storage in the inheritance chain.
* See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps
*/
uint256[49] private __gap;
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC20/IERC20.sol)
pragma solidity ^0.8.0;
/**
* @dev Interface of the ERC20 standard as defined in the EIP.
*/
interface IERC20Upgradeable {
/**
* @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 (last updated v4.9.4) (token/ERC20/extensions/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.
*
* ==== Security Considerations
*
* There are two important considerations concerning the use of `permit`. The first is that a valid permit signature
* expresses an allowance, and it should not be assumed to convey additional meaning. In particular, it should not be
* considered as an intention to spend the allowance in any specific way. The second is that because permits have
* built-in replay protection and can be submitted by anyone, they can be frontrun. A protocol that uses permits should
* take this into consideration and allow a `permit` call to fail. Combining these two aspects, a pattern that may be
* generally recommended is:
*
* ```solidity
* function doThingWithPermit(..., uint256 value, uint256 deadline, uint8 v, bytes32 r, bytes32 s) public {
* try token.permit(msg.sender, address(this), value, deadline, v, r, s) {} catch {}
* doThing(..., value);
* }
*
* function doThing(..., uint256 value) public {
* token.safeTransferFrom(msg.sender, address(this), value);
* ...
* }
* ```
*
* Observe that: 1) `msg.sender` is used as the owner, leaving no ambiguity as to the signer intent, and 2) the use of
* `try/catch` allows the permit to fail and makes the code tolerant to frontrunning. (See also
* {SafeERC20-safeTransferFrom}).
*
* Additionally, note that smart contract wallets (such as Argent or Safe) are not able to produce permit signatures, so
* contracts should have entry points that don't rely on permit.
*/
interface IERC20PermitUpgradeable {
/**
* @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].
*
* CAUTION: See Security Considerations above.
*/
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.9.3) (token/ERC20/utils/SafeERC20.sol)
pragma solidity ^0.8.0;
import "../IERC20Upgradeable.sol";
import "../extensions/IERC20PermitUpgradeable.sol";
import "../../../utils/AddressUpgradeable.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 SafeERC20Upgradeable {
using AddressUpgradeable for address;
/**
* @dev Transfer `value` amount of `token` from the calling contract to `to`. If `token` returns no value,
* non-reverting calls are assumed to be successful.
*/
function safeTransfer(IERC20Upgradeable token, address to, uint256 value) internal {
_callOptionalReturn(token, abi.encodeWithSelector(token.transfer.selector, to, value));
}
/**
* @dev Transfer `value` amount of `token` from `from` to `to`, spending the approval given by `from` to the
* calling contract. If `token` returns no value, non-reverting calls are assumed to be successful.
*/
function safeTransferFrom(IERC20Upgradeable 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(IERC20Upgradeable 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));
}
/**
* @dev Increase the calling contract's allowance toward `spender` by `value`. If `token` returns no value,
* non-reverting calls are assumed to be successful.
*/
function safeIncreaseAllowance(IERC20Upgradeable token, address spender, uint256 value) internal {
uint256 oldAllowance = token.allowance(address(this), spender);
_callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, oldAllowance + value));
}
/**
* @dev Decrease the calling contract's allowance toward `spender` by `value`. If `token` returns no value,
* non-reverting calls are assumed to be successful.
*/
function safeDecreaseAllowance(IERC20Upgradeable token, address spender, uint256 value) internal {
unchecked {
uint256 oldAllowance = token.allowance(address(this), spender);
require(oldAllowance >= value, "SafeERC20: decreased allowance below zero");
_callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, oldAllowance - value));
}
}
/**
* @dev Set the calling contract's allowance toward `spender` to `value`. If `token` returns no value,
* non-reverting calls are assumed to be successful. Meant to be used with tokens that require the approval
* to be set to zero before setting it to a non-zero value, such as USDT.
*/
function forceApprove(IERC20Upgradeable token, address spender, uint256 value) internal {
bytes memory approvalCall = abi.encodeWithSelector(token.approve.selector, spender, value);
if (!_callOptionalReturnBool(token, approvalCall)) {
_callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, 0));
_callOptionalReturn(token, approvalCall);
}
}
/**
* @dev Use a ERC-2612 signature to set the `owner` approval toward `spender` on `token`.
* Revert on invalid signature.
*/
function safePermit(
IERC20PermitUpgradeable token,
address owner,
address spender,
uint256 value,
uint256 deadline,
uint8 v,
bytes32 r,
bytes32 s
) internal {
uint256 nonceBefore = token.nonces(owner);
token.permit(owner, spender, value, deadline, v, r, s);
uint256 nonceAfter = token.nonces(owner);
require(nonceAfter == nonceBefore + 1, "SafeERC20: permit did not succeed");
}
/**
* @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(IERC20Upgradeable 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");
require(returndata.length == 0 || abi.decode(returndata, (bool)), "SafeERC20: ERC20 operation did not succeed");
}
/**
* @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).
*
* This is a variant of {_callOptionalReturn} that silents catches all reverts and returns a bool instead.
*/
function _callOptionalReturnBool(IERC20Upgradeable token, bytes memory data) private returns (bool) {
// 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 cannot use {Address-functionCall} here since this should return false
// and not revert is the subcall reverts.
(bool success, bytes memory returndata) = address(token).call(data);
return
success && (returndata.length == 0 || abi.decode(returndata, (bool))) && AddressUpgradeable.isContract(address(token));
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (utils/Address.sol)
pragma solidity ^0.8.1;
/**
* @dev Collection of functions related to the address type
*/
library AddressUpgradeable {
/**
* @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
*
* Furthermore, `isContract` will also return true if the target contract within
* the same transaction is already scheduled for destruction by `SELFDESTRUCT`,
* which only has an effect at the end of a transaction.
* ====
*
* [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://consensys.net/diligence/blog/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.8.0/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 functionCallWithValue(target, data, 0, "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");
(bool success, bytes memory returndata) = target.call{value: value}(data);
return verifyCallResultFromTarget(target, 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) {
(bool success, bytes memory returndata) = target.staticcall(data);
return verifyCallResultFromTarget(target, 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) {
(bool success, bytes memory returndata) = target.delegatecall(data);
return verifyCallResultFromTarget(target, success, returndata, errorMessage);
}
/**
* @dev Tool to verify that a low level call to smart-contract was successful, and revert (either by bubbling
* the revert reason or using the provided one) in case of unsuccessful call or if target was not a contract.
*
* _Available since v4.8._
*/
function verifyCallResultFromTarget(
address target,
bool success,
bytes memory returndata,
string memory errorMessage
) internal view returns (bytes memory) {
if (success) {
if (returndata.length == 0) {
// only check isContract if the call was successful and the return data is empty
// otherwise we already know that it was a contract
require(isContract(target), "Address: call to non-contract");
}
return returndata;
} else {
_revert(returndata, errorMessage);
}
}
/**
* @dev Tool to verify that a low level call was successful, and revert if it wasn't, either by bubbling the
* revert reason or 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 {
_revert(returndata, errorMessage);
}
}
function _revert(bytes memory returndata, string memory errorMessage) private pure {
// 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
/// @solidity memory-safe-assembly
assembly {
let returndata_size := mload(returndata)
revert(add(32, returndata), returndata_size)
}
} else {
revert(errorMessage);
}
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.4) (utils/Context.sol)
pragma solidity ^0.8.0;
import {Initializable} from "../proxy/utils/Initializable.sol";
/**
* @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 ContextUpgradeable is Initializable {
function __Context_init() internal onlyInitializing {
}
function __Context_init_unchained() internal onlyInitializing {
}
function _msgSender() internal view virtual returns (address) {
return msg.sender;
}
function _msgData() internal view virtual returns (bytes calldata) {
return msg.data;
}
function _contextSuffixLength() internal view virtual returns (uint256) {
return 0;
}
/**
* @dev This empty reserved space is put in place to allow future versions to add new
* variables without shifting down storage in the inheritance chain.
* See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps
*/
uint256[50] private __gap;
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (access/IAccessControl.sol)
pragma solidity ^0.8.0;
/**
* @dev External interface of AccessControl declared to support ERC165 detection.
*/
interface IAccessControl {
/**
* @dev Emitted when `newAdminRole` is set as ``role``'s admin role, replacing `previousAdminRole`
*
* `DEFAULT_ADMIN_ROLE` is the starting admin for all roles, despite
* {RoleAdminChanged} not being emitted signaling this.
*
* _Available since v3.1._
*/
event RoleAdminChanged(bytes32 indexed role, bytes32 indexed previousAdminRole, bytes32 indexed newAdminRole);
/**
* @dev Emitted when `account` is granted `role`.
*
* `sender` is the account that originated the contract call, an admin role
* bearer except when using {AccessControl-_setupRole}.
*/
event RoleGranted(bytes32 indexed role, address indexed account, address indexed sender);
/**
* @dev Emitted when `account` is revoked `role`.
*
* `sender` is the account that originated the contract call:
* - if using `revokeRole`, it is the admin role bearer
* - if using `renounceRole`, it is the role bearer (i.e. `account`)
*/
event RoleRevoked(bytes32 indexed role, address indexed account, address indexed sender);
/**
* @dev Returns `true` if `account` has been granted `role`.
*/
function hasRole(bytes32 role, address account) external view returns (bool);
/**
* @dev Returns the admin role that controls `role`. See {grantRole} and
* {revokeRole}.
*
* To change a role's admin, use {AccessControl-_setRoleAdmin}.
*/
function getRoleAdmin(bytes32 role) external view returns (bytes32);
/**
* @dev Grants `role` to `account`.
*
* If `account` had not been already granted `role`, emits a {RoleGranted}
* event.
*
* Requirements:
*
* - the caller must have ``role``'s admin role.
*/
function grantRole(bytes32 role, address account) external;
/**
* @dev Revokes `role` from `account`.
*
* If `account` had been granted `role`, emits a {RoleRevoked} event.
*
* Requirements:
*
* - the caller must have ``role``'s admin role.
*/
function revokeRole(bytes32 role, address account) external;
/**
* @dev Revokes `role` from the calling account.
*
* Roles are often managed via {grantRole} and {revokeRole}: this function's
* purpose is to provide a mechanism for accounts to lose their privileges
* if they are compromised (such as when a trusted device is misplaced).
*
* If the calling account had been granted `role`, emits a {RoleRevoked}
* event.
*
* Requirements:
*
* - the caller must be `account`.
*/
function renounceRole(bytes32 role, address account) external;
}// SPDX-License-Identifier: BSD-3-Clause
pragma solidity 0.8.25;
import "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol";
import "@openzeppelin/contracts-upgradeable/access/Ownable2StepUpgradeable.sol";
import "./IAccessControlManagerV8.sol";
/**
* @title AccessControlledV8
* @author Venus
* @notice This contract is helper between access control manager and actual contract. This contract further inherited by other contract (using solidity 0.8.13)
* to integrate access controlled mechanism. It provides initialise methods and verifying access methods.
*/
abstract contract AccessControlledV8 is Initializable, Ownable2StepUpgradeable {
/// @notice Access control manager contract
IAccessControlManagerV8 private _accessControlManager;
/**
* @dev This empty reserved space is put in place to allow future versions to add new
* variables without shifting down storage in the inheritance chain.
* See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps
*/
uint256[49] private __gap;
/// @notice Emitted when access control manager contract address is changed
event NewAccessControlManager(address oldAccessControlManager, address newAccessControlManager);
/// @notice Thrown when the action is prohibited by AccessControlManager
error Unauthorized(address sender, address calledContract, string methodSignature);
function __AccessControlled_init(address accessControlManager_) internal onlyInitializing {
__Ownable2Step_init();
__AccessControlled_init_unchained(accessControlManager_);
}
function __AccessControlled_init_unchained(address accessControlManager_) internal onlyInitializing {
_setAccessControlManager(accessControlManager_);
}
/**
* @notice Sets the address of AccessControlManager
* @dev Admin function to set address of AccessControlManager
* @param accessControlManager_ The new address of the AccessControlManager
* @custom:event Emits NewAccessControlManager event
* @custom:access Only Governance
*/
function setAccessControlManager(address accessControlManager_) external onlyOwner {
_setAccessControlManager(accessControlManager_);
}
/**
* @notice Returns the address of the access control manager contract
*/
function accessControlManager() external view returns (IAccessControlManagerV8) {
return _accessControlManager;
}
/**
* @dev Internal function to set address of AccessControlManager
* @param accessControlManager_ The new address of the AccessControlManager
*/
function _setAccessControlManager(address accessControlManager_) internal {
require(address(accessControlManager_) != address(0), "invalid acess control manager address");
address oldAccessControlManager = address(_accessControlManager);
_accessControlManager = IAccessControlManagerV8(accessControlManager_);
emit NewAccessControlManager(oldAccessControlManager, accessControlManager_);
}
/**
* @notice Reverts if the call is not allowed by AccessControlManager
* @param signature Method signature
*/
function _checkAccessAllowed(string memory signature) internal view {
bool isAllowedToCall = _accessControlManager.isAllowedToCall(msg.sender, signature);
if (!isAllowedToCall) {
revert Unauthorized(msg.sender, address(this), signature);
}
}
}// SPDX-License-Identifier: BSD-3-Clause
pragma solidity ^0.8.25;
import "@openzeppelin/contracts/access/IAccessControl.sol";
/**
* @title IAccessControlManagerV8
* @author Venus
* @notice Interface implemented by the `AccessControlManagerV8` contract.
*/
interface IAccessControlManagerV8 is IAccessControl {
function giveCallPermission(address contractAddress, string calldata functionSig, address accountToPermit) external;
function revokeCallPermission(
address contractAddress,
string calldata functionSig,
address accountToRevoke
) external;
function isAllowedToCall(address account, string calldata functionSig) external view returns (bool);
function hasPermission(
address account,
address contractAddress,
string calldata functionSig
) external view returns (bool);
}// SPDX-License-Identifier: BSD-3-Clause
pragma solidity 0.8.25;
/**
* @title MaxLoopsLimitHelper
* @author Venus
* @notice Abstract contract used to avoid collection with too many items that would generate gas errors and DoS.
*/
abstract contract MaxLoopsLimitHelper {
// Limit for the loops to avoid the DOS
uint256 public maxLoopsLimit;
/**
* @dev This empty reserved space is put in place to allow future versions to add new
* variables without shifting down storage in the inheritance chain.
* See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps
*/
uint256[49] private __gap;
/// @notice Emitted when max loops limit is set
event MaxLoopsLimitUpdated(uint256 oldMaxLoopsLimit, uint256 newmaxLoopsLimit);
/// @notice Thrown an error on maxLoopsLimit exceeds for any loop
error MaxLoopsLimitExceeded(uint256 loopsLimit, uint256 requiredLoops);
/**
* @notice Set the limit for the loops can iterate to avoid the DOS
* @param limit Limit for the max loops can execute at a time
*/
function _setMaxLoopsLimit(uint256 limit) internal {
require(limit > maxLoopsLimit, "Comptroller: Invalid maxLoopsLimit");
uint256 oldMaxLoopsLimit = maxLoopsLimit;
maxLoopsLimit = limit;
emit MaxLoopsLimitUpdated(oldMaxLoopsLimit, limit);
}
/**
* @notice Compare the maxLoopsLimit with number of the times loop iterate
* @param len Length of the loops iterate
* @custom:error MaxLoopsLimitExceeded error is thrown when loops length exceeds maxLoopsLimit
*/
function _ensureMaxLoops(uint256 len) internal view {
if (len > maxLoopsLimit) {
revert MaxLoopsLimitExceeded(maxLoopsLimit, len);
}
}
}// SPDX-License-Identifier: BSD-3-Clause
pragma solidity 0.8.25;
import { SECONDS_PER_YEAR } from "./constants.sol";
abstract contract TimeManagerV8 {
/// @notice Stores blocksPerYear if isTimeBased is true else secondsPerYear is stored
/// @custom:oz-upgrades-unsafe-allow state-variable-immutable
uint256 public immutable blocksOrSecondsPerYear;
/// @notice Acknowledges if a contract is time based or not
/// @custom:oz-upgrades-unsafe-allow state-variable-immutable
bool public immutable isTimeBased;
/// @notice Stores the current block timestamp or block number depending on isTimeBased
/// @custom:oz-upgrades-unsafe-allow state-variable-immutable
function() view returns (uint256) private immutable _getCurrentSlot;
/**
* @dev This empty reserved space is put in place to allow future versions to add new
* variables without shifting down storage in the inheritance chain
* See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps
*/
uint256[48] private __gap;
/// @notice Thrown when blocks per year is invalid
error InvalidBlocksPerYear();
/// @notice Thrown when time based but blocks per year is provided
error InvalidTimeBasedConfiguration();
/**
* @param timeBased_ A boolean indicating whether the contract is based on time or block
* If timeBased is true than blocksPerYear_ param is ignored as blocksOrSecondsPerYear is set to SECONDS_PER_YEAR
* @param blocksPerYear_ The number of blocks per year
* @custom:error InvalidBlocksPerYear is thrown if blocksPerYear entered is zero and timeBased is false
* @custom:error InvalidTimeBasedConfiguration is thrown if blocksPerYear entered is non zero and timeBased is true
* @custom:oz-upgrades-unsafe-allow constructor
*/
constructor(bool timeBased_, uint256 blocksPerYear_) {
if (!timeBased_ && blocksPerYear_ == 0) {
revert InvalidBlocksPerYear();
}
if (timeBased_ && blocksPerYear_ != 0) {
revert InvalidTimeBasedConfiguration();
}
isTimeBased = timeBased_;
blocksOrSecondsPerYear = timeBased_ ? SECONDS_PER_YEAR : blocksPerYear_;
_getCurrentSlot = timeBased_ ? _getBlockTimestamp : _getBlockNumber;
}
/**
* @dev Function to simply retrieve block number or block timestamp
* @return Current block number or block timestamp
*/
function getBlockNumberOrTimestamp() public view virtual returns (uint256) {
return _getCurrentSlot();
}
/**
* @dev Returns the current timestamp in seconds
* @return The current timestamp
*/
function _getBlockTimestamp() private view returns (uint256) {
return block.timestamp;
}
/**
* @dev Returns the current block number
* @return The current block number
*/
function _getBlockNumber() private view returns (uint256) {
return block.number;
}
}// SPDX-License-Identifier: BSD-3-Clause pragma solidity ^0.8.25; /// @dev Base unit for computations, usually used in scaling (multiplications, divisions) uint256 constant EXP_SCALE = 1e18; /// @dev A unit (literal one) in EXP_SCALE, usually used in additions/subtractions uint256 constant MANTISSA_ONE = EXP_SCALE; /// @dev The approximate number of seconds per year uint256 constant SECONDS_PER_YEAR = 31_536_000;
// SPDX-License-Identifier: BSD-3-Clause
pragma solidity ^0.8.25;
import { IERC20Upgradeable } from "@openzeppelin/contracts-upgradeable/token/ERC20/utils/SafeERC20Upgradeable.sol";
/**
* @title IPrimeLiquidityProvider
* @author Venus
* @notice Interface for PrimeLiquidityProvider
*/
interface IPrimeLiquidityProvider {
/**
* @notice Initialize the distribution of the token
* @param tokens_ Array of addresses of the tokens to be intialized
*/
function initializeTokens(address[] calldata tokens_) external;
/**
* @notice Pause fund transfer of tokens to Prime contract
*/
function pauseFundsTransfer() external;
/**
* @notice Resume fund transfer of tokens to Prime contract
*/
function resumeFundsTransfer() external;
/**
* @notice Set distribution speed (amount of token distribute per block or second)
* @param tokens_ Array of addresses of the tokens
* @param distributionSpeeds_ New distribution speeds for tokens
*/
function setTokensDistributionSpeed(address[] calldata tokens_, uint256[] calldata distributionSpeeds_) external;
/**
* @notice Set max distribution speed for token (amount of maximum token distribute per block or second)
* @param tokens_ Array of addresses of the tokens
* @param maxDistributionSpeeds_ New distribution speeds for tokens
*/
function setMaxTokensDistributionSpeed(
address[] calldata tokens_,
uint256[] calldata maxDistributionSpeeds_
) external;
/**
* @notice Set the prime token contract address
* @param prime_ The new address of the prime token contract
*/
function setPrimeToken(address prime_) external;
/**
* @notice Claim all the token accrued till last block or second
* @param token_ The token to release to the Prime contract
*/
function releaseFunds(address token_) external;
/**
* @notice A public function to sweep accidental ERC-20 transfers to this contract. Tokens are sent to user
* @param token_ The address of the ERC-20 token to sweep
* @param to_ The address of the recipient
* @param amount_ The amount of tokens needs to transfer
*/
function sweepToken(IERC20Upgradeable token_, address to_, uint256 amount_) external;
/**
* @notice Accrue token by updating the distribution state
* @param token_ Address of the token
*/
function accrueTokens(address token_) external;
/**
* @notice Set the limit for the loops can iterate to avoid the DOS
* @param loopsLimit Limit for the max loops can execute at a time
*/
function setMaxLoopsLimit(uint256 loopsLimit) external;
/**
* @notice Get rewards per block or second for token
* @param token_ Address of the token
* @return speed returns the per block or second reward
*/
function getEffectiveDistributionSpeed(address token_) external view returns (uint256);
/**
* @notice Get the amount of tokens accrued
* @param token_ Address of the token
* @return Amount of tokens that are accrued
*/
function tokenAmountAccrued(address token_) external view returns (uint256);
}// SPDX-License-Identifier: BSD-3-Clause
pragma solidity 0.8.25;
/**
* @title PrimeLiquidityProviderStorageV1
* @author Venus
* @notice Storage for Prime Liquidity Provider
*/
contract PrimeLiquidityProviderStorageV1 {
/// @notice Address of the Prime contract
address public prime;
/// @notice The rate at which token is distributed (per block or second)
mapping(address => uint256) public tokenDistributionSpeeds;
/// @notice The max token distribution speed for token
mapping(address => uint256) public maxTokenDistributionSpeeds;
/// @notice The block or second till which rewards are distributed for an asset
mapping(address => uint256) public lastAccruedBlockOrSecond;
/// @notice The token accrued but not yet transferred to prime contract
mapping(address => uint256) internal _tokenAmountAccrued;
/// @dev This empty reserved space is put in place to allow future versions to add new
/// variables without shifting down storage in the inheritance chain.
uint256[45] private __gap;
}{
"evmVersion": "paris",
"libraries": {},
"metadata": {
"bytecodeHash": "ipfs",
"useLiteralContent": true
},
"optimizer": {
"enabled": true,
"runs": 200
},
"remappings": [],
"outputSelection": {
"*": {
"*": [
"evm.bytecode",
"evm.deployedBytecode",
"devdoc",
"userdoc",
"metadata",
"abi"
]
}
}
}Contract Security Audit
- No Contract Security Audit Submitted- Submit Audit Here
Contract ABI
API[{"inputs":[{"internalType":"bool","name":"_timeBased","type":"bool"},{"internalType":"uint256","name":"_blocksPerYear","type":"uint256"}],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[],"name":"AddressesMustDiffer","type":"error"},{"inputs":[],"name":"FundsTransferIsPaused","type":"error"},{"inputs":[{"internalType":"uint256","name":"sweepAmount","type":"uint256"},{"internalType":"uint256","name":"balance","type":"uint256"}],"name":"InsufficientBalance","type":"error"},{"inputs":[],"name":"InvalidArguments","type":"error"},{"inputs":[],"name":"InvalidBlocksPerYear","type":"error"},{"inputs":[],"name":"InvalidCaller","type":"error"},{"inputs":[{"internalType":"uint256","name":"speed","type":"uint256"},{"internalType":"uint256","name":"maxSpeed","type":"uint256"}],"name":"InvalidDistributionSpeed","type":"error"},{"inputs":[],"name":"InvalidTimeBasedConfiguration","type":"error"},{"inputs":[{"internalType":"uint256","name":"loopsLimit","type":"uint256"},{"internalType":"uint256","name":"requiredLoops","type":"uint256"}],"name":"MaxLoopsLimitExceeded","type":"error"},{"inputs":[{"internalType":"address","name":"token","type":"address"}],"name":"TokenAlreadyInitialized","type":"error"},{"inputs":[{"internalType":"address","name":"token_","type":"address"}],"name":"TokenNotInitialized","type":"error"},{"inputs":[{"internalType":"address","name":"sender","type":"address"},{"internalType":"address","name":"calledContract","type":"address"},{"internalType":"string","name":"methodSignature","type":"string"}],"name":"Unauthorized","type":"error"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint8","name":"version","type":"uint8"}],"name":"Initialized","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"oldMaxLoopsLimit","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"newmaxLoopsLimit","type":"uint256"}],"name":"MaxLoopsLimitUpdated","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"token","type":"address"},{"indexed":false,"internalType":"uint256","name":"oldSpeed","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"newSpeed","type":"uint256"}],"name":"MaxTokenDistributionSpeedUpdated","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"oldAccessControlManager","type":"address"},{"indexed":false,"internalType":"address","name":"newAccessControlManager","type":"address"}],"name":"NewAccessControlManager","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"previousOwner","type":"address"},{"indexed":true,"internalType":"address","name":"newOwner","type":"address"}],"name":"OwnershipTransferStarted","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":"account","type":"address"}],"name":"Paused","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"oldPrimeToken","type":"address"},{"indexed":true,"internalType":"address","name":"newPrimeToken","type":"address"}],"name":"PrimeTokenUpdated","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"token","type":"address"},{"indexed":true,"internalType":"address","name":"to","type":"address"},{"indexed":false,"internalType":"uint256","name":"sweepAmount","type":"uint256"}],"name":"SweepToken","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"token","type":"address"}],"name":"TokenDistributionInitialized","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"token","type":"address"},{"indexed":false,"internalType":"uint256","name":"oldSpeed","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"newSpeed","type":"uint256"}],"name":"TokenDistributionSpeedUpdated","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"token","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"TokenTransferredToPrime","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"token","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"TokensAccrued","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"account","type":"address"}],"name":"Unpaused","type":"event"},{"inputs":[],"name":"DEFAULT_MAX_DISTRIBUTION_SPEED","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"acceptOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"accessControlManager","outputs":[{"internalType":"contract IAccessControlManagerV8","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"token_","type":"address"}],"name":"accrueTokens","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"blocksOrSecondsPerYear","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getBlockNumberOrTimestamp","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"token_","type":"address"}],"name":"getEffectiveDistributionSpeed","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"accessControlManager_","type":"address"},{"internalType":"address[]","name":"tokens_","type":"address[]"},{"internalType":"uint256[]","name":"distributionSpeeds_","type":"uint256[]"},{"internalType":"uint256[]","name":"maxDistributionSpeeds_","type":"uint256[]"},{"internalType":"uint256","name":"loopsLimit_","type":"uint256"}],"name":"initialize","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address[]","name":"tokens_","type":"address[]"}],"name":"initializeTokens","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"isTimeBased","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"token_","type":"address"}],"name":"lastAccruedBlock","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"lastAccruedBlockOrSecond","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"maxLoopsLimit","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"maxTokenDistributionSpeeds","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":"pauseFundsTransfer","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"paused","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"pendingOwner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"prime","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"token_","type":"address"}],"name":"releaseFunds","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"renounceOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"resumeFundsTransfer","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"accessControlManager_","type":"address"}],"name":"setAccessControlManager","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"loopsLimit","type":"uint256"}],"name":"setMaxLoopsLimit","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address[]","name":"tokens_","type":"address[]"},{"internalType":"uint256[]","name":"maxDistributionSpeeds_","type":"uint256[]"}],"name":"setMaxTokensDistributionSpeed","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"prime_","type":"address"}],"name":"setPrimeToken","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address[]","name":"tokens_","type":"address[]"},{"internalType":"uint256[]","name":"distributionSpeeds_","type":"uint256[]"}],"name":"setTokensDistributionSpeed","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"contract IERC20Upgradeable","name":"token_","type":"address"},{"internalType":"address","name":"to_","type":"address"},{"internalType":"uint256","name":"amount_","type":"uint256"}],"name":"sweepToken","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"token_","type":"address"}],"name":"tokenAmountAccrued","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"tokenDistributionSpeeds","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"}]Contract Creation Code
60e060405234801561001057600080fd5b5060405161207a38038061207a83398101604081905261002f916101a3565b81818115801561003d575080155b1561005b576040516302723dfb60e21b815260040160405180910390fd5b81801561006757508015155b156100855760405163ae0fcab360e01b815260040160405180910390fd5b81151560a05281610096578061009c565b6301e133805b608052816100b3576100dc60201b610f61176100be565b6100e060201b610f65175b6001600160401b031660c052506100d590506100e4565b50506101d6565b4390565b4290565b600054610100900460ff16156101505760405162461bcd60e51b815260206004820152602760248201527f496e697469616c697a61626c653a20636f6e747261637420697320696e697469604482015266616c697a696e6760c81b606482015260840160405180910390fd5b60005460ff908116146101a1576000805460ff191660ff9081179091556040519081527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989060200160405180910390a15b565b600080604083850312156101b657600080fd5b825180151581146101c657600080fd5b6020939093015192949293505050565b60805160a05160c051611e756102056000396000610cb7015260006103e8015260006102db0152611e756000f3fe608060405234801561001057600080fd5b50600436106101e55760003560e01c806393920bf81161010f578063c7ad0895116100a2578063e30c397811610071578063e30c397814610439578063e458a65d1461044a578063f2fde38b1461045d578063fa7781ff1461047057600080fd5b8063c7ad0895146103e3578063c7ee005e1461040a578063ce82e8411461041e578063e1d146fb1461043157600080fd5b8063b4a0bdf3116100de578063b4a0bdf3146103ae578063bc2f7dc3146103bf578063be26317e146103c7578063c32094c7146103d057600080fd5b806393920bf8146103585780639d3cc5431461036b5780639dd5428e1461038c578063a666642b1461039b57600080fd5b8063637c9b4e1161018757806379ba50971161015657806379ba50971461030557806380d45a2d1461030d5780638aadf799146103205780638da5cb5b1461033357600080fd5b8063637c9b4e146102a257806364aff9ec146102c35780636857249c146102d6578063715018a6146102fd57600080fd5b80633131b065116101c35780633131b0651461024657806343bf7283146102595780635a38f84d146102835780635c975abb1461028b57600080fd5b80630e32cb86146101ea578063192e7a7b146101ff578063231f82bb14610212575b600080fd5b6101fd6101f83660046119e5565b61049a565b005b6101fd61020d3660046119e5565b6104ae565b6102336102203660046119e5565b61012e6020526000908152604090205481565b6040519081526020015b60405180910390f35b6101fd610254366004611a55565b610574565b6102336102673660046119e5565b6001600160a01b03166000908152610130602052604090205490565b6101fd6105ce565b60c95460ff165b604051901515815260200161023d565b6102336102b03660046119e5565b61012f6020526000908152604090205481565b6101fd6102d1366004611a97565b61060d565b6102337f000000000000000000000000000000000000000000000000000000000000000081565b6101fd610713565b6101fd610725565b6101fd61031b366004611ad8565b61079c565b6101fd61032e3660046119e5565b6107e3565b6033546001600160a01b03165b6040516001600160a01b03909116815260200161023d565b6101fd610366366004611af1565b610993565b6102336103793660046119e5565b6101306020526000908152604090205481565b610233670de0b6b3a764000081565b6102336103a93660046119e5565b610a41565b6097546001600160a01b0316610340565b6101fd610af8565b61023360fb5481565b6101fd6103de3660046119e5565b610b36565b6102927f000000000000000000000000000000000000000000000000000000000000000081565b61012d54610340906001600160a01b031681565b6101fd61042c366004611af1565b610bdb565b610233610cb0565b6065546001600160a01b0316610340565b6101fd610458366004611b5d565b610ce3565b6101fd61046b3660046119e5565b610ef0565b61023361047e3660046119e5565b6001600160a01b03166000908152610131602052604090205490565b6104a2610f69565b6104ab81610fc3565b50565b61012d546001600160a01b03163381146104db576040516348f5c3ed60e01b815260040160405180910390fd5b60c95460ff16156104ff5760405163f4eaf50160e01b815260040160405180910390fd5b610508826107e3565b6001600160a01b0382166000818152610131602090815260408083208054939055518281529192917fa80c25cc8959419d41ee66f93961c567b272badc10e0e117261a0ee31b55c312910160405180910390a261056f6001600160a01b0384168383611089565b505050565b61057c610f69565b80610586816110db565b60005b818110156105c8576105c08484838181106105a6576105a6611c11565b90506020020160208101906105bb91906119e5565b61110c565b600101610589565b50505050565b61060360405180604001604052806014815260200173706175736546756e64735472616e73666572282960601b8152506111ad565b61060b61124b565b565b610615610f69565b6040516370a0823160e01b81523060048201526000906001600160a01b038516906370a0823190602401602060405180830381865afa15801561065c573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906106809190611c27565b9050808211156106b25760405163cf47918160e01b815260048101839052602481018290526044015b60405180910390fd5b826001600160a01b0316846001600160a01b03167f6d25be279134f4ecaa4770aff0c3d916d9e7c5ef37b65ed95dbdba411f5d54d5846040516106f791815260200190565b60405180910390a36105c86001600160a01b0385168484611089565b61071b610f69565b61060b60006112a5565b60655433906001600160a01b031681146107935760405162461bcd60e51b815260206004820152602960248201527f4f776e61626c6532537465703a2063616c6c6572206973206e6f7420746865206044820152683732bb9037bbb732b960b91b60648201526084016106a9565b6104ab816112a5565b6107da6040518060400160405280601981526020017f7365744d61784c6f6f70734c696d69742875696e7432353629000000000000008152506111ad565b6104ab816112be565b6107ec81611358565b6107f58161137f565b60006107ff610cb0565b6001600160a01b0383166000908152610130602052604090205490915080820390821461056f576001600160a01b038316600081815261012e60205260408082205490516370a0823160e01b81523060048201529092906370a0823190602401602060405180830381865afa15801561087c573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906108a09190611c27565b6001600160a01b03861660009081526101316020526040812054919250906108c89083611c56565b905082158015906108d857508015155b156109715760006108e98486611c6f565b90506000818311156108fb57816108fd565b825b6001600160a01b0389166000908152610131602052604081208054929350839290919061092b908490611c86565b90915550506040518181526001600160a01b038916907ffe854c4c4e633d5bb31aec1f39f01d9f8f01ad2e0212a0e576825ac986af05899060200160405180910390a250505b505050506001600160a01b039190911660009081526101306020526040902055565b6109b4604051806060016040528060328152602001611ddf603291396111ad565b826109be816110db565b8082146109de576040516317dbc4cb60e21b815260040160405180910390fd5b60005b81811015610a3957610a318686838181106109fe576109fe611c11565b9050602002016020810190610a1391906119e5565b858584818110610a2557610a25611c11565b905060200201356113c5565b6001016109e1565b505050505050565b6001600160a01b038116600081815261012e60205260408082205490516370a0823160e01b8152306004820152919290918391906370a0823190602401602060405180830381865afa158015610a9b573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610abf9190611c27565b6001600160a01b0385166000908152610131602052604090205490915080821115610aed5750909392505050565b506000949350505050565b610b2e60405180604001604052806015815260200174726573756d6546756e64735472616e73666572282960581b8152506111ad565b61060b611436565b610b3e610f69565b61012d546001600160a01b039081169082908116829003610b72576040516380ae98f560e01b815260040160405180910390fd5b610b7b83611358565b61012d546040516001600160a01b038086169216907fcf4d0ac7a2f943727f0189dd1f26ba0cde29a1b14f222163ac866d4f5167db9490600090a3505061012d80546001600160a01b0319166001600160a01b0392909216919091179055565b610bfc6040518060600160405280602f8152602001611e11602f91396111ad565b82610c06816110db565b808214610c26576040516317dbc4cb60e21b815260040160405180910390fd5b60005b81811015610a3957610c60868683818110610c4657610c46611c11565b9050602002016020810190610c5b91906119e5565b61137f565b610ca8868683818110610c7557610c75611c11565b9050602002016020810190610c8a91906119e5565b858584818110610c9c57610c9c611c11565b9050602002013561146f565b600101610c29565b6000610cde7f000000000000000000000000000000000000000000000000000000000000000063ffffffff16565b905090565b600054610100900460ff1615808015610d035750600054600160ff909116105b80610d1d5750303b158015610d1d575060005460ff166001145b610d805760405162461bcd60e51b815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201526d191e481a5b9a5d1a585b1a5e995960921b60648201526084016106a9565b6000805460ff191660011790558015610da3576000805461ff0019166101001790555b610dac89611358565b610db58961156a565b610dbd6115a2565b610dc6826112be565b86610dd0816110db565b8086141580610ddf5750808414155b15610dfd576040516317dbc4cb60e21b815260040160405180910390fd5b60005b81811015610e9d57610e1d8a8a838181106105a6576105a6611c11565b610e598a8a83818110610e3257610e32611c11565b9050602002016020810190610e4791906119e5565b878784818110610a2557610a25611c11565b610e958a8a83818110610e6e57610e6e611c11565b9050602002016020810190610e8391906119e5565b898984818110610c9c57610c9c611c11565b600101610e00565b50508015610ee5576000805461ff0019169055604051600181527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989060200160405180910390a15b505050505050505050565b610ef8610f69565b606580546001600160a01b0383166001600160a01b03199091168117909155610f296033546001600160a01b031690565b6001600160a01b03167f38d16b8cac22d99fc7c124b9cd0de2d3fa1faef420bfe791d8c362d765e2270060405160405180910390a350565b4390565b4290565b6033546001600160a01b0316331461060b5760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657260448201526064016106a9565b6001600160a01b0381166110275760405162461bcd60e51b815260206004820152602560248201527f696e76616c696420616365737320636f6e74726f6c206d616e61676572206164604482015264647265737360d81b60648201526084016106a9565b609780546001600160a01b038381166001600160a01b031983168117909355604080519190921680825260208201939093527f66fd58e82f7b31a2a5c30e0888f3093efe4e111b00cd2b0c31fe014601293aa091015b60405180910390a15050565b604080516001600160a01b038416602482015260448082018490528251808303909101815260649091019091526020810180516001600160e01b031663a9059cbb60e01b17905261056f9084906115d1565b60fb548111156104ab5760fb5460405163792bfb1b60e11b81526004810191909152602481018290526044016106a9565b61111581611358565b600061111f610cb0565b6001600160a01b038316600090815261013060205260409020549091508015611166576040516303b51ceb60e11b81526001600160a01b03841660048201526024016106a9565b6001600160a01b03831660008181526101306020526040808220859055517fcf6e06116a82c1b468912f23d8bb1d126edbb21bc0864d6d5169e3be39b1a8189190a2505050565b6097546040516318c5e8ab60e01b81526000916001600160a01b0316906318c5e8ab906111e09033908690600401611ce9565b602060405180830381865afa1580156111fd573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906112219190611d0d565b90508061124757333083604051634a3fa29360e01b81526004016106a993929190611d2f565b5050565b6112536116a6565b60c9805460ff191660011790557f62e78cea01bee320cd4e420270b5ea74000d11b0c9f74754ebdbfc544b05a2586112883390565b6040516001600160a01b03909116815260200160405180910390a1565b606580546001600160a01b03191690556104ab816116ec565b60fb54811161131a5760405162461bcd60e51b815260206004820152602260248201527f436f6d7074726f6c6c65723a20496e76616c6964206d61784c6f6f70734c696d6044820152611a5d60f21b60648201526084016106a9565b60fb80549082905560408051828152602081018490527fc2d09fef144f7c8a86f71ea459f8fc17f675768eb1ae369cbd77fb31d467aafa910161107d565b6001600160a01b0381166104ab576040516317dbc4cb60e21b815260040160405180910390fd5b6001600160a01b0381166000908152610130602052604081205490819003611247576040516341ea4b5960e01b81526001600160a01b03831660048201526024016106a9565b6001600160a01b038216600081815261012e60209081526040918290205482519081529081018490527f2351eb1e51f0d96d3d2dc08e3c9bddbdb2153580843330b57433c3bf5031be01910160405180910390a26001600160a01b03909116600090815261012f6020526040902055565b61143e61173e565b60c9805460ff191690557f5db9ee0a495bf2e6ff9c91a7834c1ba4fdd244a5e8aa4e537bd38aeae4b073aa33611288565b6001600160a01b038216600090815261012f6020526040812054908190036114b957506001600160a01b038216600090815261012f60205260409020670de0b6b3a7640000908190555b808211156114e457604051631cf8f4dd60e11b815260048101839052602481018290526044016106a9565b6001600160a01b038316600090815261012e60205260409020548281146105c85761150e846107e3565b6001600160a01b038416600081815261012e602090815260409182902086905581518481529081018690527f2a139b40b9bf8c89ae5053746323912620b9d8ea3b076b098b1bc57702abf3a5910160405180910390a250505050565b600054610100900460ff166115915760405162461bcd60e51b81526004016106a990611d64565b611599611787565b6104ab816117b6565b600054610100900460ff166115c95760405162461bcd60e51b81526004016106a990611d64565b61060b6117dd565b6000611626826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b03166118109092919063ffffffff16565b90508051600014806116475750808060200190518101906116479190611d0d565b61056f5760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b60648201526084016106a9565b60c95460ff161561060b5760405162461bcd60e51b815260206004820152601060248201526f14185d5cd8589b194e881c185d5cd95960821b60448201526064016106a9565b603380546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b60c95460ff1661060b5760405162461bcd60e51b815260206004820152601460248201527314185d5cd8589b194e881b9bdd081c185d5cd95960621b60448201526064016106a9565b600054610100900460ff166117ae5760405162461bcd60e51b81526004016106a990611d64565b61060b611827565b600054610100900460ff166104a25760405162461bcd60e51b81526004016106a990611d64565b600054610100900460ff166118045760405162461bcd60e51b81526004016106a990611d64565b60c9805460ff19169055565b606061181f8484600085611857565b949350505050565b600054610100900460ff1661184e5760405162461bcd60e51b81526004016106a990611d64565b61060b336112a5565b6060824710156118b85760405162461bcd60e51b815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f6044820152651c8818d85b1b60d21b60648201526084016106a9565b600080866001600160a01b031685876040516118d49190611daf565b60006040518083038185875af1925050503d8060008114611911576040519150601f19603f3d011682016040523d82523d6000602084013e611916565b606091505b509150915061192787838387611932565b979650505050505050565b606083156119a157825160000361199a576001600160a01b0385163b61199a5760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e747261637400000060448201526064016106a9565b508161181f565b61181f83838151156119b65781518083602001fd5b8060405162461bcd60e51b81526004016106a99190611dcb565b6001600160a01b03811681146104ab57600080fd5b6000602082840312156119f757600080fd5b8135611a02816119d0565b9392505050565b60008083601f840112611a1b57600080fd5b50813567ffffffffffffffff811115611a3357600080fd5b6020830191508360208260051b8501011115611a4e57600080fd5b9250929050565b60008060208385031215611a6857600080fd5b823567ffffffffffffffff811115611a7f57600080fd5b611a8b85828601611a09565b90969095509350505050565b600080600060608486031215611aac57600080fd5b8335611ab7816119d0565b92506020840135611ac7816119d0565b929592945050506040919091013590565b600060208284031215611aea57600080fd5b5035919050565b60008060008060408587031215611b0757600080fd5b843567ffffffffffffffff80821115611b1f57600080fd5b611b2b88838901611a09565b90965094506020870135915080821115611b4457600080fd5b50611b5187828801611a09565b95989497509550505050565b60008060008060008060008060a0898b031215611b7957600080fd5b8835611b84816119d0565b9750602089013567ffffffffffffffff80821115611ba157600080fd5b611bad8c838d01611a09565b909950975060408b0135915080821115611bc657600080fd5b611bd28c838d01611a09565b909750955060608b0135915080821115611beb57600080fd5b50611bf88b828c01611a09565b999c989b50969995989497949560800135949350505050565b634e487b7160e01b600052603260045260246000fd5b600060208284031215611c3957600080fd5b5051919050565b634e487b7160e01b600052601160045260246000fd5b81810381811115611c6957611c69611c40565b92915050565b8082028115828204841417611c6957611c69611c40565b80820180821115611c6957611c69611c40565b60005b83811015611cb4578181015183820152602001611c9c565b50506000910152565b60008151808452611cd5816020860160208601611c99565b601f01601f19169290920160200192915050565b6001600160a01b038316815260406020820181905260009061181f90830184611cbd565b600060208284031215611d1f57600080fd5b81518015158114611a0257600080fd5b6001600160a01b03848116825283166020820152606060408201819052600090611d5b90830184611cbd565b95945050505050565b6020808252602b908201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960408201526a6e697469616c697a696e6760a81b606082015260800190565b60008251611dc1818460208701611c99565b9190910192915050565b602081526000611a026020830184611cbd56fe7365744d6178546f6b656e73446973747269627574696f6e537065656428616464726573735b5d2c75696e743235365b5d29736574546f6b656e73446973747269627574696f6e537065656428616464726573735b5d2c75696e743235365b5d29a26469706673582212200c9d46a058dbf3a96c4cd4ce25d3f05a6a88096bf609a1ae8de1fb215c20c2b864736f6c6343000819003300000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000000
Deployed Bytecode
0x608060405234801561001057600080fd5b50600436106101e55760003560e01c806393920bf81161010f578063c7ad0895116100a2578063e30c397811610071578063e30c397814610439578063e458a65d1461044a578063f2fde38b1461045d578063fa7781ff1461047057600080fd5b8063c7ad0895146103e3578063c7ee005e1461040a578063ce82e8411461041e578063e1d146fb1461043157600080fd5b8063b4a0bdf3116100de578063b4a0bdf3146103ae578063bc2f7dc3146103bf578063be26317e146103c7578063c32094c7146103d057600080fd5b806393920bf8146103585780639d3cc5431461036b5780639dd5428e1461038c578063a666642b1461039b57600080fd5b8063637c9b4e1161018757806379ba50971161015657806379ba50971461030557806380d45a2d1461030d5780638aadf799146103205780638da5cb5b1461033357600080fd5b8063637c9b4e146102a257806364aff9ec146102c35780636857249c146102d6578063715018a6146102fd57600080fd5b80633131b065116101c35780633131b0651461024657806343bf7283146102595780635a38f84d146102835780635c975abb1461028b57600080fd5b80630e32cb86146101ea578063192e7a7b146101ff578063231f82bb14610212575b600080fd5b6101fd6101f83660046119e5565b61049a565b005b6101fd61020d3660046119e5565b6104ae565b6102336102203660046119e5565b61012e6020526000908152604090205481565b6040519081526020015b60405180910390f35b6101fd610254366004611a55565b610574565b6102336102673660046119e5565b6001600160a01b03166000908152610130602052604090205490565b6101fd6105ce565b60c95460ff165b604051901515815260200161023d565b6102336102b03660046119e5565b61012f6020526000908152604090205481565b6101fd6102d1366004611a97565b61060d565b6102337f0000000000000000000000000000000000000000000000000000000001e1338081565b6101fd610713565b6101fd610725565b6101fd61031b366004611ad8565b61079c565b6101fd61032e3660046119e5565b6107e3565b6033546001600160a01b03165b6040516001600160a01b03909116815260200161023d565b6101fd610366366004611af1565b610993565b6102336103793660046119e5565b6101306020526000908152604090205481565b610233670de0b6b3a764000081565b6102336103a93660046119e5565b610a41565b6097546001600160a01b0316610340565b6101fd610af8565b61023360fb5481565b6101fd6103de3660046119e5565b610b36565b6102927f000000000000000000000000000000000000000000000000000000000000000181565b61012d54610340906001600160a01b031681565b6101fd61042c366004611af1565b610bdb565b610233610cb0565b6065546001600160a01b0316610340565b6101fd610458366004611b5d565b610ce3565b6101fd61046b3660046119e5565b610ef0565b61023361047e3660046119e5565b6001600160a01b03166000908152610131602052604090205490565b6104a2610f69565b6104ab81610fc3565b50565b61012d546001600160a01b03163381146104db576040516348f5c3ed60e01b815260040160405180910390fd5b60c95460ff16156104ff5760405163f4eaf50160e01b815260040160405180910390fd5b610508826107e3565b6001600160a01b0382166000818152610131602090815260408083208054939055518281529192917fa80c25cc8959419d41ee66f93961c567b272badc10e0e117261a0ee31b55c312910160405180910390a261056f6001600160a01b0384168383611089565b505050565b61057c610f69565b80610586816110db565b60005b818110156105c8576105c08484838181106105a6576105a6611c11565b90506020020160208101906105bb91906119e5565b61110c565b600101610589565b50505050565b61060360405180604001604052806014815260200173706175736546756e64735472616e73666572282960601b8152506111ad565b61060b61124b565b565b610615610f69565b6040516370a0823160e01b81523060048201526000906001600160a01b038516906370a0823190602401602060405180830381865afa15801561065c573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906106809190611c27565b9050808211156106b25760405163cf47918160e01b815260048101839052602481018290526044015b60405180910390fd5b826001600160a01b0316846001600160a01b03167f6d25be279134f4ecaa4770aff0c3d916d9e7c5ef37b65ed95dbdba411f5d54d5846040516106f791815260200190565b60405180910390a36105c86001600160a01b0385168484611089565b61071b610f69565b61060b60006112a5565b60655433906001600160a01b031681146107935760405162461bcd60e51b815260206004820152602960248201527f4f776e61626c6532537465703a2063616c6c6572206973206e6f7420746865206044820152683732bb9037bbb732b960b91b60648201526084016106a9565b6104ab816112a5565b6107da6040518060400160405280601981526020017f7365744d61784c6f6f70734c696d69742875696e7432353629000000000000008152506111ad565b6104ab816112be565b6107ec81611358565b6107f58161137f565b60006107ff610cb0565b6001600160a01b0383166000908152610130602052604090205490915080820390821461056f576001600160a01b038316600081815261012e60205260408082205490516370a0823160e01b81523060048201529092906370a0823190602401602060405180830381865afa15801561087c573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906108a09190611c27565b6001600160a01b03861660009081526101316020526040812054919250906108c89083611c56565b905082158015906108d857508015155b156109715760006108e98486611c6f565b90506000818311156108fb57816108fd565b825b6001600160a01b0389166000908152610131602052604081208054929350839290919061092b908490611c86565b90915550506040518181526001600160a01b038916907ffe854c4c4e633d5bb31aec1f39f01d9f8f01ad2e0212a0e576825ac986af05899060200160405180910390a250505b505050506001600160a01b039190911660009081526101306020526040902055565b6109b4604051806060016040528060328152602001611ddf603291396111ad565b826109be816110db565b8082146109de576040516317dbc4cb60e21b815260040160405180910390fd5b60005b81811015610a3957610a318686838181106109fe576109fe611c11565b9050602002016020810190610a1391906119e5565b858584818110610a2557610a25611c11565b905060200201356113c5565b6001016109e1565b505050505050565b6001600160a01b038116600081815261012e60205260408082205490516370a0823160e01b8152306004820152919290918391906370a0823190602401602060405180830381865afa158015610a9b573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610abf9190611c27565b6001600160a01b0385166000908152610131602052604090205490915080821115610aed5750909392505050565b506000949350505050565b610b2e60405180604001604052806015815260200174726573756d6546756e64735472616e73666572282960581b8152506111ad565b61060b611436565b610b3e610f69565b61012d546001600160a01b039081169082908116829003610b72576040516380ae98f560e01b815260040160405180910390fd5b610b7b83611358565b61012d546040516001600160a01b038086169216907fcf4d0ac7a2f943727f0189dd1f26ba0cde29a1b14f222163ac866d4f5167db9490600090a3505061012d80546001600160a01b0319166001600160a01b0392909216919091179055565b610bfc6040518060600160405280602f8152602001611e11602f91396111ad565b82610c06816110db565b808214610c26576040516317dbc4cb60e21b815260040160405180910390fd5b60005b81811015610a3957610c60868683818110610c4657610c46611c11565b9050602002016020810190610c5b91906119e5565b61137f565b610ca8868683818110610c7557610c75611c11565b9050602002016020810190610c8a91906119e5565b858584818110610c9c57610c9c611c11565b9050602002013561146f565b600101610c29565b6000610cde7f000000000000000000000000000000000000000000000000000000e000000f6563ffffffff16565b905090565b600054610100900460ff1615808015610d035750600054600160ff909116105b80610d1d5750303b158015610d1d575060005460ff166001145b610d805760405162461bcd60e51b815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201526d191e481a5b9a5d1a585b1a5e995960921b60648201526084016106a9565b6000805460ff191660011790558015610da3576000805461ff0019166101001790555b610dac89611358565b610db58961156a565b610dbd6115a2565b610dc6826112be565b86610dd0816110db565b8086141580610ddf5750808414155b15610dfd576040516317dbc4cb60e21b815260040160405180910390fd5b60005b81811015610e9d57610e1d8a8a838181106105a6576105a6611c11565b610e598a8a83818110610e3257610e32611c11565b9050602002016020810190610e4791906119e5565b878784818110610a2557610a25611c11565b610e958a8a83818110610e6e57610e6e611c11565b9050602002016020810190610e8391906119e5565b898984818110610c9c57610c9c611c11565b600101610e00565b50508015610ee5576000805461ff0019169055604051600181527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989060200160405180910390a15b505050505050505050565b610ef8610f69565b606580546001600160a01b0383166001600160a01b03199091168117909155610f296033546001600160a01b031690565b6001600160a01b03167f38d16b8cac22d99fc7c124b9cd0de2d3fa1faef420bfe791d8c362d765e2270060405160405180910390a350565b4390565b4290565b6033546001600160a01b0316331461060b5760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657260448201526064016106a9565b6001600160a01b0381166110275760405162461bcd60e51b815260206004820152602560248201527f696e76616c696420616365737320636f6e74726f6c206d616e61676572206164604482015264647265737360d81b60648201526084016106a9565b609780546001600160a01b038381166001600160a01b031983168117909355604080519190921680825260208201939093527f66fd58e82f7b31a2a5c30e0888f3093efe4e111b00cd2b0c31fe014601293aa091015b60405180910390a15050565b604080516001600160a01b038416602482015260448082018490528251808303909101815260649091019091526020810180516001600160e01b031663a9059cbb60e01b17905261056f9084906115d1565b60fb548111156104ab5760fb5460405163792bfb1b60e11b81526004810191909152602481018290526044016106a9565b61111581611358565b600061111f610cb0565b6001600160a01b038316600090815261013060205260409020549091508015611166576040516303b51ceb60e11b81526001600160a01b03841660048201526024016106a9565b6001600160a01b03831660008181526101306020526040808220859055517fcf6e06116a82c1b468912f23d8bb1d126edbb21bc0864d6d5169e3be39b1a8189190a2505050565b6097546040516318c5e8ab60e01b81526000916001600160a01b0316906318c5e8ab906111e09033908690600401611ce9565b602060405180830381865afa1580156111fd573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906112219190611d0d565b90508061124757333083604051634a3fa29360e01b81526004016106a993929190611d2f565b5050565b6112536116a6565b60c9805460ff191660011790557f62e78cea01bee320cd4e420270b5ea74000d11b0c9f74754ebdbfc544b05a2586112883390565b6040516001600160a01b03909116815260200160405180910390a1565b606580546001600160a01b03191690556104ab816116ec565b60fb54811161131a5760405162461bcd60e51b815260206004820152602260248201527f436f6d7074726f6c6c65723a20496e76616c6964206d61784c6f6f70734c696d6044820152611a5d60f21b60648201526084016106a9565b60fb80549082905560408051828152602081018490527fc2d09fef144f7c8a86f71ea459f8fc17f675768eb1ae369cbd77fb31d467aafa910161107d565b6001600160a01b0381166104ab576040516317dbc4cb60e21b815260040160405180910390fd5b6001600160a01b0381166000908152610130602052604081205490819003611247576040516341ea4b5960e01b81526001600160a01b03831660048201526024016106a9565b6001600160a01b038216600081815261012e60209081526040918290205482519081529081018490527f2351eb1e51f0d96d3d2dc08e3c9bddbdb2153580843330b57433c3bf5031be01910160405180910390a26001600160a01b03909116600090815261012f6020526040902055565b61143e61173e565b60c9805460ff191690557f5db9ee0a495bf2e6ff9c91a7834c1ba4fdd244a5e8aa4e537bd38aeae4b073aa33611288565b6001600160a01b038216600090815261012f6020526040812054908190036114b957506001600160a01b038216600090815261012f60205260409020670de0b6b3a7640000908190555b808211156114e457604051631cf8f4dd60e11b815260048101839052602481018290526044016106a9565b6001600160a01b038316600090815261012e60205260409020548281146105c85761150e846107e3565b6001600160a01b038416600081815261012e602090815260409182902086905581518481529081018690527f2a139b40b9bf8c89ae5053746323912620b9d8ea3b076b098b1bc57702abf3a5910160405180910390a250505050565b600054610100900460ff166115915760405162461bcd60e51b81526004016106a990611d64565b611599611787565b6104ab816117b6565b600054610100900460ff166115c95760405162461bcd60e51b81526004016106a990611d64565b61060b6117dd565b6000611626826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b03166118109092919063ffffffff16565b90508051600014806116475750808060200190518101906116479190611d0d565b61056f5760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b60648201526084016106a9565b60c95460ff161561060b5760405162461bcd60e51b815260206004820152601060248201526f14185d5cd8589b194e881c185d5cd95960821b60448201526064016106a9565b603380546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b60c95460ff1661060b5760405162461bcd60e51b815260206004820152601460248201527314185d5cd8589b194e881b9bdd081c185d5cd95960621b60448201526064016106a9565b600054610100900460ff166117ae5760405162461bcd60e51b81526004016106a990611d64565b61060b611827565b600054610100900460ff166104a25760405162461bcd60e51b81526004016106a990611d64565b600054610100900460ff166118045760405162461bcd60e51b81526004016106a990611d64565b60c9805460ff19169055565b606061181f8484600085611857565b949350505050565b600054610100900460ff1661184e5760405162461bcd60e51b81526004016106a990611d64565b61060b336112a5565b6060824710156118b85760405162461bcd60e51b815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f6044820152651c8818d85b1b60d21b60648201526084016106a9565b600080866001600160a01b031685876040516118d49190611daf565b60006040518083038185875af1925050503d8060008114611911576040519150601f19603f3d011682016040523d82523d6000602084013e611916565b606091505b509150915061192787838387611932565b979650505050505050565b606083156119a157825160000361199a576001600160a01b0385163b61199a5760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e747261637400000060448201526064016106a9565b508161181f565b61181f83838151156119b65781518083602001fd5b8060405162461bcd60e51b81526004016106a99190611dcb565b6001600160a01b03811681146104ab57600080fd5b6000602082840312156119f757600080fd5b8135611a02816119d0565b9392505050565b60008083601f840112611a1b57600080fd5b50813567ffffffffffffffff811115611a3357600080fd5b6020830191508360208260051b8501011115611a4e57600080fd5b9250929050565b60008060208385031215611a6857600080fd5b823567ffffffffffffffff811115611a7f57600080fd5b611a8b85828601611a09565b90969095509350505050565b600080600060608486031215611aac57600080fd5b8335611ab7816119d0565b92506020840135611ac7816119d0565b929592945050506040919091013590565b600060208284031215611aea57600080fd5b5035919050565b60008060008060408587031215611b0757600080fd5b843567ffffffffffffffff80821115611b1f57600080fd5b611b2b88838901611a09565b90965094506020870135915080821115611b4457600080fd5b50611b5187828801611a09565b95989497509550505050565b60008060008060008060008060a0898b031215611b7957600080fd5b8835611b84816119d0565b9750602089013567ffffffffffffffff80821115611ba157600080fd5b611bad8c838d01611a09565b909950975060408b0135915080821115611bc657600080fd5b611bd28c838d01611a09565b909750955060608b0135915080821115611beb57600080fd5b50611bf88b828c01611a09565b999c989b50969995989497949560800135949350505050565b634e487b7160e01b600052603260045260246000fd5b600060208284031215611c3957600080fd5b5051919050565b634e487b7160e01b600052601160045260246000fd5b81810381811115611c6957611c69611c40565b92915050565b8082028115828204841417611c6957611c69611c40565b80820180821115611c6957611c69611c40565b60005b83811015611cb4578181015183820152602001611c9c565b50506000910152565b60008151808452611cd5816020860160208601611c99565b601f01601f19169290920160200192915050565b6001600160a01b038316815260406020820181905260009061181f90830184611cbd565b600060208284031215611d1f57600080fd5b81518015158114611a0257600080fd5b6001600160a01b03848116825283166020820152606060408201819052600090611d5b90830184611cbd565b95945050505050565b6020808252602b908201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960408201526a6e697469616c697a696e6760a81b606082015260800190565b60008251611dc1818460208701611c99565b9190910192915050565b602081526000611a026020830184611cbd56fe7365744d6178546f6b656e73446973747269627574696f6e537065656428616464726573735b5d2c75696e743235365b5d29736574546f6b656e73446973747269627574696f6e537065656428616464726573735b5d2c75696e743235365b5d29a26469706673582212200c9d46a058dbf3a96c4cd4ce25d3f05a6a88096bf609a1ae8de1fb215c20c2b864736f6c63430008190033
Constructor Arguments (ABI-Encoded and is the last bytes of the Contract Creation Code above)
00000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000000
-----Decoded View---------------
Arg [0] : _timeBased (bool): True
Arg [1] : _blocksPerYear (uint256): 0
-----Encoded View---------------
2 Constructor Arguments found :
Arg [0] : 0000000000000000000000000000000000000000000000000000000000000001
Arg [1] : 0000000000000000000000000000000000000000000000000000000000000000
Loading...
Loading
Loading...
Loading
Net Worth in USD
$0.00
Net Worth in ETH
0
Multichain Portfolio | 34 Chains
| Chain | Token | Portfolio % | Price | Amount | Value |
|---|
Loading...
Loading
Loading...
Loading
Loading...
Loading
A contract address hosts a smart contract, which is a set of code stored on the blockchain that runs when predetermined conditions are met. Learn more about addresses in our Knowledge Base.