Source Code
Overview
ETH Balance
0 ETH
ETH Value
$0.00View more zero value Internal Transactions in Advanced View mode
Advanced mode:
Cross-Chain Transactions
Loading...
Loading
Contract Name:
MinterUpgradeable
Compiler Version
v0.8.19+commit.7dd6d404
Optimization Enabled:
Yes with 2000 runs
Other Settings:
paris EvmVersion
Contract Source Code (Solidity Standard Json-Input format)
// SPDX-License-Identifier: GPL-3.0-or-later
pragma solidity =0.8.19;
import {Math} from "@openzeppelin/contracts/utils/math/Math.sol";
import {Ownable2StepUpgradeable} from "@openzeppelin/contracts-upgradeable/access/Ownable2StepUpgradeable.sol";
import {IMinter} from "./interfaces/IMinter.sol";
import {IFenix} from "./interfaces/IFenix.sol";
import {IVoter} from "./interfaces/IVoter.sol";
import {IVotingEscrow} from "./interfaces/IVotingEscrow.sol";
import {BlastGovernorClaimableSetup} from "../integration/BlastGovernorClaimableSetup.sol";
// codifies the minting rules as per ve(3,3), abstracted from the token to support any token that allows minting
contract MinterUpgradeable is IMinter, BlastGovernorClaimableSetup, Ownable2StepUpgradeable {
uint256 public constant PRECISION = 10_000; // 10,000 = 100%
uint256 public constant MAX_TEAM_RATE = 500; // 500 bips = 5%
uint256 public constant WEEK = 86400 * 7; // allows minting once per week (reset every Thursday 00:00 UTC)
uint256 public constant TAIL_EMISSION = 20; // 0.2%
bool public isFirstMint;
bool public isStarted;
uint256 public decayRate;
uint256 public inflationRate;
uint256 public inflationPeriodCount;
uint256 public teamRate;
uint256 public weekly;
uint256 public active_period;
uint256 public lastInflationPeriod;
IFenix public fenix;
IVoter public voter;
IVotingEscrow public ve;
uint256 public startEmissionDistributionTimestamp;
constructor(address blastGovernor_) {
__BlastGovernorClaimableSetup_init(blastGovernor_);
_disableInitializers();
}
function initialize(
address blastGovernor_,
address voter_, // the voting & distribution system
address ve_
) external initializer {
__BlastGovernorClaimableSetup_init(blastGovernor_);
__Ownable2Step_init();
isFirstMint = true;
teamRate = MAX_TEAM_RATE;
decayRate = 100; // 1%
inflationRate = 150; // 1.5%
inflationPeriodCount = 8;
active_period = ((block.timestamp + (2 * WEEK)) / WEEK) * WEEK;
weekly = 225_000 * 1e18; // represents a starting weekly emission of 225,000 Fenix (Fenix has 18 decimals)
fenix = IFenix(IVotingEscrow(ve_).token());
voter = IVoter(voter_);
ve = IVotingEscrow(ve_);
}
function patchInitialSupply() external onlyOwner reinitializer(2) {
assert(weekly == 225_000e18);
assert(fenix.totalSupply() == 7_500_000e18);
fenix.mint(msg.sender, 67_500_000e18);
weekly = 2_250_000e18;
}
function shiftStartByOneWeek() external onlyOwner reinitializer(3) {
require(isStarted && weekly == 2_250_000e18 && fenix.totalSupply() == 75_000_000e18, "Invalid contract state for call");
startEmissionDistributionTimestamp = active_period + 2 * WEEK;
lastInflationPeriod = lastInflationPeriod + WEEK;
}
function start() external onlyOwner {
require(!isStarted, "Already started");
isStarted = true;
active_period = ((block.timestamp) / WEEK) * WEEK; // allow minter.update_period() to mint new emissions THIS Thursday
lastInflationPeriod = active_period + inflationPeriodCount * WEEK;
}
function setVoter(address __voter) external onlyOwner {
require(__voter != address(0));
voter = IVoter(__voter);
}
function setVotingEscrow(address votingEscrow_) external onlyOwner {
require(votingEscrow_ != address(0));
ve = IVotingEscrow(votingEscrow_);
}
function setTeamRate(uint256 _teamRate) external onlyOwner {
require(_teamRate <= MAX_TEAM_RATE, "rate too high");
teamRate = _teamRate;
}
function setDecayRate(uint256 _decayRate) external onlyOwner {
require(_decayRate <= PRECISION, "rate too high");
decayRate = _decayRate;
}
function setInflationRate(uint256 _inflationRate) external onlyOwner {
require(_inflationRate <= PRECISION, "rate too high");
inflationRate = _inflationRate;
}
// calculate circulating supply as total token supply - locked supply
function circulating_supply() public view returns (uint256) {
return fenix.totalSupply() - fenix.balanceOf(address(ve));
}
function circulating_emission() public view returns (uint) {
return (circulating_supply() * TAIL_EMISSION) / PRECISION;
}
function calculate_emission_decay() public view returns (uint256) {
return (weekly * decayRate) / PRECISION;
}
function calculate_emission_inflation() public view returns (uint256) {
return (weekly * inflationRate) / PRECISION;
}
// weekly emission takes the max of calculated (aka target) emission versus circulating tail end emission
function weekly_emission() public view returns (uint256) {
uint256 weeklyCache = weekly;
if (active_period <= lastInflationPeriod) {
return calculate_emission_inflation() + weeklyCache;
} else {
uint256 decay = calculate_emission_decay();
return Math.max(weeklyCache < decay ? 0 : weeklyCache - decay, circulating_emission());
}
}
// update period can only be called once per cycle (1 week)
function update_period() external returns (uint256) {
uint256 _period = active_period;
if (block.timestamp >= _period + WEEK && isStarted) {
// only trigger if new week
_period = (block.timestamp / WEEK) * WEEK;
active_period = _period;
if (block.timestamp >= startEmissionDistributionTimestamp) {
if (!isFirstMint) {
weekly = weekly_emission();
} else {
isFirstMint = false;
}
uint256 weeklyCache = weekly;
uint256 teamEmissions = (weeklyCache * teamRate) / PRECISION;
uint256 gauge = weeklyCache - teamEmissions;
uint256 currentBalance = fenix.balanceOf(address(this));
if (currentBalance < weeklyCache) {
fenix.mint(address(this), weeklyCache - currentBalance);
}
require(fenix.transfer(owner(), teamEmissions));
fenix.approve(address(voter), gauge);
voter.notifyRewardAmount(gauge);
emit Mint(msg.sender, weeklyCache, circulating_supply());
}
}
return _period;
}
function check() external view returns (bool) {
uint256 _period = active_period;
return (block.timestamp >= _period + WEEK && isStarted);
}
function period() external view returns (uint256) {
return (block.timestamp / WEEK) * WEEK;
}
/**
* @dev This empty reserved space is put in place to allow future versions to add new
* variables without shifting down storage in the inheritance chain.
* See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps
*/
uint256[50] private __gap;
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (access/Ownable2Step.sol)
pragma solidity ^0.8.0;
import "./OwnableUpgradeable.sol";
import {Initializable} from "../proxy/utils/Initializable.sol";
/**
* @dev Contract module which provides access control mechanism, where
* there is an account (an owner) that can be granted exclusive access to
* specific functions.
*
* By default, the owner account will be the one that deploys the contract. This
* can later be changed with {transferOwnership} and {acceptOwnership}.
*
* This module is used through inheritance. It will make available all functions
* from parent (Ownable).
*/
abstract contract Ownable2StepUpgradeable is Initializable, OwnableUpgradeable {
address private _pendingOwner;
event OwnershipTransferStarted(address indexed previousOwner, address indexed newOwner);
function __Ownable2Step_init() internal onlyInitializing {
__Ownable_init_unchained();
}
function __Ownable2Step_init_unchained() internal onlyInitializing {
}
/**
* @dev Returns the address of the pending owner.
*/
function pendingOwner() public view virtual returns (address) {
return _pendingOwner;
}
/**
* @dev Starts the ownership transfer of the contract to a new account. Replaces the pending transfer if there is one.
* Can only be called by the current owner.
*/
function transferOwnership(address newOwner) public virtual override onlyOwner {
_pendingOwner = newOwner;
emit OwnershipTransferStarted(owner(), newOwner);
}
/**
* @dev Transfers ownership of the contract to a new account (`newOwner`) and deletes any pending owner.
* Internal function without access restriction.
*/
function _transferOwnership(address newOwner) internal virtual override {
delete _pendingOwner;
super._transferOwnership(newOwner);
}
/**
* @dev The new owner accepts the ownership transfer.
*/
function acceptOwnership() public virtual {
address sender = _msgSender();
require(pendingOwner() == sender, "Ownable2Step: caller is not the new owner");
_transferOwnership(sender);
}
/**
* @dev This empty reserved space is put in place to allow future versions to add new
* variables without shifting down storage in the inheritance chain.
* See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps
*/
uint256[49] private __gap;
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (access/Ownable.sol)
pragma solidity ^0.8.0;
import "../utils/ContextUpgradeable.sol";
import {Initializable} from "../proxy/utils/Initializable.sol";
/**
* @dev Contract module which provides a basic access control mechanism, where
* there is an account (an owner) that can be granted exclusive access to
* specific functions.
*
* By default, the owner account will be the one that deploys the contract. This
* can later be changed with {transferOwnership}.
*
* This module is used through inheritance. It will make available the modifier
* `onlyOwner`, which can be applied to your functions to restrict their use to
* the owner.
*/
abstract contract OwnableUpgradeable is Initializable, ContextUpgradeable {
address private _owner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
/**
* @dev Initializes the contract setting the deployer as the initial owner.
*/
function __Ownable_init() internal onlyInitializing {
__Ownable_init_unchained();
}
function __Ownable_init_unchained() internal onlyInitializing {
_transferOwnership(_msgSender());
}
/**
* @dev Throws if called by any account other than the owner.
*/
modifier onlyOwner() {
_checkOwner();
_;
}
/**
* @dev Returns the address of the current owner.
*/
function owner() public view virtual returns (address) {
return _owner;
}
/**
* @dev Throws if the sender is not the owner.
*/
function _checkOwner() internal view virtual {
require(owner() == _msgSender(), "Ownable: caller is not the owner");
}
/**
* @dev Leaves the contract without owner. It will not be possible to call
* `onlyOwner` functions. Can only be called by the current owner.
*
* NOTE: Renouncing ownership will leave the contract without an owner,
* thereby disabling any functionality that is only available to the owner.
*/
function renounceOwnership() public virtual onlyOwner {
_transferOwnership(address(0));
}
/**
* @dev Transfers ownership of the contract to a new account (`newOwner`).
* Can only be called by the current owner.
*/
function transferOwnership(address newOwner) public virtual onlyOwner {
require(newOwner != address(0), "Ownable: new owner is the zero address");
_transferOwnership(newOwner);
}
/**
* @dev Transfers ownership of the contract to a new account (`newOwner`).
* Internal function without access restriction.
*/
function _transferOwnership(address newOwner) internal virtual {
address oldOwner = _owner;
_owner = newOwner;
emit OwnershipTransferred(oldOwner, newOwner);
}
/**
* @dev This empty reserved space is put in place to allow future versions to add new
* variables without shifting down storage in the inheritance chain.
* See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps
*/
uint256[49] private __gap;
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (proxy/utils/Initializable.sol)
pragma solidity ^0.8.2;
import "../../utils/AddressUpgradeable.sol";
/**
* @dev This is a base contract to aid in writing upgradeable contracts, or any kind of contract that will be deployed
* behind a proxy. Since proxied contracts do not make use of a constructor, it's common to move constructor logic to an
* external initializer function, usually called `initialize`. It then becomes necessary to protect this initializer
* function so it can only be called once. The {initializer} modifier provided by this contract will have this effect.
*
* The initialization functions use a version number. Once a version number is used, it is consumed and cannot be
* reused. This mechanism prevents re-execution of each "step" but allows the creation of new initialization steps in
* case an upgrade adds a module that needs to be initialized.
*
* For example:
*
* [.hljs-theme-light.nopadding]
* ```solidity
* contract MyToken is ERC20Upgradeable {
* function initialize() initializer public {
* __ERC20_init("MyToken", "MTK");
* }
* }
*
* contract MyTokenV2 is MyToken, ERC20PermitUpgradeable {
* function initializeV2() reinitializer(2) public {
* __ERC20Permit_init("MyToken");
* }
* }
* ```
*
* TIP: To avoid leaving the proxy in an uninitialized state, the initializer function should be called as early as
* possible by providing the encoded function call as the `_data` argument to {ERC1967Proxy-constructor}.
*
* CAUTION: When used with inheritance, manual care must be taken to not invoke a parent initializer twice, or to ensure
* that all initializers are idempotent. This is not verified automatically as constructors are by Solidity.
*
* [CAUTION]
* ====
* Avoid leaving a contract uninitialized.
*
* An uninitialized contract can be taken over by an attacker. This applies to both a proxy and its implementation
* contract, which may impact the proxy. To prevent the implementation contract from being used, you should invoke
* the {_disableInitializers} function in the constructor to automatically lock it when it is deployed:
*
* [.hljs-theme-light.nopadding]
* ```
* /// @custom:oz-upgrades-unsafe-allow constructor
* constructor() {
* _disableInitializers();
* }
* ```
* ====
*/
abstract contract Initializable {
/**
* @dev Indicates that the contract has been initialized.
* @custom:oz-retyped-from bool
*/
uint8 private _initialized;
/**
* @dev Indicates that the contract is in the process of being initialized.
*/
bool private _initializing;
/**
* @dev Triggered when the contract has been initialized or reinitialized.
*/
event Initialized(uint8 version);
/**
* @dev A modifier that defines a protected initializer function that can be invoked at most once. In its scope,
* `onlyInitializing` functions can be used to initialize parent contracts.
*
* Similar to `reinitializer(1)`, except that functions marked with `initializer` can be nested in the context of a
* constructor.
*
* Emits an {Initialized} event.
*/
modifier initializer() {
bool isTopLevelCall = !_initializing;
require(
(isTopLevelCall && _initialized < 1) || (!AddressUpgradeable.isContract(address(this)) && _initialized == 1),
"Initializable: contract is already initialized"
);
_initialized = 1;
if (isTopLevelCall) {
_initializing = true;
}
_;
if (isTopLevelCall) {
_initializing = false;
emit Initialized(1);
}
}
/**
* @dev A modifier that defines a protected reinitializer function that can be invoked at most once, and only if the
* contract hasn't been initialized to a greater version before. In its scope, `onlyInitializing` functions can be
* used to initialize parent contracts.
*
* A reinitializer may be used after the original initialization step. This is essential to configure modules that
* are added through upgrades and that require initialization.
*
* When `version` is 1, this modifier is similar to `initializer`, except that functions marked with `reinitializer`
* cannot be nested. If one is invoked in the context of another, execution will revert.
*
* Note that versions can jump in increments greater than 1; this implies that if multiple reinitializers coexist in
* a contract, executing them in the right order is up to the developer or operator.
*
* WARNING: setting the version to 255 will prevent any future reinitialization.
*
* Emits an {Initialized} event.
*/
modifier reinitializer(uint8 version) {
require(!_initializing && _initialized < version, "Initializable: contract is already initialized");
_initialized = version;
_initializing = true;
_;
_initializing = false;
emit Initialized(version);
}
/**
* @dev Modifier to protect an initialization function so that it can only be invoked by functions with the
* {initializer} and {reinitializer} modifiers, directly or indirectly.
*/
modifier onlyInitializing() {
require(_initializing, "Initializable: contract is not initializing");
_;
}
/**
* @dev Locks the contract, preventing any future reinitialization. This cannot be part of an initializer call.
* Calling this in the constructor of a contract will prevent that contract from being initialized or reinitialized
* to any version. It is recommended to use this to lock implementation contracts that are designed to be called
* through proxies.
*
* Emits an {Initialized} event the first time it is successfully executed.
*/
function _disableInitializers() internal virtual {
require(!_initializing, "Initializable: contract is initializing");
if (_initialized != type(uint8).max) {
_initialized = type(uint8).max;
emit Initialized(type(uint8).max);
}
}
/**
* @dev Returns the highest version that has been initialized. See {reinitializer}.
*/
function _getInitializedVersion() internal view returns (uint8) {
return _initialized;
}
/**
* @dev Returns `true` if the contract is currently initializing. See {onlyInitializing}.
*/
function _isInitializing() internal view returns (bool) {
return _initializing;
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC721/IERC721.sol)
pragma solidity ^0.8.0;
import "../../utils/introspection/IERC165Upgradeable.sol";
/**
* @dev Required interface of an ERC721 compliant contract.
*/
interface IERC721Upgradeable is IERC165Upgradeable {
/**
* @dev Emitted when `tokenId` token is transferred from `from` to `to`.
*/
event Transfer(address indexed from, address indexed to, uint256 indexed tokenId);
/**
* @dev Emitted when `owner` enables `approved` to manage the `tokenId` token.
*/
event Approval(address indexed owner, address indexed approved, uint256 indexed tokenId);
/**
* @dev Emitted when `owner` enables or disables (`approved`) `operator` to manage all of its assets.
*/
event ApprovalForAll(address indexed owner, address indexed operator, bool approved);
/**
* @dev Returns the number of tokens in ``owner``'s account.
*/
function balanceOf(address owner) external view returns (uint256 balance);
/**
* @dev Returns the owner of the `tokenId` token.
*
* Requirements:
*
* - `tokenId` must exist.
*/
function ownerOf(uint256 tokenId) external view returns (address owner);
/**
* @dev Safely transfers `tokenId` token from `from` to `to`.
*
* Requirements:
*
* - `from` cannot be the zero address.
* - `to` cannot be the zero address.
* - `tokenId` token must exist and be owned by `from`.
* - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}.
* - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.
*
* Emits a {Transfer} event.
*/
function safeTransferFrom(address from, address to, uint256 tokenId, bytes calldata data) external;
/**
* @dev Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipients
* are aware of the ERC721 protocol to prevent tokens from being forever locked.
*
* Requirements:
*
* - `from` cannot be the zero address.
* - `to` cannot be the zero address.
* - `tokenId` token must exist and be owned by `from`.
* - If the caller is not `from`, it must have been allowed to move this token by either {approve} or {setApprovalForAll}.
* - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.
*
* Emits a {Transfer} event.
*/
function safeTransferFrom(address from, address to, uint256 tokenId) external;
/**
* @dev Transfers `tokenId` token from `from` to `to`.
*
* WARNING: Note that the caller is responsible to confirm that the recipient is capable of receiving ERC721
* or else they may be permanently lost. Usage of {safeTransferFrom} prevents loss, though the caller must
* understand this adds an external call which potentially creates a reentrancy vulnerability.
*
* Requirements:
*
* - `from` cannot be the zero address.
* - `to` cannot be the zero address.
* - `tokenId` token must be owned by `from`.
* - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}.
*
* Emits a {Transfer} event.
*/
function transferFrom(address from, address to, uint256 tokenId) external;
/**
* @dev Gives permission to `to` to transfer `tokenId` token to another account.
* The approval is cleared when the token is transferred.
*
* Only a single account can be approved at a time, so approving the zero address clears previous approvals.
*
* Requirements:
*
* - The caller must own the token or be an approved operator.
* - `tokenId` must exist.
*
* Emits an {Approval} event.
*/
function approve(address to, uint256 tokenId) external;
/**
* @dev Approve or remove `operator` as an operator for the caller.
* Operators can call {transferFrom} or {safeTransferFrom} for any token owned by the caller.
*
* Requirements:
*
* - The `operator` cannot be the caller.
*
* Emits an {ApprovalForAll} event.
*/
function setApprovalForAll(address operator, bool approved) external;
/**
* @dev Returns the account approved for `tokenId` token.
*
* Requirements:
*
* - `tokenId` must exist.
*/
function getApproved(uint256 tokenId) external view returns (address operator);
/**
* @dev Returns if the `operator` is allowed to manage all of the assets of `owner`.
*
* See {setApprovalForAll}
*/
function isApprovedForAll(address owner, address operator) external view returns (bool);
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (utils/Address.sol)
pragma solidity ^0.8.1;
/**
* @dev Collection of functions related to the address type
*/
library AddressUpgradeable {
/**
* @dev Returns true if `account` is a contract.
*
* [IMPORTANT]
* ====
* It is unsafe to assume that an address for which this function returns
* false is an externally-owned account (EOA) and not a contract.
*
* Among others, `isContract` will return false for the following
* types of addresses:
*
* - an externally-owned account
* - a contract in construction
* - an address where a contract will be created
* - an address where a contract lived, but was destroyed
*
* Furthermore, `isContract` will also return true if the target contract within
* the same transaction is already scheduled for destruction by `SELFDESTRUCT`,
* which only has an effect at the end of a transaction.
* ====
*
* [IMPORTANT]
* ====
* You shouldn't rely on `isContract` to protect against flash loan attacks!
*
* Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets
* like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract
* constructor.
* ====
*/
function isContract(address account) internal view returns (bool) {
// This method relies on extcodesize/address.code.length, which returns 0
// for contracts in construction, since the code is only stored at the end
// of the constructor execution.
return account.code.length > 0;
}
/**
* @dev Replacement for Solidity's `transfer`: sends `amount` wei to
* `recipient`, forwarding all available gas and reverting on errors.
*
* https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost
* of certain opcodes, possibly making contracts go over the 2300 gas limit
* imposed by `transfer`, making them unable to receive funds via
* `transfer`. {sendValue} removes this limitation.
*
* https://consensys.net/diligence/blog/2019/09/stop-using-soliditys-transfer-now/[Learn more].
*
* IMPORTANT: because control is transferred to `recipient`, care must be
* taken to not create reentrancy vulnerabilities. Consider using
* {ReentrancyGuard} or the
* https://solidity.readthedocs.io/en/v0.8.0/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].
*/
function sendValue(address payable recipient, uint256 amount) internal {
require(address(this).balance >= amount, "Address: insufficient balance");
(bool success, ) = recipient.call{value: amount}("");
require(success, "Address: unable to send value, recipient may have reverted");
}
/**
* @dev Performs a Solidity function call using a low level `call`. A
* plain `call` is an unsafe replacement for a function call: use this
* function instead.
*
* If `target` reverts with a revert reason, it is bubbled up by this
* function (like regular Solidity function calls).
*
* Returns the raw returned data. To convert to the expected return value,
* use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].
*
* Requirements:
*
* - `target` must be a contract.
* - calling `target` with `data` must not revert.
*
* _Available since v3.1._
*/
function functionCall(address target, bytes memory data) internal returns (bytes memory) {
return functionCallWithValue(target, data, 0, "Address: low-level call failed");
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with
* `errorMessage` as a fallback revert reason when `target` reverts.
*
* _Available since v3.1._
*/
function functionCall(
address target,
bytes memory data,
string memory errorMessage
) internal returns (bytes memory) {
return functionCallWithValue(target, data, 0, errorMessage);
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
* but also transferring `value` wei to `target`.
*
* Requirements:
*
* - the calling contract must have an ETH balance of at least `value`.
* - the called Solidity function must be `payable`.
*
* _Available since v3.1._
*/
function functionCallWithValue(address target, bytes memory data, uint256 value) internal returns (bytes memory) {
return functionCallWithValue(target, data, value, "Address: low-level call with value failed");
}
/**
* @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but
* with `errorMessage` as a fallback revert reason when `target` reverts.
*
* _Available since v3.1._
*/
function functionCallWithValue(
address target,
bytes memory data,
uint256 value,
string memory errorMessage
) internal returns (bytes memory) {
require(address(this).balance >= value, "Address: insufficient balance for call");
(bool success, bytes memory returndata) = target.call{value: value}(data);
return verifyCallResultFromTarget(target, success, returndata, errorMessage);
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
* but performing a static call.
*
* _Available since v3.3._
*/
function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {
return functionStaticCall(target, data, "Address: low-level static call failed");
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],
* but performing a static call.
*
* _Available since v3.3._
*/
function functionStaticCall(
address target,
bytes memory data,
string memory errorMessage
) internal view returns (bytes memory) {
(bool success, bytes memory returndata) = target.staticcall(data);
return verifyCallResultFromTarget(target, success, returndata, errorMessage);
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
* but performing a delegate call.
*
* _Available since v3.4._
*/
function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {
return functionDelegateCall(target, data, "Address: low-level delegate call failed");
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],
* but performing a delegate call.
*
* _Available since v3.4._
*/
function functionDelegateCall(
address target,
bytes memory data,
string memory errorMessage
) internal returns (bytes memory) {
(bool success, bytes memory returndata) = target.delegatecall(data);
return verifyCallResultFromTarget(target, success, returndata, errorMessage);
}
/**
* @dev Tool to verify that a low level call to smart-contract was successful, and revert (either by bubbling
* the revert reason or using the provided one) in case of unsuccessful call or if target was not a contract.
*
* _Available since v4.8._
*/
function verifyCallResultFromTarget(
address target,
bool success,
bytes memory returndata,
string memory errorMessage
) internal view returns (bytes memory) {
if (success) {
if (returndata.length == 0) {
// only check isContract if the call was successful and the return data is empty
// otherwise we already know that it was a contract
require(isContract(target), "Address: call to non-contract");
}
return returndata;
} else {
_revert(returndata, errorMessage);
}
}
/**
* @dev Tool to verify that a low level call was successful, and revert if it wasn't, either by bubbling the
* revert reason or using the provided one.
*
* _Available since v4.3._
*/
function verifyCallResult(
bool success,
bytes memory returndata,
string memory errorMessage
) internal pure returns (bytes memory) {
if (success) {
return returndata;
} else {
_revert(returndata, errorMessage);
}
}
function _revert(bytes memory returndata, string memory errorMessage) private pure {
// Look for revert reason and bubble it up if present
if (returndata.length > 0) {
// The easiest way to bubble the revert reason is using memory via assembly
/// @solidity memory-safe-assembly
assembly {
let returndata_size := mload(returndata)
revert(add(32, returndata), returndata_size)
}
} else {
revert(errorMessage);
}
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.4) (utils/Context.sol)
pragma solidity ^0.8.0;
import {Initializable} from "../proxy/utils/Initializable.sol";
/**
* @dev Provides information about the current execution context, including the
* sender of the transaction and its data. While these are generally available
* via msg.sender and msg.data, they should not be accessed in such a direct
* manner, since when dealing with meta-transactions the account sending and
* paying for execution may not be the actual sender (as far as an application
* is concerned).
*
* This contract is only required for intermediate, library-like contracts.
*/
abstract contract ContextUpgradeable is Initializable {
function __Context_init() internal onlyInitializing {
}
function __Context_init_unchained() internal onlyInitializing {
}
function _msgSender() internal view virtual returns (address) {
return msg.sender;
}
function _msgData() internal view virtual returns (bytes calldata) {
return msg.data;
}
function _contextSuffixLength() internal view virtual returns (uint256) {
return 0;
}
/**
* @dev This empty reserved space is put in place to allow future versions to add new
* variables without shifting down storage in the inheritance chain.
* See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps
*/
uint256[50] private __gap;
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (utils/introspection/IERC165.sol)
pragma solidity ^0.8.0;
/**
* @dev Interface of the ERC165 standard, as defined in the
* https://eips.ethereum.org/EIPS/eip-165[EIP].
*
* Implementers can declare support of contract interfaces, which can then be
* queried by others ({ERC165Checker}).
*
* For an implementation, see {ERC165}.
*/
interface IERC165Upgradeable {
/**
* @dev Returns true if this contract implements the interface defined by
* `interfaceId`. See the corresponding
* https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section]
* to learn more about how these ids are created.
*
* This function call must use less than 30 000 gas.
*/
function supportsInterface(bytes4 interfaceId) external view returns (bool);
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC20/ERC20.sol)
pragma solidity ^0.8.0;
import "./IERC20.sol";
import "./extensions/IERC20Metadata.sol";
import "../../utils/Context.sol";
/**
* @dev Implementation of the {IERC20} interface.
*
* This implementation is agnostic to the way tokens are created. This means
* that a supply mechanism has to be added in a derived contract using {_mint}.
* For a generic mechanism see {ERC20PresetMinterPauser}.
*
* TIP: For a detailed writeup see our guide
* https://forum.openzeppelin.com/t/how-to-implement-erc20-supply-mechanisms/226[How
* to implement supply mechanisms].
*
* The default value of {decimals} is 18. To change this, you should override
* this function so it returns a different value.
*
* We have followed general OpenZeppelin Contracts guidelines: functions revert
* instead returning `false` on failure. This behavior is nonetheless
* conventional and does not conflict with the expectations of ERC20
* applications.
*
* Additionally, an {Approval} event is emitted on calls to {transferFrom}.
* This allows applications to reconstruct the allowance for all accounts just
* by listening to said events. Other implementations of the EIP may not emit
* these events, as it isn't required by the specification.
*
* Finally, the non-standard {decreaseAllowance} and {increaseAllowance}
* functions have been added to mitigate the well-known issues around setting
* allowances. See {IERC20-approve}.
*/
contract ERC20 is Context, IERC20, IERC20Metadata {
mapping(address => uint256) private _balances;
mapping(address => mapping(address => uint256)) private _allowances;
uint256 private _totalSupply;
string private _name;
string private _symbol;
/**
* @dev Sets the values for {name} and {symbol}.
*
* All two of these values are immutable: they can only be set once during
* construction.
*/
constructor(string memory name_, string memory symbol_) {
_name = name_;
_symbol = symbol_;
}
/**
* @dev Returns the name of the token.
*/
function name() public view virtual override returns (string memory) {
return _name;
}
/**
* @dev Returns the symbol of the token, usually a shorter version of the
* name.
*/
function symbol() public view virtual override returns (string memory) {
return _symbol;
}
/**
* @dev Returns the number of decimals used to get its user representation.
* For example, if `decimals` equals `2`, a balance of `505` tokens should
* be displayed to a user as `5.05` (`505 / 10 ** 2`).
*
* Tokens usually opt for a value of 18, imitating the relationship between
* Ether and Wei. This is the default value returned by this function, unless
* it's overridden.
*
* NOTE: This information is only used for _display_ purposes: it in
* no way affects any of the arithmetic of the contract, including
* {IERC20-balanceOf} and {IERC20-transfer}.
*/
function decimals() public view virtual override returns (uint8) {
return 18;
}
/**
* @dev See {IERC20-totalSupply}.
*/
function totalSupply() public view virtual override returns (uint256) {
return _totalSupply;
}
/**
* @dev See {IERC20-balanceOf}.
*/
function balanceOf(address account) public view virtual override returns (uint256) {
return _balances[account];
}
/**
* @dev See {IERC20-transfer}.
*
* Requirements:
*
* - `to` cannot be the zero address.
* - the caller must have a balance of at least `amount`.
*/
function transfer(address to, uint256 amount) public virtual override returns (bool) {
address owner = _msgSender();
_transfer(owner, to, amount);
return true;
}
/**
* @dev See {IERC20-allowance}.
*/
function allowance(address owner, address spender) public view virtual override returns (uint256) {
return _allowances[owner][spender];
}
/**
* @dev See {IERC20-approve}.
*
* NOTE: If `amount` is the maximum `uint256`, the allowance is not updated on
* `transferFrom`. This is semantically equivalent to an infinite approval.
*
* Requirements:
*
* - `spender` cannot be the zero address.
*/
function approve(address spender, uint256 amount) public virtual override returns (bool) {
address owner = _msgSender();
_approve(owner, spender, amount);
return true;
}
/**
* @dev See {IERC20-transferFrom}.
*
* Emits an {Approval} event indicating the updated allowance. This is not
* required by the EIP. See the note at the beginning of {ERC20}.
*
* NOTE: Does not update the allowance if the current allowance
* is the maximum `uint256`.
*
* Requirements:
*
* - `from` and `to` cannot be the zero address.
* - `from` must have a balance of at least `amount`.
* - the caller must have allowance for ``from``'s tokens of at least
* `amount`.
*/
function transferFrom(address from, address to, uint256 amount) public virtual override returns (bool) {
address spender = _msgSender();
_spendAllowance(from, spender, amount);
_transfer(from, to, amount);
return true;
}
/**
* @dev Atomically increases the allowance granted to `spender` by the caller.
*
* This is an alternative to {approve} that can be used as a mitigation for
* problems described in {IERC20-approve}.
*
* Emits an {Approval} event indicating the updated allowance.
*
* Requirements:
*
* - `spender` cannot be the zero address.
*/
function increaseAllowance(address spender, uint256 addedValue) public virtual returns (bool) {
address owner = _msgSender();
_approve(owner, spender, allowance(owner, spender) + addedValue);
return true;
}
/**
* @dev Atomically decreases the allowance granted to `spender` by the caller.
*
* This is an alternative to {approve} that can be used as a mitigation for
* problems described in {IERC20-approve}.
*
* Emits an {Approval} event indicating the updated allowance.
*
* Requirements:
*
* - `spender` cannot be the zero address.
* - `spender` must have allowance for the caller of at least
* `subtractedValue`.
*/
function decreaseAllowance(address spender, uint256 subtractedValue) public virtual returns (bool) {
address owner = _msgSender();
uint256 currentAllowance = allowance(owner, spender);
require(currentAllowance >= subtractedValue, "ERC20: decreased allowance below zero");
unchecked {
_approve(owner, spender, currentAllowance - subtractedValue);
}
return true;
}
/**
* @dev Moves `amount` of tokens from `from` to `to`.
*
* This internal function is equivalent to {transfer}, and can be used to
* e.g. implement automatic token fees, slashing mechanisms, etc.
*
* Emits a {Transfer} event.
*
* Requirements:
*
* - `from` cannot be the zero address.
* - `to` cannot be the zero address.
* - `from` must have a balance of at least `amount`.
*/
function _transfer(address from, address to, uint256 amount) internal virtual {
require(from != address(0), "ERC20: transfer from the zero address");
require(to != address(0), "ERC20: transfer to the zero address");
_beforeTokenTransfer(from, to, amount);
uint256 fromBalance = _balances[from];
require(fromBalance >= amount, "ERC20: transfer amount exceeds balance");
unchecked {
_balances[from] = fromBalance - amount;
// Overflow not possible: the sum of all balances is capped by totalSupply, and the sum is preserved by
// decrementing then incrementing.
_balances[to] += amount;
}
emit Transfer(from, to, amount);
_afterTokenTransfer(from, to, amount);
}
/** @dev Creates `amount` tokens and assigns them to `account`, increasing
* the total supply.
*
* Emits a {Transfer} event with `from` set to the zero address.
*
* Requirements:
*
* - `account` cannot be the zero address.
*/
function _mint(address account, uint256 amount) internal virtual {
require(account != address(0), "ERC20: mint to the zero address");
_beforeTokenTransfer(address(0), account, amount);
_totalSupply += amount;
unchecked {
// Overflow not possible: balance + amount is at most totalSupply + amount, which is checked above.
_balances[account] += amount;
}
emit Transfer(address(0), account, amount);
_afterTokenTransfer(address(0), account, amount);
}
/**
* @dev Destroys `amount` tokens from `account`, reducing the
* total supply.
*
* Emits a {Transfer} event with `to` set to the zero address.
*
* Requirements:
*
* - `account` cannot be the zero address.
* - `account` must have at least `amount` tokens.
*/
function _burn(address account, uint256 amount) internal virtual {
require(account != address(0), "ERC20: burn from the zero address");
_beforeTokenTransfer(account, address(0), amount);
uint256 accountBalance = _balances[account];
require(accountBalance >= amount, "ERC20: burn amount exceeds balance");
unchecked {
_balances[account] = accountBalance - amount;
// Overflow not possible: amount <= accountBalance <= totalSupply.
_totalSupply -= amount;
}
emit Transfer(account, address(0), amount);
_afterTokenTransfer(account, address(0), amount);
}
/**
* @dev Sets `amount` as the allowance of `spender` over the `owner` s tokens.
*
* This internal function is equivalent to `approve`, and can be used to
* e.g. set automatic allowances for certain subsystems, etc.
*
* Emits an {Approval} event.
*
* Requirements:
*
* - `owner` cannot be the zero address.
* - `spender` cannot be the zero address.
*/
function _approve(address owner, address spender, uint256 amount) internal virtual {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
/**
* @dev Updates `owner` s allowance for `spender` based on spent `amount`.
*
* Does not update the allowance amount in case of infinite allowance.
* Revert if not enough allowance is available.
*
* Might emit an {Approval} event.
*/
function _spendAllowance(address owner, address spender, uint256 amount) internal virtual {
uint256 currentAllowance = allowance(owner, spender);
if (currentAllowance != type(uint256).max) {
require(currentAllowance >= amount, "ERC20: insufficient allowance");
unchecked {
_approve(owner, spender, currentAllowance - amount);
}
}
}
/**
* @dev Hook that is called before any transfer of tokens. This includes
* minting and burning.
*
* Calling conditions:
*
* - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens
* will be transferred to `to`.
* - when `from` is zero, `amount` tokens will be minted for `to`.
* - when `to` is zero, `amount` of ``from``'s tokens will be burned.
* - `from` and `to` are never both zero.
*
* To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].
*/
function _beforeTokenTransfer(address from, address to, uint256 amount) internal virtual {}
/**
* @dev Hook that is called after any transfer of tokens. This includes
* minting and burning.
*
* Calling conditions:
*
* - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens
* has been transferred to `to`.
* - when `from` is zero, `amount` tokens have been minted for `to`.
* - when `to` is zero, `amount` of ``from``'s tokens have been burned.
* - `from` and `to` are never both zero.
*
* To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].
*/
function _afterTokenTransfer(address from, address to, uint256 amount) internal virtual {}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.5.0) (token/ERC20/extensions/ERC20Burnable.sol)
pragma solidity ^0.8.0;
import "../ERC20.sol";
import "../../../utils/Context.sol";
/**
* @dev Extension of {ERC20} that allows token holders to destroy both their own
* tokens and those that they have an allowance for, in a way that can be
* recognized off-chain (via event analysis).
*/
abstract contract ERC20Burnable is Context, ERC20 {
/**
* @dev Destroys `amount` tokens from the caller.
*
* See {ERC20-_burn}.
*/
function burn(uint256 amount) public virtual {
_burn(_msgSender(), amount);
}
/**
* @dev Destroys `amount` tokens from `account`, deducting from the caller's
* allowance.
*
* See {ERC20-_burn} and {ERC20-allowance}.
*
* Requirements:
*
* - the caller must have allowance for ``accounts``'s tokens of at least
* `amount`.
*/
function burnFrom(address account, uint256 amount) public virtual {
_spendAllowance(account, _msgSender(), amount);
_burn(account, amount);
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (token/ERC20/extensions/IERC20Metadata.sol)
pragma solidity ^0.8.0;
import "../IERC20.sol";
/**
* @dev Interface for the optional metadata functions from the ERC20 standard.
*
* _Available since v4.1._
*/
interface IERC20Metadata is IERC20 {
/**
* @dev Returns the name of the token.
*/
function name() external view returns (string memory);
/**
* @dev Returns the symbol of the token.
*/
function symbol() external view returns (string memory);
/**
* @dev Returns the decimals places of the token.
*/
function decimals() external view returns (uint8);
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC20/IERC20.sol)
pragma solidity ^0.8.0;
/**
* @dev Interface of the ERC20 standard as defined in the EIP.
*/
interface IERC20 {
/**
* @dev Emitted when `value` tokens are moved from one account (`from`) to
* another (`to`).
*
* Note that `value` may be zero.
*/
event Transfer(address indexed from, address indexed to, uint256 value);
/**
* @dev Emitted when the allowance of a `spender` for an `owner` is set by
* a call to {approve}. `value` is the new allowance.
*/
event Approval(address indexed owner, address indexed spender, uint256 value);
/**
* @dev Returns the amount of tokens in existence.
*/
function totalSupply() external view returns (uint256);
/**
* @dev Returns the amount of tokens owned by `account`.
*/
function balanceOf(address account) external view returns (uint256);
/**
* @dev Moves `amount` tokens from the caller's account to `to`.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* Emits a {Transfer} event.
*/
function transfer(address to, uint256 amount) external returns (bool);
/**
* @dev Returns the remaining number of tokens that `spender` will be
* allowed to spend on behalf of `owner` through {transferFrom}. This is
* zero by default.
*
* This value changes when {approve} or {transferFrom} are called.
*/
function allowance(address owner, address spender) external view returns (uint256);
/**
* @dev Sets `amount` as the allowance of `spender` over the caller's tokens.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* IMPORTANT: Beware that changing an allowance with this method brings the risk
* that someone may use both the old and the new allowance by unfortunate
* transaction ordering. One possible solution to mitigate this race
* condition is to first reduce the spender's allowance to 0 and set the
* desired value afterwards:
* https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729
*
* Emits an {Approval} event.
*/
function approve(address spender, uint256 amount) external returns (bool);
/**
* @dev Moves `amount` tokens from `from` to `to` using the
* allowance mechanism. `amount` is then deducted from the caller's
* allowance.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* Emits a {Transfer} event.
*/
function transferFrom(address from, address to, uint256 amount) external returns (bool);
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.4) (utils/Context.sol)
pragma solidity ^0.8.0;
/**
* @dev Provides information about the current execution context, including the
* sender of the transaction and its data. While these are generally available
* via msg.sender and msg.data, they should not be accessed in such a direct
* manner, since when dealing with meta-transactions the account sending and
* paying for execution may not be the actual sender (as far as an application
* is concerned).
*
* This contract is only required for intermediate, library-like contracts.
*/
abstract contract Context {
function _msgSender() internal view virtual returns (address) {
return msg.sender;
}
function _msgData() internal view virtual returns (bytes calldata) {
return msg.data;
}
function _contextSuffixLength() internal view virtual returns (uint256) {
return 0;
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (utils/math/Math.sol)
pragma solidity ^0.8.0;
/**
* @dev Standard math utilities missing in the Solidity language.
*/
library Math {
enum Rounding {
Down, // Toward negative infinity
Up, // Toward infinity
Zero // Toward zero
}
/**
* @dev Returns the largest of two numbers.
*/
function max(uint256 a, uint256 b) internal pure returns (uint256) {
return a > b ? a : b;
}
/**
* @dev Returns the smallest of two numbers.
*/
function min(uint256 a, uint256 b) internal pure returns (uint256) {
return a < b ? a : b;
}
/**
* @dev Returns the average of two numbers. The result is rounded towards
* zero.
*/
function average(uint256 a, uint256 b) internal pure returns (uint256) {
// (a + b) / 2 can overflow.
return (a & b) + (a ^ b) / 2;
}
/**
* @dev Returns the ceiling of the division of two numbers.
*
* This differs from standard division with `/` in that it rounds up instead
* of rounding down.
*/
function ceilDiv(uint256 a, uint256 b) internal pure returns (uint256) {
// (a + b - 1) / b can overflow on addition, so we distribute.
return a == 0 ? 0 : (a - 1) / b + 1;
}
/**
* @notice Calculates floor(x * y / denominator) with full precision. Throws if result overflows a uint256 or denominator == 0
* @dev Original credit to Remco Bloemen under MIT license (https://xn--2-umb.com/21/muldiv)
* with further edits by Uniswap Labs also under MIT license.
*/
function mulDiv(uint256 x, uint256 y, uint256 denominator) internal pure returns (uint256 result) {
unchecked {
// 512-bit multiply [prod1 prod0] = x * y. Compute the product mod 2^256 and mod 2^256 - 1, then use
// use the Chinese Remainder Theorem to reconstruct the 512 bit result. The result is stored in two 256
// variables such that product = prod1 * 2^256 + prod0.
uint256 prod0; // Least significant 256 bits of the product
uint256 prod1; // Most significant 256 bits of the product
assembly {
let mm := mulmod(x, y, not(0))
prod0 := mul(x, y)
prod1 := sub(sub(mm, prod0), lt(mm, prod0))
}
// Handle non-overflow cases, 256 by 256 division.
if (prod1 == 0) {
// Solidity will revert if denominator == 0, unlike the div opcode on its own.
// The surrounding unchecked block does not change this fact.
// See https://docs.soliditylang.org/en/latest/control-structures.html#checked-or-unchecked-arithmetic.
return prod0 / denominator;
}
// Make sure the result is less than 2^256. Also prevents denominator == 0.
require(denominator > prod1, "Math: mulDiv overflow");
///////////////////////////////////////////////
// 512 by 256 division.
///////////////////////////////////////////////
// Make division exact by subtracting the remainder from [prod1 prod0].
uint256 remainder;
assembly {
// Compute remainder using mulmod.
remainder := mulmod(x, y, denominator)
// Subtract 256 bit number from 512 bit number.
prod1 := sub(prod1, gt(remainder, prod0))
prod0 := sub(prod0, remainder)
}
// Factor powers of two out of denominator and compute largest power of two divisor of denominator. Always >= 1.
// See https://cs.stackexchange.com/q/138556/92363.
// Does not overflow because the denominator cannot be zero at this stage in the function.
uint256 twos = denominator & (~denominator + 1);
assembly {
// Divide denominator by twos.
denominator := div(denominator, twos)
// Divide [prod1 prod0] by twos.
prod0 := div(prod0, twos)
// Flip twos such that it is 2^256 / twos. If twos is zero, then it becomes one.
twos := add(div(sub(0, twos), twos), 1)
}
// Shift in bits from prod1 into prod0.
prod0 |= prod1 * twos;
// Invert denominator mod 2^256. Now that denominator is an odd number, it has an inverse modulo 2^256 such
// that denominator * inv = 1 mod 2^256. Compute the inverse by starting with a seed that is correct for
// four bits. That is, denominator * inv = 1 mod 2^4.
uint256 inverse = (3 * denominator) ^ 2;
// Use the Newton-Raphson iteration to improve the precision. Thanks to Hensel's lifting lemma, this also works
// in modular arithmetic, doubling the correct bits in each step.
inverse *= 2 - denominator * inverse; // inverse mod 2^8
inverse *= 2 - denominator * inverse; // inverse mod 2^16
inverse *= 2 - denominator * inverse; // inverse mod 2^32
inverse *= 2 - denominator * inverse; // inverse mod 2^64
inverse *= 2 - denominator * inverse; // inverse mod 2^128
inverse *= 2 - denominator * inverse; // inverse mod 2^256
// Because the division is now exact we can divide by multiplying with the modular inverse of denominator.
// This will give us the correct result modulo 2^256. Since the preconditions guarantee that the outcome is
// less than 2^256, this is the final result. We don't need to compute the high bits of the result and prod1
// is no longer required.
result = prod0 * inverse;
return result;
}
}
/**
* @notice Calculates x * y / denominator with full precision, following the selected rounding direction.
*/
function mulDiv(uint256 x, uint256 y, uint256 denominator, Rounding rounding) internal pure returns (uint256) {
uint256 result = mulDiv(x, y, denominator);
if (rounding == Rounding.Up && mulmod(x, y, denominator) > 0) {
result += 1;
}
return result;
}
/**
* @dev Returns the square root of a number. If the number is not a perfect square, the value is rounded down.
*
* Inspired by Henry S. Warren, Jr.'s "Hacker's Delight" (Chapter 11).
*/
function sqrt(uint256 a) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
// For our first guess, we get the biggest power of 2 which is smaller than the square root of the target.
//
// We know that the "msb" (most significant bit) of our target number `a` is a power of 2 such that we have
// `msb(a) <= a < 2*msb(a)`. This value can be written `msb(a)=2**k` with `k=log2(a)`.
//
// This can be rewritten `2**log2(a) <= a < 2**(log2(a) + 1)`
// → `sqrt(2**k) <= sqrt(a) < sqrt(2**(k+1))`
// → `2**(k/2) <= sqrt(a) < 2**((k+1)/2) <= 2**(k/2 + 1)`
//
// Consequently, `2**(log2(a) / 2)` is a good first approximation of `sqrt(a)` with at least 1 correct bit.
uint256 result = 1 << (log2(a) >> 1);
// At this point `result` is an estimation with one bit of precision. We know the true value is a uint128,
// since it is the square root of a uint256. Newton's method converges quadratically (precision doubles at
// every iteration). We thus need at most 7 iteration to turn our partial result with one bit of precision
// into the expected uint128 result.
unchecked {
result = (result + a / result) >> 1;
result = (result + a / result) >> 1;
result = (result + a / result) >> 1;
result = (result + a / result) >> 1;
result = (result + a / result) >> 1;
result = (result + a / result) >> 1;
result = (result + a / result) >> 1;
return min(result, a / result);
}
}
/**
* @notice Calculates sqrt(a), following the selected rounding direction.
*/
function sqrt(uint256 a, Rounding rounding) internal pure returns (uint256) {
unchecked {
uint256 result = sqrt(a);
return result + (rounding == Rounding.Up && result * result < a ? 1 : 0);
}
}
/**
* @dev Return the log in base 2, rounded down, of a positive value.
* Returns 0 if given 0.
*/
function log2(uint256 value) internal pure returns (uint256) {
uint256 result = 0;
unchecked {
if (value >> 128 > 0) {
value >>= 128;
result += 128;
}
if (value >> 64 > 0) {
value >>= 64;
result += 64;
}
if (value >> 32 > 0) {
value >>= 32;
result += 32;
}
if (value >> 16 > 0) {
value >>= 16;
result += 16;
}
if (value >> 8 > 0) {
value >>= 8;
result += 8;
}
if (value >> 4 > 0) {
value >>= 4;
result += 4;
}
if (value >> 2 > 0) {
value >>= 2;
result += 2;
}
if (value >> 1 > 0) {
result += 1;
}
}
return result;
}
/**
* @dev Return the log in base 2, following the selected rounding direction, of a positive value.
* Returns 0 if given 0.
*/
function log2(uint256 value, Rounding rounding) internal pure returns (uint256) {
unchecked {
uint256 result = log2(value);
return result + (rounding == Rounding.Up && 1 << result < value ? 1 : 0);
}
}
/**
* @dev Return the log in base 10, rounded down, of a positive value.
* Returns 0 if given 0.
*/
function log10(uint256 value) internal pure returns (uint256) {
uint256 result = 0;
unchecked {
if (value >= 10 ** 64) {
value /= 10 ** 64;
result += 64;
}
if (value >= 10 ** 32) {
value /= 10 ** 32;
result += 32;
}
if (value >= 10 ** 16) {
value /= 10 ** 16;
result += 16;
}
if (value >= 10 ** 8) {
value /= 10 ** 8;
result += 8;
}
if (value >= 10 ** 4) {
value /= 10 ** 4;
result += 4;
}
if (value >= 10 ** 2) {
value /= 10 ** 2;
result += 2;
}
if (value >= 10 ** 1) {
result += 1;
}
}
return result;
}
/**
* @dev Return the log in base 10, following the selected rounding direction, of a positive value.
* Returns 0 if given 0.
*/
function log10(uint256 value, Rounding rounding) internal pure returns (uint256) {
unchecked {
uint256 result = log10(value);
return result + (rounding == Rounding.Up && 10 ** result < value ? 1 : 0);
}
}
/**
* @dev Return the log in base 256, rounded down, of a positive value.
* Returns 0 if given 0.
*
* Adding one to the result gives the number of pairs of hex symbols needed to represent `value` as a hex string.
*/
function log256(uint256 value) internal pure returns (uint256) {
uint256 result = 0;
unchecked {
if (value >> 128 > 0) {
value >>= 128;
result += 16;
}
if (value >> 64 > 0) {
value >>= 64;
result += 8;
}
if (value >> 32 > 0) {
value >>= 32;
result += 4;
}
if (value >> 16 > 0) {
value >>= 16;
result += 2;
}
if (value >> 8 > 0) {
result += 1;
}
}
return result;
}
/**
* @dev Return the log in base 256, following the selected rounding direction, of a positive value.
* Returns 0 if given 0.
*/
function log256(uint256 value, Rounding rounding) internal pure returns (uint256) {
unchecked {
uint256 result = log256(value);
return result + (rounding == Rounding.Up && 1 << (result << 3) < value ? 1 : 0);
}
}
}// SPDX-License-Identifier: MIT
pragma solidity >=0.8.0;
import {IERC20} from "@openzeppelin/contracts/token/ERC20/extensions/ERC20Burnable.sol";
/**
* @title Interface of the Fenix main ERC20 token
* @author Fenix Protocol team
*/
interface IFenix is IERC20 {
/**
* @dev Allows the contract owner to mint new tokens to a specified address.
* @param to_ The address to receive the minted tokens.
* @param amount_ The number of tokens to mint.
*/
function mint(address to_, uint256 amount_) external;
}// SPDX-License-Identifier: MIT
pragma solidity >=0.8.0;
interface IMinter {
event Mint(address indexed sender, uint256 weekly, uint256 circulating_supply);
function update_period() external returns (uint);
function check() external view returns (bool);
function period() external view returns (uint);
function active_period() external view returns (uint);
}// SPDX-License-Identifier: MIT
pragma solidity >=0.8.0;
interface IVoter {
/**
* @notice Represents the state of a gauge.
* @param isGauge Indicates if the address is a gauge.
* @param isAlive Indicates if the gauge is active.
* @param internalBribe The address of the internal bribe contract.
* @param externalBribe The address of the external bribe contract.
* @param pool The address of the associated pool.
* @param claimable The amount of rewards claimable by the gauge.
* @param index The current index used for reward distribution calculations.
* @param lastDistributionTimestamp The last time rewards were distributed.
*/
struct GaugeState {
bool isGauge;
bool isAlive;
address internalBribe;
address externalBribe;
address pool;
uint256 claimable;
uint256 index;
uint256 lastDistributionTimestamp;
}
/**
* @notice Parameters for claiming bribes using a specific tokenId.
* @param tokenId The token ID to claim bribes for.
* @param bribes The array of bribe contract addresses.
* @param tokens The array of arrays containing token addresses for each bribe.
*/
struct AggregateClaimBribesByTokenIdParams {
uint256 tokenId;
address[] bribes;
address[][] tokens;
}
/**
* @notice Parameters for claiming bribes.
* @param bribes The array of bribe contract addresses.
* @param tokens The array of arrays containing token addresses for each bribe.
*/
struct AggregateClaimBribesParams {
address[] bribes;
address[][] tokens;
}
/**
* @notice Parameters for claiming Merkl data.
* @param users The array of user addresses to claim for.
* @param tokens The array of token addresses.
* @param amounts The array of amounts to claim.
* @param proofs The array of arrays containing Merkle proofs.
*/
struct AggregateClaimMerklDataParams {
address[] users;
address[] tokens;
uint256[] amounts;
bytes32[][] proofs;
}
/**
* @notice Parameters for claiming VeFnx Merkl airdrop data.
* @param inPureTokens_ Boolean indicating if the claim is in pure tokens.
* @param amount The amount to claim.
* @param withPermanentLock_ Whether the lock should be permanent.
* @param managedTokenIdForAttach_ The ID of the managed NFT to attach, if any. 0 for ignore
* @param proofs The array of Merkle proofs.
*/
struct AggregateClaimVeFnxMerklAirdrop {
bool inPureTokens;
uint256 amount;
bool withPermanentLock;
uint256 managedTokenIdForAttach;
bytes32[] proofs;
}
/**
* @notice Emitted when a gauge is created.
* @param gauge The address of the created gauge.
* @param creator The address of the creator.
* @param internalBribe The address of the created internal bribe.
* @param externalBribe The address of the created external bribe.
* @param pool The address of the associated pool.
*/
event GaugeCreated(address indexed gauge, address creator, address internalBribe, address indexed externalBribe, address indexed pool);
/**
* @notice Emitted when a gauge is created.
* @param gauge The address of the created gauge.
* @param gaugeType Type identifier of the created gauge.
*/
event GaugeCreatedType(address indexed gauge, uint256 indexed gaugeType);
/**
* @notice Emitted when a gauge is killed.
* @param gauge The address of the killed gauge.
*/
event GaugeKilled(address indexed gauge);
/**
* @notice Emitted when a gauge is revived.
* @param gauge The address of the revived gauge.
*/
event GaugeRevived(address indexed gauge);
/**
* @notice Emitted when a vote is cast.
* @param voter The address of the voter.
* @param tokenId The ID of the token used for voting.
* @param weight The weight of the vote.
*/
event Voted(address indexed voter, uint256 tokenId, uint256 weight);
/**
* @notice Emitted when a vote is reset.
* @param tokenId The ID of the token that had its vote reset.
* @param weight The weight of the vote that was reset.
*/
event Abstained(uint256 tokenId, uint256 weight);
/**
* @notice Emitted when rewards are notified for distribution.
* @param sender The address of the sender.
* @param reward The address of the reward token.
* @param amount The amount of rewards to distribute.
*/
event NotifyReward(address indexed sender, address indexed reward, uint256 amount);
/**
* @notice Emitted when rewards are distributed to a gauge.
* @param sender The address of the sender.
* @param gauge The address of the gauge receiving the rewards.
* @param amount The amount of rewards distributed.
*/
event DistributeReward(address indexed sender, address indexed gauge, uint256 amount);
/**
* @notice Emitted when the vote delay is updated.
* @param old The previous vote delay.
* @param latest The new vote delay.
*/
event SetVoteDelay(uint256 old, uint256 latest);
/**
* @notice Emitted when a contract address is updated.
* @param key The key representing the contract.
* @param value The new address of the contract.
*/
event UpdateAddress(string key, address indexed value);
/**
* @notice Emitted when the distribution window duration is set or updated.
* @param duration New duration of the distribution window in seconds.
*/
event SetDistributionWindowDuration(uint256 indexed duration);
/**
* @notice Emitted when a token is attached to a managed NFT.
* @param tokenId ID of the user's token that is being attached.
* @param managedTokenId ID of the managed token to which the user's token is attached.
*/
event AttachToManagedNFT(uint256 indexed tokenId, uint256 indexed managedTokenId);
/**
* @notice Emitted when a token is detached from a managed NFT.
* @param tokenId ID of the user's token that is being detached.
*/
event DettachFromManagedNFT(uint256 indexed tokenId);
/**
* @notice Updates the address of a specified contract.
* @param key_ The key representing the contract.
* @param value_ The new address of the contract.
*/
function updateAddress(string memory key_, address value_) external;
/**
* @notice Sets the duration of the distribution window for voting.
* @param distributionWindowDuration_ The duration in seconds.
*/
function setDistributionWindowDuration(uint256 distributionWindowDuration_) external;
/**
* @notice Sets the delay period before a vote can be cast again.
* @param newVoteDelay_ The new delay period in seconds.
*/
function setVoteDelay(uint256 newVoteDelay_) external;
/**
* @notice Disables a gauge, preventing further rewards distribution.
* @param gauge_ The address of the gauge to be disabled.
*/
function killGauge(address gauge_) external;
/**
* @notice Revives a previously disabled gauge, allowing it to distribute rewards again.
* @param gauge_ The address of the gauge to be revived.
*/
function reviveGauge(address gauge_) external;
/**
* @notice Creates a new V2 gauge for a specified pool.
* @param pool_ The address of the pool for which to create a gauge.
* @return gauge The address of the created gauge.
* @return internalBribe The address of the created internal bribe.
* @return externalBribe The address of the created external bribe.
*/
function createV2Gauge(address pool_) external returns (address gauge, address internalBribe, address externalBribe);
/**
* @notice Creates a new V3 gauge for a specified pool.
* @param pool_ The address of the pool for which to create a gauge.
* @return gauge The address of the created gauge.
* @return internalBribe The address of the created internal bribe.
* @return externalBribe The address of the created external bribe.
*/
function createV3Gauge(address pool_) external returns (address gauge, address internalBribe, address externalBribe);
/**
* @notice Creates a custom gauge with specified parameters.
* @param gauge_ The address of the custom gauge.
* @param pool_ The address of the pool for which to create a gauge.
* @param tokenA_ The address of token A in the pool.
* @param tokenB_ The address of token B in the pool.
* @param externalBribesName_ The name of the external bribe.
* @param internalBribesName_ The name of the internal bribe.
* @return gauge The address of the created gauge.
* @return internalBribe The address of the created internal bribe.
* @return externalBribe The address of the created external bribe.
*/
function createCustomGauge(
address gauge_,
address pool_,
address tokenA_,
address tokenB_,
string memory externalBribesName_,
string memory internalBribesName_
) external returns (address gauge, address internalBribe, address externalBribe);
/**
* @notice Notifies the contract of a reward amount to be distributed.
* @param amount_ The amount of rewards to distribute.
*/
function notifyRewardAmount(uint256 amount_) external;
/**
* @notice Distributes fees to a list of gauges.
* @param gauges_ An array of gauge addresses to distribute fees to.
*/
function distributeFees(address[] calldata gauges_) external;
/**
* @notice Distributes rewards to all pools managed by the contract.
*/
function distributeAll() external;
/**
* @notice Distributes rewards to a specified range of pools.
* @param start_ The starting index of the pool array.
* @param finish_ The ending index of the pool array.
*/
function distribute(uint256 start_, uint256 finish_) external;
/**
* @notice Distributes rewards to a specified list of gauges.
* @param gauges_ An array of gauge addresses to distribute rewards to.
*/
function distribute(address[] calldata gauges_) external;
/**
* @notice Resets the votes for a given NFT token ID.
* @param tokenId_ The token ID for which to reset votes.
*/
function reset(uint256 tokenId_) external;
/**
* @notice Updates the voting preferences for a given token ID.
* @param tokenId_ The token ID for which to update voting preferences.
*/
function poke(uint256 tokenId_) external;
/**
* @notice Casts votes for a given NFT token ID.
* @param tokenId_ The token ID for which to cast votes.
* @param poolsVotes_ An array of pool addresses to vote for.
* @param weights_ An array of weights corresponding to the pools.
*/
function vote(uint256 tokenId_, address[] calldata poolsVotes_, uint256[] calldata weights_) external;
/**
* @notice Claims rewards from multiple gauges.
* @param _gauges An array of gauge addresses to claim rewards from.
*/
function claimRewards(address[] memory _gauges) external;
/**
* @notice Claims bribes for a given NFT token ID from multiple bribe contracts.
* @param _bribes An array of bribe contract addresses to claim bribes from.
* @param _tokens An array of token arrays, specifying the tokens to claim.
* @param tokenId_ The token ID for which to claim bribes.
*/
function claimBribes(address[] memory _bribes, address[][] memory _tokens, uint256 tokenId_) external;
/**
* @notice Claims bribes from multiple bribe contracts.
* @param _bribes An array of bribe contract addresses to claim bribes from.
* @param _tokens An array of token arrays, specifying the tokens to claim.
*/
function claimBribes(address[] memory _bribes, address[][] memory _tokens) external;
/**
* @notice Attaches a tokenId to a managed tokenId.
* @param tokenId_ The user's tokenId to be attached.
* @param managedTokenId_ The managed tokenId to attach to.
*/
function attachToManagedNFT(uint256 tokenId_, uint256 managedTokenId_) external;
/**
* @notice Detaches a tokenId from its managed tokenId.
* @param tokenId_ The user's tokenId to be detached.
*/
function dettachFromManagedNFT(uint256 tokenId_) external;
/**
* @notice Checks if the provided address is a registered gauge.
* @param gauge_ The address of the gauge to check.
* @return True if the address is a registered gauge, false otherwise.
*/
function isGauge(address gauge_) external view returns (bool);
/**
* @notice Returns the state of a specific gauge.
* @param gauge_ The address of the gauge.
* @return GaugeState The current state of the specified gauge.
*/
function getGaugeState(address gauge_) external view returns (GaugeState memory);
/**
* @notice Checks if the specified gauge is alive (i.e., enabled for reward distribution).
* @param gauge_ The address of the gauge to check.
* @return True if the gauge is alive, false otherwise.
*/
function isAlive(address gauge_) external view returns (bool);
/**
* @notice Returns the pool address associated with a specified gauge.
* @param gauge_ The address of the gauge to query.
* @return The address of the pool associated with the specified gauge.
*/
function poolForGauge(address gauge_) external view returns (address);
/**
* @notice Returns the gauge address associated with a specified pool.
* @param pool_ The address of the pool to query.
* @return The address of the gauge associated with the specified pool.
*/
function poolToGauge(address pool_) external view returns (address);
/**
* @notice Returns the address of the Voting Escrow contract.
* @return The address of the Voting Escrow contract.
*/
function votingEscrow() external view returns (address);
/**
* @notice Returns the address of the Minter contract.
* @return The address of the Minter contract.
*/
function minter() external view returns (address);
/**
* @notice Returns the address of the V2 Pool Factory contract.
* @return The address of the V2 Pool Factory contract.
*/
function v2PoolFactory() external view returns (address);
/**
* @notice Returns the address of the V3 Pool Factory contract.
* @return The address of the V3 Pool Factory contract.
*/
function v3PoolFactory() external view returns (address);
/**
* @notice Returns the V2 pool address at a specific index.
* @param index The index of the V2 pool.
* @return The address of the V2 pool at the specified index.
*/
function v2Pools(uint256 index) external view returns (address);
/**
* @notice Returns the V3 pool address at a specific index.
* @param index The index of the V3 pool.
* @return The address of the V3 pool at the specified index.
*/
function v3Pools(uint256 index) external view returns (address);
/**
* @notice Returns the total number of pools, V2 pools, and V3 pools managed by the contract.
* @return totalCount The total number of pools.
* @return v2PoolsCount The total number of V2 pools.
* @return v3PoolsCount The total number of V3 pools.
*/
function poolsCounts() external view returns (uint256 totalCount, uint256 v2PoolsCount, uint256 v3PoolsCount);
/**
* @notice Returns the current epoch timestamp used for reward calculations.
* @return The current epoch timestamp.
*/
function epochTimestamp() external view returns (uint256);
/**
* @notice Returns the weight for a specific pool in a given epoch.
* @param timestamp The timestamp of the epoch.
* @param pool The address of the pool.
* @return The weight of the pool in the specified epoch.
*/
function weightsPerEpoch(uint256 timestamp, address pool) external view returns (uint256);
/**
* @notice Returns the vote weight of a specific NFT token ID for a given pool.
* @param tokenId The ID of the NFT.
* @param pool The address of the pool.
* @return The vote weight of the token for the specified pool.
*/
function votes(uint256 tokenId, address pool) external view returns (uint256);
/**
* @notice Returns the number of pools that an NFT token ID has voted for.
* @param tokenId The ID of the NFT.
* @return The number of pools the token has voted for.
*/
function poolVoteLength(uint256 tokenId) external view returns (uint256);
/**
* @notice Returns the pool address at a specific index for which the NFT token ID has voted.
* @param tokenId The ID of the NFT.
* @param index The index of the pool.
* @return The address of the pool at the specified index.
*/
function poolVote(uint256 tokenId, uint256 index) external view returns (address);
/**
* @notice Returns the last timestamp when an NFT token ID voted.
* @param tokenId The ID of the NFT.
* @return The timestamp of the last vote.
*/
function lastVotedTimestamps(uint256 tokenId) external view returns (uint256);
}// SPDX-License-Identifier: MIT
pragma solidity >=0.8.0;
import "@openzeppelin/contracts-upgradeable/token/ERC721/IERC721Upgradeable.sol";
/**
* @title IVotingEscrow
* @notice Interface for Voting Escrow, allowing users to lock tokens in exchange for veNFTs that are used in governance and other systems.
*/
interface IVotingEscrow is IERC721Upgradeable {
/**
* @notice Enum representing the types of deposits that can be made.
* @dev Defines the context in which a deposit is made:
* - `DEPOSIT_FOR_TYPE`: Regular deposit for an existing lock.
* - `CREATE_LOCK_TYPE`: Creating a new lock.
* - `INCREASE_UNLOCK_TIME`: Increasing the unlock time for an existing lock.
* - `MERGE_TYPE`: Merging two locks together.
*/
enum DepositType {
DEPOSIT_FOR_TYPE,
CREATE_LOCK_TYPE,
INCREASE_UNLOCK_TIME,
MERGE_TYPE
}
/**
* @notice Structure representing the state of a token.
* @dev This includes information about the lock, voting status, attachment status, last transfer block, and point epoch.
* @param locked The locked balance associated with the token.
* @param isVoted Whether the token has been used to vote.
* @param isAttached Whether the token is attached to a managed NFT.
* @param lastTranferBlock The block number of the last transfer.
* @param pointEpoch The epoch of the last point associated with the token.
*/
struct TokenState {
LockedBalance locked;
bool isVoted;
bool isAttached;
uint256 lastTranferBlock;
uint256 pointEpoch;
}
/**
* @notice Structure representing a locked balance.
* @dev Contains the amount locked, the end time of the lock, and whether the lock is permanent.
* @param amount The amount of tokens locked.
* @param end The timestamp when the lock ends.
* @param isPermanentLocked Whether the lock is permanent.
*/
struct LockedBalance {
int128 amount;
uint256 end;
bool isPermanentLocked;
}
/**
* @notice Structure representing a point in time for calculating voting power.
* @dev Used for calculating the slope and bias for lock balances over time.
* @param bias The bias of the lock, representing the remaining voting power.
* @param slope The rate at which the voting power decreases.
* @param ts The timestamp of the point.
* @param blk The block number of the point.
* @param permanent The permanent amount associated with the lock.
*/
struct Point {
int128 bias;
int128 slope; // -dweight / dt
uint256 ts;
uint256 blk; // block
int128 permanent;
}
/**
* @notice Emitted when a boost is applied to a token's lock.
* @param tokenId The ID of the token that received the boost.
* @param value The value of the boost applied.
*/
event Boost(uint256 indexed tokenId, uint256 value);
/**
* @notice Emitted when a deposit is made into a lock.
* @param provider The address of the entity making the deposit.
* @param tokenId The ID of the token associated with the deposit.
* @param value The value of the deposit made.
* @param locktime The time until which the lock is extended.
* @param deposit_type The type of deposit being made.
* @param ts The timestamp when the deposit was made.
*/
event Deposit(address indexed provider, uint256 tokenId, uint256 value, uint256 indexed locktime, DepositType deposit_type, uint256 ts);
/**
* @notice Emitted when a withdrawal is made from a lock.
* @param provider The address of the entity making the withdrawal.
* @param tokenId The ID of the token associated with the withdrawal.
* @param value The value of the withdrawal made.
* @param ts The timestamp when the withdrawal was made.
*/
event Withdraw(address indexed provider, uint256 tokenId, uint256 value, uint256 ts);
/**
* @notice Emitted when the total supply of voting power changes.
* @param prevSupply The previous total supply of voting power.
* @param supply The new total supply of voting power.
*/
event Supply(uint256 prevSupply, uint256 supply);
/**
* @notice Emitted when an address associated with the contract is updated.
* @param key The key representing the contract being updated.
* @param value The new address of the contract.
*/
event UpdateAddress(string key, address indexed value);
/**
* @notice Emitted when a token is permanently locked by a user.
* @param sender The address of the user who initiated the lock.
* @param tokenId The ID of the token that has been permanently locked.
*/
event LockPermanent(address indexed sender, uint256 indexed tokenId);
/**
* @notice Emitted when a token is unlocked from a permanent lock state by a user.
* @param sender The address of the user who initiated the unlock.
* @param tokenId The ID of the token that has been unlocked from its permanent state.
*/
event UnlockPermanent(address indexed sender, uint256 indexed tokenId);
/**
* @notice Returns the address of the token used in voting escrow.
* @return The address of the token.
*/
function token() external view returns (address);
/**
* @notice Returns the address of the voter.
* @return The address of the voter.
*/
function voter() external view returns (address);
/**
* @notice Checks if the specified address is approved or the owner of the given token.
* @param sender The address to check.
* @param tokenId The ID of the token to check against.
* @return True if the sender is approved or the owner of the token, false otherwise.
*/
function isApprovedOrOwner(address sender, uint256 tokenId) external view returns (bool);
/**
* @notice Retrieves the state of a specific NFT.
* @param tokenId_ The ID of the NFT to query.
* @return The current state of the specified NFT.
*/
function getNftState(uint256 tokenId_) external view returns (TokenState memory);
/**
* @notice Returns the total supply of voting power at the current block timestamp.
* @return The total supply of voting power.
*/
function votingPowerTotalSupply() external view returns (uint256);
/**
* @notice Returns the balance of an NFT at the current block timestamp.
* @param tokenId_ The ID of the NFT to query.
* @return The balance of the NFT.
*/
function balanceOfNFT(uint256 tokenId_) external view returns (uint256);
/**
* @notice Returns the balance of an NFT at the current block timestamp, ignoring ownership changes.
* @param tokenId_ The ID of the NFT to query.
* @return The balance of the NFT.
*/
function balanceOfNftIgnoreOwnershipChange(uint256 tokenId_) external view returns (uint256);
/**
* @notice Updates the address of a specified contract.
* @param key_ The key representing the contract.
* @param value_ The new address of the contract.
* @dev Reverts with `InvalidAddressKey` if the key does not match any known contracts.
* Emits an {UpdateAddress} event on successful address update.
*/
function updateAddress(string memory key_, address value_) external;
/**
* @notice Hooks the voting state for a specified NFT.
* @param tokenId_ The ID of the NFT.
* @param state_ The voting state to set.
* @dev Reverts with `AccessDenied` if the caller is not the voter.
*/
function votingHook(uint256 tokenId_, bool state_) external;
/**
* @notice Creates a new lock for a specified recipient.
* @param amount_ The amount of tokens to lock.
* @param lockDuration_ The duration for which the tokens will be locked.
* @param to_ The address of the recipient who will receive the veNFT.
* @param shouldBoosted_ Whether the deposit should be boosted.
* @param withPermanentLock_ Whether the lock should be permanent.
* @param managedTokenIdForAttach_ The ID of the managed NFT to attach, if any. 0 for ignore
* @return The ID of the newly created veNFT.
* @dev Reverts with `InvalidLockDuration` if the lock duration is invalid.
* Emits a {Deposit} event on successful lock creation.
*/
function createLockFor(
uint256 amount_,
uint256 lockDuration_,
address to_,
bool shouldBoosted_,
bool withPermanentLock_,
uint256 managedTokenIdForAttach_
) external returns (uint256);
/**
* @notice Deposits tokens for a specific NFT, increasing its locked balance.
* @param tokenId_ The ID of the NFT.
* @param amount_ The amount of tokens to deposit.
* @param shouldBoosted_ Whether the deposit should be boosted.
* @param withPermanentLock_ Whether to apply a permanent lock.
* @dev Reverts with `InvalidAmount` if the amount is zero.
* Emits a {Deposit} event on successful deposit.
*/
function depositFor(uint256 tokenId_, uint256 amount_, bool shouldBoosted_, bool withPermanentLock_) external;
/**
* @notice Increases the unlock time for a specified NFT.
* @param tokenId_ The ID of the NFT to increase unlock time for.
* @param lockDuration_ The additional duration to add to the unlock time.
* @dev Reverts with `InvalidLockDuration` if the new unlock time is invalid.
* Reverts with `AccessDenied` if the caller is not approved or the owner of the NFT.
* Emits a {Deposit} event on successful unlock time increase.
*/
function increase_unlock_time(uint256 tokenId_, uint256 lockDuration_) external;
/**
* @notice Deposits tokens to increase the balance and extend the lock duration for a given token ID.
* @dev The lock duration is increased and the deposit is processed for the given token.
*
* !!! Important: The veBoost incentive is applied whenever possible
*
* @param tokenId_ The ID of the token to increase the balance and extend the lock duration.
* @param amount_ The amount of tokens to be deposited.
* @param lockDuration_ The duration (in seconds) - how long the new lock should be.
* Emits a {Deposit} event on successful deposit.
* Emits second a {Deposit} event on successful unlock time increase.
*/
function depositWithIncreaseUnlockTime(uint256 tokenId_, uint256 amount_, uint256 lockDuration_) external;
/**
* @notice Withdraws tokens from a specified NFT lock.
* @param tokenId_ The ID of the NFT to withdraw tokens from.
* @dev Reverts with `AccessDenied` if the caller is not approved or the owner of the NFT.
* Emits a {Supply} event reflecting the change in total supply.
*/
function withdraw(uint256 tokenId_) external;
/**
* @notice Merges two NFTs into one.
* @param tokenFromId_ The ID of the NFT to merge from.
* @param tokenToId_ The ID of the NFT to merge into.
* @dev Reverts with `MergeTokenIdsTheSame` if the token IDs are the same.
* Reverts with `AccessDenied` if the caller is not approved or the owner of both NFTs.
* Emits a {Deposit} event reflecting the merge.
*/
function merge(uint256 tokenFromId_, uint256 tokenToId_) external;
/**
* @notice Permanently locks a specified NFT.
* @param tokenId_ The ID of the NFT to lock permanently.
* @dev Reverts with `AccessDenied` if the caller is not approved or the owner of the NFT.
* Emits a {LockPermanent} event on successful permanent lock.
*/
function lockPermanent(uint256 tokenId_) external;
/**
* @notice Unlocks a permanently locked NFT.
* @param tokenId_ The ID of the NFT to unlock.
* @dev Reverts with `AccessDenied` if the caller is not approved or the owner of the NFT.
* Emits an {UnlockPermanent} event on successful unlock.
*/
function unlockPermanent(uint256 tokenId_) external;
/**
* @notice Creates a new managed NFT for a given recipient.
* @param recipient_ The address of the recipient to receive the newly created managed NFT.
* @return The ID of the newly created managed NFT.
* @dev Reverts with `AccessDenied` if the caller is not the managed NFT manager.
*/
function createManagedNFT(address recipient_) external returns (uint256);
/**
* @notice Attaches a token to a managed NFT.
* @param tokenId_ The ID of the user's token being attached.
* @param managedTokenId_ The ID of the managed token to which the user's token is being attached.
* @return The amount of tokens locked during the attach operation.
* @dev Reverts with `AccessDenied` if the caller is not the managed NFT manager.
* Reverts with `ZeroVotingPower` if the NFT has no voting power.
* Reverts with `NotManagedNft` if the target is not a managed NFT.
*/
function onAttachToManagedNFT(uint256 tokenId_, uint256 managedTokenId_) external returns (uint256);
/**
* @notice Detaches a token from a managed NFT.
* @param tokenId_ The ID of the user's token being detached.
* @param managedTokenId_ The ID of the managed token from which the user's token is being detached.
* @param newBalance_ The new balance to set for the user's token post detachment.
* @dev Reverts with `AccessDenied` if the caller is not the managed NFT manager.
* Reverts with `NotManagedNft` if the target is not a managed NFT.
*/
function onDettachFromManagedNFT(uint256 tokenId_, uint256 managedTokenId_, uint256 newBalance_) external;
}// SPDX-License-Identifier: BUSL-1.1
pragma solidity =0.8.19;
import {IBlastFull, YieldMode, GasMode} from "./interfaces/IBlastFull.sol";
import {IBlastGovernor} from "./interfaces/IBlastGovernor.sol";
/**
* @title Blast Governor Claiamble Setup
* @dev Abstract contract for setting up a governor in the Blast ecosystem.
* This contract provides an initialization function to configure a governor address
* for the Blast protocol, utilizing the `IBlast` interface.
*/
abstract contract BlastGovernorClaimableSetup {
/// @dev Error thrown when an operation involves a zero address where a valid address is required.
error AddressZero();
/**
* @dev Initializes the governor and claimable configuration for the Blast protocol.
* This internal function is meant to be called in the initialization process
* of a derived contract that sets up governance.
*
* @param blastGovernor_ The address of the governor to be configured in the Blast protocol.
* Must be a non-zero address.
*/
function __BlastGovernorClaimableSetup_init(address blastGovernor_) internal {
if (blastGovernor_ == address(0)) {
revert AddressZero();
}
IBlastFull(0x4300000000000000000000000000000000000002).configure(YieldMode.CLAIMABLE, GasMode.CLAIMABLE, blastGovernor_);
if (blastGovernor_.code.length > 0) {
IBlastGovernor(blastGovernor_).addGasHolder(address(this));
}
}
}// SPDX-License-Identifier: MIT
pragma solidity >=0.8.0;
/**
* @title IBlastFull Interface
* @dev Interface for interacting with the Blast protocol, specifically for configuring
* governance settings. This interface abstracts the function to set up a governor
* within the Blast ecosystem.
*/
enum GasMode {
VOID,
CLAIMABLE
}
enum YieldMode {
AUTOMATIC,
VOID,
CLAIMABLE
}
interface IBlastFull {
// configure
function configureContract(address contractAddress, YieldMode _yield, GasMode gasMode, address governor) external;
function configure(YieldMode _yield, GasMode gasMode, address governor) external;
// base configuration options
function configureClaimableYield() external;
function configureClaimableYieldOnBehalf(address contractAddress) external;
function configureAutomaticYield() external;
function configureAutomaticYieldOnBehalf(address contractAddress) external;
function configureVoidYield() external;
function configureVoidYieldOnBehalf(address contractAddress) external;
function configureClaimableGas() external;
function configureClaimableGasOnBehalf(address contractAddress) external;
function configureVoidGas() external;
function configureVoidGasOnBehalf(address contractAddress) external;
function configureGovernor(address _governor) external;
function configureGovernorOnBehalf(address _newGovernor, address contractAddress) external;
// claim yield
function claimYield(address contractAddress, address recipientOfYield, uint256 amount) external returns (uint256);
function claimAllYield(address contractAddress, address recipientOfYield) external returns (uint256);
// claim gas
function claimAllGas(address contractAddress, address recipientOfGas) external returns (uint256);
// NOTE: can be off by 1 bip
function claimGasAtMinClaimRate(address contractAddress, address recipientOfGas, uint256 minClaimRateBips) external returns (uint256);
function claimMaxGas(address contractAddress, address recipientOfGas) external returns (uint256);
function claimGas(
address contractAddress,
address recipientOfGas,
uint256 gasToClaim,
uint256 gasSecondsToConsume
) external returns (uint256);
// read functions
function readClaimableYield(address contractAddress) external view returns (uint256);
function readYieldConfiguration(address contractAddress) external view returns (uint8);
function readGasParams(
address contractAddress
) external view returns (uint256 etherSeconds, uint256 etherBalance, uint256 lastUpdated, GasMode);
function isGovernor(address) external view returns (bool);
function governorMap(address) external view returns (address);
}// SPDX-License-Identifier: MIT
pragma solidity =0.8.19;
import {GasMode} from "./IBlastFull.sol";
/**
* @title IBlastGovernor
* @dev Interface for the BlastGovernor contract.
*/
interface IBlastGovernor {
/**
* @dev Structure representing gas parameters.
* @param contractAddress Address of the gas holder contract.
* @param etherSeconds Accumulated ether seconds.
* @param etherBalance Ether balance.
* @param lastUpdated Timestamp of the last update.
* @param gasMode Current gas mode.
*/
struct GasParamsResult {
address contractAddress;
uint256 etherSeconds;
uint256 etherBalance;
uint256 lastUpdated;
GasMode gasMode;
}
/**
* @dev Emitted when a gas holder is added.
* @param contractAddress The address of the added gas holder contract.
*/
event AddGasHolder(address indexed contractAddress);
/**
* @dev Emitted when gas is claimed.
* @param caller The address of the caller who initiated the claim.
* @param recipient The address of the recipient who receives the claimed gas.
* @param gasHolders The addresses of the gas holders from which gas was claimed.
* @param totalClaimedAmount The total amount of gas claimed.
*/
event ClaimGas(address indexed caller, address indexed recipient, address[] gasHolders, uint256 totalClaimedAmount);
/**
* @notice Adds a gas holder.
* @dev Adds a contract to the list of gas holders.
* @param contractAddress_ The address of the gas holder contract.
*/
function addGasHolder(address contractAddress_) external;
/**
* @notice Claims all gas for a recipient within the specified range.
* @param recipient_ The address of the recipient.
* @param offset_ The offset to start from.
* @param limit_ The maximum number of gas holders to process.
* @return totalClaimedGas The total amount of gas claimed.
*/
function claimAllGas(address recipient_, uint256 offset_, uint256 limit_) external returns (uint256 totalClaimedGas);
/**
* @notice Claims all gas for a recipient from specified gas holders.
* @param recipient_ The address of the recipient.
* @param holders_ The addresses of the gas holders.
* @return totalClaimedGas The total amount of gas claimed.
*/
function claimAllGasFromSpecifiedGasHolders(address recipient_, address[] memory holders_) external returns (uint256 totalClaimedGas);
/**
* @notice Claims gas at minimum claim rate for a recipient within the specified range.
* @param recipient_ The address of the recipient.
* @param minClaimRateBips_ The minimum claim rate in basis points.
* @param offset_ The offset to start from.
* @param limit_ The maximum number of gas holders to process.
* @return totalClaimedGas The total amount of gas claimed.
*/
function claimGasAtMinClaimRate(
address recipient_,
uint256 minClaimRateBips_,
uint256 offset_,
uint256 limit_
) external returns (uint256 totalClaimedGas);
/**
* @notice Claims gas at minimum claim rate for a recipient from specified gas holders.
* @param recipient_ The address of the recipient.
* @param minClaimRateBips_ The minimum claim rate in basis points.
* @param holders_ The addresses of the gas holders.
* @return totalClaimedGas The total amount of gas claimed.
*/
function claimGasAtMinClaimRateFromSpecifiedGasHolders(
address recipient_,
uint256 minClaimRateBips_,
address[] memory holders_
) external returns (uint256 totalClaimedGas);
/**
* @notice Claims maximum gas for a recipient within the specified range.
* @param recipient_ The address of the recipient.
* @param offset_ The offset to start from.
* @param limit_ The maximum number of gas holders to process.
* @return totalClaimedGas The total amount of gas claimed.
*/
function claimMaxGas(address recipient_, uint256 offset_, uint256 limit_) external returns (uint256 totalClaimedGas);
/**
* @notice Claims maximum gas for a recipient from specified gas holders.
* @param recipient_ The address of the recipient.
* @param holders_ The addresses of the gas holders.
* @return totalClaimedGas The total amount of gas claimed.
*/
function claimMaxGasFromSpecifiedGasHolders(address recipient_, address[] memory holders_) external returns (uint256 totalClaimedGas);
/**
* @notice Claims a specific amount of gas for a recipient within the specified range.
* @param recipient_ The address of the recipient.
* @param gasToClaim_ The amount of gas to claim.
* @param gasSecondsToConsume_ The amount of gas seconds to consume.
* @param offset_ The offset to start from.
* @param limit_ The maximum number of gas holders to process.
* @return totalClaimedGas The total amount of gas claimed.
*/
function claimGas(
address recipient_,
uint256 gasToClaim_,
uint256 gasSecondsToConsume_,
uint256 offset_,
uint256 limit_
) external returns (uint256 totalClaimedGas);
/**
* @notice Claims a specific amount of gas for a recipient from specified gas holders.
* @param recipient_ The address of the recipient.
* @param gasToClaim_ The amount of gas to claim.
* @param gasSecondsToConsume_ The amount of gas seconds to consume.
* @param holders_ The addresses of the gas holders.
* @return totalClaimedGas The total amount of gas claimed.
*/
function claimGasFromSpecifiedGasHolders(
address recipient_,
uint256 gasToClaim_,
uint256 gasSecondsToConsume_,
address[] memory holders_
) external returns (uint256 totalClaimedGas);
/**
* @notice Reads gas parameters within the specified range.
* @param offset_ The offset to start from.
* @param limit_ The maximum number of gas holders to process.
* @return gasHoldersParams The gas parameters of the gas holders.
*/
function readGasParams(uint256 offset_, uint256 limit_) external view returns (GasParamsResult[] memory gasHoldersParams);
/**
* @notice Reads gas parameters from specified gas holders.
* @param holders_ The addresses of the gas holders.
* @return gasHoldersParams The gas parameters of the gas holders.
*/
function readGasParamsFromSpecifiedGasHolders(
address[] memory holders_
) external view returns (GasParamsResult[] memory gasHoldersParams);
/**
* @notice Checks if a contract is a registered gas holder.
* @param contractAddress_ The address of the contract.
* @return isRegistered Whether the contract is a registered gas holder.
*/
function isRegisteredGasHolder(address contractAddress_) external view returns (bool isRegistered);
/**
* @notice Lists gas holders within the specified range.
* @param offset_ The offset to start from.
* @param limit_ The maximum number of gas holders to process.
* @return gasHolders The addresses of the gas holders.
*/
function listGasHolders(uint256 offset_, uint256 limit_) external view returns (address[] memory gasHolders);
}{
"evmVersion": "paris",
"viaIR": true,
"optimizer": {
"enabled": true,
"runs": 2000
},
"metadata": {
"bytecodeHash": "none"
},
"outputSelection": {
"*": {
"*": [
"evm.bytecode",
"evm.deployedBytecode",
"devdoc",
"userdoc",
"metadata",
"abi"
]
}
},
"libraries": {}
}Contract Security Audit
- No Contract Security Audit Submitted- Submit Audit Here
Contract ABI
API[{"inputs":[{"internalType":"address","name":"blastGovernor_","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[],"name":"AddressZero","type":"error"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint8","name":"version","type":"uint8"}],"name":"Initialized","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"sender","type":"address"},{"indexed":false,"internalType":"uint256","name":"weekly","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"circulating_supply","type":"uint256"}],"name":"Mint","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"previousOwner","type":"address"},{"indexed":true,"internalType":"address","name":"newOwner","type":"address"}],"name":"OwnershipTransferStarted","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"previousOwner","type":"address"},{"indexed":true,"internalType":"address","name":"newOwner","type":"address"}],"name":"OwnershipTransferred","type":"event"},{"inputs":[],"name":"MAX_TEAM_RATE","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"PRECISION","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"TAIL_EMISSION","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"WEEK","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"acceptOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"active_period","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"calculate_emission_decay","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"calculate_emission_inflation","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"check","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"circulating_emission","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"circulating_supply","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"decayRate","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"fenix","outputs":[{"internalType":"contract IFenix","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"inflationPeriodCount","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"inflationRate","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"blastGovernor_","type":"address"},{"internalType":"address","name":"voter_","type":"address"},{"internalType":"address","name":"ve_","type":"address"}],"name":"initialize","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"isFirstMint","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"isStarted","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"lastInflationPeriod","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"patchInitialSupply","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"pendingOwner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"period","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"renounceOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_decayRate","type":"uint256"}],"name":"setDecayRate","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_inflationRate","type":"uint256"}],"name":"setInflationRate","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_teamRate","type":"uint256"}],"name":"setTeamRate","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"__voter","type":"address"}],"name":"setVoter","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"votingEscrow_","type":"address"}],"name":"setVotingEscrow","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"shiftStartByOneWeek","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"start","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"startEmissionDistributionTimestamp","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"teamRate","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"update_period","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"ve","outputs":[{"internalType":"contract IVotingEscrow","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"voter","outputs":[{"internalType":"contract IVoter","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"weekly","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"weekly_emission","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"}]Contract Creation Code
6080346200022c57601f62001aa238819003918201601f191683019260009290916001600160401b0385118386101762000218578160209284926040978852833981010312620001db57516001600160a01b03811690818103620002145781156200020357734300000000000000000000000000000000000002803b15620001ff57838091606487518094819363c8992e6160e01b835260026004840152600160248401528860448401525af18015620001f557620001df575b503b6200017a575b50805460ff8160081c16620001265760ff80821603620000eb575b825161184690816200025c8239f35b60ff908119161790557f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024986020825160ff8152a13880620000dc565b825162461bcd60e51b815260206004820152602760248201527f496e697469616c697a61626c653a20636f6e747261637420697320696e697469604482015266616c697a696e6760c81b6064820152608490fd5b803b15620001db5781809160248551809481936305573b1760e31b83523060048401525af18015620001d157908291620001b6575b50620000c1565b620001c19062000231565b620001ce578038620001af565b80fd5b83513d84823e3d90fd5b5080fd5b620001ed9093919362000231565b9138620000b9565b85513d86823e3d90fd5b8380fd5b8351639fabe1c160e01b8152600490fd5b8280fd5b634e487b7160e01b84526041600452602484fd5b600080fd5b6001600160401b0381116200024557604052565b634e487b7160e01b600052604160045260246000fdfe608060408181526004918236101561001657600080fd5b600092833560e01c91826301c8e6fd146113a75750816304e7e0b9146113775781631eebae801461135a5781631f8507161461133257816321c9a85b1461131357816326cfc17b146112f45781632e8f7b1f146112c457816331f9e35b146112a5578163350935201461128657816346c96aac1461125e5781634bc2a6571461120c578163544736e6146111e5578163715018a61461117457816378ef7f021461115557816379ba5097146110ba578163801512e4146110925781638da5cb5b1461106a578163919840ad14611021578163a2e23a5114611005578163a9abf7ec14610fe1578163a9c1f2f114610fc2578163aaf5eb6814610fa5578163b1551b9514610f75578163be9a655514610eaa578163c0c53b8b14610b5457838263c2d542b0146109ad57508163c3d6f2c814610986578163c3df9a60146107d3578163ce5ec92e14610781578163cfc6c8ff14610764578163d139960814610745578163e038c75a14610721578163e30c3978146106f9578163ed29fc1114610303578163ef4b13b0146102e4578163ef78d4fd1461029d57508063f2fde38b14610222578063f4359ce5146102055763f8029ce1146101d457600080fd5b346102015781600319360112610201576020906127106101f9609c54609854906114ff565b049051908152f35b5080fd5b50346102015781600319360112610201576020905162093a808152f35b823461029a57602060031936011261029a5761023c6113c3565b610244611436565b6001600160a01b03809116908173ffffffffffffffffffffffffffffffffffffffff196065541617606555603354167f38d16b8cac22d99fc7c124b9cd0de2d3fa1faef420bfe791d8c362d765e227008380a380f35b80fd5b83833461020157816003193601126102015762093a80918242048381029381850414901517156102d1576020838351908152f35b80601185634e487b7160e01b6024945252fd5b505034610201578160031936011261020157602090609e549051908152f35b9190503461058b578260031936011261058b57609d549162093a80908184018085116106e657421015806106d7575b610341575b6020848451908152f35b9080935042048381029381850414901517156106c45782609d5560a25442101561036c575b80610337565b60975460ff81166106b857506103806117b6565b609c555b609c5490612710610397609b54846114ff565b0490856103a48385611689565b6001600160a01b0380609f5416948751957f70a0823100000000000000000000000000000000000000000000000000000000875230868801526020968781602481855afa9081156106ae57908892918791610675575b508981106105e3575b505061045d9183609f54168460335416878c518096819582947fa9059cbb0000000000000000000000000000000000000000000000000000000084528d8401602090939291936001600160a01b0360408201951681520152565b03925af19081156105bc5784916105c6575b501561058b576104ce858383609f54168460a05416878c518096819582947f095ea7b30000000000000000000000000000000000000000000000000000000084528d8401602090939291936001600160a01b0360408201951681520152565b03925af180156105bc5761058f575b5060a0541692833b1561058b5760249083885195869485937f3c6b16ab0000000000000000000000000000000000000000000000000000000085528401525af1801561058157610569575b5060209450610535611696565b9083519283528201527f4c209b5fc8ad50758f13e2e1088ba56a560dff690a1c6fef26394f4c03821c4f823392a238610366565b6105738691611545565b61057d5784610528565b8480fd5b84513d88823e3d90fd5b8280fd5b6105ae90863d88116105b5575b6105a6818361156f565b810190611821565b50386104dd565b503d61059c565b88513d86823e3d90fd5b6105dd9150863d88116105b5576105a6818361156f565b3861046f565b6105ef91925089611689565b90803b156106715789517f40c10f19000000000000000000000000000000000000000000000000000000008152308882019081526020810193909352918691839182908490829060400103925af1801561066757879186911561040357610657919250611545565b61066357858438610403565b8380fd5b89513d87823e3d90fd5b8580fd5b92809297508391503d83116106a7575b61068f818361156f565b810103126106a2578a94879151386103fa565b600080fd5b503d610685565b8a513d88823e3d90fd5b60ff1916609755610384565b836011602492634e487b7160e01b835252fd5b5060ff60975460081c16610332565b602486601184634e487b7160e01b835252fd5b5050346102015781600319360112610201576020906001600160a01b03606554169051908152f35b50503461020157816003193601126102015760209061073e611696565b9051908152f35b505034610201578160031936011261020157602090609d549051908152f35b50503461020157816003193601126102015760209061073e6117b6565b833461029a57602060031936011261029a576001600160a01b036107a36113c3565b6107ab611436565b1680156102015773ffffffffffffffffffffffffffffffffffffffff1960a154161760a15580f35b8383346102015781600319360112610201576107ed611436565b61ffff19825460ff8160081c161580610979575b61080a9061148e565b166101038117835560ff60975460081c1680610963575b806108d7575b1561089457610837609d54611528565b60a255609e5462093a808101809111610881579160036020927f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb384740249894609e551784555160038152a180f35b602484601187634e487b7160e01b835252fd5b606484602084519162461bcd60e51b8352820152601f60248201527f496e76616c696420636f6e747261637420737461746520666f722063616c6c006044820152fd5b508360206001600160a01b03609f54168451928380926318160ddd60e01b82525afa801561095657849061091a575b6a3e09de2596099e2b000000915014610827565b506020813d821161094e575b816109336020938361156f565b810103126106a2576a3e09de2596099e2b0000009051610906565b3d9150610926565b50505051903d90823e3d90fd5b506a01dc74be914d16aa400000609c5414610821565b50600360ff821610610801565b5050346102015781600319360112610201576020906127106101f9609c54609954906114ff565b9150346102015781600319360112610201576109c7611436565b61010261ffff19835460ff8160081c161580610b47575b6109e79061148e565b16178255610a02692fa54641bae8aaa00000609c5414611621565b6001600160a01b03609f54169083516318160ddd60e01b81526020818381865afa908115610b3d578491610afc575b506a06342fd08f00f637800000610a489114611621565b813b1561058b57829160448392865194859384927f40c10f1900000000000000000000000000000000000000000000000000000000845233908401526a37d5ae550708a7f380000060248401525af1801561095657610ae8575b507f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024986020836a01dc74be914d16aa400000609c5561ff001984541684555160028152a180f35b610af190611545565b610201578138610aa2565b9350506020833d8211610b35575b81610b176020938361156f565b810103126106a25791518492906a06342fd08f00f637800000610a31565b3d9150610b0a565b85513d86823e3d90fd5b50600260ff8216106109de565b90503461058b57606060031936011261058b57610b6f6113c3565b90602435906001600160a01b03918281168091036106715760443592808416809403610d9c57865460ff8160081c161595868097610e9d575b8015610e86575b610bb89061148e565b60ff1991876001848316178b55610e75575b50828116908115610e4d5789734300000000000000000000000000000000000002803b1561020157819060648c51809481937fc8992e6100000000000000000000000000000000000000000000000000000000835260028d840152600160248401528860448401525af18015610e4357610e2e575b509089913b610dc5575b5090610c6660ff6001935460081c16610c61816115b0565b6115b0565b610c6f336113d9565b60975416176097556101f4609b55606460985560966099556008609a5562093a8080610c9a42611528565b04818102918183041490151715610db257609d55692fa54641bae8aaa00000609c556020865180947ffc0c546a00000000000000000000000000000000000000000000000000000000825281875afa928315610da8578793610d68575b5073ffffffffffffffffffffffffffffffffffffffff19921682609f541617609f558160a054161760a05560a154161760a155610d32575080f35b60207f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989161ff001984541684555160018152a180f35b9092506020813d8211610da0575b81610d836020938361156f565b81010312610d9c57518281168103610d9c579138610cf7565b8680fd5b3d9150610d76565b86513d89823e3d90fd5b602488601186634e487b7160e01b835252fd5b803b156102015781809160248b51809481937f2ab9d8b8000000000000000000000000000000000000000000000000000000008352308c8401525af18015610e245715610c4957610e1590611545565b610e20578738610c49565b8780fd5b89513d84823e3d90fd5b610e3b909a91929a611545565b989038610c3f565b8a513d8d823e3d90fd5b8589517f9fabe1c1000000000000000000000000000000000000000000000000000000008152fd5b61ffff191661010117895538610bca565b50303b158015610baf575060ff8216600114610baf565b50600160ff831610610ba8565b838334610201578160031936011261020157610ec4611436565b6097549060ff8260081c16610f33575061ff001961010091161760975562093a8080420481810290808204831490151715610f205780609d55609a54828102928184041490151715610f205790610f1a91611538565b609e5580f35b602483601186634e487b7160e01b835252fd5b5162461bcd60e51b8152602081850152600f60248201527f416c7265616479207374617274656400000000000000000000000000000000006044820152606490fd5b8390346102015760206003193601126102015735610f91611436565b610f9f61271082111561163e565b60995580f35b505034610201578160031936011261020157602090516127108152f35b5050346102015781600319360112610201576020906098549051908152f35b50503461020157816003193601126102015760209060ff6097541690519015158152f35b5050346102015781600319360112610201576020905160148152f35b82843461029a578060031936011261029a57609d549062093a8082018092116102d15760208383421015908161105a575b519015158152f35b60975460081c60ff169150611052565b5050346102015781600319360112610201576020906001600160a01b03603354169051908152f35b5050346102015781600319360112610201576020906001600160a01b03609f54169051908152f35b9190503461058b578260031936011261058b57336001600160a01b0360655416036110ec57826110e9336113d9565b80f35b906020608492519162461bcd60e51b8352820152602960248201527f4f776e61626c6532537465703a2063616c6c6572206973206e6f74207468652060448201527f6e6577206f776e657200000000000000000000000000000000000000000000006064820152fd5b505034610201578160031936011261020157602090609b549051908152f35b833461029a578060031936011261029a5761118d611436565b806001600160a01b0373ffffffffffffffffffffffffffffffffffffffff198060655416606555603354908116603355167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e08280a380f35b50503461020157816003193601126102015760209060ff60975460081c1690519015158152f35b833461029a57602060031936011261029a576001600160a01b0361122e6113c3565b611236611436565b1680156102015773ffffffffffffffffffffffffffffffffffffffff1960a054161760a05580f35b5050346102015781600319360112610201576020906001600160a01b0360a054169051908152f35b50503461020157816003193601126102015760209060a2549051908152f35b5050346102015781600319360112610201576020906099549051908152f35b83903461020157602060031936011261020157356112e0611436565b6112ee6101f482111561163e565b609b5580f35b505034610201578160031936011261020157602090609c549051908152f35b505034610201578160031936011261020157602090609a549051908152f35b5050346102015781600319360112610201576020906001600160a01b0360a154169051908152f35b50503461020157816003193601126102015760209061073e611793565b8390346102015760206003193601126102015735611393611436565b6113a161271082111561163e565b60985580f35b849034610201578160031936011261020157806101f460209252f35b600435906001600160a01b03821682036106a257565b73ffffffffffffffffffffffffffffffffffffffff199081606554166065556033546001600160a01b038092168093821617603355167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0600080a3565b6001600160a01b0360335416330361144a57565b606460405162461bcd60e51b815260206004820152602060248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152fd5b1561149557565b608460405162461bcd60e51b815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201527f647920696e697469616c697a65640000000000000000000000000000000000006064820152fd5b8181029291811591840414171561151257565b634e487b7160e01b600052601160045260246000fd5b9062127500820180921161151257565b9190820180921161151257565b67ffffffffffffffff811161155957604052565b634e487b7160e01b600052604160045260246000fd5b90601f7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0910116810190811067ffffffffffffffff82111761155957604052565b156115b757565b608460405162461bcd60e51b815260206004820152602b60248201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960448201527f6e697469616c697a696e670000000000000000000000000000000000000000006064820152fd5b1561162857565b634e487b7160e01b600052600160045260246000fd5b1561164557565b606460405162461bcd60e51b815260206004820152600d60248201527f7261746520746f6f2068696768000000000000000000000000000000000000006044820152fd5b9190820391821161151257565b6001600160a01b039081609f541691604051926318160ddd60e01b84526020938481600481855afa928315611755578591600094611761575b5060a154166024604051809481937f70a0823100000000000000000000000000000000000000000000000000000000835260048301525afa93841561175557600094611726575b5050916117239192611689565b90565b81813d831161174e575b61173a818361156f565b810103126106635751925061172338611716565b503d611730565b6040513d6000823e3d90fd5b9182819592953d831161178c575b611779818361156f565b8101031261029a575084905192386116cf565b503d61176f565b61179b611696565b60148102908082046014149015171561151257612710900490565b609c54609d54609e54106117dd57611723906127106117d7609954836114ff565b04611538565b6127106117ec609854836114ff565b048082101561181357505060005b611802611793565b8082111561180e575090565b905090565b61181c91611689565b6117fa565b908160209103126106a2575180151581036106a2579056fea164736f6c6343000813000a00000000000000000000000072e47b1eaaaac6c07ea4071f1d0d355f603e1cc1
Deployed Bytecode
0x608060408181526004918236101561001657600080fd5b600092833560e01c91826301c8e6fd146113a75750816304e7e0b9146113775781631eebae801461135a5781631f8507161461133257816321c9a85b1461131357816326cfc17b146112f45781632e8f7b1f146112c457816331f9e35b146112a5578163350935201461128657816346c96aac1461125e5781634bc2a6571461120c578163544736e6146111e5578163715018a61461117457816378ef7f021461115557816379ba5097146110ba578163801512e4146110925781638da5cb5b1461106a578163919840ad14611021578163a2e23a5114611005578163a9abf7ec14610fe1578163a9c1f2f114610fc2578163aaf5eb6814610fa5578163b1551b9514610f75578163be9a655514610eaa578163c0c53b8b14610b5457838263c2d542b0146109ad57508163c3d6f2c814610986578163c3df9a60146107d3578163ce5ec92e14610781578163cfc6c8ff14610764578163d139960814610745578163e038c75a14610721578163e30c3978146106f9578163ed29fc1114610303578163ef4b13b0146102e4578163ef78d4fd1461029d57508063f2fde38b14610222578063f4359ce5146102055763f8029ce1146101d457600080fd5b346102015781600319360112610201576020906127106101f9609c54609854906114ff565b049051908152f35b5080fd5b50346102015781600319360112610201576020905162093a808152f35b823461029a57602060031936011261029a5761023c6113c3565b610244611436565b6001600160a01b03809116908173ffffffffffffffffffffffffffffffffffffffff196065541617606555603354167f38d16b8cac22d99fc7c124b9cd0de2d3fa1faef420bfe791d8c362d765e227008380a380f35b80fd5b83833461020157816003193601126102015762093a80918242048381029381850414901517156102d1576020838351908152f35b80601185634e487b7160e01b6024945252fd5b505034610201578160031936011261020157602090609e549051908152f35b9190503461058b578260031936011261058b57609d549162093a80908184018085116106e657421015806106d7575b610341575b6020848451908152f35b9080935042048381029381850414901517156106c45782609d5560a25442101561036c575b80610337565b60975460ff81166106b857506103806117b6565b609c555b609c5490612710610397609b54846114ff565b0490856103a48385611689565b6001600160a01b0380609f5416948751957f70a0823100000000000000000000000000000000000000000000000000000000875230868801526020968781602481855afa9081156106ae57908892918791610675575b508981106105e3575b505061045d9183609f54168460335416878c518096819582947fa9059cbb0000000000000000000000000000000000000000000000000000000084528d8401602090939291936001600160a01b0360408201951681520152565b03925af19081156105bc5784916105c6575b501561058b576104ce858383609f54168460a05416878c518096819582947f095ea7b30000000000000000000000000000000000000000000000000000000084528d8401602090939291936001600160a01b0360408201951681520152565b03925af180156105bc5761058f575b5060a0541692833b1561058b5760249083885195869485937f3c6b16ab0000000000000000000000000000000000000000000000000000000085528401525af1801561058157610569575b5060209450610535611696565b9083519283528201527f4c209b5fc8ad50758f13e2e1088ba56a560dff690a1c6fef26394f4c03821c4f823392a238610366565b6105738691611545565b61057d5784610528565b8480fd5b84513d88823e3d90fd5b8280fd5b6105ae90863d88116105b5575b6105a6818361156f565b810190611821565b50386104dd565b503d61059c565b88513d86823e3d90fd5b6105dd9150863d88116105b5576105a6818361156f565b3861046f565b6105ef91925089611689565b90803b156106715789517f40c10f19000000000000000000000000000000000000000000000000000000008152308882019081526020810193909352918691839182908490829060400103925af1801561066757879186911561040357610657919250611545565b61066357858438610403565b8380fd5b89513d87823e3d90fd5b8580fd5b92809297508391503d83116106a7575b61068f818361156f565b810103126106a2578a94879151386103fa565b600080fd5b503d610685565b8a513d88823e3d90fd5b60ff1916609755610384565b836011602492634e487b7160e01b835252fd5b5060ff60975460081c16610332565b602486601184634e487b7160e01b835252fd5b5050346102015781600319360112610201576020906001600160a01b03606554169051908152f35b50503461020157816003193601126102015760209061073e611696565b9051908152f35b505034610201578160031936011261020157602090609d549051908152f35b50503461020157816003193601126102015760209061073e6117b6565b833461029a57602060031936011261029a576001600160a01b036107a36113c3565b6107ab611436565b1680156102015773ffffffffffffffffffffffffffffffffffffffff1960a154161760a15580f35b8383346102015781600319360112610201576107ed611436565b61ffff19825460ff8160081c161580610979575b61080a9061148e565b166101038117835560ff60975460081c1680610963575b806108d7575b1561089457610837609d54611528565b60a255609e5462093a808101809111610881579160036020927f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb384740249894609e551784555160038152a180f35b602484601187634e487b7160e01b835252fd5b606484602084519162461bcd60e51b8352820152601f60248201527f496e76616c696420636f6e747261637420737461746520666f722063616c6c006044820152fd5b508360206001600160a01b03609f54168451928380926318160ddd60e01b82525afa801561095657849061091a575b6a3e09de2596099e2b000000915014610827565b506020813d821161094e575b816109336020938361156f565b810103126106a2576a3e09de2596099e2b0000009051610906565b3d9150610926565b50505051903d90823e3d90fd5b506a01dc74be914d16aa400000609c5414610821565b50600360ff821610610801565b5050346102015781600319360112610201576020906127106101f9609c54609954906114ff565b9150346102015781600319360112610201576109c7611436565b61010261ffff19835460ff8160081c161580610b47575b6109e79061148e565b16178255610a02692fa54641bae8aaa00000609c5414611621565b6001600160a01b03609f54169083516318160ddd60e01b81526020818381865afa908115610b3d578491610afc575b506a06342fd08f00f637800000610a489114611621565b813b1561058b57829160448392865194859384927f40c10f1900000000000000000000000000000000000000000000000000000000845233908401526a37d5ae550708a7f380000060248401525af1801561095657610ae8575b507f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024986020836a01dc74be914d16aa400000609c5561ff001984541684555160028152a180f35b610af190611545565b610201578138610aa2565b9350506020833d8211610b35575b81610b176020938361156f565b810103126106a25791518492906a06342fd08f00f637800000610a31565b3d9150610b0a565b85513d86823e3d90fd5b50600260ff8216106109de565b90503461058b57606060031936011261058b57610b6f6113c3565b90602435906001600160a01b03918281168091036106715760443592808416809403610d9c57865460ff8160081c161595868097610e9d575b8015610e86575b610bb89061148e565b60ff1991876001848316178b55610e75575b50828116908115610e4d5789734300000000000000000000000000000000000002803b1561020157819060648c51809481937fc8992e6100000000000000000000000000000000000000000000000000000000835260028d840152600160248401528860448401525af18015610e4357610e2e575b509089913b610dc5575b5090610c6660ff6001935460081c16610c61816115b0565b6115b0565b610c6f336113d9565b60975416176097556101f4609b55606460985560966099556008609a5562093a8080610c9a42611528565b04818102918183041490151715610db257609d55692fa54641bae8aaa00000609c556020865180947ffc0c546a00000000000000000000000000000000000000000000000000000000825281875afa928315610da8578793610d68575b5073ffffffffffffffffffffffffffffffffffffffff19921682609f541617609f558160a054161760a05560a154161760a155610d32575080f35b60207f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989161ff001984541684555160018152a180f35b9092506020813d8211610da0575b81610d836020938361156f565b81010312610d9c57518281168103610d9c579138610cf7565b8680fd5b3d9150610d76565b86513d89823e3d90fd5b602488601186634e487b7160e01b835252fd5b803b156102015781809160248b51809481937f2ab9d8b8000000000000000000000000000000000000000000000000000000008352308c8401525af18015610e245715610c4957610e1590611545565b610e20578738610c49565b8780fd5b89513d84823e3d90fd5b610e3b909a91929a611545565b989038610c3f565b8a513d8d823e3d90fd5b8589517f9fabe1c1000000000000000000000000000000000000000000000000000000008152fd5b61ffff191661010117895538610bca565b50303b158015610baf575060ff8216600114610baf565b50600160ff831610610ba8565b838334610201578160031936011261020157610ec4611436565b6097549060ff8260081c16610f33575061ff001961010091161760975562093a8080420481810290808204831490151715610f205780609d55609a54828102928184041490151715610f205790610f1a91611538565b609e5580f35b602483601186634e487b7160e01b835252fd5b5162461bcd60e51b8152602081850152600f60248201527f416c7265616479207374617274656400000000000000000000000000000000006044820152606490fd5b8390346102015760206003193601126102015735610f91611436565b610f9f61271082111561163e565b60995580f35b505034610201578160031936011261020157602090516127108152f35b5050346102015781600319360112610201576020906098549051908152f35b50503461020157816003193601126102015760209060ff6097541690519015158152f35b5050346102015781600319360112610201576020905160148152f35b82843461029a578060031936011261029a57609d549062093a8082018092116102d15760208383421015908161105a575b519015158152f35b60975460081c60ff169150611052565b5050346102015781600319360112610201576020906001600160a01b03603354169051908152f35b5050346102015781600319360112610201576020906001600160a01b03609f54169051908152f35b9190503461058b578260031936011261058b57336001600160a01b0360655416036110ec57826110e9336113d9565b80f35b906020608492519162461bcd60e51b8352820152602960248201527f4f776e61626c6532537465703a2063616c6c6572206973206e6f74207468652060448201527f6e6577206f776e657200000000000000000000000000000000000000000000006064820152fd5b505034610201578160031936011261020157602090609b549051908152f35b833461029a578060031936011261029a5761118d611436565b806001600160a01b0373ffffffffffffffffffffffffffffffffffffffff198060655416606555603354908116603355167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e08280a380f35b50503461020157816003193601126102015760209060ff60975460081c1690519015158152f35b833461029a57602060031936011261029a576001600160a01b0361122e6113c3565b611236611436565b1680156102015773ffffffffffffffffffffffffffffffffffffffff1960a054161760a05580f35b5050346102015781600319360112610201576020906001600160a01b0360a054169051908152f35b50503461020157816003193601126102015760209060a2549051908152f35b5050346102015781600319360112610201576020906099549051908152f35b83903461020157602060031936011261020157356112e0611436565b6112ee6101f482111561163e565b609b5580f35b505034610201578160031936011261020157602090609c549051908152f35b505034610201578160031936011261020157602090609a549051908152f35b5050346102015781600319360112610201576020906001600160a01b0360a154169051908152f35b50503461020157816003193601126102015760209061073e611793565b8390346102015760206003193601126102015735611393611436565b6113a161271082111561163e565b60985580f35b849034610201578160031936011261020157806101f460209252f35b600435906001600160a01b03821682036106a257565b73ffffffffffffffffffffffffffffffffffffffff199081606554166065556033546001600160a01b038092168093821617603355167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0600080a3565b6001600160a01b0360335416330361144a57565b606460405162461bcd60e51b815260206004820152602060248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152fd5b1561149557565b608460405162461bcd60e51b815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201527f647920696e697469616c697a65640000000000000000000000000000000000006064820152fd5b8181029291811591840414171561151257565b634e487b7160e01b600052601160045260246000fd5b9062127500820180921161151257565b9190820180921161151257565b67ffffffffffffffff811161155957604052565b634e487b7160e01b600052604160045260246000fd5b90601f7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0910116810190811067ffffffffffffffff82111761155957604052565b156115b757565b608460405162461bcd60e51b815260206004820152602b60248201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960448201527f6e697469616c697a696e670000000000000000000000000000000000000000006064820152fd5b1561162857565b634e487b7160e01b600052600160045260246000fd5b1561164557565b606460405162461bcd60e51b815260206004820152600d60248201527f7261746520746f6f2068696768000000000000000000000000000000000000006044820152fd5b9190820391821161151257565b6001600160a01b039081609f541691604051926318160ddd60e01b84526020938481600481855afa928315611755578591600094611761575b5060a154166024604051809481937f70a0823100000000000000000000000000000000000000000000000000000000835260048301525afa93841561175557600094611726575b5050916117239192611689565b90565b81813d831161174e575b61173a818361156f565b810103126106635751925061172338611716565b503d611730565b6040513d6000823e3d90fd5b9182819592953d831161178c575b611779818361156f565b8101031261029a575084905192386116cf565b503d61176f565b61179b611696565b60148102908082046014149015171561151257612710900490565b609c54609d54609e54106117dd57611723906127106117d7609954836114ff565b04611538565b6127106117ec609854836114ff565b048082101561181357505060005b611802611793565b8082111561180e575090565b905090565b61181c91611689565b6117fa565b908160209103126106a2575180151581036106a2579056fea164736f6c6343000813000a
Constructor Arguments (ABI-Encoded and is the last bytes of the Contract Creation Code above)
00000000000000000000000072e47b1eaaaac6c07ea4071f1d0d355f603e1cc1
-----Decoded View---------------
Arg [0] : blastGovernor_ (address): 0x72e47b1eaAAaC6c07Ea4071f1d0d355f603E1cc1
-----Encoded View---------------
1 Constructor Arguments found :
Arg [0] : 00000000000000000000000072e47b1eaaaac6c07ea4071f1d0d355f603e1cc1
Loading...
Loading
Loading...
Loading
Loading...
Loading
Net Worth in USD
$0.00
Net Worth in ETH
0
Multichain Portfolio | 35 Chains
| Chain | Token | Portfolio % | Price | Amount | Value |
|---|
Loading...
Loading
Loading...
Loading
Loading...
Loading
A contract address hosts a smart contract, which is a set of code stored on the blockchain that runs when predetermined conditions are met. Learn more about addresses in our Knowledge Base.