Overview
ETH Balance
0 ETH
Eth Value
$0.00More Info
Private Name Tags
ContractCreator
View more zero value Internal Transactions in Advanced View mode
Advanced mode:
Loading...
Loading
Contract Source Code Verified (Exact Match)
Contract Name:
DrawBeacon
Compiler Version
v0.8.10+commit.fc410830
Optimization Enabled:
Yes with 2000 runs
Other Settings:
default evmVersion
Contract Source Code (Solidity Standard Json-Input format)
// SPDX-License-Identifier: GPL-3.0 pragma solidity 0.8.10; import "@openzeppelin/contracts-upgradeable/token/ERC20/utils/SafeERC20Upgradeable.sol"; import "@openzeppelin/contracts-upgradeable/security/ReentrancyGuardUpgradeable.sol"; import "@openzeppelin/contracts-upgradeable/utils/math/SafeCastUpgradeable.sol"; import "@openzeppelin/contracts-upgradeable/token/ERC20/IERC20Upgradeable.sol"; import "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol"; import "../owner-manager/Ownable.sol"; import "./interfaces/IDrawBeacon.sol"; import "./interfaces/IDrawBuffer.sol"; /** * @title Asymetrix Protocol V1 DrawBeacon * @author Asymetrix Protocol Inc Team * @notice Manages pushing Draws onto DrawBuffer. The DrawBeacon has 1 major * action: creating of a new Draw. A user can create a new Draw using * the startDraw() method which will push the draw onto the DrawBuffer. */ contract DrawBeacon is Initializable, IDrawBeacon, Ownable, ReentrancyGuardUpgradeable { using SafeERC20Upgradeable for IERC20Upgradeable; using SafeCastUpgradeable for uint256; /* ============ Variables ============ */ /// @notice DrawBuffer address IDrawBuffer internal drawBuffer; /// @notice Seconds between beacon period request uint32 internal beaconPeriodSeconds; /// @notice Epoch timestamp when beacon period can start uint64 internal beaconPeriodStartedAt; /** * @notice Next Draw ID to use when pushing a Draw onto DrawBuffer * @dev Starts at 1. This way we know that no Draw has been recorded at 0. */ uint32 internal nextDrawId; /* ============ Events ============ */ /** * @notice Emit when the DrawBeacon is deployed. * @param nextDrawId Draw ID at which the DrawBeacon should start. Can't be * inferior to 1. * @param beaconPeriodStartedAt Timestamp when beacon period starts. */ event Deployed(uint32 nextDrawId, uint64 beaconPeriodStartedAt); /* ============ Modifiers ============ */ modifier requireCanStartDraw() { require(_isBeaconPeriodOver(), "DrawBeacon/beacon-period-not-over"); _; } /// @custom:oz-upgrades-unsafe-allow constructor constructor() { _disableInitializers(); } /* ============ Initialize ============ */ /** * @notice Deploy the DrawBeacon smart contract. * @param _owner Address of the DrawBeacon owner * @param _drawBuffer The address of the draw buffer to push draws to * @param _nextDrawId Draw ID at which the DrawBeacon should start. Can't be * inferior to 1. * @param _beaconPeriodStart The starting timestamp of the beacon period. * @param _beaconPeriodSeconds The duration of the beacon period in seconds */ function initialize( address _owner, IDrawBuffer _drawBuffer, uint32 _nextDrawId, uint64 _beaconPeriodStart, uint32 _beaconPeriodSeconds ) external initializer { __DrawBeacon_init_unchained( _owner, _drawBuffer, _nextDrawId, _beaconPeriodStart, _beaconPeriodSeconds ); } function __DrawBeacon_init_unchained( address _owner, IDrawBuffer _drawBuffer, uint32 _nextDrawId, uint64 _beaconPeriodStart, uint32 _beaconPeriodSeconds ) internal onlyInitializing { __Ownable_init_unchained(_owner); require( _beaconPeriodStart > 0, "DrawBeacon/beacon-period-greater-than-zero" ); require(_nextDrawId >= 1, "DrawBeacon/next-draw-id-gte-one"); beaconPeriodStartedAt = _beaconPeriodStart; nextDrawId = _nextDrawId; _setBeaconPeriodSeconds(_beaconPeriodSeconds); _setDrawBuffer(_drawBuffer); emit Deployed(_nextDrawId, _beaconPeriodStart); emit BeaconPeriodStarted(_beaconPeriodStart); } /* ============ External Functions ============ */ /// @inheritdoc IDrawBeacon function calculateNextBeaconPeriodStartTimeFromCurrentTime() external view returns (uint64) { return _calculateNextBeaconPeriodStartTime( beaconPeriodStartedAt, beaconPeriodSeconds, _currentTime() ); } /// @inheritdoc IDrawBeacon function calculateNextBeaconPeriodStartTime( uint64 _time ) external view override returns (uint64) { return _calculateNextBeaconPeriodStartTime( beaconPeriodStartedAt, beaconPeriodSeconds, _time ); } /// @inheritdoc IDrawBeacon function startDraw() external override nonReentrant requireCanStartDraw { uint64 _beaconPeriodStartedAt = beaconPeriodStartedAt; uint32 _beaconPeriodSeconds = beaconPeriodSeconds; uint64 _time = _currentTime(); // Сreate Draw struct IDrawBeacon.Draw memory _draw; _draw.drawId = nextDrawId; _draw.timestamp = _currentTime(); _draw.beaconPeriodStartedAt = _beaconPeriodStartedAt; _draw.beaconPeriodSeconds = _beaconPeriodSeconds; uint32 _drawId = drawBuffer.pushDraw(_draw); emit DrawStarted(_drawId); /** * To avoid clock drift, we should calculate the start time based on the * previous period start time. */ uint64 _nextBeaconPeriodStartedAt = _calculateNextBeaconPeriodStartTime( _beaconPeriodStartedAt, _beaconPeriodSeconds, _time ); beaconPeriodStartedAt = _nextBeaconPeriodStartedAt; nextDrawId = _drawId + 1; emit BeaconPeriodStarted(_nextBeaconPeriodStartedAt); } /// @inheritdoc IDrawBeacon function beaconPeriodRemainingSeconds() external view override returns (uint64) { return _beaconPeriodRemainingSeconds(); } /// @inheritdoc IDrawBeacon function beaconPeriodEndAt() external view override returns (uint64) { return _beaconPeriodEndAt(); } /// @inheritdoc IDrawBeacon function getBeaconPeriodSeconds() external view returns (uint32) { return beaconPeriodSeconds; } /// @inheritdoc IDrawBeacon function getBeaconPeriodStartedAt() external view returns (uint64) { return beaconPeriodStartedAt; } /// @inheritdoc IDrawBeacon function getDrawBuffer() external view returns (IDrawBuffer) { return drawBuffer; } /// @inheritdoc IDrawBeacon function getNextDrawId() external view returns (uint32) { return nextDrawId; } /// @inheritdoc IDrawBeacon function isBeaconPeriodOver() external view override returns (bool) { return _isBeaconPeriodOver(); } /// @inheritdoc IDrawBeacon function canStartDraw() external view override returns (bool) { return _isBeaconPeriodOver(); } /// @inheritdoc IDrawBeacon function setDrawBuffer( IDrawBuffer newDrawBuffer ) external override onlyOwner returns (IDrawBuffer) { return _setDrawBuffer(newDrawBuffer); } /// @inheritdoc IDrawBeacon function setBeaconPeriodSeconds( uint32 _beaconPeriodSeconds ) external override onlyOwner { _setBeaconPeriodSeconds(_beaconPeriodSeconds); } /* ============ Internal Functions ============ */ /** * @notice Calculates when the next beacon period will start. * @param _beaconPeriodStartedAt The timestamp at which the beacon period * started. * @param _beaconPeriodSeconds The duration of the beacon period in seconds. * @param _time The timestamp to use as the current time. * @return The timestamp at which the next beacon period would start. */ function _calculateNextBeaconPeriodStartTime( uint64 _beaconPeriodStartedAt, uint32 _beaconPeriodSeconds, uint64 _time ) internal pure returns (uint64) { uint64 elapsedPeriods = (_time - _beaconPeriodStartedAt) / _beaconPeriodSeconds; return _beaconPeriodStartedAt + (elapsedPeriods * _beaconPeriodSeconds); } /** * @notice returns the current time. Used for testing. * @return The current time (block.timestamp) */ function _currentTime() internal view virtual returns (uint64) { return uint64(block.timestamp); } /** * @notice Returns the timestamp at which the beacon period ends * @return The timestamp at which the beacon period ends */ function _beaconPeriodEndAt() internal view returns (uint64) { return beaconPeriodStartedAt + beaconPeriodSeconds; } /** * @notice Returns the number of seconds remaining until the prize can be * awarded. * @return The number of seconds remaining until the prize can be awarded. */ function _beaconPeriodRemainingSeconds() internal view returns (uint64) { uint64 endAt = _beaconPeriodEndAt(); uint64 time = _currentTime(); if (endAt <= time) { return 0; } return endAt - time; } /** * @notice Returns whether the beacon period is over. * @return True if the beacon period is over, false otherwise */ function _isBeaconPeriodOver() internal view returns (bool) { return _beaconPeriodEndAt() <= _currentTime(); } /** * @notice Set global DrawBuffer variable. * @dev All subsequent Draw requests/completions will be pushed to the * new DrawBuffer. * @param _newDrawBuffer DrawBuffer address * @return DrawBuffer */ function _setDrawBuffer( IDrawBuffer _newDrawBuffer ) internal returns (IDrawBuffer) { IDrawBuffer _previousDrawBuffer = drawBuffer; require( address(_newDrawBuffer) != address(0), "DrawBeacon/draw-history-not-zero-address" ); require( address(_newDrawBuffer) != address(_previousDrawBuffer), "DrawBeacon/existing-draw-history-address" ); drawBuffer = _newDrawBuffer; emit DrawBufferUpdated(_newDrawBuffer); return _newDrawBuffer; } /** * @notice Sets the beacon period in seconds. * @param _beaconPeriodSeconds The new beacon period in seconds. Must be * greater than zero. */ function _setBeaconPeriodSeconds(uint32 _beaconPeriodSeconds) internal { require( _beaconPeriodSeconds > 0, "DrawBeacon/beacon-period-greater-than-zero" ); beaconPeriodSeconds = _beaconPeriodSeconds; emit BeaconPeriodSecondsUpdated(_beaconPeriodSeconds); } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.8.1) (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] * ``` * 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.8.0) (security/ReentrancyGuard.sol) pragma solidity ^0.8.0; import "../proxy/utils/Initializable.sol"; /** * @dev Contract module that helps prevent reentrant calls to a function. * * Inheriting from `ReentrancyGuard` will make the {nonReentrant} modifier * available, which can be applied to functions to make sure there are no nested * (reentrant) calls to them. * * Note that because there is a single `nonReentrant` guard, functions marked as * `nonReentrant` may not call one another. This can be worked around by making * those functions `private`, and then adding `external` `nonReentrant` entry * points to them. * * TIP: If you would like to learn more about reentrancy and alternative ways * to protect against it, check out our blog post * https://blog.openzeppelin.com/reentrancy-after-istanbul/[Reentrancy After Istanbul]. */ abstract contract ReentrancyGuardUpgradeable is Initializable { // Booleans are more expensive than uint256 or any type that takes up a full // word because each write operation emits an extra SLOAD to first read the // slot's contents, replace the bits taken up by the boolean, and then write // back. This is the compiler's defense against contract upgrades and // pointer aliasing, and it cannot be disabled. // The values being non-zero value makes deployment a bit more expensive, // but in exchange the refund on every call to nonReentrant will be lower in // amount. Since refunds are capped to a percentage of the total // transaction's gas, it is best to keep them low in cases like this one, to // increase the likelihood of the full refund coming into effect. uint256 private constant _NOT_ENTERED = 1; uint256 private constant _ENTERED = 2; uint256 private _status; function __ReentrancyGuard_init() internal onlyInitializing { __ReentrancyGuard_init_unchained(); } function __ReentrancyGuard_init_unchained() internal onlyInitializing { _status = _NOT_ENTERED; } /** * @dev Prevents a contract from calling itself, directly or indirectly. * Calling a `nonReentrant` function from another `nonReentrant` * function is not supported. It is possible to prevent this from happening * by making the `nonReentrant` function external, and making it call a * `private` function that does the actual work. */ modifier nonReentrant() { _nonReentrantBefore(); _; _nonReentrantAfter(); } function _nonReentrantBefore() private { // On the first call to nonReentrant, _status will be _NOT_ENTERED require(_status != _ENTERED, "ReentrancyGuard: reentrant call"); // Any calls to nonReentrant after this point will fail _status = _ENTERED; } function _nonReentrantAfter() private { // By storing the original value once again, a refund is triggered (see // https://eips.ethereum.org/EIPS/eip-2200) _status = _NOT_ENTERED; } /** * @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 v4.4.1 (token/ERC20/extensions/draft-IERC20Permit.sol) pragma solidity ^0.8.0; /** * @dev Interface of the ERC20 Permit extension allowing approvals to be made via signatures, as defined in * https://eips.ethereum.org/EIPS/eip-2612[EIP-2612]. * * Adds the {permit} method, which can be used to change an account's ERC20 allowance (see {IERC20-allowance}) by * presenting a message signed by the account. By not relying on {IERC20-approve}, the token holder account doesn't * need to send a transaction, and thus is not required to hold Ether at all. */ interface 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]. */ 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.6.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.8.0) (token/ERC20/utils/SafeERC20.sol) pragma solidity ^0.8.0; import "../IERC20Upgradeable.sol"; import "../extensions/draft-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; function safeTransfer( IERC20Upgradeable token, address to, uint256 value ) internal { _callOptionalReturn(token, abi.encodeWithSelector(token.transfer.selector, to, value)); } 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)); } function safeIncreaseAllowance( IERC20Upgradeable token, address spender, uint256 value ) internal { uint256 newAllowance = token.allowance(address(this), spender) + value; _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance)); } function safeDecreaseAllowance( IERC20Upgradeable token, address spender, uint256 value ) internal { unchecked { uint256 oldAllowance = token.allowance(address(this), spender); require(oldAllowance >= value, "SafeERC20: decreased allowance below zero"); uint256 newAllowance = oldAllowance - value; _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance)); } } 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"); if (returndata.length > 0) { // Return data is optional require(abi.decode(returndata, (bool)), "SafeERC20: ERC20 operation did not succeed"); } } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.8.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 * ==== * * [IMPORTANT] * ==== * You shouldn't rely on `isContract` to protect against flash loan attacks! * * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract * constructor. * ==== */ function isContract(address account) internal view returns (bool) { // This method relies on extcodesize/address.code.length, which returns 0 // for contracts in construction, since the code is only stored at the end // of the constructor execution. return account.code.length > 0; } /** * @dev Replacement for Solidity's `transfer`: sends `amount` wei to * `recipient`, forwarding all available gas and reverting on errors. * * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost * of certain opcodes, possibly making contracts go over the 2300 gas limit * imposed by `transfer`, making them unable to receive funds via * `transfer`. {sendValue} removes this limitation. * * https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more]. * * IMPORTANT: because control is transferred to `recipient`, care must be * taken to not create reentrancy vulnerabilities. Consider using * {ReentrancyGuard} or the * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern]. */ function sendValue(address payable recipient, uint256 amount) internal { require(address(this).balance >= amount, "Address: insufficient balance"); (bool success, ) = recipient.call{value: amount}(""); require(success, "Address: unable to send value, recipient may have reverted"); } /** * @dev Performs a Solidity function call using a low level `call`. A * plain `call` is an unsafe replacement for a function call: use this * function instead. * * If `target` reverts with a revert reason, it is bubbled up by this * function (like regular Solidity function calls). * * Returns the raw returned data. To convert to the expected return value, * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`]. * * Requirements: * * - `target` must be a contract. * - calling `target` with `data` must not revert. * * _Available since v3.1._ */ function functionCall(address target, bytes memory data) internal returns (bytes memory) { return 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 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.8.0) (utils/math/SafeCast.sol) // This file was procedurally generated from scripts/generate/templates/SafeCast.js. pragma solidity ^0.8.0; /** * @dev Wrappers over Solidity's uintXX/intXX casting operators with added overflow * checks. * * Downcasting from uint256/int256 in Solidity does not revert on overflow. This can * easily result in undesired exploitation or bugs, since developers usually * assume that overflows raise errors. `SafeCast` restores this intuition by * reverting the transaction when such an operation overflows. * * Using this library instead of the unchecked operations eliminates an entire * class of bugs, so it's recommended to use it always. * * Can be combined with {SafeMath} and {SignedSafeMath} to extend it to smaller types, by performing * all math on `uint256` and `int256` and then downcasting. */ library SafeCastUpgradeable { /** * @dev Returns the downcasted uint248 from uint256, reverting on * overflow (when the input is greater than largest uint248). * * Counterpart to Solidity's `uint248` operator. * * Requirements: * * - input must fit into 248 bits * * _Available since v4.7._ */ function toUint248(uint256 value) internal pure returns (uint248) { require(value <= type(uint248).max, "SafeCast: value doesn't fit in 248 bits"); return uint248(value); } /** * @dev Returns the downcasted uint240 from uint256, reverting on * overflow (when the input is greater than largest uint240). * * Counterpart to Solidity's `uint240` operator. * * Requirements: * * - input must fit into 240 bits * * _Available since v4.7._ */ function toUint240(uint256 value) internal pure returns (uint240) { require(value <= type(uint240).max, "SafeCast: value doesn't fit in 240 bits"); return uint240(value); } /** * @dev Returns the downcasted uint232 from uint256, reverting on * overflow (when the input is greater than largest uint232). * * Counterpart to Solidity's `uint232` operator. * * Requirements: * * - input must fit into 232 bits * * _Available since v4.7._ */ function toUint232(uint256 value) internal pure returns (uint232) { require(value <= type(uint232).max, "SafeCast: value doesn't fit in 232 bits"); return uint232(value); } /** * @dev Returns the downcasted uint224 from uint256, reverting on * overflow (when the input is greater than largest uint224). * * Counterpart to Solidity's `uint224` operator. * * Requirements: * * - input must fit into 224 bits * * _Available since v4.2._ */ function toUint224(uint256 value) internal pure returns (uint224) { require(value <= type(uint224).max, "SafeCast: value doesn't fit in 224 bits"); return uint224(value); } /** * @dev Returns the downcasted uint216 from uint256, reverting on * overflow (when the input is greater than largest uint216). * * Counterpart to Solidity's `uint216` operator. * * Requirements: * * - input must fit into 216 bits * * _Available since v4.7._ */ function toUint216(uint256 value) internal pure returns (uint216) { require(value <= type(uint216).max, "SafeCast: value doesn't fit in 216 bits"); return uint216(value); } /** * @dev Returns the downcasted uint208 from uint256, reverting on * overflow (when the input is greater than largest uint208). * * Counterpart to Solidity's `uint208` operator. * * Requirements: * * - input must fit into 208 bits * * _Available since v4.7._ */ function toUint208(uint256 value) internal pure returns (uint208) { require(value <= type(uint208).max, "SafeCast: value doesn't fit in 208 bits"); return uint208(value); } /** * @dev Returns the downcasted uint200 from uint256, reverting on * overflow (when the input is greater than largest uint200). * * Counterpart to Solidity's `uint200` operator. * * Requirements: * * - input must fit into 200 bits * * _Available since v4.7._ */ function toUint200(uint256 value) internal pure returns (uint200) { require(value <= type(uint200).max, "SafeCast: value doesn't fit in 200 bits"); return uint200(value); } /** * @dev Returns the downcasted uint192 from uint256, reverting on * overflow (when the input is greater than largest uint192). * * Counterpart to Solidity's `uint192` operator. * * Requirements: * * - input must fit into 192 bits * * _Available since v4.7._ */ function toUint192(uint256 value) internal pure returns (uint192) { require(value <= type(uint192).max, "SafeCast: value doesn't fit in 192 bits"); return uint192(value); } /** * @dev Returns the downcasted uint184 from uint256, reverting on * overflow (when the input is greater than largest uint184). * * Counterpart to Solidity's `uint184` operator. * * Requirements: * * - input must fit into 184 bits * * _Available since v4.7._ */ function toUint184(uint256 value) internal pure returns (uint184) { require(value <= type(uint184).max, "SafeCast: value doesn't fit in 184 bits"); return uint184(value); } /** * @dev Returns the downcasted uint176 from uint256, reverting on * overflow (when the input is greater than largest uint176). * * Counterpart to Solidity's `uint176` operator. * * Requirements: * * - input must fit into 176 bits * * _Available since v4.7._ */ function toUint176(uint256 value) internal pure returns (uint176) { require(value <= type(uint176).max, "SafeCast: value doesn't fit in 176 bits"); return uint176(value); } /** * @dev Returns the downcasted uint168 from uint256, reverting on * overflow (when the input is greater than largest uint168). * * Counterpart to Solidity's `uint168` operator. * * Requirements: * * - input must fit into 168 bits * * _Available since v4.7._ */ function toUint168(uint256 value) internal pure returns (uint168) { require(value <= type(uint168).max, "SafeCast: value doesn't fit in 168 bits"); return uint168(value); } /** * @dev Returns the downcasted uint160 from uint256, reverting on * overflow (when the input is greater than largest uint160). * * Counterpart to Solidity's `uint160` operator. * * Requirements: * * - input must fit into 160 bits * * _Available since v4.7._ */ function toUint160(uint256 value) internal pure returns (uint160) { require(value <= type(uint160).max, "SafeCast: value doesn't fit in 160 bits"); return uint160(value); } /** * @dev Returns the downcasted uint152 from uint256, reverting on * overflow (when the input is greater than largest uint152). * * Counterpart to Solidity's `uint152` operator. * * Requirements: * * - input must fit into 152 bits * * _Available since v4.7._ */ function toUint152(uint256 value) internal pure returns (uint152) { require(value <= type(uint152).max, "SafeCast: value doesn't fit in 152 bits"); return uint152(value); } /** * @dev Returns the downcasted uint144 from uint256, reverting on * overflow (when the input is greater than largest uint144). * * Counterpart to Solidity's `uint144` operator. * * Requirements: * * - input must fit into 144 bits * * _Available since v4.7._ */ function toUint144(uint256 value) internal pure returns (uint144) { require(value <= type(uint144).max, "SafeCast: value doesn't fit in 144 bits"); return uint144(value); } /** * @dev Returns the downcasted uint136 from uint256, reverting on * overflow (when the input is greater than largest uint136). * * Counterpart to Solidity's `uint136` operator. * * Requirements: * * - input must fit into 136 bits * * _Available since v4.7._ */ function toUint136(uint256 value) internal pure returns (uint136) { require(value <= type(uint136).max, "SafeCast: value doesn't fit in 136 bits"); return uint136(value); } /** * @dev Returns the downcasted uint128 from uint256, reverting on * overflow (when the input is greater than largest uint128). * * Counterpart to Solidity's `uint128` operator. * * Requirements: * * - input must fit into 128 bits * * _Available since v2.5._ */ function toUint128(uint256 value) internal pure returns (uint128) { require(value <= type(uint128).max, "SafeCast: value doesn't fit in 128 bits"); return uint128(value); } /** * @dev Returns the downcasted uint120 from uint256, reverting on * overflow (when the input is greater than largest uint120). * * Counterpart to Solidity's `uint120` operator. * * Requirements: * * - input must fit into 120 bits * * _Available since v4.7._ */ function toUint120(uint256 value) internal pure returns (uint120) { require(value <= type(uint120).max, "SafeCast: value doesn't fit in 120 bits"); return uint120(value); } /** * @dev Returns the downcasted uint112 from uint256, reverting on * overflow (when the input is greater than largest uint112). * * Counterpart to Solidity's `uint112` operator. * * Requirements: * * - input must fit into 112 bits * * _Available since v4.7._ */ function toUint112(uint256 value) internal pure returns (uint112) { require(value <= type(uint112).max, "SafeCast: value doesn't fit in 112 bits"); return uint112(value); } /** * @dev Returns the downcasted uint104 from uint256, reverting on * overflow (when the input is greater than largest uint104). * * Counterpart to Solidity's `uint104` operator. * * Requirements: * * - input must fit into 104 bits * * _Available since v4.7._ */ function toUint104(uint256 value) internal pure returns (uint104) { require(value <= type(uint104).max, "SafeCast: value doesn't fit in 104 bits"); return uint104(value); } /** * @dev Returns the downcasted uint96 from uint256, reverting on * overflow (when the input is greater than largest uint96). * * Counterpart to Solidity's `uint96` operator. * * Requirements: * * - input must fit into 96 bits * * _Available since v4.2._ */ function toUint96(uint256 value) internal pure returns (uint96) { require(value <= type(uint96).max, "SafeCast: value doesn't fit in 96 bits"); return uint96(value); } /** * @dev Returns the downcasted uint88 from uint256, reverting on * overflow (when the input is greater than largest uint88). * * Counterpart to Solidity's `uint88` operator. * * Requirements: * * - input must fit into 88 bits * * _Available since v4.7._ */ function toUint88(uint256 value) internal pure returns (uint88) { require(value <= type(uint88).max, "SafeCast: value doesn't fit in 88 bits"); return uint88(value); } /** * @dev Returns the downcasted uint80 from uint256, reverting on * overflow (when the input is greater than largest uint80). * * Counterpart to Solidity's `uint80` operator. * * Requirements: * * - input must fit into 80 bits * * _Available since v4.7._ */ function toUint80(uint256 value) internal pure returns (uint80) { require(value <= type(uint80).max, "SafeCast: value doesn't fit in 80 bits"); return uint80(value); } /** * @dev Returns the downcasted uint72 from uint256, reverting on * overflow (when the input is greater than largest uint72). * * Counterpart to Solidity's `uint72` operator. * * Requirements: * * - input must fit into 72 bits * * _Available since v4.7._ */ function toUint72(uint256 value) internal pure returns (uint72) { require(value <= type(uint72).max, "SafeCast: value doesn't fit in 72 bits"); return uint72(value); } /** * @dev Returns the downcasted uint64 from uint256, reverting on * overflow (when the input is greater than largest uint64). * * Counterpart to Solidity's `uint64` operator. * * Requirements: * * - input must fit into 64 bits * * _Available since v2.5._ */ function toUint64(uint256 value) internal pure returns (uint64) { require(value <= type(uint64).max, "SafeCast: value doesn't fit in 64 bits"); return uint64(value); } /** * @dev Returns the downcasted uint56 from uint256, reverting on * overflow (when the input is greater than largest uint56). * * Counterpart to Solidity's `uint56` operator. * * Requirements: * * - input must fit into 56 bits * * _Available since v4.7._ */ function toUint56(uint256 value) internal pure returns (uint56) { require(value <= type(uint56).max, "SafeCast: value doesn't fit in 56 bits"); return uint56(value); } /** * @dev Returns the downcasted uint48 from uint256, reverting on * overflow (when the input is greater than largest uint48). * * Counterpart to Solidity's `uint48` operator. * * Requirements: * * - input must fit into 48 bits * * _Available since v4.7._ */ function toUint48(uint256 value) internal pure returns (uint48) { require(value <= type(uint48).max, "SafeCast: value doesn't fit in 48 bits"); return uint48(value); } /** * @dev Returns the downcasted uint40 from uint256, reverting on * overflow (when the input is greater than largest uint40). * * Counterpart to Solidity's `uint40` operator. * * Requirements: * * - input must fit into 40 bits * * _Available since v4.7._ */ function toUint40(uint256 value) internal pure returns (uint40) { require(value <= type(uint40).max, "SafeCast: value doesn't fit in 40 bits"); return uint40(value); } /** * @dev Returns the downcasted uint32 from uint256, reverting on * overflow (when the input is greater than largest uint32). * * Counterpart to Solidity's `uint32` operator. * * Requirements: * * - input must fit into 32 bits * * _Available since v2.5._ */ function toUint32(uint256 value) internal pure returns (uint32) { require(value <= type(uint32).max, "SafeCast: value doesn't fit in 32 bits"); return uint32(value); } /** * @dev Returns the downcasted uint24 from uint256, reverting on * overflow (when the input is greater than largest uint24). * * Counterpart to Solidity's `uint24` operator. * * Requirements: * * - input must fit into 24 bits * * _Available since v4.7._ */ function toUint24(uint256 value) internal pure returns (uint24) { require(value <= type(uint24).max, "SafeCast: value doesn't fit in 24 bits"); return uint24(value); } /** * @dev Returns the downcasted uint16 from uint256, reverting on * overflow (when the input is greater than largest uint16). * * Counterpart to Solidity's `uint16` operator. * * Requirements: * * - input must fit into 16 bits * * _Available since v2.5._ */ function toUint16(uint256 value) internal pure returns (uint16) { require(value <= type(uint16).max, "SafeCast: value doesn't fit in 16 bits"); return uint16(value); } /** * @dev Returns the downcasted uint8 from uint256, reverting on * overflow (when the input is greater than largest uint8). * * Counterpart to Solidity's `uint8` operator. * * Requirements: * * - input must fit into 8 bits * * _Available since v2.5._ */ function toUint8(uint256 value) internal pure returns (uint8) { require(value <= type(uint8).max, "SafeCast: value doesn't fit in 8 bits"); return uint8(value); } /** * @dev Converts a signed int256 into an unsigned uint256. * * Requirements: * * - input must be greater than or equal to 0. * * _Available since v3.0._ */ function toUint256(int256 value) internal pure returns (uint256) { require(value >= 0, "SafeCast: value must be positive"); return uint256(value); } /** * @dev Returns the downcasted int248 from int256, reverting on * overflow (when the input is less than smallest int248 or * greater than largest int248). * * Counterpart to Solidity's `int248` operator. * * Requirements: * * - input must fit into 248 bits * * _Available since v4.7._ */ function toInt248(int256 value) internal pure returns (int248 downcasted) { downcasted = int248(value); require(downcasted == value, "SafeCast: value doesn't fit in 248 bits"); } /** * @dev Returns the downcasted int240 from int256, reverting on * overflow (when the input is less than smallest int240 or * greater than largest int240). * * Counterpart to Solidity's `int240` operator. * * Requirements: * * - input must fit into 240 bits * * _Available since v4.7._ */ function toInt240(int256 value) internal pure returns (int240 downcasted) { downcasted = int240(value); require(downcasted == value, "SafeCast: value doesn't fit in 240 bits"); } /** * @dev Returns the downcasted int232 from int256, reverting on * overflow (when the input is less than smallest int232 or * greater than largest int232). * * Counterpart to Solidity's `int232` operator. * * Requirements: * * - input must fit into 232 bits * * _Available since v4.7._ */ function toInt232(int256 value) internal pure returns (int232 downcasted) { downcasted = int232(value); require(downcasted == value, "SafeCast: value doesn't fit in 232 bits"); } /** * @dev Returns the downcasted int224 from int256, reverting on * overflow (when the input is less than smallest int224 or * greater than largest int224). * * Counterpart to Solidity's `int224` operator. * * Requirements: * * - input must fit into 224 bits * * _Available since v4.7._ */ function toInt224(int256 value) internal pure returns (int224 downcasted) { downcasted = int224(value); require(downcasted == value, "SafeCast: value doesn't fit in 224 bits"); } /** * @dev Returns the downcasted int216 from int256, reverting on * overflow (when the input is less than smallest int216 or * greater than largest int216). * * Counterpart to Solidity's `int216` operator. * * Requirements: * * - input must fit into 216 bits * * _Available since v4.7._ */ function toInt216(int256 value) internal pure returns (int216 downcasted) { downcasted = int216(value); require(downcasted == value, "SafeCast: value doesn't fit in 216 bits"); } /** * @dev Returns the downcasted int208 from int256, reverting on * overflow (when the input is less than smallest int208 or * greater than largest int208). * * Counterpart to Solidity's `int208` operator. * * Requirements: * * - input must fit into 208 bits * * _Available since v4.7._ */ function toInt208(int256 value) internal pure returns (int208 downcasted) { downcasted = int208(value); require(downcasted == value, "SafeCast: value doesn't fit in 208 bits"); } /** * @dev Returns the downcasted int200 from int256, reverting on * overflow (when the input is less than smallest int200 or * greater than largest int200). * * Counterpart to Solidity's `int200` operator. * * Requirements: * * - input must fit into 200 bits * * _Available since v4.7._ */ function toInt200(int256 value) internal pure returns (int200 downcasted) { downcasted = int200(value); require(downcasted == value, "SafeCast: value doesn't fit in 200 bits"); } /** * @dev Returns the downcasted int192 from int256, reverting on * overflow (when the input is less than smallest int192 or * greater than largest int192). * * Counterpart to Solidity's `int192` operator. * * Requirements: * * - input must fit into 192 bits * * _Available since v4.7._ */ function toInt192(int256 value) internal pure returns (int192 downcasted) { downcasted = int192(value); require(downcasted == value, "SafeCast: value doesn't fit in 192 bits"); } /** * @dev Returns the downcasted int184 from int256, reverting on * overflow (when the input is less than smallest int184 or * greater than largest int184). * * Counterpart to Solidity's `int184` operator. * * Requirements: * * - input must fit into 184 bits * * _Available since v4.7._ */ function toInt184(int256 value) internal pure returns (int184 downcasted) { downcasted = int184(value); require(downcasted == value, "SafeCast: value doesn't fit in 184 bits"); } /** * @dev Returns the downcasted int176 from int256, reverting on * overflow (when the input is less than smallest int176 or * greater than largest int176). * * Counterpart to Solidity's `int176` operator. * * Requirements: * * - input must fit into 176 bits * * _Available since v4.7._ */ function toInt176(int256 value) internal pure returns (int176 downcasted) { downcasted = int176(value); require(downcasted == value, "SafeCast: value doesn't fit in 176 bits"); } /** * @dev Returns the downcasted int168 from int256, reverting on * overflow (when the input is less than smallest int168 or * greater than largest int168). * * Counterpart to Solidity's `int168` operator. * * Requirements: * * - input must fit into 168 bits * * _Available since v4.7._ */ function toInt168(int256 value) internal pure returns (int168 downcasted) { downcasted = int168(value); require(downcasted == value, "SafeCast: value doesn't fit in 168 bits"); } /** * @dev Returns the downcasted int160 from int256, reverting on * overflow (when the input is less than smallest int160 or * greater than largest int160). * * Counterpart to Solidity's `int160` operator. * * Requirements: * * - input must fit into 160 bits * * _Available since v4.7._ */ function toInt160(int256 value) internal pure returns (int160 downcasted) { downcasted = int160(value); require(downcasted == value, "SafeCast: value doesn't fit in 160 bits"); } /** * @dev Returns the downcasted int152 from int256, reverting on * overflow (when the input is less than smallest int152 or * greater than largest int152). * * Counterpart to Solidity's `int152` operator. * * Requirements: * * - input must fit into 152 bits * * _Available since v4.7._ */ function toInt152(int256 value) internal pure returns (int152 downcasted) { downcasted = int152(value); require(downcasted == value, "SafeCast: value doesn't fit in 152 bits"); } /** * @dev Returns the downcasted int144 from int256, reverting on * overflow (when the input is less than smallest int144 or * greater than largest int144). * * Counterpart to Solidity's `int144` operator. * * Requirements: * * - input must fit into 144 bits * * _Available since v4.7._ */ function toInt144(int256 value) internal pure returns (int144 downcasted) { downcasted = int144(value); require(downcasted == value, "SafeCast: value doesn't fit in 144 bits"); } /** * @dev Returns the downcasted int136 from int256, reverting on * overflow (when the input is less than smallest int136 or * greater than largest int136). * * Counterpart to Solidity's `int136` operator. * * Requirements: * * - input must fit into 136 bits * * _Available since v4.7._ */ function toInt136(int256 value) internal pure returns (int136 downcasted) { downcasted = int136(value); require(downcasted == value, "SafeCast: value doesn't fit in 136 bits"); } /** * @dev Returns the downcasted int128 from int256, reverting on * overflow (when the input is less than smallest int128 or * greater than largest int128). * * Counterpart to Solidity's `int128` operator. * * Requirements: * * - input must fit into 128 bits * * _Available since v3.1._ */ function toInt128(int256 value) internal pure returns (int128 downcasted) { downcasted = int128(value); require(downcasted == value, "SafeCast: value doesn't fit in 128 bits"); } /** * @dev Returns the downcasted int120 from int256, reverting on * overflow (when the input is less than smallest int120 or * greater than largest int120). * * Counterpart to Solidity's `int120` operator. * * Requirements: * * - input must fit into 120 bits * * _Available since v4.7._ */ function toInt120(int256 value) internal pure returns (int120 downcasted) { downcasted = int120(value); require(downcasted == value, "SafeCast: value doesn't fit in 120 bits"); } /** * @dev Returns the downcasted int112 from int256, reverting on * overflow (when the input is less than smallest int112 or * greater than largest int112). * * Counterpart to Solidity's `int112` operator. * * Requirements: * * - input must fit into 112 bits * * _Available since v4.7._ */ function toInt112(int256 value) internal pure returns (int112 downcasted) { downcasted = int112(value); require(downcasted == value, "SafeCast: value doesn't fit in 112 bits"); } /** * @dev Returns the downcasted int104 from int256, reverting on * overflow (when the input is less than smallest int104 or * greater than largest int104). * * Counterpart to Solidity's `int104` operator. * * Requirements: * * - input must fit into 104 bits * * _Available since v4.7._ */ function toInt104(int256 value) internal pure returns (int104 downcasted) { downcasted = int104(value); require(downcasted == value, "SafeCast: value doesn't fit in 104 bits"); } /** * @dev Returns the downcasted int96 from int256, reverting on * overflow (when the input is less than smallest int96 or * greater than largest int96). * * Counterpart to Solidity's `int96` operator. * * Requirements: * * - input must fit into 96 bits * * _Available since v4.7._ */ function toInt96(int256 value) internal pure returns (int96 downcasted) { downcasted = int96(value); require(downcasted == value, "SafeCast: value doesn't fit in 96 bits"); } /** * @dev Returns the downcasted int88 from int256, reverting on * overflow (when the input is less than smallest int88 or * greater than largest int88). * * Counterpart to Solidity's `int88` operator. * * Requirements: * * - input must fit into 88 bits * * _Available since v4.7._ */ function toInt88(int256 value) internal pure returns (int88 downcasted) { downcasted = int88(value); require(downcasted == value, "SafeCast: value doesn't fit in 88 bits"); } /** * @dev Returns the downcasted int80 from int256, reverting on * overflow (when the input is less than smallest int80 or * greater than largest int80). * * Counterpart to Solidity's `int80` operator. * * Requirements: * * - input must fit into 80 bits * * _Available since v4.7._ */ function toInt80(int256 value) internal pure returns (int80 downcasted) { downcasted = int80(value); require(downcasted == value, "SafeCast: value doesn't fit in 80 bits"); } /** * @dev Returns the downcasted int72 from int256, reverting on * overflow (when the input is less than smallest int72 or * greater than largest int72). * * Counterpart to Solidity's `int72` operator. * * Requirements: * * - input must fit into 72 bits * * _Available since v4.7._ */ function toInt72(int256 value) internal pure returns (int72 downcasted) { downcasted = int72(value); require(downcasted == value, "SafeCast: value doesn't fit in 72 bits"); } /** * @dev Returns the downcasted int64 from int256, reverting on * overflow (when the input is less than smallest int64 or * greater than largest int64). * * Counterpart to Solidity's `int64` operator. * * Requirements: * * - input must fit into 64 bits * * _Available since v3.1._ */ function toInt64(int256 value) internal pure returns (int64 downcasted) { downcasted = int64(value); require(downcasted == value, "SafeCast: value doesn't fit in 64 bits"); } /** * @dev Returns the downcasted int56 from int256, reverting on * overflow (when the input is less than smallest int56 or * greater than largest int56). * * Counterpart to Solidity's `int56` operator. * * Requirements: * * - input must fit into 56 bits * * _Available since v4.7._ */ function toInt56(int256 value) internal pure returns (int56 downcasted) { downcasted = int56(value); require(downcasted == value, "SafeCast: value doesn't fit in 56 bits"); } /** * @dev Returns the downcasted int48 from int256, reverting on * overflow (when the input is less than smallest int48 or * greater than largest int48). * * Counterpart to Solidity's `int48` operator. * * Requirements: * * - input must fit into 48 bits * * _Available since v4.7._ */ function toInt48(int256 value) internal pure returns (int48 downcasted) { downcasted = int48(value); require(downcasted == value, "SafeCast: value doesn't fit in 48 bits"); } /** * @dev Returns the downcasted int40 from int256, reverting on * overflow (when the input is less than smallest int40 or * greater than largest int40). * * Counterpart to Solidity's `int40` operator. * * Requirements: * * - input must fit into 40 bits * * _Available since v4.7._ */ function toInt40(int256 value) internal pure returns (int40 downcasted) { downcasted = int40(value); require(downcasted == value, "SafeCast: value doesn't fit in 40 bits"); } /** * @dev Returns the downcasted int32 from int256, reverting on * overflow (when the input is less than smallest int32 or * greater than largest int32). * * Counterpart to Solidity's `int32` operator. * * Requirements: * * - input must fit into 32 bits * * _Available since v3.1._ */ function toInt32(int256 value) internal pure returns (int32 downcasted) { downcasted = int32(value); require(downcasted == value, "SafeCast: value doesn't fit in 32 bits"); } /** * @dev Returns the downcasted int24 from int256, reverting on * overflow (when the input is less than smallest int24 or * greater than largest int24). * * Counterpart to Solidity's `int24` operator. * * Requirements: * * - input must fit into 24 bits * * _Available since v4.7._ */ function toInt24(int256 value) internal pure returns (int24 downcasted) { downcasted = int24(value); require(downcasted == value, "SafeCast: value doesn't fit in 24 bits"); } /** * @dev Returns the downcasted int16 from int256, reverting on * overflow (when the input is less than smallest int16 or * greater than largest int16). * * Counterpart to Solidity's `int16` operator. * * Requirements: * * - input must fit into 16 bits * * _Available since v3.1._ */ function toInt16(int256 value) internal pure returns (int16 downcasted) { downcasted = int16(value); require(downcasted == value, "SafeCast: value doesn't fit in 16 bits"); } /** * @dev Returns the downcasted int8 from int256, reverting on * overflow (when the input is less than smallest int8 or * greater than largest int8). * * Counterpart to Solidity's `int8` operator. * * Requirements: * * - input must fit into 8 bits * * _Available since v3.1._ */ function toInt8(int256 value) internal pure returns (int8 downcasted) { downcasted = int8(value); require(downcasted == value, "SafeCast: value doesn't fit in 8 bits"); } /** * @dev Converts an unsigned uint256 into a signed int256. * * Requirements: * * - input must be less than or equal to maxInt256. * * _Available since v3.0._ */ function toInt256(uint256 value) internal pure returns (int256) { // Note: Unsafe cast below is okay because `type(int256).max` is guaranteed to be positive require(value <= uint256(type(int256).max), "SafeCast: value doesn't fit in an int256"); return int256(value); } }
// SPDX-License-Identifier: GPL-3.0 pragma solidity 0.8.10; import "./IDrawBuffer.sol"; /** * @title IDrawBeacon * @author Asymetrix Protocol Inc Team * @notice The DrawBeacon interface. */ interface IDrawBeacon { /// @notice Draw struct created every draw /// @param drawId The monotonically increasing drawId for each draw /// @param timestamp Unix timestamp of the draw. Recorded when the draw is /// created by the DrawBeacon. /// @param beaconPeriodStartedAt Unix timestamp of when the draw started /// @param beaconPeriodSeconds Unix timestamp of the beacon draw period for /// this draw. /// @param rngRequestInternalId An internal ID of RNG service request. /// @param participantsHash A unique hash of participants of the draw. /// @param picksNumber A number of picks for the draw. /// @param randomness An array of random numbers for the draw. /// @param isEmpty A flag that indicates if the draw doesn't have /// participants. /// @param paid A flag that indicates if prizes for the draw are paid or not. struct Draw { uint32 drawId; uint64 timestamp; uint64 beaconPeriodStartedAt; uint32 beaconPeriodSeconds; uint32 rngRequestInternalId; bytes participantsHash; uint256[] randomness; uint256 picksNumber; bool isEmpty; bool paid; } /** * @notice Emit when a new DrawBuffer has been set. * @param newDrawBuffer The new DrawBuffer address */ event DrawBufferUpdated(IDrawBuffer indexed newDrawBuffer); /** * @notice Emit when a draw has opened. * @param startedAt Start timestamp */ event BeaconPeriodStarted(uint64 indexed startedAt); /** * @notice Emit when a draw has started. * @param drawId Draw id */ event DrawStarted(uint32 indexed drawId); /** * @notice Emit when the drawPeriodSeconds is set. * @param drawPeriodSeconds Time between draw */ event BeaconPeriodSecondsUpdated(uint32 drawPeriodSeconds); /** * @notice Returns the number of seconds remaining until the beacon period * can be complete. * @return The number of seconds remaining until the beacon period can be * complete. */ function beaconPeriodRemainingSeconds() external view returns (uint64); /** * @notice Returns beacon period seconds. * @return The number of seconds of the beacon period. */ function getBeaconPeriodSeconds() external view returns (uint32); /** * @notice Returns DrawBuffer contract address. * @return DrawBuffer contract address. */ function getDrawBuffer() external view returns (IDrawBuffer); /** * @notice Returns the time when the beacon period started at. * @return The time when the beacon period started at. */ function getBeaconPeriodStartedAt() external view returns (uint64); /** * @notice Returns the timestamp at which the beacon period ends. * @return The timestamp at which the beacon period ends. */ function beaconPeriodEndAt() external view returns (uint64); /** * @notice Returns the next draw ID. * @return The ID of the next draw to start. */ function getNextDrawId() external view returns (uint32); /** * @notice Calculates the next beacon start time, assuming all beacon * periods have occurred between the last and now. * @return The next beacon period start time. */ function calculateNextBeaconPeriodStartTimeFromCurrentTime() external view returns (uint64); /** * @notice Calculates when the next beacon period will start. * @param time The timestamp to use as the current time. * @return The timestamp at which the next beacon period would start. */ function calculateNextBeaconPeriodStartTime( uint64 time ) external view returns (uint64); /** * @notice Returns whether the beacon period is over. * @return True if the beacon period is over, false otherwise. */ function isBeaconPeriodOver() external view returns (bool); /** * @notice Returns whether the draw can start * @return True if the beacon period is over, false otherwise */ function canStartDraw() external view returns (bool); /** * @notice Allows the owner to set the beacon period in seconds. * @param beaconPeriodSeconds The new beacon period in seconds. Must be * greater than zero. */ function setBeaconPeriodSeconds(uint32 beaconPeriodSeconds) external; /** * @notice Starts the Draw process. The previous beacon period must have * ended. */ function startDraw() external; /** * @notice Set global DrawBuffer variable. * @dev All subsequent Draw requests/completions will be pushed to the * new DrawBuffer. * @param newDrawBuffer DrawBuffer address * @return DrawBuffer */ function setDrawBuffer( IDrawBuffer newDrawBuffer ) external returns (IDrawBuffer); }
// SPDX-License-Identifier: GPL-3.0 pragma solidity 0.8.10; import "./IDrawBeacon.sol"; /** * @title IDrawBuffer * @author Asymetrix Protocol Inc Team * @notice The DrawBuffer interface. */ interface IDrawBuffer { /** * @notice Emit when a new draw has been created. * @param drawId Draw id * @param draw The Draw struct */ event DrawSet(uint32 indexed drawId, IDrawBeacon.Draw draw); /** * @notice Emit when a new PrizeDistributor contract address is set. * @param prizeDistributor A new PrizeDistributor contract address */ event PrizeDistributorSet(address prizeDistributor); /** * @notice Emit when draw is marked is paid. * @param drawId An ID of a draw that was marked as paid */ event DrawMarkedAsPaid(uint32 drawId); /** * @notice Read a PrizeDistributor contract address. * @return A PrizeDistributor contract address. */ function getPrizeDistributor() external view returns (address); /** * @notice Read a ring buffer cardinality. * @return Ring buffer cardinality. */ function getBufferCardinality() external view returns (uint32); /** * @notice Read a Draw from the draws ring buffer. * @dev Read a Draw using the Draw.drawId to calculate position in the * draws ring buffer. * @param drawId Draw.drawId * @return IDrawBeacon.Draw */ function getDraw( uint32 drawId ) external view returns (IDrawBeacon.Draw memory); /** * @notice Read multiple Draws from the draws ring buffer. * @dev Read multiple Draws using each drawId to calculate position in * the draws ring buffer. * @param drawIds Array of drawIds * @return IDrawBeacon.Draw[] array with the draw information of the * requested draw ids */ function getDraws( uint32[] calldata drawIds ) external view returns (IDrawBeacon.Draw[] memory); /** * @notice Gets the number of Draws held in the draw ring buffer. * @dev If no Draws have been pushed, it will return 0. * @dev If the ring buffer is full, it will return the cardinality. * @dev Otherwise, it will return the NewestDraw index + 1. * @return Number of Draws held in the draw ring buffer. */ function getDrawCount() external view returns (uint32); /** * @notice Read newest Draw from draws ring buffer. * @dev Uses the nextDrawIndex to calculate the most recently added Draw. * @return IDrawBeacon.Draw */ function getNewestDraw() external view returns (IDrawBeacon.Draw memory); /** * @notice Read oldest Draw from draws ring buffer. * @dev Finds the oldest Draw by comparing and/or diffing totalDraws with * the cardinality. * @return IDrawBeacon.Draw */ function getOldestDraw() external view returns (IDrawBeacon.Draw memory); /** * @notice Push Draw onto draws ring buffer history. * @dev Push new draw onto draws history via authorized manager or owner. * @param draw IDrawBeacon.Draw * @return Draw.drawId */ function pushDraw(IDrawBeacon.Draw calldata draw) external returns (uint32); /** * @notice Set existing Draw in draws ring buffer with new parameters. * @dev Updating a Draw should be used sparingly and only in the event an * incorrect Draw parameter has been stored. * @param newDraw IDrawBeacon.Draw * @return Draw.drawId */ function setDraw( IDrawBeacon.Draw calldata newDraw ) external returns (uint32); /** * @notice Set a new PrizeDistributor contract address. * @param prizeDistributor A new PrizeDistributor contract address */ function setPrizeDistributor(address prizeDistributor) external; /** * @notice Mark a draw as paid. * @dev It means that the winners of the draw were paid and the draw can * not be paid again. * @param drawId An ID of a draw that should be marked as paid */ function markDrawAsPaid(uint32 drawId) external; }
// SPDX-License-Identifier: GPL-3.0 pragma solidity 0.8.10; import "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol"; /** * @title Abstract ownable contract that can be inherited by other contracts. * @notice 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. * * The `owner` is first set by passing the address of the `initialOwner` * to the Ownable Initialize. * * The owner account can be transferred through a two steps process: * 1. The current `owner` calls {transferOwnership} to set a * `pendingOwner`. * 2. The `pendingOwner` calls {claimOwnership} to accept the ownership * transfer. * * This module is used through inheritance. It will make available the * modifier `onlyOwner`, which can be applied to your functions to * restrict their use to the owner. */ abstract contract Ownable is Initializable { address private _owner; address private _pendingOwner; /** * @dev Emitted when `_pendingOwner` has been changed. * @param pendingOwner new `_pendingOwner` address. */ event OwnershipOffered(address indexed pendingOwner); /** * @dev Emitted when `_owner` has been changed. * @param previousOwner previous `_owner` address. * @param newOwner new `_owner` address. */ event OwnershipTransferred( address indexed previousOwner, address indexed newOwner ); /* ============ Deploy ============ */ /** * @notice Initializes the contract setting `_initialOwner` as the initial * owner. * @param _initialOwner Initial owner of the contract. */ function __Ownable_init_unchained( address _initialOwner ) internal onlyInitializing { _setOwner(_initialOwner); } /* ============ External Functions ============ */ /** * @notice Returns the address of the current owner. */ function owner() public view virtual returns (address) { return _owner; } /** * @notice Gets current `_pendingOwner`. * @return Current `_pendingOwner` address. */ function pendingOwner() external view virtual returns (address) { return _pendingOwner; } /** * @notice Renounce ownership of the contract. * @dev Leaves the contract without owner. It will not be possible to call * `onlyOwner` functions anymore. Can only be called by the current owner. * * NOTE: Renouncing ownership will leave the contract without an owner, * thereby removing any functionality that is only available to the owner. */ function renounceOwnership() external virtual onlyOwner { _setOwner(address(0)); } /** * @notice Allows current owner to set the `_pendingOwner` address. * @param _newOwner Address to transfer ownership to. */ function transferOwnership(address _newOwner) external onlyOwner { require( _newOwner != address(0), "Ownable/pendingOwner-not-zero-address" ); _pendingOwner = _newOwner; emit OwnershipOffered(_newOwner); } /** * @notice Allows the `_pendingOwner` address to finalize the transfer. * @dev This function is only callable by the `_pendingOwner`. */ function claimOwnership() external onlyPendingOwner { _setOwner(_pendingOwner); _pendingOwner = address(0); } /* ============ Internal Functions ============ */ /** * @notice Internal function to set the `_owner` of the contract. * @param _newOwner New `_owner` address. */ function _setOwner(address _newOwner) private { address _oldOwner = _owner; _owner = _newOwner; emit OwnershipTransferred(_oldOwner, _newOwner); } /* ============ Modifier Functions ============ */ /** * @dev Throws if called by any account other than the owner. */ modifier onlyOwner() { require(owner() == msg.sender, "Ownable/caller-not-owner"); _; } /** * @dev Throws if called by any account other than the `pendingOwner`. */ modifier onlyPendingOwner() { require(msg.sender == _pendingOwner, "Ownable/caller-not-pendingOwner"); _; } uint256[45] private __gap; }
{ "optimizer": { "enabled": true, "runs": 2000 }, "evmVersion": "london", "outputSelection": { "*": { "*": [ "evm.bytecode", "evm.deployedBytecode", "devdoc", "userdoc", "metadata", "abi" ] } }, "metadata": { "useLiteralContent": true }, "libraries": {} }
Contract Security Audit
- No Contract Security Audit Submitted- Submit Audit Here
Contract ABI
API[{"inputs":[],"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint32","name":"drawPeriodSeconds","type":"uint32"}],"name":"BeaconPeriodSecondsUpdated","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint64","name":"startedAt","type":"uint64"}],"name":"BeaconPeriodStarted","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint32","name":"nextDrawId","type":"uint32"},{"indexed":false,"internalType":"uint64","name":"beaconPeriodStartedAt","type":"uint64"}],"name":"Deployed","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"contract IDrawBuffer","name":"newDrawBuffer","type":"address"}],"name":"DrawBufferUpdated","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint32","name":"drawId","type":"uint32"}],"name":"DrawStarted","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint8","name":"version","type":"uint8"}],"name":"Initialized","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"pendingOwner","type":"address"}],"name":"OwnershipOffered","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"},{"inputs":[],"name":"beaconPeriodEndAt","outputs":[{"internalType":"uint64","name":"","type":"uint64"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"beaconPeriodRemainingSeconds","outputs":[{"internalType":"uint64","name":"","type":"uint64"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint64","name":"_time","type":"uint64"}],"name":"calculateNextBeaconPeriodStartTime","outputs":[{"internalType":"uint64","name":"","type":"uint64"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"calculateNextBeaconPeriodStartTimeFromCurrentTime","outputs":[{"internalType":"uint64","name":"","type":"uint64"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"canStartDraw","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"claimOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"getBeaconPeriodSeconds","outputs":[{"internalType":"uint32","name":"","type":"uint32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getBeaconPeriodStartedAt","outputs":[{"internalType":"uint64","name":"","type":"uint64"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getDrawBuffer","outputs":[{"internalType":"contract IDrawBuffer","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getNextDrawId","outputs":[{"internalType":"uint32","name":"","type":"uint32"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_owner","type":"address"},{"internalType":"contract IDrawBuffer","name":"_drawBuffer","type":"address"},{"internalType":"uint32","name":"_nextDrawId","type":"uint32"},{"internalType":"uint64","name":"_beaconPeriodStart","type":"uint64"},{"internalType":"uint32","name":"_beaconPeriodSeconds","type":"uint32"}],"name":"initialize","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"isBeaconPeriodOver","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"pendingOwner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"renounceOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint32","name":"_beaconPeriodSeconds","type":"uint32"}],"name":"setBeaconPeriodSeconds","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"contract IDrawBuffer","name":"newDrawBuffer","type":"address"}],"name":"setDrawBuffer","outputs":[{"internalType":"contract IDrawBuffer","name":"","type":"address"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"startDraw","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"}]
Contract Creation Code
608060405234801561001057600080fd5b5061001961001e565b6100de565b600054610100900460ff161561008a5760405162461bcd60e51b815260206004820152602760248201527f496e697469616c697a61626c653a20636f6e747261637420697320696e697469604482015266616c697a696e6760c81b606482015260840160405180910390fd5b60005460ff90811610156100dc576000805460ff191660ff9081179091556040519081527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989060200160405180910390a15b565b61149a806100ed6000396000f3fe608060405234801561001057600080fd5b50600436106101515760003560e01c806389c36f8e116100cd578063ab70d49c11610081578063d1e7765711610066578063d1e7765714610156578063e30c39781461028f578063f2fde38b146102a057600080fd5b8063ab70d49c1461026e578063c57708c21461028157600080fd5b8063919bead0116100b2578063919bead014610240578063a104fd7914610253578063a3ae35ab1461025b57600080fd5b806389c36f8e146102215780638da5cb5b1461022957600080fd5b80634019f2d6116101245780634e71e0c8116101095780634e71e0c814610209578063715018a61461021157806375e38f161461021957600080fd5b80634019f2d6146101d1578063406d40dd146101f657600080fd5b80630996f6e1146101565780632ae168a61461017357806339f92c301461017d5780633e7a3908146101ab575b600080fd5b61015e6102b3565b60405190151581526020015b60405180910390f35b61017b6102c2565b005b606154600160c01b900467ffffffffffffffff165b60405167ffffffffffffffff909116815260200161016a565b606154600160a01b900463ffffffff165b60405163ffffffff909116815260200161016a565b6061546001600160a01b03165b6040516001600160a01b03909116815260200161016a565b61017b6102043660046110f2565b610533565b61017b61067b565b61017b610709565b610192610774565b61019261077e565b6000546201000090046001600160a01b03166101de565b61017b61024e366004611161565b6107ad565b61019261081a565b610192610269366004611185565b610824565b6101de61027c3660046111a0565b610859565b60625463ffffffff166101bc565b6001546001600160a01b03166101de565b61017b6102ae3660046111a0565b6108c9565b60006102bd6109fd565b905090565b6102ca610a23565b6102d26109fd565b6103495760405162461bcd60e51b815260206004820152602160248201527f44726177426561636f6e2f626561636f6e2d706572696f642d6e6f742d6f766560448201527f720000000000000000000000000000000000000000000000000000000000000060648201526084015b60405180910390fd5b6061546040805161014081018252600060808201819052606060a0830181905260c0830181905260e083018290526101008301829052610120830182905260625463ffffffff90811684524267ffffffffffffffff8181166020870152600160c01b880416858701819052600160a01b88049290921692850183905294517f3ecf6213000000000000000000000000000000000000000000000000000000008152909591949392916001600160a01b031690633ecf62139061040f908590600401611245565b6020604051808303816000875af115801561042e573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906104529190611326565b60405190915063ffffffff8216907f6bb6ddd92ced3d5a87cb33dece8347be7f1b9a5f53fa1808c938f5f064d1042e90600090a26000610493868686610a7d565b6061805477ffffffffffffffffffffffffffffffffffffffffffffffff16600160c01b67ffffffffffffffff84160217905590506104d2826001611372565b6062805463ffffffff191663ffffffff9290921691909117905560405167ffffffffffffffff8216907f9e5f7e6ac833c4735b5548bbeec59dac4d413789aa351fbe11a654dac0c4306c90600090a25050505050506105316001602f55565b565b600054610100900460ff16158080156105535750600054600160ff909116105b8061056d5750303b15801561056d575060005460ff166001145b6105df5760405162461bcd60e51b815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201527f647920696e697469616c697a65640000000000000000000000000000000000006064820152608401610340565b600080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff001660011790558015610620576000805461ff0019166101001790555b61062d8686868686610ac0565b8015610673576000805461ff0019169055604051600181527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989060200160405180910390a15b505050505050565b6001546001600160a01b031633146106d55760405162461bcd60e51b815260206004820152601f60248201527f4f776e61626c652f63616c6c65722d6e6f742d70656e64696e674f776e6572006044820152606401610340565b6001546106ea906001600160a01b0316610cfb565b6001805473ffffffffffffffffffffffffffffffffffffffff19169055565b6000546001600160a01b036201000090910416331461076a5760405162461bcd60e51b815260206004820152601860248201527f4f776e61626c652f63616c6c65722d6e6f742d6f776e657200000000000000006044820152606401610340565b6105316000610cfb565b60006102bd610d6c565b6061546000906102bd90600160c01b810467ffffffffffffffff1690600160a01b900463ffffffff1642610a7d565b6000546001600160a01b036201000090910416331461080e5760405162461bcd60e51b815260206004820152601860248201527f4f776e61626c652f63616c6c65722d6e6f742d6f776e657200000000000000006044820152606401610340565b61081781610da8565b50565b60006102bd610e96565b60615460009061085390600160c01b810467ffffffffffffffff1690600160a01b900463ffffffff1684610a7d565b92915050565b600080546001600160a01b03620100009091041633146108bb5760405162461bcd60e51b815260206004820152601860248201527f4f776e61626c652f63616c6c65722d6e6f742d6f776e657200000000000000006044820152606401610340565b61085382610ec4565b919050565b6000546001600160a01b036201000090910416331461092a5760405162461bcd60e51b815260206004820152601860248201527f4f776e61626c652f63616c6c65722d6e6f742d6f776e657200000000000000006044820152606401610340565b6001600160a01b0381166109a65760405162461bcd60e51b815260206004820152602560248201527f4f776e61626c652f70656e64696e674f776e65722d6e6f742d7a65726f2d616460448201527f64726573730000000000000000000000000000000000000000000000000000006064820152608401610340565b6001805473ffffffffffffffffffffffffffffffffffffffff19166001600160a01b0383169081179091556040517f239a2ddded15777fa246aed5f7e1a9bc69a39d4eb4a397034d1d85766cca7d4c90600090a250565b60004267ffffffffffffffff16610a12610e96565b67ffffffffffffffff161115905090565b6002602f541415610a765760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c006044820152606401610340565b6002602f55565b60008063ffffffff8416610a91868561139a565b610a9b91906113c3565b9050610aad63ffffffff851682611411565b610ab79086611441565b95945050505050565b600054610100900460ff16610b3d5760405162461bcd60e51b815260206004820152602b60248201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960448201527f6e697469616c697a696e670000000000000000000000000000000000000000006064820152608401610340565b610b468561102d565b60008267ffffffffffffffff1611610bc65760405162461bcd60e51b815260206004820152602a60248201527f44726177426561636f6e2f626561636f6e2d706572696f642d6772656174657260448201527f2d7468616e2d7a65726f000000000000000000000000000000000000000000006064820152608401610340565b60018363ffffffff161015610c1d5760405162461bcd60e51b815260206004820152601f60248201527f44726177426561636f6e2f6e6578742d647261772d69642d6774652d6f6e65006044820152606401610340565b6061805477ffffffffffffffffffffffffffffffffffffffffffffffff16600160c01b67ffffffffffffffff8516021790556062805463ffffffff191663ffffffff8516179055610c6d81610da8565b610c7684610ec4565b506040805163ffffffff8516815267ffffffffffffffff841660208201527f3125f2f28108d5eabe48aa2a11adff21d6f9244f0436278992999404ba4fc5ad910160405180910390a160405167ffffffffffffffff8316907f9e5f7e6ac833c4735b5548bbeec59dac4d413789aa351fbe11a654dac0c4306c90600090a25050505050565b600080546001600160a01b03838116620100008181027fffffffffffffffffffff0000000000000000000000000000000000000000ffff851617855560405193049190911692909183917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e091a35050565b600080610d77610e96565b90504267ffffffffffffffff80821690831611610d975760009250505090565b610da1818361139a565b9250505090565b60008163ffffffff1611610e245760405162461bcd60e51b815260206004820152602a60248201527f44726177426561636f6e2f626561636f6e2d706572696f642d6772656174657260448201527f2d7468616e2d7a65726f000000000000000000000000000000000000000000006064820152608401610340565b606180547fffffffffffffffff00000000ffffffffffffffffffffffffffffffffffffffff16600160a01b63ffffffff8416908102919091179091556040519081527f4727494dbd863e2084366f539d6ec569aaf7ab78582a34f006f004266777cd199060200160405180910390a150565b6061546000906102bd90600160a01b810463ffffffff1690600160c01b900467ffffffffffffffff16611441565b6061546000906001600160a01b03908116908316610f4a5760405162461bcd60e51b815260206004820152602860248201527f44726177426561636f6e2f647261772d686973746f72792d6e6f742d7a65726f60448201527f2d616464726573730000000000000000000000000000000000000000000000006064820152608401610340565b806001600160a01b0316836001600160a01b03161415610fd25760405162461bcd60e51b815260206004820152602860248201527f44726177426561636f6e2f6578697374696e672d647261772d686973746f727960448201527f2d616464726573730000000000000000000000000000000000000000000000006064820152608401610340565b6061805473ffffffffffffffffffffffffffffffffffffffff19166001600160a01b0385169081179091556040517feb70b03fab908e126e5efc33f8dfd2731fa89c716282a86769025f8dd4a6c1e090600090a25090919050565b600054610100900460ff166110aa5760405162461bcd60e51b815260206004820152602b60248201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960448201527f6e697469616c697a696e670000000000000000000000000000000000000000006064820152608401610340565b61081781610cfb565b6001600160a01b038116811461081757600080fd5b63ffffffff8116811461081757600080fd5b803567ffffffffffffffff811681146108c457600080fd5b600080600080600060a0868803121561110a57600080fd5b8535611115816110b3565b94506020860135611125816110b3565b93506040860135611135816110c8565b9250611143606087016110da565b91506080860135611153816110c8565b809150509295509295909350565b60006020828403121561117357600080fd5b813561117e816110c8565b9392505050565b60006020828403121561119757600080fd5b61117e826110da565b6000602082840312156111b257600080fd5b813561117e816110b3565b6000815180845260005b818110156111e3576020818501810151868301820152016111c7565b818111156111f5576000602083870101525b50601f01601f19169290920160200192915050565b600081518084526020808501945080840160005b8381101561123a5781518752958201959082019060010161121e565b509495945050505050565b6020815261125c60208201835163ffffffff169052565b60006020830151611279604084018267ffffffffffffffff169052565b50604083015167ffffffffffffffff8116606084015250606083015163ffffffff8116608084015250608083015163ffffffff811660a08401525060a08301516101408060c08501526112d06101608501836111bd565b915060c0850151601f198584030160e08601526112ed838261120a565b92505060e08501516101008181870152808701519150506101206113148187018315159052565b90950151151593019290925250919050565b60006020828403121561133857600080fd5b815161117e816110c8565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b600063ffffffff80831681851680830382111561139157611391611343565b01949350505050565b600067ffffffffffffffff838116908316818110156113bb576113bb611343565b039392505050565b600067ffffffffffffffff80841680611405577f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b92169190910492915050565b600067ffffffffffffffff8083168185168183048111821515161561143857611438611343565b02949350505050565b600067ffffffffffffffff8083168185168083038211156113915761139161134356fea26469706673582212202c268fff87155ccd9ccc4442026d722ecc43a88b41cc3caa237b55e56c4d7f6564736f6c634300080a0033
Deployed Bytecode
0x608060405234801561001057600080fd5b50600436106101515760003560e01c806389c36f8e116100cd578063ab70d49c11610081578063d1e7765711610066578063d1e7765714610156578063e30c39781461028f578063f2fde38b146102a057600080fd5b8063ab70d49c1461026e578063c57708c21461028157600080fd5b8063919bead0116100b2578063919bead014610240578063a104fd7914610253578063a3ae35ab1461025b57600080fd5b806389c36f8e146102215780638da5cb5b1461022957600080fd5b80634019f2d6116101245780634e71e0c8116101095780634e71e0c814610209578063715018a61461021157806375e38f161461021957600080fd5b80634019f2d6146101d1578063406d40dd146101f657600080fd5b80630996f6e1146101565780632ae168a61461017357806339f92c301461017d5780633e7a3908146101ab575b600080fd5b61015e6102b3565b60405190151581526020015b60405180910390f35b61017b6102c2565b005b606154600160c01b900467ffffffffffffffff165b60405167ffffffffffffffff909116815260200161016a565b606154600160a01b900463ffffffff165b60405163ffffffff909116815260200161016a565b6061546001600160a01b03165b6040516001600160a01b03909116815260200161016a565b61017b6102043660046110f2565b610533565b61017b61067b565b61017b610709565b610192610774565b61019261077e565b6000546201000090046001600160a01b03166101de565b61017b61024e366004611161565b6107ad565b61019261081a565b610192610269366004611185565b610824565b6101de61027c3660046111a0565b610859565b60625463ffffffff166101bc565b6001546001600160a01b03166101de565b61017b6102ae3660046111a0565b6108c9565b60006102bd6109fd565b905090565b6102ca610a23565b6102d26109fd565b6103495760405162461bcd60e51b815260206004820152602160248201527f44726177426561636f6e2f626561636f6e2d706572696f642d6e6f742d6f766560448201527f720000000000000000000000000000000000000000000000000000000000000060648201526084015b60405180910390fd5b6061546040805161014081018252600060808201819052606060a0830181905260c0830181905260e083018290526101008301829052610120830182905260625463ffffffff90811684524267ffffffffffffffff8181166020870152600160c01b880416858701819052600160a01b88049290921692850183905294517f3ecf6213000000000000000000000000000000000000000000000000000000008152909591949392916001600160a01b031690633ecf62139061040f908590600401611245565b6020604051808303816000875af115801561042e573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906104529190611326565b60405190915063ffffffff8216907f6bb6ddd92ced3d5a87cb33dece8347be7f1b9a5f53fa1808c938f5f064d1042e90600090a26000610493868686610a7d565b6061805477ffffffffffffffffffffffffffffffffffffffffffffffff16600160c01b67ffffffffffffffff84160217905590506104d2826001611372565b6062805463ffffffff191663ffffffff9290921691909117905560405167ffffffffffffffff8216907f9e5f7e6ac833c4735b5548bbeec59dac4d413789aa351fbe11a654dac0c4306c90600090a25050505050506105316001602f55565b565b600054610100900460ff16158080156105535750600054600160ff909116105b8061056d5750303b15801561056d575060005460ff166001145b6105df5760405162461bcd60e51b815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201527f647920696e697469616c697a65640000000000000000000000000000000000006064820152608401610340565b600080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff001660011790558015610620576000805461ff0019166101001790555b61062d8686868686610ac0565b8015610673576000805461ff0019169055604051600181527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989060200160405180910390a15b505050505050565b6001546001600160a01b031633146106d55760405162461bcd60e51b815260206004820152601f60248201527f4f776e61626c652f63616c6c65722d6e6f742d70656e64696e674f776e6572006044820152606401610340565b6001546106ea906001600160a01b0316610cfb565b6001805473ffffffffffffffffffffffffffffffffffffffff19169055565b6000546001600160a01b036201000090910416331461076a5760405162461bcd60e51b815260206004820152601860248201527f4f776e61626c652f63616c6c65722d6e6f742d6f776e657200000000000000006044820152606401610340565b6105316000610cfb565b60006102bd610d6c565b6061546000906102bd90600160c01b810467ffffffffffffffff1690600160a01b900463ffffffff1642610a7d565b6000546001600160a01b036201000090910416331461080e5760405162461bcd60e51b815260206004820152601860248201527f4f776e61626c652f63616c6c65722d6e6f742d6f776e657200000000000000006044820152606401610340565b61081781610da8565b50565b60006102bd610e96565b60615460009061085390600160c01b810467ffffffffffffffff1690600160a01b900463ffffffff1684610a7d565b92915050565b600080546001600160a01b03620100009091041633146108bb5760405162461bcd60e51b815260206004820152601860248201527f4f776e61626c652f63616c6c65722d6e6f742d6f776e657200000000000000006044820152606401610340565b61085382610ec4565b919050565b6000546001600160a01b036201000090910416331461092a5760405162461bcd60e51b815260206004820152601860248201527f4f776e61626c652f63616c6c65722d6e6f742d6f776e657200000000000000006044820152606401610340565b6001600160a01b0381166109a65760405162461bcd60e51b815260206004820152602560248201527f4f776e61626c652f70656e64696e674f776e65722d6e6f742d7a65726f2d616460448201527f64726573730000000000000000000000000000000000000000000000000000006064820152608401610340565b6001805473ffffffffffffffffffffffffffffffffffffffff19166001600160a01b0383169081179091556040517f239a2ddded15777fa246aed5f7e1a9bc69a39d4eb4a397034d1d85766cca7d4c90600090a250565b60004267ffffffffffffffff16610a12610e96565b67ffffffffffffffff161115905090565b6002602f541415610a765760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c006044820152606401610340565b6002602f55565b60008063ffffffff8416610a91868561139a565b610a9b91906113c3565b9050610aad63ffffffff851682611411565b610ab79086611441565b95945050505050565b600054610100900460ff16610b3d5760405162461bcd60e51b815260206004820152602b60248201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960448201527f6e697469616c697a696e670000000000000000000000000000000000000000006064820152608401610340565b610b468561102d565b60008267ffffffffffffffff1611610bc65760405162461bcd60e51b815260206004820152602a60248201527f44726177426561636f6e2f626561636f6e2d706572696f642d6772656174657260448201527f2d7468616e2d7a65726f000000000000000000000000000000000000000000006064820152608401610340565b60018363ffffffff161015610c1d5760405162461bcd60e51b815260206004820152601f60248201527f44726177426561636f6e2f6e6578742d647261772d69642d6774652d6f6e65006044820152606401610340565b6061805477ffffffffffffffffffffffffffffffffffffffffffffffff16600160c01b67ffffffffffffffff8516021790556062805463ffffffff191663ffffffff8516179055610c6d81610da8565b610c7684610ec4565b506040805163ffffffff8516815267ffffffffffffffff841660208201527f3125f2f28108d5eabe48aa2a11adff21d6f9244f0436278992999404ba4fc5ad910160405180910390a160405167ffffffffffffffff8316907f9e5f7e6ac833c4735b5548bbeec59dac4d413789aa351fbe11a654dac0c4306c90600090a25050505050565b600080546001600160a01b03838116620100008181027fffffffffffffffffffff0000000000000000000000000000000000000000ffff851617855560405193049190911692909183917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e091a35050565b600080610d77610e96565b90504267ffffffffffffffff80821690831611610d975760009250505090565b610da1818361139a565b9250505090565b60008163ffffffff1611610e245760405162461bcd60e51b815260206004820152602a60248201527f44726177426561636f6e2f626561636f6e2d706572696f642d6772656174657260448201527f2d7468616e2d7a65726f000000000000000000000000000000000000000000006064820152608401610340565b606180547fffffffffffffffff00000000ffffffffffffffffffffffffffffffffffffffff16600160a01b63ffffffff8416908102919091179091556040519081527f4727494dbd863e2084366f539d6ec569aaf7ab78582a34f006f004266777cd199060200160405180910390a150565b6061546000906102bd90600160a01b810463ffffffff1690600160c01b900467ffffffffffffffff16611441565b6061546000906001600160a01b03908116908316610f4a5760405162461bcd60e51b815260206004820152602860248201527f44726177426561636f6e2f647261772d686973746f72792d6e6f742d7a65726f60448201527f2d616464726573730000000000000000000000000000000000000000000000006064820152608401610340565b806001600160a01b0316836001600160a01b03161415610fd25760405162461bcd60e51b815260206004820152602860248201527f44726177426561636f6e2f6578697374696e672d647261772d686973746f727960448201527f2d616464726573730000000000000000000000000000000000000000000000006064820152608401610340565b6061805473ffffffffffffffffffffffffffffffffffffffff19166001600160a01b0385169081179091556040517feb70b03fab908e126e5efc33f8dfd2731fa89c716282a86769025f8dd4a6c1e090600090a25090919050565b600054610100900460ff166110aa5760405162461bcd60e51b815260206004820152602b60248201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960448201527f6e697469616c697a696e670000000000000000000000000000000000000000006064820152608401610340565b61081781610cfb565b6001600160a01b038116811461081757600080fd5b63ffffffff8116811461081757600080fd5b803567ffffffffffffffff811681146108c457600080fd5b600080600080600060a0868803121561110a57600080fd5b8535611115816110b3565b94506020860135611125816110b3565b93506040860135611135816110c8565b9250611143606087016110da565b91506080860135611153816110c8565b809150509295509295909350565b60006020828403121561117357600080fd5b813561117e816110c8565b9392505050565b60006020828403121561119757600080fd5b61117e826110da565b6000602082840312156111b257600080fd5b813561117e816110b3565b6000815180845260005b818110156111e3576020818501810151868301820152016111c7565b818111156111f5576000602083870101525b50601f01601f19169290920160200192915050565b600081518084526020808501945080840160005b8381101561123a5781518752958201959082019060010161121e565b509495945050505050565b6020815261125c60208201835163ffffffff169052565b60006020830151611279604084018267ffffffffffffffff169052565b50604083015167ffffffffffffffff8116606084015250606083015163ffffffff8116608084015250608083015163ffffffff811660a08401525060a08301516101408060c08501526112d06101608501836111bd565b915060c0850151601f198584030160e08601526112ed838261120a565b92505060e08501516101008181870152808701519150506101206113148187018315159052565b90950151151593019290925250919050565b60006020828403121561133857600080fd5b815161117e816110c8565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b600063ffffffff80831681851680830382111561139157611391611343565b01949350505050565b600067ffffffffffffffff838116908316818110156113bb576113bb611343565b039392505050565b600067ffffffffffffffff80841680611405577f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b92169190910492915050565b600067ffffffffffffffff8083168185168183048111821515161561143857611438611343565b02949350505050565b600067ffffffffffffffff8083168185168083038211156113915761139161134356fea26469706673582212202c268fff87155ccd9ccc4442026d722ecc43a88b41cc3caa237b55e56c4d7f6564736f6c634300080a0033
Loading...
Loading
Loading...
Loading
Multichain Portfolio | 31 Chains
Chain | Token | Portfolio % | Price | Amount | Value |
---|
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.