Source Code
Overview
HYPE Balance
HYPE Value
$0.00View more zero value Internal Transactions in Advanced View mode
Advanced mode:
Cross-Chain Transactions
Loading...
Loading
Contract Name:
GaugeUpgradeable
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: MIT
pragma solidity =0.8.19;
import {ReentrancyGuardUpgradeable} from "@openzeppelin/contracts-upgradeable/security/ReentrancyGuardUpgradeable.sol";
import {SafeERC20, IERC20} from "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";
import {Math} from "@openzeppelin/contracts/utils/math/Math.sol";
import {IGaugeFactory} from "./interfaces/IGaugeFactory.sol";
import {IRewarder} from "./interfaces/IRewarder.sol";
import {IMerklGaugeMiddleman} from "../integration/interfaces/IMerklGaugeMiddleman.sol";
import {IPairIntegrationInfo} from "../integration/interfaces/IPairIntegrationInfo.sol";
import {IPairInfo} from "../dexV2/interfaces/IPairInfo.sol";
import {IPair} from "../dexV2/interfaces/IPair.sol";
import {IBribe} from "../bribes/interfaces/IBribe.sol";
import {IGauge} from "./interfaces/IGauge.sol";
import {IFeesVault} from "../fees/interfaces/IFeesVault.sol";
import {UpgradeCall} from "../integration/UpgradeCall.sol";
contract GaugeUpgradeable is IGauge, ReentrancyGuardUpgradeable, UpgradeCall {
using SafeERC20 for IERC20;
enum GaugeType {
None,
V2PairsGauge,
V3PairsGauge
}
GaugeType public immutable gaugeType;
bool public isDistributeEmissionToMerkle;
bool public emergency;
IERC20 public rewardToken;
address public TOKEN;
address public VE;
address public DISTRIBUTION;
address public gaugeRewarder;
address public internal_bribe;
address public external_bribe;
address public feeVault;
address public gaugeFactory;
address public merklGaugeMiddleman;
uint256 public DURATION;
uint256 internal _periodFinish;
uint256 public rewardRate;
uint256 public lastUpdateTime;
uint256 public rewardPerTokenStored;
mapping(address => uint256) public userRewardPerTokenPaid;
mapping(address => uint256) public rewards;
uint256 internal _totalSupply;
mapping(address => uint256) internal _balances;
event RewardAdded(uint256 reward);
event Deposit(address indexed user, uint256 amount);
event Withdraw(address indexed user, uint256 amount);
event Harvest(address indexed user, uint256 reward);
event ClaimFees(address indexed from, uint256 claimed0, uint256 claimed1);
event EmergencyActivated(address indexed gauge, uint256 timestamp);
event EmergencyDeactivated(address indexed gauge, uint256 timestamp);
modifier updateReward(address account) {
rewardPerTokenStored = rewardPerToken();
lastUpdateTime = lastTimeRewardApplicable();
if (account != address(0)) {
rewards[account] = earned(account);
userRewardPerTokenPaid[account] = rewardPerTokenStored;
}
_;
}
modifier onlyDistribution() {
require(msg.sender == DISTRIBUTION, "Caller is not RewardsDistribution contract");
_;
}
modifier isNotEmergency() {
require(emergency == false);
_;
}
constructor(GaugeType gaugeType_) {
_disableInitializers();
gaugeType = gaugeType_;
}
function initialize(
address _rewardToken,
address _ve,
address _token,
address _distribution,
address _internal_bribe,
address _external_bribe,
bool _isDistributeEmissionToMerkle,
address _merklGaugeMiddleman,
address _feeVault
) external initializer {
__ReentrancyGuard_init();
gaugeFactory = msg.sender;
rewardToken = IERC20(_rewardToken); // main reward
VE = _ve; // vested
TOKEN = _token; // underlying (LP)
DISTRIBUTION = _distribution; // distro address (voter)
DURATION = 7 * 86400; // distro time
internal_bribe = _internal_bribe; // lp fees goes here
external_bribe = _external_bribe; // bribe fees goes here
isDistributeEmissionToMerkle = _isDistributeEmissionToMerkle;
if (_isDistributeEmissionToMerkle) {
require(_merklGaugeMiddleman != address(0), "not setup merklGaugeMiddleman");
}
merklGaugeMiddleman = _merklGaugeMiddleman;
feeVault = _feeVault;
emergency = false; // emergency flag
}
/* -----------------------------------------------------------------------------
--------------------------------------------------------------------------------
--------------------------------------------------------------------------------
ONLY OWNER
--------------------------------------------------------------------------------
--------------------------------------------------------------------------------
----------------------------------------------------------------------------- */
modifier onlyOwner() {
require(msg.sender == IGaugeFactory(gaugeFactory).gaugeOwner());
_;
}
///@notice set distribution address (should be GaugeProxyL2)
function setDistribution(address _distribution) external onlyOwner {
require(_distribution != address(0), "zero addr");
require(_distribution != DISTRIBUTION, "same addr");
DISTRIBUTION = _distribution;
}
///@notice set distribution address (should be GaugeProxyL2)
function setMerklGaugeMiddleman(address _newMerklGaugeMiddleman) external onlyOwner {
require(_newMerklGaugeMiddleman != address(0));
merklGaugeMiddleman = _newMerklGaugeMiddleman;
}
///@notice set distribution address (should be GaugeProxyL2)
function setIsDistributeEmissionToMerkle(bool _isDistributeEmissionToMerkle) external onlyOwner {
if (_isDistributeEmissionToMerkle) {
require(merklGaugeMiddleman != address(0));
}
isDistributeEmissionToMerkle = _isDistributeEmissionToMerkle;
}
///@notice set gauge rewarder address
function setGaugeRewarder(address _gaugeRewarder) external onlyOwner {
require(_gaugeRewarder != gaugeRewarder, "same addr");
gaugeRewarder = _gaugeRewarder;
}
///@notice set feeVault address
function setFeeVault(address _feeVault) external onlyOwner {
require(_feeVault != address(0), "zero addr");
require(_feeVault != feeVault, "same addr");
feeVault = _feeVault;
}
///@notice set new internal bribe contract (where to send fees)
function setInternalBribe(address _int) external onlyOwner {
require(_int != address(0), "zero");
internal_bribe = _int;
}
function activateEmergencyMode() external onlyOwner {
require(emergency == false, "emergency");
emergency = true;
emit EmergencyActivated(address(this), block.timestamp);
}
function stopEmergencyMode() external onlyOwner {
require(emergency == true, "emergency");
emergency = false;
emit EmergencyDeactivated(address(this), block.timestamp);
}
/* -----------------------------------------------------------------------------
--------------------------------------------------------------------------------
--------------------------------------------------------------------------------
VIEW FUNCTIONS
--------------------------------------------------------------------------------
--------------------------------------------------------------------------------
----------------------------------------------------------------------------- */
///@notice total supply held
function totalSupply() public view returns (uint256) {
return _totalSupply;
}
///@notice balance of a user
function balanceOf(address account) external view returns (uint256) {
return _balances[account];
}
///@notice last time reward
function lastTimeRewardApplicable() public view returns (uint256) {
return Math.min(block.timestamp, _periodFinish);
}
///@notice reward for a single token
function rewardPerToken() public view returns (uint256) {
if (_totalSupply == 0) {
return rewardPerTokenStored;
} else {
return rewardPerTokenStored + ((lastTimeRewardApplicable() - lastUpdateTime) * rewardRate * 1e18) / _totalSupply;
}
}
///@notice see earned rewards for user
function earned(address account) public view returns (uint256) {
return rewards[account] + (_balances[account] * (rewardPerToken() - userRewardPerTokenPaid[account])) / 1e18;
}
///@notice get total reward for the duration
function rewardForDuration() external view returns (uint256) {
return rewardRate * DURATION;
}
function periodFinish() external view returns (uint256) {
return _periodFinish;
}
/* -----------------------------------------------------------------------------
--------------------------------------------------------------------------------
--------------------------------------------------------------------------------
USER INTERACTION
--------------------------------------------------------------------------------
--------------------------------------------------------------------------------
----------------------------------------------------------------------------- */
///@notice deposit all TOKEN of msg.sender
function depositAll() external {
_deposit(IERC20(TOKEN).balanceOf(msg.sender), msg.sender);
}
///@notice deposit amount TOKEN
function deposit(uint256 amount) external {
_deposit(amount, msg.sender);
}
///@notice deposit internal
function _deposit(uint256 amount, address account) internal nonReentrant isNotEmergency updateReward(account) {
require(amount > 0, "deposit(Gauge): cannot stake 0");
_balances[account] = _balances[account] + (amount);
_totalSupply = _totalSupply + (amount);
IERC20(TOKEN).safeTransferFrom(account, address(this), amount);
if (address(gaugeRewarder) != address(0)) {
IRewarder(gaugeRewarder).onReward(account, account, _balances[account]);
}
emit Deposit(account, amount);
}
///@notice withdraw all token
function withdrawAll() external {
_withdraw(_balances[msg.sender]);
}
///@notice withdraw a certain amount of TOKEN
function withdraw(uint256 amount) external {
_withdraw(amount);
}
///@notice withdraw internal
function _withdraw(uint256 amount) internal nonReentrant isNotEmergency updateReward(msg.sender) {
require(amount > 0, "Cannot withdraw 0");
require(_balances[msg.sender] > 0, "no balances");
_totalSupply = _totalSupply - (amount);
_balances[msg.sender] = _balances[msg.sender] - (amount);
if (address(gaugeRewarder) != address(0)) {
IRewarder(gaugeRewarder).onReward(msg.sender, msg.sender, _balances[msg.sender]);
}
IERC20(TOKEN).safeTransfer(msg.sender, amount);
emit Withdraw(msg.sender, amount);
}
function emergencyWithdraw() external nonReentrant {
require(emergency, "emergency");
require(_balances[msg.sender] > 0, "no balances");
uint256 _amount = _balances[msg.sender];
_totalSupply = _totalSupply - (_amount);
_balances[msg.sender] = 0;
IERC20(TOKEN).safeTransfer(msg.sender, _amount);
emit Withdraw(msg.sender, _amount);
}
function emergencyWithdrawAmount(uint256 _amount) external nonReentrant {
require(emergency, "emergency");
require(_balances[msg.sender] >= _amount, "no balances");
_totalSupply = _totalSupply - (_amount);
_balances[msg.sender] -= _amount;
IERC20(TOKEN).safeTransfer(msg.sender, _amount);
emit Withdraw(msg.sender, _amount);
}
///@notice withdraw all TOKEN and harvest rewardToken
function withdrawAllAndHarvest() external {
_withdraw(_balances[msg.sender]);
getReward();
}
///@notice User harvest function called from distribution (voter allows harvest on multiple gauges)
function getReward(address _user) public nonReentrant onlyDistribution updateReward(_user) {
uint256 reward = rewards[_user];
if (reward > 0) {
rewards[_user] = 0;
rewardToken.safeTransfer(_user, reward);
emit Harvest(_user, reward);
}
if (gaugeRewarder != address(0)) {
IRewarder(gaugeRewarder).onReward(_user, _user, _balances[_user]);
}
}
///@notice User harvest function
function getReward() public nonReentrant updateReward(msg.sender) {
uint256 reward = rewards[msg.sender];
if (reward > 0) {
rewards[msg.sender] = 0;
rewardToken.safeTransfer(msg.sender, reward);
emit Harvest(msg.sender, reward);
}
if (gaugeRewarder != address(0)) {
IRewarder(gaugeRewarder).onReward(msg.sender, msg.sender, _balances[msg.sender]);
}
}
/* -----------------------------------------------------------------------------
--------------------------------------------------------------------------------
--------------------------------------------------------------------------------
DISTRIBUTION
--------------------------------------------------------------------------------
--------------------------------------------------------------------------------
----------------------------------------------------------------------------- */
/// @dev Receive rewards from distribution
function notifyRewardAmount(
address token,
uint256 reward
) external nonReentrant isNotEmergency onlyDistribution updateReward(address(0)) {
require(token == address(rewardToken), "not rew token");
rewardToken.safeTransferFrom(DISTRIBUTION, address(this), reward);
if (isDistributeEmissionToMerkle) {
rewardToken.safeTransfer(merklGaugeMiddleman, reward);
IMerklGaugeMiddleman(merklGaugeMiddleman).notifyReward(address(this), 0);
} else {
if (block.timestamp >= _periodFinish) {
rewardRate = reward / (DURATION);
} else {
uint256 remaining = _periodFinish - (block.timestamp);
uint256 leftover = remaining * (rewardRate);
rewardRate = (reward + leftover) / DURATION;
}
// Ensure the provided reward amount is not more than the balance in the contract.
// This keeps the reward rate in the right range, preventing overflows due to
// very high values of rewardRate in the earned and rewardsPerToken functions;
// Reward + leftover must be less than 2^256 / 10^18 to avoid overflow.
uint256 balance = rewardToken.balanceOf(address(this));
require(rewardRate <= balance / (DURATION), "Provided reward too high");
}
lastUpdateTime = block.timestamp;
_periodFinish = block.timestamp + (DURATION);
emit RewardAdded(reward);
}
function claimFees() external nonReentrant returns (uint256 claimed0, uint256 claimed1) {
return _claimFees();
}
function _claimFees() internal returns (uint256 claimed0, uint256 claimed1) {
address _token = address(TOKEN);
(claimed0, claimed1) = IFeesVault(feeVault).claimFees();
if (gaugeType == GaugeType.V2PairsGauge) {
(uint256 poolClaimedToken0, uint256 poolClaimedToken1) = IPair(_token).claimFees();
claimed0 += poolClaimedToken0;
claimed1 += poolClaimedToken1;
}
if (claimed0 > 0 || claimed1 > 0) {
uint256 _fees0 = claimed0;
uint256 _fees1 = claimed1;
address _token0 = IPairIntegrationInfo(_token).token0();
address _token1 = IPairIntegrationInfo(_token).token1();
if (_fees0 > 0) {
IERC20(_token0).safeApprove(internal_bribe, 0);
IERC20(_token0).safeApprove(internal_bribe, _fees0);
IBribe(internal_bribe).notifyRewardAmount(_token0, _fees0);
}
if (_fees1 > 0) {
IERC20(_token1).safeApprove(internal_bribe, 0);
IERC20(_token1).safeApprove(internal_bribe, _fees1);
IBribe(internal_bribe).notifyRewardAmount(_token1, _fees1);
}
emit ClaimFees(msg.sender, claimed0, claimed1);
}
}
}// 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) (security/ReentrancyGuard.sol)
pragma solidity ^0.8.0;
import {Initializable} from "../proxy/utils/Initializable.sol";
/**
* @dev Contract module that helps prevent reentrant calls to a function.
*
* Inheriting from `ReentrancyGuard` will make the {nonReentrant} modifier
* available, which can be applied to functions to make sure there are no nested
* (reentrant) calls to them.
*
* Note that because there is a single `nonReentrant` guard, functions marked as
* `nonReentrant` may not call one another. This can be worked around by making
* those functions `private`, and then adding `external` `nonReentrant` entry
* points to them.
*
* TIP: If you would like to learn more about reentrancy and alternative ways
* to protect against it, check out our blog post
* https://blog.openzeppelin.com/reentrancy-after-istanbul/[Reentrancy After Istanbul].
*/
abstract contract ReentrancyGuardUpgradeable is Initializable {
// Booleans are more expensive than uint256 or any type that takes up a full
// word because each write operation emits an extra SLOAD to first read the
// slot's contents, replace the bits taken up by the boolean, and then write
// back. This is the compiler's defense against contract upgrades and
// pointer aliasing, and it cannot be disabled.
// The values being non-zero value makes deployment a bit more expensive,
// but in exchange the refund on every call to nonReentrant will be lower in
// amount. Since refunds are capped to a percentage of the total
// transaction's gas, it is best to keep them low in cases like this one, to
// increase the likelihood of the full refund coming into effect.
uint256 private constant _NOT_ENTERED = 1;
uint256 private constant _ENTERED = 2;
uint256 private _status;
function __ReentrancyGuard_init() internal onlyInitializing {
__ReentrancyGuard_init_unchained();
}
function __ReentrancyGuard_init_unchained() internal onlyInitializing {
_status = _NOT_ENTERED;
}
/**
* @dev Prevents a contract from calling itself, directly or indirectly.
* Calling a `nonReentrant` function from another `nonReentrant`
* function is not supported. It is possible to prevent this from happening
* by making the `nonReentrant` function external, and making it call a
* `private` function that does the actual work.
*/
modifier nonReentrant() {
_nonReentrantBefore();
_;
_nonReentrantAfter();
}
function _nonReentrantBefore() private {
// On the first call to nonReentrant, _status will be _NOT_ENTERED
require(_status != _ENTERED, "ReentrancyGuard: reentrant call");
// Any calls to nonReentrant after this point will fail
_status = _ENTERED;
}
function _nonReentrantAfter() private {
// By storing the original value once again, a refund is triggered (see
// https://eips.ethereum.org/EIPS/eip-2200)
_status = _NOT_ENTERED;
}
/**
* @dev Returns true if the reentrancy guard is currently set to "entered", which indicates there is a
* `nonReentrant` function in the call stack.
*/
function _reentrancyGuardEntered() internal view returns (bool) {
return _status == _ENTERED;
}
/**
* @dev This empty reserved space is put in place to allow future versions to add new
* variables without shifting down storage in the inheritance chain.
* See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps
*/
uint256[49] private __gap;
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (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) (token/ERC20/extensions/IERC20Permit.sol)
pragma solidity ^0.8.0;
/**
* @dev Interface of the ERC20 Permit extension allowing approvals to be made via signatures, as defined in
* https://eips.ethereum.org/EIPS/eip-2612[EIP-2612].
*
* Adds the {permit} method, which can be used to change an account's ERC20 allowance (see {IERC20-allowance}) by
* presenting a message signed by the account. By not relying on {IERC20-approve}, the token holder account doesn't
* need to send a transaction, and thus is not required to hold Ether at all.
*
* ==== Security Considerations
*
* There are two important considerations concerning the use of `permit`. The first is that a valid permit signature
* expresses an allowance, and it should not be assumed to convey additional meaning. In particular, it should not be
* considered as an intention to spend the allowance in any specific way. The second is that because permits have
* built-in replay protection and can be submitted by anyone, they can be frontrun. A protocol that uses permits should
* take this into consideration and allow a `permit` call to fail. Combining these two aspects, a pattern that may be
* generally recommended is:
*
* ```solidity
* function doThingWithPermit(..., uint256 value, uint256 deadline, uint8 v, bytes32 r, bytes32 s) public {
* try token.permit(msg.sender, address(this), value, deadline, v, r, s) {} catch {}
* doThing(..., value);
* }
*
* function doThing(..., uint256 value) public {
* token.safeTransferFrom(msg.sender, address(this), value);
* ...
* }
* ```
*
* Observe that: 1) `msg.sender` is used as the owner, leaving no ambiguity as to the signer intent, and 2) the use of
* `try/catch` allows the permit to fail and makes the code tolerant to frontrunning. (See also
* {SafeERC20-safeTransferFrom}).
*
* Additionally, note that smart contract wallets (such as Argent or Safe) are not able to produce permit signatures, so
* contracts should have entry points that don't rely on permit.
*/
interface IERC20Permit {
/**
* @dev Sets `value` as the allowance of `spender` over ``owner``'s tokens,
* given ``owner``'s signed approval.
*
* IMPORTANT: The same issues {IERC20-approve} has related to transaction
* ordering also apply here.
*
* Emits an {Approval} event.
*
* Requirements:
*
* - `spender` cannot be the zero address.
* - `deadline` must be a timestamp in the future.
* - `v`, `r` and `s` must be a valid `secp256k1` signature from `owner`
* over the EIP712-formatted function arguments.
* - the signature must use ``owner``'s current nonce (see {nonces}).
*
* For more information on the signature format, see the
* https://eips.ethereum.org/EIPS/eip-2612#specification[relevant EIP
* section].
*
* CAUTION: See Security Considerations above.
*/
function permit(
address owner,
address spender,
uint256 value,
uint256 deadline,
uint8 v,
bytes32 r,
bytes32 s
) external;
/**
* @dev Returns the current nonce for `owner`. This value must be
* included whenever a signature is generated for {permit}.
*
* Every successful call to {permit} increases ``owner``'s nonce by one. This
* prevents a signature from being used multiple times.
*/
function nonces(address owner) external view returns (uint256);
/**
* @dev Returns the domain separator used in the encoding of the signature for {permit}, as defined by {EIP712}.
*/
// solhint-disable-next-line func-name-mixedcase
function DOMAIN_SEPARATOR() external view returns (bytes32);
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.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.3) (token/ERC20/utils/SafeERC20.sol)
pragma solidity ^0.8.0;
import "../IERC20.sol";
import "../extensions/IERC20Permit.sol";
import "../../../utils/Address.sol";
/**
* @title SafeERC20
* @dev Wrappers around ERC20 operations that throw on failure (when the token
* contract returns false). Tokens that return no value (and instead revert or
* throw on failure) are also supported, non-reverting calls are assumed to be
* successful.
* To use this library you can add a `using SafeERC20 for IERC20;` statement to your contract,
* which allows you to call the safe operations as `token.safeTransfer(...)`, etc.
*/
library SafeERC20 {
using Address for address;
/**
* @dev Transfer `value` amount of `token` from the calling contract to `to`. If `token` returns no value,
* non-reverting calls are assumed to be successful.
*/
function safeTransfer(IERC20 token, address to, uint256 value) internal {
_callOptionalReturn(token, abi.encodeWithSelector(token.transfer.selector, to, value));
}
/**
* @dev Transfer `value` amount of `token` from `from` to `to`, spending the approval given by `from` to the
* calling contract. If `token` returns no value, non-reverting calls are assumed to be successful.
*/
function safeTransferFrom(IERC20 token, address from, address to, uint256 value) internal {
_callOptionalReturn(token, abi.encodeWithSelector(token.transferFrom.selector, from, to, value));
}
/**
* @dev Deprecated. This function has issues similar to the ones found in
* {IERC20-approve}, and its usage is discouraged.
*
* Whenever possible, use {safeIncreaseAllowance} and
* {safeDecreaseAllowance} instead.
*/
function safeApprove(IERC20 token, address spender, uint256 value) internal {
// safeApprove should only be called when setting an initial allowance,
// or when resetting it to zero. To increase and decrease it, use
// 'safeIncreaseAllowance' and 'safeDecreaseAllowance'
require(
(value == 0) || (token.allowance(address(this), spender) == 0),
"SafeERC20: approve from non-zero to non-zero allowance"
);
_callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, value));
}
/**
* @dev Increase the calling contract's allowance toward `spender` by `value`. If `token` returns no value,
* non-reverting calls are assumed to be successful.
*/
function safeIncreaseAllowance(IERC20 token, address spender, uint256 value) internal {
uint256 oldAllowance = token.allowance(address(this), spender);
_callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, oldAllowance + value));
}
/**
* @dev Decrease the calling contract's allowance toward `spender` by `value`. If `token` returns no value,
* non-reverting calls are assumed to be successful.
*/
function safeDecreaseAllowance(IERC20 token, address spender, uint256 value) internal {
unchecked {
uint256 oldAllowance = token.allowance(address(this), spender);
require(oldAllowance >= value, "SafeERC20: decreased allowance below zero");
_callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, oldAllowance - value));
}
}
/**
* @dev Set the calling contract's allowance toward `spender` to `value`. If `token` returns no value,
* non-reverting calls are assumed to be successful. Meant to be used with tokens that require the approval
* to be set to zero before setting it to a non-zero value, such as USDT.
*/
function forceApprove(IERC20 token, address spender, uint256 value) internal {
bytes memory approvalCall = abi.encodeWithSelector(token.approve.selector, spender, value);
if (!_callOptionalReturnBool(token, approvalCall)) {
_callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, 0));
_callOptionalReturn(token, approvalCall);
}
}
/**
* @dev Use a ERC-2612 signature to set the `owner` approval toward `spender` on `token`.
* Revert on invalid signature.
*/
function safePermit(
IERC20Permit token,
address owner,
address spender,
uint256 value,
uint256 deadline,
uint8 v,
bytes32 r,
bytes32 s
) internal {
uint256 nonceBefore = token.nonces(owner);
token.permit(owner, spender, value, deadline, v, r, s);
uint256 nonceAfter = token.nonces(owner);
require(nonceAfter == nonceBefore + 1, "SafeERC20: permit did not succeed");
}
/**
* @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement
* on the return value: the return value is optional (but if data is returned, it must not be false).
* @param token The token targeted by the call.
* @param data The call data (encoded using abi.encode or one of its variants).
*/
function _callOptionalReturn(IERC20 token, bytes memory data) private {
// We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since
// we're implementing it ourselves. We use {Address-functionCall} to perform this call, which verifies that
// the target address contains contract code and also asserts for success in the low-level call.
bytes memory returndata = address(token).functionCall(data, "SafeERC20: low-level call failed");
require(returndata.length == 0 || abi.decode(returndata, (bool)), "SafeERC20: ERC20 operation did not succeed");
}
/**
* @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement
* on the return value: the return value is optional (but if data is returned, it must not be false).
* @param token The token targeted by the call.
* @param data The call data (encoded using abi.encode or one of its variants).
*
* This is a variant of {_callOptionalReturn} that silents catches all reverts and returns a bool instead.
*/
function _callOptionalReturnBool(IERC20 token, bytes memory data) private returns (bool) {
// We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since
// we're implementing it ourselves. We cannot use {Address-functionCall} here since this should return false
// and not revert is the subcall reverts.
(bool success, bytes memory returndata) = address(token).call(data);
return
success && (returndata.length == 0 || abi.decode(returndata, (bool))) && Address.isContract(address(token));
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (utils/Address.sol)
pragma solidity ^0.8.1;
/**
* @dev Collection of functions related to the address type
*/
library Address {
/**
* @dev Returns true if `account` is a contract.
*
* [IMPORTANT]
* ====
* It is unsafe to assume that an address for which this function returns
* false is an externally-owned account (EOA) and not a contract.
*
* Among others, `isContract` will return false for the following
* types of addresses:
*
* - an externally-owned account
* - a contract in construction
* - an address where a contract will be created
* - an address where a contract lived, but was destroyed
*
* 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.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;
interface IBribe {
struct Reward {
uint256 periodFinish;
uint256 rewardsPerEpoch;
uint256 lastUpdateTime;
}
/* ========== EVENTS ========== */
event RewardAdded(address indexed rewardToken, uint256 reward, uint256 startTimestamp);
event Staked(uint256 indexed tokenId, uint256 amount);
event Withdrawn(uint256 indexed tokenId, uint256 amount);
event RewardPaid(address indexed user, address indexed rewardsToken, uint256 reward);
event Recovered(address indexed token, uint256 amount);
event AddRewardToken(address indexed token);
function deposit(uint amount, uint tokenId) external;
function withdraw(uint amount, uint tokenId) external;
function getRewardTokens() external view returns (address[] memory);
function getSpecificRewardTokens() external view returns (address[] memory);
function getRewardForOwner(uint tokenId, address[] memory tokens) external;
function getRewardForAddress(address _owner, address[] memory tokens) external;
function notifyRewardAmount(address token, uint amount) external;
function addRewardToken(address) external;
function addRewardTokens(address[] memory) external;
function initialize(address, address, string memory) external;
function firstBribeTimestamp() external view returns (uint256);
function totalSupplyAt(uint256 timestamp) external view returns (uint256);
function rewardData(address, uint256) external view returns (uint256 periodFinish, uint256 rewardsPerEpoch, uint256 lastUpdateTime);
function rewardsListLength() external view returns (uint256);
function getEpochStart() external view returns (uint256);
function earned(uint256 tokenId, address _rewardToken) external view returns (uint256);
function earned(address _owner, address _rewardToken) external view returns (uint256);
function balanceOfAt(uint256 tokenId, uint256 _timestamp) external view returns (uint256);
function balanceOf(uint256 tokenId) external view returns (uint256);
function getNextEpochStart() external view returns (uint256);
}// SPDX-License-Identifier: MIT
pragma solidity >=0.8.0;
interface IPair {
function setCommunityVault(address communityVault_) external;
function metadata() external view returns (uint dec0, uint dec1, uint r0, uint r1, bool st, address t0, address t1);
function claimFees() external returns (uint, uint);
function tokens() external view returns (address, address);
function token0() external view returns (address);
function token1() external view returns (address);
function transferFrom(address src, address dst, uint amount) external returns (bool);
function permit(address owner, address spender, uint value, uint deadline, uint8 v, bytes32 r, bytes32 s) external;
function swap(uint amount0Out, uint amount1Out, address to, bytes calldata data) external;
function burn(address to) external returns (uint amount0, uint amount1);
function mint(address to) external returns (uint liquidity);
function getReserves() external view returns (uint _reserve0, uint _reserve1, uint _blockTimestampLast);
function getAmountOut(uint, address) external view returns (uint);
function name() external view returns (string memory);
function symbol() external view returns (string memory);
function totalSupply() external view returns (uint);
function decimals() external view returns (uint8);
function claimable0(address _user) external view returns (uint);
function claimable1(address _user) external view returns (uint);
function isStable() external view returns (bool);
function initialize(
address token0,
address token1,
bool isStable,
address communityVault
) external;
function fees() external view returns (address);
}// SPDX-License-Identifier: MIT
pragma solidity >=0.8.0;
interface IPairInfo {
function token0() external view returns (address);
function reserve0() external view returns (uint);
function decimals0() external view returns (uint);
function token1() external view returns (address);
function reserve1() external view returns (uint);
function decimals1() external view returns (uint);
function isPair(address _pair) external view returns (bool);
}// SPDX-License-Identifier: MIT
pragma solidity >=0.8.0;
/**
* @title Fees Vault Interface
* @dev Interface for the FeesVault contract responsible for managing fee distribution.
* Defines the essential functions and events for fee claiming and configuration.
*/
interface IFeesVault {
/**
* @dev Emitted when fees are claimed from the gauge and distributed.
* @param pool Address of the liquidity pool.
* @param token0 Address of the first token in the pool.
* @param token1 Address of the second token in the pool.
* @param totalAmount0 Total amount of token0 distributed.
* @param totalAmount1 Total amount of token1 distributed.
*/
event Fees(address indexed pool, address indexed token0, address indexed token1, uint256 totalAmount0, uint256 totalAmount1);
/**
* @notice Emitted when fees are distributed to the gauge.
* @param token Address of the token distributed.
* @param recipient Address of the gauge receiving the fees.
* @param amount Amount of fees distributed.
*/
event FeesToGauge(address indexed token, address indexed recipient, uint256 amount);
/**
* @notice Emitted when fees are distributed to a recipient other than the gauge.
* @param token Address of the token distributed.
* @param recipient Address of the entity receiving the fees.
* @param amount Amount of fees distributed.
*/
event FeesToOtherRecipient(address indexed token, address indexed recipient, uint256 amount);
/**
* @dev Reverts if the caller is not authorized to perform the operation.
*/
error AccessDenied();
/**
* @dev Reverts if the pool address provided does not match the pool address stored for a gauge.
*/
error PoolMismatch();
/**
* @notice Gets the factory address associated with this fees vault.
* @return The address of the factory contract.
*/
function factory() external view returns (address);
/**
* @notice Gets the pool address associated with this fees vault.
* @return The address of the liquidity pool.
*/
function pool() external view returns (address);
/**
* @notice Claims accumulated fees for the calling gauge and distributes them according to configured rates.
* @dev Can only be called by an authorized gauge. Distributes fees in both tokens of the associated pool.
* @return gauge0 Amount of token0 distributed to the calling gauge.
* @return gauge1 Amount of token1 distributed to the calling gauge.
*/
function claimFees() external returns (uint256 gauge0, uint256 gauge1);
/**
* @notice Allows the contract owner to recover ERC20 tokens accidentally sent to this contract.
* @param token_ The ERC20 token address to recover.
* @param amount_ The amount of tokens to recover.
*/
function emergencyRecoverERC20(address token_, uint256 amount_) external;
/**
* @dev Initializes the contract with necessary configuration parameters.
* Can only be called once by the contract factory during the deployment process.
* @param factory_ Address of the contract factory for this vault.
* @param pool_ Address of the liquidity pool associated with this vault.
*/
function initialize(address factory_, address pool_) external;
}// SPDX-License-Identifier: MIT
pragma solidity >=0.8.0;
interface IGauge {
function TOKEN() external view returns (address);
function notifyRewardAmount(address token, uint amount) external;
function getReward(address account) external;
function earned(address account) external view returns (uint256);
function periodFinish() external view returns (uint256);
function rewardRate() external view returns (uint256);
function claimFees() external returns (uint claimed0, uint claimed1);
function balanceOf(address _account) external view returns (uint);
function totalSupply() external view returns (uint);
function setDistribution(address _distro) external;
function activateEmergencyMode() external;
function stopEmergencyMode() external;
function setInternalBribe(address intbribe) external;
function setGaugeRewarder(address _gr) external;
function setFeeVault(address _feeVault) external;
function initialize(
address _rewardToken,
address _ve,
address _token,
address _distribution,
address _internal_bribe,
address _external_bribe,
bool _isToMerkleDistributor,
address _merklGaugeMiddleman,
address _feeVault
) external;
}// SPDX-License-Identifier: MIT
pragma solidity >=0.8.0;
interface IGaugeFactory {
event GaugeImplementationChanged(address _oldGaugeImplementation, address _newGaugeImplementation);
function createGauge(
address _rewardToken,
address _ve,
address _token,
address _distribution,
address _internal_bribe,
address _external_bribe,
bool _isDistributeEmissionToMerkle,
address _feeVault
) external returns (address);
function gaugeImplementation() external view returns (address impl);
function merklGaugeMiddleman() external view returns (address);
function gaugeOwner() external view returns (address);
}// SPDX-License-Identifier: MIT
pragma solidity =0.8.19;
interface IRewarder {
function onReward(address user, address recipient, uint256 userBalance) external;
}// SPDX-License-Identifier: MIT
pragma solidity >=0.8.0;
/**
* @title IMerklGaugeMiddleman Interface
* @dev Interface for the MerklGaugeMiddleman contract, which acts as an intermediary
* between Gauges and a DistributionCreator to manage reward distributions.
*/
interface IMerklGaugeMiddleman {
/**
* @dev Emitted when a gauge's parameters are set or updated.
* @param gauge Address of the gauge for which parameters are set
*/
event GaugeSet(address indexed gauge);
/**
* @dev Emitted when a distribution is created for a gauge.
* @param sender Address of the entity initiating the distribution
* @param gauge Address of the gauge for which the distribution is created
* @param amount The amount of tokens used from the gauge for distribution
* @param distributionAmount The total amount distributed to participants
*/
event CreateDistribution(address indexed sender, address indexed gauge, uint256 indexed amount, uint256 distributionAmount);
/// @dev Error thrown when the parameters provided to a function are invalid.
error InvalidParams();
/**
* @dev Notifies the contract about a reward for a specific gauge.
* This function is intended to be called by the gauge contract itself or an authorized entity.
* @param gauge_ Address of the gauge to notify about the reward
* @param amount_ Amount of reward tokens to be distributed
*/
function notifyReward(address gauge_, uint256 amount_) external;
/**
* @dev Transfers reward tokens from the caller and notifies the contract about a reward for a specific gauge.
* This combines the token transfer and notification into a single transaction for efficiency.
* @param gauge_ Address of the gauge to notify about the reward
* @param amount_ Amount of reward tokens to be transferred and then distributed
*/
function notifyRewardWithTransfer(address gauge_, uint256 amount_) external;
}// SPDX-License-Identifier: MIT
pragma solidity >=0.8.0;
interface IPairIntegrationInfo {
/// @notice The first of the two tokens of the pool, sorted by address
/// @return The token contract address
function token0() external view returns (address);
/// @notice The second of the two tokens of the pool, sorted by address
/// @return The token contract address
function token1() external view returns (address);
/// @notice The contract to which community fees are transferred
/// @return communityVaultAddress The communityVault address
function communityVault() external view returns (address);
}// SPDX-License-Identifier: MIT
pragma solidity >=0.8.0;
interface IUpgradeCall {
function upgradeCall() external;
}// SPDX-License-Identifier: MIT
pragma solidity =0.8.19;
import {IUpgradeCall} from "./interfaces/IUgradeCall.sol";
abstract contract UpgradeCall is IUpgradeCall {
function upgradeCall() external virtual override {}
}{
"evmVersion": "paris",
"viaIR": true,
"optimizer": {
"enabled": true,
"runs": 2000
},
"metadata": {
"bytecodeHash": "none"
},
"outputSelection": {
"*": {
"*": [
"evm.bytecode",
"evm.deployedBytecode",
"devdoc",
"userdoc",
"metadata",
"abi"
]
}
}
}Contract Security Audit
- No Contract Security Audit Submitted- Submit Audit Here
Contract ABI
API[{"inputs":[{"internalType":"enum GaugeUpgradeable.GaugeType","name":"gaugeType_","type":"uint8"}],"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"from","type":"address"},{"indexed":false,"internalType":"uint256","name":"claimed0","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"claimed1","type":"uint256"}],"name":"ClaimFees","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"user","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"Deposit","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"gauge","type":"address"},{"indexed":false,"internalType":"uint256","name":"timestamp","type":"uint256"}],"name":"EmergencyActivated","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"gauge","type":"address"},{"indexed":false,"internalType":"uint256","name":"timestamp","type":"uint256"}],"name":"EmergencyDeactivated","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"user","type":"address"},{"indexed":false,"internalType":"uint256","name":"reward","type":"uint256"}],"name":"Harvest","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint8","name":"version","type":"uint8"}],"name":"Initialized","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"reward","type":"uint256"}],"name":"RewardAdded","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"user","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"Withdraw","type":"event"},{"inputs":[],"name":"DISTRIBUTION","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"DURATION","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"TOKEN","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"VE","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"activateEmergencyMode","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"account","type":"address"}],"name":"balanceOf","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"claimFees","outputs":[{"internalType":"uint256","name":"claimed0","type":"uint256"},{"internalType":"uint256","name":"claimed1","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"deposit","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"depositAll","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"account","type":"address"}],"name":"earned","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"emergency","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"emergencyWithdraw","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_amount","type":"uint256"}],"name":"emergencyWithdrawAmount","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"external_bribe","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"feeVault","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"gaugeFactory","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"gaugeRewarder","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"gaugeType","outputs":[{"internalType":"enum GaugeUpgradeable.GaugeType","name":"","type":"uint8"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getReward","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_user","type":"address"}],"name":"getReward","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_rewardToken","type":"address"},{"internalType":"address","name":"_ve","type":"address"},{"internalType":"address","name":"_token","type":"address"},{"internalType":"address","name":"_distribution","type":"address"},{"internalType":"address","name":"_internal_bribe","type":"address"},{"internalType":"address","name":"_external_bribe","type":"address"},{"internalType":"bool","name":"_isDistributeEmissionToMerkle","type":"bool"},{"internalType":"address","name":"_merklGaugeMiddleman","type":"address"},{"internalType":"address","name":"_feeVault","type":"address"}],"name":"initialize","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"internal_bribe","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"isDistributeEmissionToMerkle","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"lastTimeRewardApplicable","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"lastUpdateTime","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"merklGaugeMiddleman","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"token","type":"address"},{"internalType":"uint256","name":"reward","type":"uint256"}],"name":"notifyRewardAmount","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"periodFinish","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"rewardForDuration","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"rewardPerToken","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"rewardPerTokenStored","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"rewardRate","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"rewardToken","outputs":[{"internalType":"contract IERC20","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"rewards","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_distribution","type":"address"}],"name":"setDistribution","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_feeVault","type":"address"}],"name":"setFeeVault","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_gaugeRewarder","type":"address"}],"name":"setGaugeRewarder","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_int","type":"address"}],"name":"setInternalBribe","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bool","name":"_isDistributeEmissionToMerkle","type":"bool"}],"name":"setIsDistributeEmissionToMerkle","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_newMerklGaugeMiddleman","type":"address"}],"name":"setMerklGaugeMiddleman","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"stopEmergencyMode","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"totalSupply","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"upgradeCall","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"userRewardPerTokenPaid","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"withdraw","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"withdrawAll","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"withdrawAllAndHarvest","outputs":[],"stateMutability":"nonpayable","type":"function"}]Contract Creation Code
60a0346200011d57601f62002e3538819003918201601f19168301916001600160401b0383118484101762000122578084926020946040528339810103126200011d575160038110156200011d5760005460ff8160081c16620000c85760ff808216036200008c575b50608052604051612cfc908162000139823960805181818161070a01526116ac0152f35b60ff90811916176000557f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb3847402498602060405160ff8152a13862000068565b60405162461bcd60e51b815260206004820152602760248201527f496e697469616c697a61626c653a20636f6e747261637420697320696e697469604482015266616c697a696e6760c81b6064820152608490fd5b600080fd5b634e487b7160e01b600052604160045260246000fdfe60406080815260048036101561001457600080fd5b600091823560e01c80628cc262146123dc57806303fbf83a146123b45780630700037d1461237d5780630d52333c1461235557806311f407af146122b857806318160ddd146122995780631be052891461227a5780632e1a7d4d146120a75780633a747f3014611ffd5780633bb2fad914611fe9578381633d18b91214611e9c57508063478222c214611e7457806348ec341b14611b7e5780636946a23514611b5a5780636e9852f21461186857806370a0823114611831578063770f8571146118095780637b0a47ee146117ea5780637c91e4eb146117c25780637f6990151461170f57806380faa57d146116f25780638282b1481461169757806382bfefc81461166f578063853828b6146114a7578063863e24421461147f5780638b8763471461144857806391f25a941461135e578063a591f97f146112ab578063b1534ecd146111f7578063b66503cf14610ef8578063b6b55f2514610df957838163c00007b014610c7557508063c6c8f6b614610bf3578063c863657d14610bcb578063c8f33c9114610bad578063caa6fea414610b86578063cd3daf9d14610b62578063d009601014610aa1578063d294f09314610696578063db2e21bc146105e5578063de5f6268146103a5578063df136d6514610386578063e5a9427c14610362578063ebe2b12b14610343578063ec71c0891461031b578063f7c618c1146102ec5763f97d21141461022857600080fd5b346102b15760206003193601126102b157610241612402565b906001600160a01b0392602084603b541683519283809263ae5dea6560e01b82525afa9182156102e3575090839185916102b5575b501633036102b15773ffffffffffffffffffffffffffffffffffffffff19906102a9836037549216938216841415612540565b161760375580f35b8280fd5b6102d6915060203d81116102dc575b6102ce81836124b3565b8101906124d6565b38610276565b503d6102c4565b513d86823e3d90fd5b8382346103175781600319360112610317576020906001600160a01b0360335460101c169051908152f35b5080fd5b8382346103175781600319360112610317576020906001600160a01b03603c54169051908152f35b838234610317578160031936011261031757602090603e549051908152f35b83823461031757816003193601126103175760209060ff6033541690519015158152f35b8382346103175781600319360112610317576020906041549051908152f35b50346102b157826003193601126102b1576001600160a01b039182603454169082519384927f70a08231000000000000000000000000000000000000000000000000000000008452338385015283602460209586935afa9485156105db5786956105a7575b50610413612706565b60ff60335460081c166105a35761042861264e565b6041556104336125d6565b84553361057f575b841561053d57908591338352604584526104588686852054612641565b338452604585528584205561046f86604454612641565b6044556104848682603454163090339061275b565b6037541690816104c2575b5050507fe1fffcc4923d04b559f4d29a8bfc6cda04eb5b0d3c460751c2402c5c5cc9109c91519283523392a26001805580f35b3383526045845284832054823b1561052f57855163711f31c160e11b8152339281018381526020810193909352604083019190915291839183919082908490829060600103925af180156105335761051b575b8061048f565b61052490612489565b61052f578338610515565b8380fd5b84513d84823e3d90fd5b5090606492519162461bcd60e51b8352820152601e60248201527f6465706f736974284761756765293a2063616e6e6f74207374616b65203000006044820152fd5b610588336126a4565b3387526043845284872055604154604284528487205561043b565b8580fd5b9094508281813d83116105d4575b6105bf81836124b3565b810103126105cf5751933861040a565b600080fd5b503d6105b5565b84513d88823e3d90fd5b8382346103175781600319360112610317576105ff612706565b61061060ff60335460081c1661258b565b33825260456020526106268183205415156129fb565b3382526045602052808220549061063f826044546125eb565b6044553383526045602052828181205561066582336001600160a01b0360345416612a46565b519081527f884edad9ce6fa2440d8a54cc123490eb96d2768479d49ff9c7366125a942436460203392a26001805580f35b5091346108d157806003193601126108d1576106b0612706565b6001600160a01b039081603454169082603a54169385519386858381867fd294f093000000000000000000000000000000000000000000000000000000009a8b83525af18015610a975783958491610a74575b50809580977f00000000000000000000000000000000000000000000000000000000000000006003811015610a61576001146109e3575b5050508515801580916109da575b610760575b8787876001805582519182526020820152f35b8751907f0dfe168100000000000000000000000000000000000000000000000000000000825260209586838681845afa9283156109b1578594939291889188946109bb575b508b51958680927fd21220a70000000000000000000000000000000000000000000000000000000082525afa9384156109b1578694610992575b506108de575b5085610829575b50505050818451918483528201527fbc567d6cbad26368064baa0ab5a757be46aae4d70f707f9203d9d9b6c8ccbfa3843392a2388080808061074d565b6108498682841661083e846038541682612b1f565b836038541690612b87565b6038541691823b1561052f576108a79284928388938b51968795869485937fb66503cf0000000000000000000000000000000000000000000000000000000085528401602090939291936001600160a01b0360408201951681520152565b03925af180156108d4576108bd575b80806107ec565b6108c78291612489565b6108d157806108b6565b80fd5b86513d84823e3d90fd5b6108fe888383166108f3856038541682612b1f565b846038541690612b87565b816038541690813b156105a3578861095c928792838d518096819582947fb66503cf0000000000000000000000000000000000000000000000000000000084528c8401602090939291936001600160a01b0360408201951681520152565b03925af1801561098857908591610974575b506107e5565b61097d90612489565b61052f57833861096e565b89513d87823e3d90fd5b6109aa919450873d89116102dc576102ce81836124b3565b92386107df565b8a513d88823e3d90fd5b6109d3919450823d84116102dc576102ce81836124b3565b92386107a5565b50851515610748565b91975091955087519081528781848187895af1908115610a5757610a1c929185918291610a25575b50610a169192612641565b96612641565b9338808061073a565b610a169250610a4a91508a3d8c11610a50575b610a4281836124b3565b810190612b09565b91610a0b565b503d610a38565b88513d86823e3d90fd5b602487602188634e487b7160e01b835252fd5b9050610a8e919550873d8911610a5057610a4281836124b3565b94909438610703565b87513d85823e3d90fd5b5090346102b157826003193601126102b1576001600160a01b0390602082603b541684519283809263ae5dea6560e01b82525afa908115610b55578491610b37575b501633036103175761010061ff0019603354610b0560ff8260081c161561258b565b1617603355514281527f774b57c3410c76d04ea4d51b0c15a9bac99b0e70f28fd88b53d702b5427fd31860203092a280f35b610b4f915060203d81116102dc576102ce81836124b3565b38610ae3565b50505051903d90823e3d90fd5b838234610317578160031936011261031757602090610b7f61264e565b9051908152f35b83823461031757816003193601126103175760209060ff60335460081c1690519015158152f35b83823461031757816003193601126103175780602091549051908152f35b8382346103175781600319360112610317576020906001600160a01b03603554169051908152f35b5090346102b15760206003193601126102b1573590610c10612706565b610c2160ff60335460081c1661258b565b3383526045602052610c38828285205410156129fb565b610c44826044546125eb565b6044553383526045602052808320610c5d8382546125eb565b905561066582336001600160a01b0360345416612a46565b80848434610df55760209182600319360112610df057610c93612402565b610c9b612706565b6001600160a01b03610cb281603654163314612a98565b610cba61264e565b604155610cc56125d6565b84558082169081610dcc575b81875260438652818588208781548a81610d87575b5050505050603754169485610cfe575b866001805580f35b6045918752528285205493803b156105a35781868094610d4f87519889968795869463711f31c160e11b865285016040919493929460608201956001600160a01b0380921683521660208201520152565b03925af1908115610d7e5750610d6a575b8080808080610cf6565b610d7390612489565b6108d1578082610d60565b513d84823e3d90fd5b7fc9695243a805adb74c91f28311176c65b417e842d5699893cef56d18bfa48cba9355610dbc81888760335460101c16612a46565b8851908152a2818987818a610ce6565b610dd5836126a4565b82885260438752858820556041546042875285882055610cd1565b505050fd5b5050fd5b50346102b15760208060031936011261052f57823592610e17612706565b60ff60335460081c16610ef457610e2c61264e565b604155610e376125d6565b835533610ed0575b8315610e8f57849033825260458352610e5b8585842054612641565b3383526045845284832055610e7285604454612641565b6044556001600160a01b036104848682603454163090339061275b565b90606492519162461bcd60e51b8352820152601e60248201527f6465706f736974284761756765293a2063616e6e6f74207374616b65203000006044820152fd5b610ed9336126a4565b33865260438352838620556041546042835283862055610e3f565b8480fd5b50346102b157806003193601126102b157610f11612402565b9160243592610f1e612706565b6033549060ff8260081c166105a3576001600160a01b0391829182806036541692610f4a843314612a98565b610f5261264e565b604155610f5d6125d6565b885560101c1692839116036111b4578587949392610f7c92309161275b565b60335460ff161561105657610f9e858260335460101c1683603c541690612a46565b603c541690813b156102b157829160448392865194859384927fe324718000000000000000000000000000000000000000000000000000000000845230908401528160248401525af1801561104c57611038575b50507fde88a922e0d3b88b24e9623efeb464919c6bf9f66857a65e2bfcf2ce87a9433d916020915b428155611029603d5442612641565b603e5551908152a16001805580f35b61104190612489565b6102b1578238610ff2565b83513d84823e3d90fd5b6024919250602090603e54804210156000146111805750611079603d5487612621565b603f555b60335460101c168451928380927f70a0823100000000000000000000000000000000000000000000000000000000825230878301525afa908115611176578591611145575b506110d3603f5491603d5490612621565b1061110357507fde88a922e0d3b88b24e9623efeb464919c6bf9f66857a65e2bfcf2ce87a9433d9160209161101a565b6020606492519162461bcd60e51b8352820152601860248201527f50726f76696465642072657761726420746f6f206869676800000000000000006044820152fd5b90506020813d821161116e575b8161115f602093836124b3565b810103126105cf5751386110c2565b3d9150611152565b83513d87823e3d90fd5b6111a361119d6111946111ac9342906125eb565b603f549061260e565b88612641565b603d5490612621565b603f5561107d565b606484602087519162461bcd60e51b8352820152600d60248201527f6e6f742072657720746f6b656e000000000000000000000000000000000000006044820152fd5b5090346102b157826003193601126102b1576001600160a01b0390602082603b541684519283809263ae5dea6560e01b82525afa908115610b5557849161128d575b501633036103175761ff001960335461125c600160ff8360081c1615151461258b565b16603355514281527fa30763a9bc0d8e121a6e721624965cae68010ece74128b4ae5b01b8dc22c00f860203092a280f35b6112a5915060203d81116102dc576102ce81836124b3565b38611239565b50346102b15760206003193601126102b1576112c5612402565b906001600160a01b0392602084603b541683519283809263ae5dea6560e01b82525afa9182156102e357509083918591611340575b501633036102b1578173ffffffffffffffffffffffffffffffffffffffff199116916113278315156124f5565b611338603a54918216841415612540565b1617603a5580f35b611358915060203d81116102dc576102ce81836124b3565b386112fa565b5090346102b15760206003193601126102b157611379612402565b6001600160a01b039082602083603b541686519283809263ae5dea6560e01b82525afa801561143e5783918791611420575b50163303610ef457169182156113de57505073ffffffffffffffffffffffffffffffffffffffff19603854161760385580f35b60649250519062461bcd60e51b825260208183015260248201527f7a65726f000000000000000000000000000000000000000000000000000000006044820152fd5b611438915060203d81116102dc576102ce81836124b3565b386113ab565b85513d88823e3d90fd5b83823461031757602060031936011261031757806020926001600160a01b0361146f612402565b1681526042845220549051908152f35b8382346103175781600319360112610317576020906001600160a01b03603754169051908152f35b5090346102b157826003193601126102b15733835260206045815282842054926114cf612706565b60ff60335460081c16610ef4576114e461264e565b6041556114ef6125d6565b81553361164b575b831561160a57338552604582526115128186205415156129fb565b61151e846044546125eb565b60445533855260458252838561153782848320546125eb565b3382526045855280848320556001600160a01b03958660375416918261159b575b5050505061158d907f884edad9ce6fa2440d8a54cc123490eb96d2768479d49ff9c7366125a942436494339060345416612a46565b519283523392a26001805580f35b9091809394503b1561052f57845163711f31c160e11b8152339281018381526020810193909352604083019190915291839183919082908490829060600103925af1801561104c57908692916115f3575b8080611558565b6115fe919250612489565b610ef4578385386115ec565b60649350519162461bcd60e51b8352820152601160248201527f43616e6e6f7420776974686472617720300000000000000000000000000000006044820152fd5b611654336126a4565b338652604383528186205560415460428352818620556114f7565b8382346103175781600319360112610317576020906001600160a01b03603454169051908152f35b508290346103175781600319360112610317577f000000000000000000000000000000000000000000000000000000000000000090519160038210156116df57602083838152f35b80602185634e487b7160e01b6024945252fd5b838234610317578160031936011261031757602090610b7f6125d6565b50346102b15760206003193601126102b157611729612402565b906001600160a01b0392602084603b541683519283809263ae5dea6560e01b82525afa9182156102e3575090839185916117a4575b501633036102b1578173ffffffffffffffffffffffffffffffffffffffff1991169161178b8315156124f5565b61179c603654918216841415612540565b161760365580f35b6117bc915060203d81116102dc576102ce81836124b3565b3861175e565b8382346103175781600319360112610317576020906001600160a01b03603654169051908152f35b838234610317578160031936011261031757602090603f549051908152f35b8382346103175781600319360112610317576020906001600160a01b03603854169051908152f35b83823461031757602060031936011261031757806020926001600160a01b03611858612402565b1681526045845220549051908152f35b50829034610317578160031936011261031757338252602090604582528083205493611892612706565b60ff60335460081c1661052f576118a761264e565b6041556118b26125d6565b82553315159485611b36575b8015611af4578495338652604585526118db8487205415156129fb565b6118e7826044546125eb565b604455338652604585526118fe82858820546125eb565b913387526045865282858820556001600160a01b0392836037541680611a84575b505061193081338560345416612a46565b84519081527f884edad9ce6fa2440d8a54cc123490eb96d2768479d49ff9c7366125a9424364863392a260018055611966612706565b61196e61264e565b6041556119796125d6565b8455611a60575b338552604384528285208581549182611a1b575b5050506037541692836119aa575b846001805580f35b6045903386525281842054833b15610ef457825163711f31c160e11b8152339281018381526020810193909352604083019190915292849184919082908490829060600103925af1908115610d7e5750611a07575b8080806119a2565b611a1090612489565b6108d15780826119ff565b55611a2e81338460335460101c16612a46565b83519081527fc9695243a805adb74c91f28311176c65b417e842d5699893cef56d18bfa48cba853392a2868581611994565b611a69336126a4565b33865260438552838620556041546042855283862055611980565b803b15611af057865163711f31c160e11b81523387820181815260208101919091526040810193909352918991839182908490829060600103925af18015611ae6579088911561191f57611ad790612489565b611ae257868961191f565b8680fd5b86513d8a823e3d90fd5b8880fd5b5082606492519162461bcd60e51b8352820152601160248201527f43616e6e6f7420776974686472617720300000000000000000000000000000006044820152fd5b611b3f336126a4565b338652604385528386205560415460428552838620556118be565b838234610317578160031936011261031757602090610b7f603f54603d549061260e565b508290346103175761012060031936011261031757611b9b612402565b92602435906001600160a01b03918281168091036105cf57604435958387168097036105cf57606435938085168095036105cf57608435978189168099036105cf5760a4358281168091036105cf5760c43595861515968781036105cf5760e435928584168094036105cf57610104359586168096036105cf578b549c60088e901c60ff16159a8b8f81611e66575b8115611e46575b5015611ddd57611c678e9f9e60ff9e9f8e600160ff198316178355611daf575b50549d8e60081c16611c6281612418565b612418565b6001805573ffffffffffffffffffffffffffffffffffffffff19963388603b541617603b556033549a88603554161760355587603454161760345586603654161760365562093a80603d55856038541617603855846039541617603955611d67575b50927fffffffffffffffffffff00000000000000000000000000000000000000000000928260ff969575ffffffffffffffffffffffffffffffffffffffff000094603c541617603c55603a541617603a5560101b16911617911617603355611d2f578280f35b7f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989161ff00196020921684555160018152a181808280f35b81611cc95760649060208b519162461bcd60e51b8352820152601d60248201527f6e6f74207365747570206d65726b6c47617567654d6964646c656d616e0000006044820152fd5b7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00001661010117815538611c51565b60848560208f519162461bcd60e51b8352820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201527f647920696e697469616c697a65640000000000000000000000000000000000006064820152fd5b303b15915081611e58575b508f611c31565b6001915060ff16148f611e51565b600160ff8216109150611c2a565b8382346103175781600319360112610317576020906001600160a01b03603a54169051908152f35b80848434610df55782600319360112610df557611eb7612706565b611ebf61264e565b604155611eca6125d6565b815533611fc3575b33835260436020528083208381549182611f76575b5050506001600160a01b03603754169182611f05575b836001805580f35b338452604560205281842054833b15610ef457825163711f31c160e11b8152339281018381526020810193909352604083019190915292849184919082908490829060600103925af1908115610d7e5750611f62575b8080611efd565b611f6b90612489565b6108d1578082611f5b565b55611f9081336001600160a01b0360335460101c16612a46565b81519081527fc9695243a805adb74c91f28311176c65b417e842d5699893cef56d18bfa48cba60203392a2848381611ee7565b611fcc336126a4565b338452604360205281842055604154604260205281842055611ed2565b83346108d157806003193601126108d15780f35b5090346102b15760206003193601126102b1578035801515928382036105cf576001600160a01b0392602084603b541683519283809263ae5dea6560e01b82525afa91821561209e57509083918691612080575b5016330361052f57612071575b5060ff60ff196033541691161760335580f35b603c541615610317573861205e565b612098915060203d81116102dc576102ce81836124b3565b38612051565b513d87823e3d90fd5b50829034610317576020806003193601126102b1578335916120c7612706565b60ff60335460081c1661052f576120dc61264e565b6041556120e76125d6565b815533612256575b8215612214573384526045825261210a8185205415156129fb565b612116836044546125eb565b6044553384526045825261212d83828620546125eb565b3385526045835280828620556001600160a01b039586603754169081612184575b50505061158d837f884edad9ce6fa2440d8a54cc123490eb96d2768479d49ff9c7366125a9424364949596339060345416612a46565b813b15611ae257835163711f31c160e11b815233918101828152602081019290925260408201939093528691839182908490829060600103925af1801561220a576121d1575b808061214e565b837f884edad9ce6fa2440d8a54cc123490eb96d2768479d49ff9c7366125a9424364949561220161158d93612489565b955093506121ca565b82513d87823e3d90fd5b6064918591519162461bcd60e51b8352820152601160248201527f43616e6e6f7420776974686472617720300000000000000000000000000000006044820152fd5b61225f336126a4565b338552604383528185205560415460428352818520556120ef565b838234610317578160031936011261031757602090603d549051908152f35b8382346103175781600319360112610317576020906044549051908152f35b50346102b15760206003193601126102b1576122d2612402565b906001600160a01b0392602084603b541683519283809263ae5dea6560e01b82525afa9182156102e357509083918591612337575b501633036102b1571680156103175773ffffffffffffffffffffffffffffffffffffffff19603c541617603c5580f35b61234f915060203d81116102dc576102ce81836124b3565b38612307565b8382346103175781600319360112610317576020906001600160a01b03603b54169051908152f35b83823461031757602060031936011261031757806020926001600160a01b036123a4612402565b1681526043845220549051908152f35b8382346103175781600319360112610317576020906001600160a01b03603954169051908152f35b83823461031757602060031936011261031757602090610b7f6123fd612402565b6126a4565b600435906001600160a01b03821682036105cf57565b1561241f57565b608460405162461bcd60e51b815260206004820152602b60248201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960448201527f6e697469616c697a696e670000000000000000000000000000000000000000006064820152fd5b67ffffffffffffffff811161249d57604052565b634e487b7160e01b600052604160045260246000fd5b90601f601f19910116810190811067ffffffffffffffff82111761249d57604052565b908160209103126105cf57516001600160a01b03811681036105cf5790565b156124fc57565b606460405162461bcd60e51b815260206004820152600960248201527f7a65726f206164647200000000000000000000000000000000000000000000006044820152fd5b1561254757565b606460405162461bcd60e51b815260206004820152600960248201527f73616d65206164647200000000000000000000000000000000000000000000006044820152fd5b1561259257565b606460405162461bcd60e51b815260206004820152600960248201527f656d657267656e637900000000000000000000000000000000000000000000006044820152fd5b603e548042106000146125e857504290565b90565b919082039182116125f857565b634e487b7160e01b600052601160045260246000fd5b818102929181159184041417156125f857565b811561262b570490565b634e487b7160e01b600052601260045260246000fd5b919082018092116125f857565b6044548061265d575060415490565b60415461267761119461266e6125d6565b604054906125eb565b670de0b6b3a7640000908181029181830414901517156125f8576125e89261269e91612621565b90612641565b6001600160a01b036125e89116806000526043602052670de0b6b3a76400006126ff6040600020549260456020526126f9604060002054916126e461264e565b906000526042602052604060002054906125eb565b9061260e565b0490612641565b600260015414612717576002600155565b606460405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c006044820152fd5b6040517f23b872dd0000000000000000000000000000000000000000000000000000000060208201526001600160a01b03928316602482015292909116604483015260648201929092526127c5916127c082608481015b03601f1981018452836124b3565b6127c7565b565b6001600160a01b0316906040516040810167ffffffffffffffff908281108282111761249d576040526020938483527f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564858401526000808587829751910182855af1903d15612920573d92831161290c57906128639392916040519261285688601f19601f84011601856124b3565b83523d868885013e61292b565b8051918215918483156128e8575b50505090501561287e5750565b6084906040519062461bcd60e51b82526004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e60448201527f6f742073756363656564000000000000000000000000000000000000000000006064820152fd5b919381809450010312610317578201519081151582036108d1575080388084612871565b602485634e487b7160e01b81526041600452fd5b906128639392506060915b9192901561298c575081511561293f575090565b3b156129485790565b606460405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e74726163740000006044820152fd5b82519091501561299f5750805190602001fd5b6040519062461bcd60e51b825281602080600483015282519283602484015260005b8481106129e457505050601f19601f836000604480968601015201168101030190fd5b8181018301518682016044015285935082016129c1565b15612a0257565b606460405162461bcd60e51b815260206004820152600b60248201527f6e6f2062616c616e6365730000000000000000000000000000000000000000006044820152fd5b6040517fa9059cbb0000000000000000000000000000000000000000000000000000000060208201526001600160a01b03909216602483015260448201929092526127c5916127c082606481016127b2565b15612a9f57565b608460405162461bcd60e51b815260206004820152602a60248201527f43616c6c6572206973206e6f742052657761726473446973747269627574696f60448201527f6e20636f6e7472616374000000000000000000000000000000000000000000006064820152fd5b91908260409103126105cf576020825192015190565b906001600160a01b03604051917f095ea7b30000000000000000000000000000000000000000000000000000000060208401521660248201526000604482015260448152608081019181831067ffffffffffffffff84111761249d576127c5926040526127c7565b91909181158015612c55575b15612beb576040517f095ea7b30000000000000000000000000000000000000000000000000000000060208201526001600160a01b03909316602484015260448301919091526127c591906127c082606481016127b2565b608460405162461bcd60e51b815260206004820152603660248201527f5361666545524332303a20617070726f76652066726f6d206e6f6e2d7a65726f60448201527f20746f206e6f6e2d7a65726f20616c6c6f77616e6365000000000000000000006064820152fd5b506040517fdd62ed3e0000000000000000000000000000000000000000000000000000000081523060048201526020816044816001600160a01b03808916602483015286165afa908115612ce357600091612cb2575b5015612b93565b906020823d8211612cdb575b81612ccb602093836124b3565b810103126108d157505138612cab565b3d9150612cbe565b6040513d6000823e3d90fdfea164736f6c6343000813000a0000000000000000000000000000000000000000000000000000000000000001
Deployed Bytecode
0x60406080815260048036101561001457600080fd5b600091823560e01c80628cc262146123dc57806303fbf83a146123b45780630700037d1461237d5780630d52333c1461235557806311f407af146122b857806318160ddd146122995780631be052891461227a5780632e1a7d4d146120a75780633a747f3014611ffd5780633bb2fad914611fe9578381633d18b91214611e9c57508063478222c214611e7457806348ec341b14611b7e5780636946a23514611b5a5780636e9852f21461186857806370a0823114611831578063770f8571146118095780637b0a47ee146117ea5780637c91e4eb146117c25780637f6990151461170f57806380faa57d146116f25780638282b1481461169757806382bfefc81461166f578063853828b6146114a7578063863e24421461147f5780638b8763471461144857806391f25a941461135e578063a591f97f146112ab578063b1534ecd146111f7578063b66503cf14610ef8578063b6b55f2514610df957838163c00007b014610c7557508063c6c8f6b614610bf3578063c863657d14610bcb578063c8f33c9114610bad578063caa6fea414610b86578063cd3daf9d14610b62578063d009601014610aa1578063d294f09314610696578063db2e21bc146105e5578063de5f6268146103a5578063df136d6514610386578063e5a9427c14610362578063ebe2b12b14610343578063ec71c0891461031b578063f7c618c1146102ec5763f97d21141461022857600080fd5b346102b15760206003193601126102b157610241612402565b906001600160a01b0392602084603b541683519283809263ae5dea6560e01b82525afa9182156102e3575090839185916102b5575b501633036102b15773ffffffffffffffffffffffffffffffffffffffff19906102a9836037549216938216841415612540565b161760375580f35b8280fd5b6102d6915060203d81116102dc575b6102ce81836124b3565b8101906124d6565b38610276565b503d6102c4565b513d86823e3d90fd5b8382346103175781600319360112610317576020906001600160a01b0360335460101c169051908152f35b5080fd5b8382346103175781600319360112610317576020906001600160a01b03603c54169051908152f35b838234610317578160031936011261031757602090603e549051908152f35b83823461031757816003193601126103175760209060ff6033541690519015158152f35b8382346103175781600319360112610317576020906041549051908152f35b50346102b157826003193601126102b1576001600160a01b039182603454169082519384927f70a08231000000000000000000000000000000000000000000000000000000008452338385015283602460209586935afa9485156105db5786956105a7575b50610413612706565b60ff60335460081c166105a35761042861264e565b6041556104336125d6565b84553361057f575b841561053d57908591338352604584526104588686852054612641565b338452604585528584205561046f86604454612641565b6044556104848682603454163090339061275b565b6037541690816104c2575b5050507fe1fffcc4923d04b559f4d29a8bfc6cda04eb5b0d3c460751c2402c5c5cc9109c91519283523392a26001805580f35b3383526045845284832054823b1561052f57855163711f31c160e11b8152339281018381526020810193909352604083019190915291839183919082908490829060600103925af180156105335761051b575b8061048f565b61052490612489565b61052f578338610515565b8380fd5b84513d84823e3d90fd5b5090606492519162461bcd60e51b8352820152601e60248201527f6465706f736974284761756765293a2063616e6e6f74207374616b65203000006044820152fd5b610588336126a4565b3387526043845284872055604154604284528487205561043b565b8580fd5b9094508281813d83116105d4575b6105bf81836124b3565b810103126105cf5751933861040a565b600080fd5b503d6105b5565b84513d88823e3d90fd5b8382346103175781600319360112610317576105ff612706565b61061060ff60335460081c1661258b565b33825260456020526106268183205415156129fb565b3382526045602052808220549061063f826044546125eb565b6044553383526045602052828181205561066582336001600160a01b0360345416612a46565b519081527f884edad9ce6fa2440d8a54cc123490eb96d2768479d49ff9c7366125a942436460203392a26001805580f35b5091346108d157806003193601126108d1576106b0612706565b6001600160a01b039081603454169082603a54169385519386858381867fd294f093000000000000000000000000000000000000000000000000000000009a8b83525af18015610a975783958491610a74575b50809580977f00000000000000000000000000000000000000000000000000000000000000016003811015610a61576001146109e3575b5050508515801580916109da575b610760575b8787876001805582519182526020820152f35b8751907f0dfe168100000000000000000000000000000000000000000000000000000000825260209586838681845afa9283156109b1578594939291889188946109bb575b508b51958680927fd21220a70000000000000000000000000000000000000000000000000000000082525afa9384156109b1578694610992575b506108de575b5085610829575b50505050818451918483528201527fbc567d6cbad26368064baa0ab5a757be46aae4d70f707f9203d9d9b6c8ccbfa3843392a2388080808061074d565b6108498682841661083e846038541682612b1f565b836038541690612b87565b6038541691823b1561052f576108a79284928388938b51968795869485937fb66503cf0000000000000000000000000000000000000000000000000000000085528401602090939291936001600160a01b0360408201951681520152565b03925af180156108d4576108bd575b80806107ec565b6108c78291612489565b6108d157806108b6565b80fd5b86513d84823e3d90fd5b6108fe888383166108f3856038541682612b1f565b846038541690612b87565b816038541690813b156105a3578861095c928792838d518096819582947fb66503cf0000000000000000000000000000000000000000000000000000000084528c8401602090939291936001600160a01b0360408201951681520152565b03925af1801561098857908591610974575b506107e5565b61097d90612489565b61052f57833861096e565b89513d87823e3d90fd5b6109aa919450873d89116102dc576102ce81836124b3565b92386107df565b8a513d88823e3d90fd5b6109d3919450823d84116102dc576102ce81836124b3565b92386107a5565b50851515610748565b91975091955087519081528781848187895af1908115610a5757610a1c929185918291610a25575b50610a169192612641565b96612641565b9338808061073a565b610a169250610a4a91508a3d8c11610a50575b610a4281836124b3565b810190612b09565b91610a0b565b503d610a38565b88513d86823e3d90fd5b602487602188634e487b7160e01b835252fd5b9050610a8e919550873d8911610a5057610a4281836124b3565b94909438610703565b87513d85823e3d90fd5b5090346102b157826003193601126102b1576001600160a01b0390602082603b541684519283809263ae5dea6560e01b82525afa908115610b55578491610b37575b501633036103175761010061ff0019603354610b0560ff8260081c161561258b565b1617603355514281527f774b57c3410c76d04ea4d51b0c15a9bac99b0e70f28fd88b53d702b5427fd31860203092a280f35b610b4f915060203d81116102dc576102ce81836124b3565b38610ae3565b50505051903d90823e3d90fd5b838234610317578160031936011261031757602090610b7f61264e565b9051908152f35b83823461031757816003193601126103175760209060ff60335460081c1690519015158152f35b83823461031757816003193601126103175780602091549051908152f35b8382346103175781600319360112610317576020906001600160a01b03603554169051908152f35b5090346102b15760206003193601126102b1573590610c10612706565b610c2160ff60335460081c1661258b565b3383526045602052610c38828285205410156129fb565b610c44826044546125eb565b6044553383526045602052808320610c5d8382546125eb565b905561066582336001600160a01b0360345416612a46565b80848434610df55760209182600319360112610df057610c93612402565b610c9b612706565b6001600160a01b03610cb281603654163314612a98565b610cba61264e565b604155610cc56125d6565b84558082169081610dcc575b81875260438652818588208781548a81610d87575b5050505050603754169485610cfe575b866001805580f35b6045918752528285205493803b156105a35781868094610d4f87519889968795869463711f31c160e11b865285016040919493929460608201956001600160a01b0380921683521660208201520152565b03925af1908115610d7e5750610d6a575b8080808080610cf6565b610d7390612489565b6108d1578082610d60565b513d84823e3d90fd5b7fc9695243a805adb74c91f28311176c65b417e842d5699893cef56d18bfa48cba9355610dbc81888760335460101c16612a46565b8851908152a2818987818a610ce6565b610dd5836126a4565b82885260438752858820556041546042875285882055610cd1565b505050fd5b5050fd5b50346102b15760208060031936011261052f57823592610e17612706565b60ff60335460081c16610ef457610e2c61264e565b604155610e376125d6565b835533610ed0575b8315610e8f57849033825260458352610e5b8585842054612641565b3383526045845284832055610e7285604454612641565b6044556001600160a01b036104848682603454163090339061275b565b90606492519162461bcd60e51b8352820152601e60248201527f6465706f736974284761756765293a2063616e6e6f74207374616b65203000006044820152fd5b610ed9336126a4565b33865260438352838620556041546042835283862055610e3f565b8480fd5b50346102b157806003193601126102b157610f11612402565b9160243592610f1e612706565b6033549060ff8260081c166105a3576001600160a01b0391829182806036541692610f4a843314612a98565b610f5261264e565b604155610f5d6125d6565b885560101c1692839116036111b4578587949392610f7c92309161275b565b60335460ff161561105657610f9e858260335460101c1683603c541690612a46565b603c541690813b156102b157829160448392865194859384927fe324718000000000000000000000000000000000000000000000000000000000845230908401528160248401525af1801561104c57611038575b50507fde88a922e0d3b88b24e9623efeb464919c6bf9f66857a65e2bfcf2ce87a9433d916020915b428155611029603d5442612641565b603e5551908152a16001805580f35b61104190612489565b6102b1578238610ff2565b83513d84823e3d90fd5b6024919250602090603e54804210156000146111805750611079603d5487612621565b603f555b60335460101c168451928380927f70a0823100000000000000000000000000000000000000000000000000000000825230878301525afa908115611176578591611145575b506110d3603f5491603d5490612621565b1061110357507fde88a922e0d3b88b24e9623efeb464919c6bf9f66857a65e2bfcf2ce87a9433d9160209161101a565b6020606492519162461bcd60e51b8352820152601860248201527f50726f76696465642072657761726420746f6f206869676800000000000000006044820152fd5b90506020813d821161116e575b8161115f602093836124b3565b810103126105cf5751386110c2565b3d9150611152565b83513d87823e3d90fd5b6111a361119d6111946111ac9342906125eb565b603f549061260e565b88612641565b603d5490612621565b603f5561107d565b606484602087519162461bcd60e51b8352820152600d60248201527f6e6f742072657720746f6b656e000000000000000000000000000000000000006044820152fd5b5090346102b157826003193601126102b1576001600160a01b0390602082603b541684519283809263ae5dea6560e01b82525afa908115610b5557849161128d575b501633036103175761ff001960335461125c600160ff8360081c1615151461258b565b16603355514281527fa30763a9bc0d8e121a6e721624965cae68010ece74128b4ae5b01b8dc22c00f860203092a280f35b6112a5915060203d81116102dc576102ce81836124b3565b38611239565b50346102b15760206003193601126102b1576112c5612402565b906001600160a01b0392602084603b541683519283809263ae5dea6560e01b82525afa9182156102e357509083918591611340575b501633036102b1578173ffffffffffffffffffffffffffffffffffffffff199116916113278315156124f5565b611338603a54918216841415612540565b1617603a5580f35b611358915060203d81116102dc576102ce81836124b3565b386112fa565b5090346102b15760206003193601126102b157611379612402565b6001600160a01b039082602083603b541686519283809263ae5dea6560e01b82525afa801561143e5783918791611420575b50163303610ef457169182156113de57505073ffffffffffffffffffffffffffffffffffffffff19603854161760385580f35b60649250519062461bcd60e51b825260208183015260248201527f7a65726f000000000000000000000000000000000000000000000000000000006044820152fd5b611438915060203d81116102dc576102ce81836124b3565b386113ab565b85513d88823e3d90fd5b83823461031757602060031936011261031757806020926001600160a01b0361146f612402565b1681526042845220549051908152f35b8382346103175781600319360112610317576020906001600160a01b03603754169051908152f35b5090346102b157826003193601126102b15733835260206045815282842054926114cf612706565b60ff60335460081c16610ef4576114e461264e565b6041556114ef6125d6565b81553361164b575b831561160a57338552604582526115128186205415156129fb565b61151e846044546125eb565b60445533855260458252838561153782848320546125eb565b3382526045855280848320556001600160a01b03958660375416918261159b575b5050505061158d907f884edad9ce6fa2440d8a54cc123490eb96d2768479d49ff9c7366125a942436494339060345416612a46565b519283523392a26001805580f35b9091809394503b1561052f57845163711f31c160e11b8152339281018381526020810193909352604083019190915291839183919082908490829060600103925af1801561104c57908692916115f3575b8080611558565b6115fe919250612489565b610ef4578385386115ec565b60649350519162461bcd60e51b8352820152601160248201527f43616e6e6f7420776974686472617720300000000000000000000000000000006044820152fd5b611654336126a4565b338652604383528186205560415460428352818620556114f7565b8382346103175781600319360112610317576020906001600160a01b03603454169051908152f35b508290346103175781600319360112610317577f000000000000000000000000000000000000000000000000000000000000000190519160038210156116df57602083838152f35b80602185634e487b7160e01b6024945252fd5b838234610317578160031936011261031757602090610b7f6125d6565b50346102b15760206003193601126102b157611729612402565b906001600160a01b0392602084603b541683519283809263ae5dea6560e01b82525afa9182156102e3575090839185916117a4575b501633036102b1578173ffffffffffffffffffffffffffffffffffffffff1991169161178b8315156124f5565b61179c603654918216841415612540565b161760365580f35b6117bc915060203d81116102dc576102ce81836124b3565b3861175e565b8382346103175781600319360112610317576020906001600160a01b03603654169051908152f35b838234610317578160031936011261031757602090603f549051908152f35b8382346103175781600319360112610317576020906001600160a01b03603854169051908152f35b83823461031757602060031936011261031757806020926001600160a01b03611858612402565b1681526045845220549051908152f35b50829034610317578160031936011261031757338252602090604582528083205493611892612706565b60ff60335460081c1661052f576118a761264e565b6041556118b26125d6565b82553315159485611b36575b8015611af4578495338652604585526118db8487205415156129fb565b6118e7826044546125eb565b604455338652604585526118fe82858820546125eb565b913387526045865282858820556001600160a01b0392836037541680611a84575b505061193081338560345416612a46565b84519081527f884edad9ce6fa2440d8a54cc123490eb96d2768479d49ff9c7366125a9424364863392a260018055611966612706565b61196e61264e565b6041556119796125d6565b8455611a60575b338552604384528285208581549182611a1b575b5050506037541692836119aa575b846001805580f35b6045903386525281842054833b15610ef457825163711f31c160e11b8152339281018381526020810193909352604083019190915292849184919082908490829060600103925af1908115610d7e5750611a07575b8080806119a2565b611a1090612489565b6108d15780826119ff565b55611a2e81338460335460101c16612a46565b83519081527fc9695243a805adb74c91f28311176c65b417e842d5699893cef56d18bfa48cba853392a2868581611994565b611a69336126a4565b33865260438552838620556041546042855283862055611980565b803b15611af057865163711f31c160e11b81523387820181815260208101919091526040810193909352918991839182908490829060600103925af18015611ae6579088911561191f57611ad790612489565b611ae257868961191f565b8680fd5b86513d8a823e3d90fd5b8880fd5b5082606492519162461bcd60e51b8352820152601160248201527f43616e6e6f7420776974686472617720300000000000000000000000000000006044820152fd5b611b3f336126a4565b338652604385528386205560415460428552838620556118be565b838234610317578160031936011261031757602090610b7f603f54603d549061260e565b508290346103175761012060031936011261031757611b9b612402565b92602435906001600160a01b03918281168091036105cf57604435958387168097036105cf57606435938085168095036105cf57608435978189168099036105cf5760a4358281168091036105cf5760c43595861515968781036105cf5760e435928584168094036105cf57610104359586168096036105cf578b549c60088e901c60ff16159a8b8f81611e66575b8115611e46575b5015611ddd57611c678e9f9e60ff9e9f8e600160ff198316178355611daf575b50549d8e60081c16611c6281612418565b612418565b6001805573ffffffffffffffffffffffffffffffffffffffff19963388603b541617603b556033549a88603554161760355587603454161760345586603654161760365562093a80603d55856038541617603855846039541617603955611d67575b50927fffffffffffffffffffff00000000000000000000000000000000000000000000928260ff969575ffffffffffffffffffffffffffffffffffffffff000094603c541617603c55603a541617603a5560101b16911617911617603355611d2f578280f35b7f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989161ff00196020921684555160018152a181808280f35b81611cc95760649060208b519162461bcd60e51b8352820152601d60248201527f6e6f74207365747570206d65726b6c47617567654d6964646c656d616e0000006044820152fd5b7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00001661010117815538611c51565b60848560208f519162461bcd60e51b8352820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201527f647920696e697469616c697a65640000000000000000000000000000000000006064820152fd5b303b15915081611e58575b508f611c31565b6001915060ff16148f611e51565b600160ff8216109150611c2a565b8382346103175781600319360112610317576020906001600160a01b03603a54169051908152f35b80848434610df55782600319360112610df557611eb7612706565b611ebf61264e565b604155611eca6125d6565b815533611fc3575b33835260436020528083208381549182611f76575b5050506001600160a01b03603754169182611f05575b836001805580f35b338452604560205281842054833b15610ef457825163711f31c160e11b8152339281018381526020810193909352604083019190915292849184919082908490829060600103925af1908115610d7e5750611f62575b8080611efd565b611f6b90612489565b6108d1578082611f5b565b55611f9081336001600160a01b0360335460101c16612a46565b81519081527fc9695243a805adb74c91f28311176c65b417e842d5699893cef56d18bfa48cba60203392a2848381611ee7565b611fcc336126a4565b338452604360205281842055604154604260205281842055611ed2565b83346108d157806003193601126108d15780f35b5090346102b15760206003193601126102b1578035801515928382036105cf576001600160a01b0392602084603b541683519283809263ae5dea6560e01b82525afa91821561209e57509083918691612080575b5016330361052f57612071575b5060ff60ff196033541691161760335580f35b603c541615610317573861205e565b612098915060203d81116102dc576102ce81836124b3565b38612051565b513d87823e3d90fd5b50829034610317576020806003193601126102b1578335916120c7612706565b60ff60335460081c1661052f576120dc61264e565b6041556120e76125d6565b815533612256575b8215612214573384526045825261210a8185205415156129fb565b612116836044546125eb565b6044553384526045825261212d83828620546125eb565b3385526045835280828620556001600160a01b039586603754169081612184575b50505061158d837f884edad9ce6fa2440d8a54cc123490eb96d2768479d49ff9c7366125a9424364949596339060345416612a46565b813b15611ae257835163711f31c160e11b815233918101828152602081019290925260408201939093528691839182908490829060600103925af1801561220a576121d1575b808061214e565b837f884edad9ce6fa2440d8a54cc123490eb96d2768479d49ff9c7366125a9424364949561220161158d93612489565b955093506121ca565b82513d87823e3d90fd5b6064918591519162461bcd60e51b8352820152601160248201527f43616e6e6f7420776974686472617720300000000000000000000000000000006044820152fd5b61225f336126a4565b338552604383528185205560415460428352818520556120ef565b838234610317578160031936011261031757602090603d549051908152f35b8382346103175781600319360112610317576020906044549051908152f35b50346102b15760206003193601126102b1576122d2612402565b906001600160a01b0392602084603b541683519283809263ae5dea6560e01b82525afa9182156102e357509083918591612337575b501633036102b1571680156103175773ffffffffffffffffffffffffffffffffffffffff19603c541617603c5580f35b61234f915060203d81116102dc576102ce81836124b3565b38612307565b8382346103175781600319360112610317576020906001600160a01b03603b54169051908152f35b83823461031757602060031936011261031757806020926001600160a01b036123a4612402565b1681526043845220549051908152f35b8382346103175781600319360112610317576020906001600160a01b03603954169051908152f35b83823461031757602060031936011261031757602090610b7f6123fd612402565b6126a4565b600435906001600160a01b03821682036105cf57565b1561241f57565b608460405162461bcd60e51b815260206004820152602b60248201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960448201527f6e697469616c697a696e670000000000000000000000000000000000000000006064820152fd5b67ffffffffffffffff811161249d57604052565b634e487b7160e01b600052604160045260246000fd5b90601f601f19910116810190811067ffffffffffffffff82111761249d57604052565b908160209103126105cf57516001600160a01b03811681036105cf5790565b156124fc57565b606460405162461bcd60e51b815260206004820152600960248201527f7a65726f206164647200000000000000000000000000000000000000000000006044820152fd5b1561254757565b606460405162461bcd60e51b815260206004820152600960248201527f73616d65206164647200000000000000000000000000000000000000000000006044820152fd5b1561259257565b606460405162461bcd60e51b815260206004820152600960248201527f656d657267656e637900000000000000000000000000000000000000000000006044820152fd5b603e548042106000146125e857504290565b90565b919082039182116125f857565b634e487b7160e01b600052601160045260246000fd5b818102929181159184041417156125f857565b811561262b570490565b634e487b7160e01b600052601260045260246000fd5b919082018092116125f857565b6044548061265d575060415490565b60415461267761119461266e6125d6565b604054906125eb565b670de0b6b3a7640000908181029181830414901517156125f8576125e89261269e91612621565b90612641565b6001600160a01b036125e89116806000526043602052670de0b6b3a76400006126ff6040600020549260456020526126f9604060002054916126e461264e565b906000526042602052604060002054906125eb565b9061260e565b0490612641565b600260015414612717576002600155565b606460405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c006044820152fd5b6040517f23b872dd0000000000000000000000000000000000000000000000000000000060208201526001600160a01b03928316602482015292909116604483015260648201929092526127c5916127c082608481015b03601f1981018452836124b3565b6127c7565b565b6001600160a01b0316906040516040810167ffffffffffffffff908281108282111761249d576040526020938483527f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564858401526000808587829751910182855af1903d15612920573d92831161290c57906128639392916040519261285688601f19601f84011601856124b3565b83523d868885013e61292b565b8051918215918483156128e8575b50505090501561287e5750565b6084906040519062461bcd60e51b82526004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e60448201527f6f742073756363656564000000000000000000000000000000000000000000006064820152fd5b919381809450010312610317578201519081151582036108d1575080388084612871565b602485634e487b7160e01b81526041600452fd5b906128639392506060915b9192901561298c575081511561293f575090565b3b156129485790565b606460405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e74726163740000006044820152fd5b82519091501561299f5750805190602001fd5b6040519062461bcd60e51b825281602080600483015282519283602484015260005b8481106129e457505050601f19601f836000604480968601015201168101030190fd5b8181018301518682016044015285935082016129c1565b15612a0257565b606460405162461bcd60e51b815260206004820152600b60248201527f6e6f2062616c616e6365730000000000000000000000000000000000000000006044820152fd5b6040517fa9059cbb0000000000000000000000000000000000000000000000000000000060208201526001600160a01b03909216602483015260448201929092526127c5916127c082606481016127b2565b15612a9f57565b608460405162461bcd60e51b815260206004820152602a60248201527f43616c6c6572206973206e6f742052657761726473446973747269627574696f60448201527f6e20636f6e7472616374000000000000000000000000000000000000000000006064820152fd5b91908260409103126105cf576020825192015190565b906001600160a01b03604051917f095ea7b30000000000000000000000000000000000000000000000000000000060208401521660248201526000604482015260448152608081019181831067ffffffffffffffff84111761249d576127c5926040526127c7565b91909181158015612c55575b15612beb576040517f095ea7b30000000000000000000000000000000000000000000000000000000060208201526001600160a01b03909316602484015260448301919091526127c591906127c082606481016127b2565b608460405162461bcd60e51b815260206004820152603660248201527f5361666545524332303a20617070726f76652066726f6d206e6f6e2d7a65726f60448201527f20746f206e6f6e2d7a65726f20616c6c6f77616e6365000000000000000000006064820152fd5b506040517fdd62ed3e0000000000000000000000000000000000000000000000000000000081523060048201526020816044816001600160a01b03808916602483015286165afa908115612ce357600091612cb2575b5015612b93565b906020823d8211612cdb575b81612ccb602093836124b3565b810103126108d157505138612cab565b3d9150612cbe565b6040513d6000823e3d90fdfea164736f6c6343000813000a
Constructor Arguments (ABI-Encoded and is the last bytes of the Contract Creation Code above)
0000000000000000000000000000000000000000000000000000000000000001
-----Decoded View---------------
Arg [0] : gaugeType_ (uint8): 1
-----Encoded View---------------
1 Constructor Arguments found :
Arg [0] : 0000000000000000000000000000000000000000000000000000000000000001
Loading...
Loading
Loading...
Loading
Loading...
Loading
Net Worth in USD
$0.00
Net Worth in HYPE
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.