Overview
ETH Balance
0 ETH
Eth Value
$0.00More Info
Private Name Tags
ContractCreator
Transaction Hash |
Method
|
Block
|
From
|
To
|
|||||
---|---|---|---|---|---|---|---|---|---|
Advanced mode: Intended for advanced users or developers and will display all Internal Transactions including zero value transfers. Name tag integration is not available in advanced view.
Latest 25 internal transactions (View All)
Advanced mode:
Parent Transaction Hash | Block |
From
|
To
|
||||
---|---|---|---|---|---|---|---|
19628921 | 295 days ago | 0 ETH | |||||
19628921 | 295 days ago | 0 ETH | |||||
19628921 | 295 days ago | 0 ETH | |||||
19628921 | 295 days ago | 0 ETH | |||||
19628921 | 295 days ago | 0 ETH | |||||
19628921 | 295 days ago | 0 ETH | |||||
19578937 | 302 days ago | 0 ETH | |||||
19578937 | 302 days ago | 0 ETH | |||||
19578937 | 302 days ago | 0 ETH | |||||
19578937 | 302 days ago | 0 ETH | |||||
19578937 | 302 days ago | 0 ETH | |||||
19578937 | 302 days ago | 0 ETH | |||||
19529456 | 309 days ago | 0 ETH | |||||
19529456 | 309 days ago | 0 ETH | |||||
19529456 | 309 days ago | 0 ETH | |||||
19529456 | 309 days ago | 0 ETH | |||||
19529456 | 309 days ago | 0 ETH | |||||
19529456 | 309 days ago | 0 ETH | |||||
19479889 | 316 days ago | 0 ETH | |||||
19479889 | 316 days ago | 0 ETH | |||||
19479889 | 316 days ago | 0 ETH | |||||
19479889 | 316 days ago | 0 ETH | |||||
19479889 | 316 days ago | 0 ETH | |||||
19479889 | 316 days ago | 0 ETH | |||||
19430104 | 323 days ago | 0 ETH |
Loading...
Loading
Contract Source Code Verified (Exact Match)
Contract Name:
MerklGaugeMiddleman
Compiler Version
v0.8.17+commit.8df45f5f
Contract Source Code (Solidity Standard Json-Input format)
// SPDX-License-Identifier: BUSL-1.1 /* * █ ***** ▓▓▓ * ▓▓▓▓▓▓▓ * ///. ▓▓▓▓▓▓▓▓▓▓▓▓▓ ***** //////// ▓▓▓▓▓▓▓ * ///////////// ▓▓▓ ▓▓ ////////////////// █ ▓▓ ▓▓ ▓▓ /////////////////////// ▓▓ ▓▓ ▓▓ ▓▓ //////////////////////////// ▓▓ ▓▓ ▓▓ ▓▓ /////////▓▓▓///////▓▓▓///////// ▓▓ ▓▓ ▓▓ ,////////////////////////////////////// ▓▓ ▓▓ ▓▓ ////////////////////////////////////////// ▓▓ ▓▓ //////////////////////▓▓▓▓///////////////////// ,//////////////////////////////////////////////////// .////////////////////////////////////////////////////////// .//////////////////////////██.,//////////////////////////█ .//////////////////////████..,./////////////////////██ ...////////////////███████.....,.////////////////███ ,.,////////////████████ ........,///////////████ .,.,//////█████████ ,.......///////████ ,..//████████ ........./████ ..,██████ .....,███ .██ ,.,█ ▓▓ ▓▓▓▓▓▓▓▓▓▓ ▓▓▓▓▓▓▓▓▓▓ ▓▓ ▓▓▓▓▓▓▓▓▓▓ ▓▓▓▓▓▓ ▓▓▓ ▓▓▓ ▓▓▓ ▓▓ ▓▓ ▓▓▓▓ ▓▓▓ ▓▓▓ ▓▓▓ ▓▓▓ ▓▓▓ ▓▓▓ ▓▓ ▓▓▓▓▓ ▓▓▓ ▓▓ ▓▓▓ ▓▓▓ ▓▓▓▓▓▓▓▓▓▓ ▓▓▓▓▓▓▓▓▓▓ ▓▓▓▓▓▓▓▓▓▓ */ pragma solidity ^0.8.17; import "@openzeppelin/contracts/token/ERC20/IERC20.sol"; import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol"; import "../DistributionCreator.sol"; /// @title MerklGaugeMiddleman /// @author Angle Labs, Inc. /// @notice Manages the transfer of ANGLE rewards to the `DistributionCreator` contract /// @dev This contract is built under the assumption that the `DistributionCreator` contract has already whitelisted /// this contract for it to distribute rewards without having to sign a message /// @dev Transient funds left in this contract after a call may be exploited contract MerklGaugeMiddleman { using SafeERC20 for IERC20; // ================================= PARAMETERS ================================ /// @notice Contract handling access control ICore public accessControlManager; /// @notice Maps a gauge to its reward parameters mapping(address => DistributionParameters) public gaugeParams; // =================================== EVENT =================================== event GaugeSet(address indexed gauge); constructor(ICore _accessControlManager) { if (address(_accessControlManager) == address(0)) revert ZeroAddress(); accessControlManager = _accessControlManager; IERC20 _angle = angle(); // Condition left here for testing purposes if (address(_angle) != address(0)) _angle.safeIncreaseAllowance(address(merklDistributionCreator()), type(uint256).max); } // ================================= REFERENCES ================================ /// @notice Address of the ANGLE token function angle() public view virtual returns (IERC20) { return IERC20(0x31429d1856aD1377A8A0079410B297e1a9e214c2); } /// @notice Address of the Merkl contract managing rewards to be distributed /// @dev Address is the same across the different chains on which it is deployed function merklDistributionCreator() public view virtual returns (DistributionCreator) { return DistributionCreator(0x8BB4C975Ff3c250e0ceEA271728547f3802B36Fd); } // ============================= EXTERNAL FUNCTIONS ============================ /// @notice Restores the allowance for the ANGLE token to the `DistributionCreator` contract function setAngleAllowance() external { IERC20 _angle = angle(); address manager = address(merklDistributionCreator()); uint256 currentAllowance = _angle.allowance(address(this), manager); if (currentAllowance < type(uint256).max) _angle.safeIncreaseAllowance(manager, type(uint256).max - currentAllowance); } /// @notice Specifies the reward distribution parameters for `gauge` function setGauge(address gauge, DistributionParameters memory params) external { if (!accessControlManager.isGovernorOrGuardian(msg.sender)) revert NotGovernorOrGuardian(); DistributionCreator manager = merklDistributionCreator(); if ( gauge == address(0) || params.rewardToken != address(angle()) || (manager.isWhitelistedToken(IUniswapV3Pool(params.uniV3Pool).token0()) == 0 && manager.isWhitelistedToken(IUniswapV3Pool(params.uniV3Pool).token1()) == 0) ) revert InvalidParams(); gaugeParams[gauge] = params; emit GaugeSet(gauge); } /// @notice Transmits rewards from the `AngleDistributor` to the `DistributionCreator` with the correct /// parameters /// @dev Callable by any contract /// @dev This method can be used to recover leftover ANGLE tokens in the contract function notifyReward(address gauge, uint256 amount) public { DistributionParameters memory params = gaugeParams[gauge]; if (params.uniV3Pool == address(0)) revert InvalidParams(); if (amount == 0) amount = angle().balanceOf(address(this)); params.epochStart = uint32(block.timestamp); params.amount = amount; DistributionCreator creator = merklDistributionCreator(); if (amount > 0) { // Need to deal with minimum distribution amounts if (amount > creator.rewardTokenMinAmounts(address(angle())) * params.numEpoch) { merklDistributionCreator().createDistribution(params); } else { // Sending leftover ANGLE tokens to the `msg.sender` angle().safeTransfer(msg.sender, amount); } } } /// @notice Fetches tokens and transmits rewards in the same transaction function notifyRewardWithTransfer(address gauge, uint256 amount) external { angle().safeTransferFrom(msg.sender, address(this), amount); notifyReward(gauge, amount); } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.5.0) (interfaces/draft-IERC1822.sol) pragma solidity ^0.8.0; /** * @dev ERC1822: Universal Upgradeable Proxy Standard (UUPS) documents a method for upgradeability through a simplified * proxy whose upgrades are fully controlled by the current implementation. */ interface IERC1822ProxiableUpgradeable { /** * @dev Returns the storage slot that the proxiable contract assumes is being used to store the implementation * address. * * IMPORTANT: A proxy pointing at a proxiable contract should not be considered proxiable itself, because this risks * bricking a proxy that upgrades to it, by delegating to itself until out of gas. Thus it is critical that this * function revert if invoked through a proxy. */ function proxiableUUID() external view returns (bytes32); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.5.0) (proxy/ERC1967/ERC1967Upgrade.sol) pragma solidity ^0.8.2; import "../beacon/IBeaconUpgradeable.sol"; import "../../interfaces/draft-IERC1822Upgradeable.sol"; import "../../utils/AddressUpgradeable.sol"; import "../../utils/StorageSlotUpgradeable.sol"; import "../utils/Initializable.sol"; /** * @dev This abstract contract provides getters and event emitting update functions for * https://eips.ethereum.org/EIPS/eip-1967[EIP1967] slots. * * _Available since v4.1._ * * @custom:oz-upgrades-unsafe-allow delegatecall */ abstract contract ERC1967UpgradeUpgradeable is Initializable { function __ERC1967Upgrade_init() internal onlyInitializing { } function __ERC1967Upgrade_init_unchained() internal onlyInitializing { } // This is the keccak-256 hash of "eip1967.proxy.rollback" subtracted by 1 bytes32 private constant _ROLLBACK_SLOT = 0x4910fdfa16fed3260ed0e7147f7cc6da11a60208b5b9406d12a635614ffd9143; /** * @dev Storage slot with the address of the current implementation. * This is the keccak-256 hash of "eip1967.proxy.implementation" subtracted by 1, and is * validated in the constructor. */ bytes32 internal constant _IMPLEMENTATION_SLOT = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc; /** * @dev Emitted when the implementation is upgraded. */ event Upgraded(address indexed implementation); /** * @dev Returns the current implementation address. */ function _getImplementation() internal view returns (address) { return StorageSlotUpgradeable.getAddressSlot(_IMPLEMENTATION_SLOT).value; } /** * @dev Stores a new address in the EIP1967 implementation slot. */ function _setImplementation(address newImplementation) private { require(AddressUpgradeable.isContract(newImplementation), "ERC1967: new implementation is not a contract"); StorageSlotUpgradeable.getAddressSlot(_IMPLEMENTATION_SLOT).value = newImplementation; } /** * @dev Perform implementation upgrade * * Emits an {Upgraded} event. */ function _upgradeTo(address newImplementation) internal { _setImplementation(newImplementation); emit Upgraded(newImplementation); } /** * @dev Perform implementation upgrade with additional setup call. * * Emits an {Upgraded} event. */ function _upgradeToAndCall( address newImplementation, bytes memory data, bool forceCall ) internal { _upgradeTo(newImplementation); if (data.length > 0 || forceCall) { _functionDelegateCall(newImplementation, data); } } /** * @dev Perform implementation upgrade with security checks for UUPS proxies, and additional setup call. * * Emits an {Upgraded} event. */ function _upgradeToAndCallUUPS( address newImplementation, bytes memory data, bool forceCall ) internal { // Upgrades from old implementations will perform a rollback test. This test requires the new // implementation to upgrade back to the old, non-ERC1822 compliant, implementation. Removing // this special case will break upgrade paths from old UUPS implementation to new ones. if (StorageSlotUpgradeable.getBooleanSlot(_ROLLBACK_SLOT).value) { _setImplementation(newImplementation); } else { try IERC1822ProxiableUpgradeable(newImplementation).proxiableUUID() returns (bytes32 slot) { require(slot == _IMPLEMENTATION_SLOT, "ERC1967Upgrade: unsupported proxiableUUID"); } catch { revert("ERC1967Upgrade: new implementation is not UUPS"); } _upgradeToAndCall(newImplementation, data, forceCall); } } /** * @dev Storage slot with the admin of the contract. * This is the keccak-256 hash of "eip1967.proxy.admin" subtracted by 1, and is * validated in the constructor. */ bytes32 internal constant _ADMIN_SLOT = 0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103; /** * @dev Emitted when the admin account has changed. */ event AdminChanged(address previousAdmin, address newAdmin); /** * @dev Returns the current admin. */ function _getAdmin() internal view returns (address) { return StorageSlotUpgradeable.getAddressSlot(_ADMIN_SLOT).value; } /** * @dev Stores a new address in the EIP1967 admin slot. */ function _setAdmin(address newAdmin) private { require(newAdmin != address(0), "ERC1967: new admin is the zero address"); StorageSlotUpgradeable.getAddressSlot(_ADMIN_SLOT).value = newAdmin; } /** * @dev Changes the admin of the proxy. * * Emits an {AdminChanged} event. */ function _changeAdmin(address newAdmin) internal { emit AdminChanged(_getAdmin(), newAdmin); _setAdmin(newAdmin); } /** * @dev The storage slot of the UpgradeableBeacon contract which defines the implementation for this proxy. * This is bytes32(uint256(keccak256('eip1967.proxy.beacon')) - 1)) and is validated in the constructor. */ bytes32 internal constant _BEACON_SLOT = 0xa3f0ad74e5423aebfd80d3ef4346578335a9a72aeaee59ff6cb3582b35133d50; /** * @dev Emitted when the beacon is upgraded. */ event BeaconUpgraded(address indexed beacon); /** * @dev Returns the current beacon. */ function _getBeacon() internal view returns (address) { return StorageSlotUpgradeable.getAddressSlot(_BEACON_SLOT).value; } /** * @dev Stores a new beacon in the EIP1967 beacon slot. */ function _setBeacon(address newBeacon) private { require(AddressUpgradeable.isContract(newBeacon), "ERC1967: new beacon is not a contract"); require( AddressUpgradeable.isContract(IBeaconUpgradeable(newBeacon).implementation()), "ERC1967: beacon implementation is not a contract" ); StorageSlotUpgradeable.getAddressSlot(_BEACON_SLOT).value = newBeacon; } /** * @dev Perform beacon upgrade with additional setup call. Note: This upgrades the address of the beacon, it does * not upgrade the implementation contained in the beacon (see {UpgradeableBeacon-_setImplementation} for that). * * Emits a {BeaconUpgraded} event. */ function _upgradeBeaconToAndCall( address newBeacon, bytes memory data, bool forceCall ) internal { _setBeacon(newBeacon); emit BeaconUpgraded(newBeacon); if (data.length > 0 || forceCall) { _functionDelegateCall(IBeaconUpgradeable(newBeacon).implementation(), data); } } /** * @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) private returns (bytes memory) { require(AddressUpgradeable.isContract(target), "Address: delegate call to non-contract"); // solhint-disable-next-line avoid-low-level-calls (bool success, bytes memory returndata) = target.delegatecall(data); return AddressUpgradeable.verifyCallResult(success, returndata, "Address: low-level delegate call failed"); } /** * @dev This empty reserved space is put in place to allow future versions to add new * variables without shifting down storage in the inheritance chain. * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps */ uint256[50] private __gap; }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (proxy/beacon/IBeacon.sol) pragma solidity ^0.8.0; /** * @dev This is the interface that {BeaconProxy} expects of its beacon. */ interface IBeaconUpgradeable { /** * @dev Must return an address that can be used as a delegate call target. * * {BeaconProxy} will check that this address is a contract. */ function implementation() external view returns (address); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.8.1) (proxy/utils/Initializable.sol) pragma solidity ^0.8.2; import "../../utils/AddressUpgradeable.sol"; /** * @dev This is a base contract to aid in writing upgradeable contracts, or any kind of contract that will be deployed * behind a proxy. Since proxied contracts do not make use of a constructor, it's common to move constructor logic to an * external initializer function, usually called `initialize`. It then becomes necessary to protect this initializer * function so it can only be called once. The {initializer} modifier provided by this contract will have this effect. * * The initialization functions use a version number. Once a version number is used, it is consumed and cannot be * reused. This mechanism prevents re-execution of each "step" but allows the creation of new initialization steps in * case an upgrade adds a module that needs to be initialized. * * For example: * * [.hljs-theme-light.nopadding] * ``` * contract MyToken is ERC20Upgradeable { * function initialize() initializer public { * __ERC20_init("MyToken", "MTK"); * } * } * contract MyTokenV2 is MyToken, ERC20PermitUpgradeable { * function initializeV2() reinitializer(2) public { * __ERC20Permit_init("MyToken"); * } * } * ``` * * TIP: To avoid leaving the proxy in an uninitialized state, the initializer function should be called as early as * possible by providing the encoded function call as the `_data` argument to {ERC1967Proxy-constructor}. * * CAUTION: When used with inheritance, manual care must be taken to not invoke a parent initializer twice, or to ensure * that all initializers are idempotent. This is not verified automatically as constructors are by Solidity. * * [CAUTION] * ==== * Avoid leaving a contract uninitialized. * * An uninitialized contract can be taken over by an attacker. This applies to both a proxy and its implementation * contract, which may impact the proxy. To prevent the implementation contract from being used, you should invoke * the {_disableInitializers} function in the constructor to automatically lock it when it is deployed: * * [.hljs-theme-light.nopadding] * ``` * /// @custom:oz-upgrades-unsafe-allow constructor * constructor() { * _disableInitializers(); * } * ``` * ==== */ abstract contract Initializable { /** * @dev Indicates that the contract has been initialized. * @custom:oz-retyped-from bool */ uint8 private _initialized; /** * @dev Indicates that the contract is in the process of being initialized. */ bool private _initializing; /** * @dev Triggered when the contract has been initialized or reinitialized. */ event Initialized(uint8 version); /** * @dev A modifier that defines a protected initializer function that can be invoked at most once. In its scope, * `onlyInitializing` functions can be used to initialize parent contracts. * * Similar to `reinitializer(1)`, except that functions marked with `initializer` can be nested in the context of a * constructor. * * Emits an {Initialized} event. */ modifier initializer() { bool isTopLevelCall = !_initializing; require( (isTopLevelCall && _initialized < 1) || (!AddressUpgradeable.isContract(address(this)) && _initialized == 1), "Initializable: contract is already initialized" ); _initialized = 1; if (isTopLevelCall) { _initializing = true; } _; if (isTopLevelCall) { _initializing = false; emit Initialized(1); } } /** * @dev A modifier that defines a protected reinitializer function that can be invoked at most once, and only if the * contract hasn't been initialized to a greater version before. In its scope, `onlyInitializing` functions can be * used to initialize parent contracts. * * A reinitializer may be used after the original initialization step. This is essential to configure modules that * are added through upgrades and that require initialization. * * When `version` is 1, this modifier is similar to `initializer`, except that functions marked with `reinitializer` * cannot be nested. If one is invoked in the context of another, execution will revert. * * Note that versions can jump in increments greater than 1; this implies that if multiple reinitializers coexist in * a contract, executing them in the right order is up to the developer or operator. * * WARNING: setting the version to 255 will prevent any future reinitialization. * * Emits an {Initialized} event. */ modifier reinitializer(uint8 version) { require(!_initializing && _initialized < version, "Initializable: contract is already initialized"); _initialized = version; _initializing = true; _; _initializing = false; emit Initialized(version); } /** * @dev Modifier to protect an initialization function so that it can only be invoked by functions with the * {initializer} and {reinitializer} modifiers, directly or indirectly. */ modifier onlyInitializing() { require(_initializing, "Initializable: contract is not initializing"); _; } /** * @dev Locks the contract, preventing any future reinitialization. This cannot be part of an initializer call. * Calling this in the constructor of a contract will prevent that contract from being initialized or reinitialized * to any version. It is recommended to use this to lock implementation contracts that are designed to be called * through proxies. * * Emits an {Initialized} event the first time it is successfully executed. */ function _disableInitializers() internal virtual { require(!_initializing, "Initializable: contract is initializing"); if (_initialized < type(uint8).max) { _initialized = type(uint8).max; emit Initialized(type(uint8).max); } } /** * @dev Returns the highest version that has been initialized. See {reinitializer}. */ function _getInitializedVersion() internal view returns (uint8) { return _initialized; } /** * @dev Returns `true` if the contract is currently initializing. See {onlyInitializing}. */ function _isInitializing() internal view returns (bool) { return _initializing; } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.8.0) (proxy/utils/UUPSUpgradeable.sol) pragma solidity ^0.8.0; import "../../interfaces/draft-IERC1822Upgradeable.sol"; import "../ERC1967/ERC1967UpgradeUpgradeable.sol"; import "./Initializable.sol"; /** * @dev An upgradeability mechanism designed for UUPS proxies. The functions included here can perform an upgrade of an * {ERC1967Proxy}, when this contract is set as the implementation behind such a proxy. * * A security mechanism ensures that an upgrade does not turn off upgradeability accidentally, although this risk is * reinstated if the upgrade retains upgradeability but removes the security mechanism, e.g. by replacing * `UUPSUpgradeable` with a custom implementation of upgrades. * * The {_authorizeUpgrade} function must be overridden to include access restriction to the upgrade mechanism. * * _Available since v4.1._ */ abstract contract UUPSUpgradeable is Initializable, IERC1822ProxiableUpgradeable, ERC1967UpgradeUpgradeable { function __UUPSUpgradeable_init() internal onlyInitializing { } function __UUPSUpgradeable_init_unchained() internal onlyInitializing { } /// @custom:oz-upgrades-unsafe-allow state-variable-immutable state-variable-assignment address private immutable __self = address(this); /** * @dev Check that the execution is being performed through a delegatecall call and that the execution context is * a proxy contract with an implementation (as defined in ERC1967) pointing to self. This should only be the case * for UUPS and transparent proxies that are using the current contract as their implementation. Execution of a * function through ERC1167 minimal proxies (clones) would not normally pass this test, but is not guaranteed to * fail. */ modifier onlyProxy() { require(address(this) != __self, "Function must be called through delegatecall"); require(_getImplementation() == __self, "Function must be called through active proxy"); _; } /** * @dev Check that the execution is not being performed through a delegate call. This allows a function to be * callable on the implementing contract but not through proxies. */ modifier notDelegated() { require(address(this) == __self, "UUPSUpgradeable: must not be called through delegatecall"); _; } /** * @dev Implementation of the ERC1822 {proxiableUUID} function. This returns the storage slot used by the * implementation. It is used to validate the implementation's compatibility when performing an upgrade. * * IMPORTANT: A proxy pointing at a proxiable contract should not be considered proxiable itself, because this risks * bricking a proxy that upgrades to it, by delegating to itself until out of gas. Thus it is critical that this * function revert if invoked through a proxy. This is guaranteed by the `notDelegated` modifier. */ function proxiableUUID() external view virtual override notDelegated returns (bytes32) { return _IMPLEMENTATION_SLOT; } /** * @dev Upgrade the implementation of the proxy to `newImplementation`. * * Calls {_authorizeUpgrade}. * * Emits an {Upgraded} event. */ function upgradeTo(address newImplementation) external virtual onlyProxy { _authorizeUpgrade(newImplementation); _upgradeToAndCallUUPS(newImplementation, new bytes(0), false); } /** * @dev Upgrade the implementation of the proxy to `newImplementation`, and subsequently execute the function call * encoded in `data`. * * Calls {_authorizeUpgrade}. * * Emits an {Upgraded} event. */ function upgradeToAndCall(address newImplementation, bytes memory data) external payable virtual onlyProxy { _authorizeUpgrade(newImplementation); _upgradeToAndCallUUPS(newImplementation, data, true); } /** * @dev Function that should revert when `msg.sender` is not authorized to upgrade the contract. Called by * {upgradeTo} and {upgradeToAndCall}. * * Normally, this function will use an xref:access.adoc[access control] modifier such as {Ownable-onlyOwner}. * * ```solidity * function _authorizeUpgrade(address) internal override onlyOwner {} * ``` */ function _authorizeUpgrade(address newImplementation) internal virtual; /** * @dev This empty reserved space is put in place to allow future versions to add new * variables without shifting down storage in the inheritance chain. * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps */ uint256[50] private __gap; }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.8.0) (security/ReentrancyGuard.sol) pragma solidity ^0.8.0; import "../proxy/utils/Initializable.sol"; /** * @dev Contract module that helps prevent reentrant calls to a function. * * Inheriting from `ReentrancyGuard` will make the {nonReentrant} modifier * available, which can be applied to functions to make sure there are no nested * (reentrant) calls to them. * * Note that because there is a single `nonReentrant` guard, functions marked as * `nonReentrant` may not call one another. This can be worked around by making * those functions `private`, and then adding `external` `nonReentrant` entry * points to them. * * TIP: If you would like to learn more about reentrancy and alternative ways * to protect against it, check out our blog post * https://blog.openzeppelin.com/reentrancy-after-istanbul/[Reentrancy After Istanbul]. */ abstract contract ReentrancyGuardUpgradeable is Initializable { // Booleans are more expensive than uint256 or any type that takes up a full // word because each write operation emits an extra SLOAD to first read the // slot's contents, replace the bits taken up by the boolean, and then write // back. This is the compiler's defense against contract upgrades and // pointer aliasing, and it cannot be disabled. // The values being non-zero value makes deployment a bit more expensive, // but in exchange the refund on every call to nonReentrant will be lower in // amount. Since refunds are capped to a percentage of the total // transaction's gas, it is best to keep them low in cases like this one, to // increase the likelihood of the full refund coming into effect. uint256 private constant _NOT_ENTERED = 1; uint256 private constant _ENTERED = 2; uint256 private _status; function __ReentrancyGuard_init() internal onlyInitializing { __ReentrancyGuard_init_unchained(); } function __ReentrancyGuard_init_unchained() internal onlyInitializing { _status = _NOT_ENTERED; } /** * @dev Prevents a contract from calling itself, directly or indirectly. * Calling a `nonReentrant` function from another `nonReentrant` * function is not supported. It is possible to prevent this from happening * by making the `nonReentrant` function external, and making it call a * `private` function that does the actual work. */ modifier nonReentrant() { _nonReentrantBefore(); _; _nonReentrantAfter(); } function _nonReentrantBefore() private { // On the first call to nonReentrant, _status will be _NOT_ENTERED require(_status != _ENTERED, "ReentrancyGuard: reentrant call"); // Any calls to nonReentrant after this point will fail _status = _ENTERED; } function _nonReentrantAfter() private { // By storing the original value once again, a refund is triggered (see // https://eips.ethereum.org/EIPS/eip-2200) _status = _NOT_ENTERED; } /** * @dev This empty reserved space is put in place to allow future versions to add new * variables without shifting down storage in the inheritance chain. * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps */ uint256[49] private __gap; }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.8.0) (utils/Address.sol) pragma solidity ^0.8.1; /** * @dev Collection of functions related to the address type */ library AddressUpgradeable { /** * @dev Returns true if `account` is a contract. * * [IMPORTANT] * ==== * It is unsafe to assume that an address for which this function returns * false is an externally-owned account (EOA) and not a contract. * * Among others, `isContract` will return false for the following * types of addresses: * * - an externally-owned account * - a contract in construction * - an address where a contract will be created * - an address where a contract lived, but was destroyed * ==== * * [IMPORTANT] * ==== * You shouldn't rely on `isContract` to protect against flash loan attacks! * * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract * constructor. * ==== */ function isContract(address account) internal view returns (bool) { // This method relies on extcodesize/address.code.length, which returns 0 // for contracts in construction, since the code is only stored at the end // of the constructor execution. return account.code.length > 0; } /** * @dev Replacement for Solidity's `transfer`: sends `amount` wei to * `recipient`, forwarding all available gas and reverting on errors. * * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost * of certain opcodes, possibly making contracts go over the 2300 gas limit * imposed by `transfer`, making them unable to receive funds via * `transfer`. {sendValue} removes this limitation. * * https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more]. * * IMPORTANT: because control is transferred to `recipient`, care must be * taken to not create reentrancy vulnerabilities. Consider using * {ReentrancyGuard} or the * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern]. */ function sendValue(address payable recipient, uint256 amount) internal { require(address(this).balance >= amount, "Address: insufficient balance"); (bool success, ) = recipient.call{value: amount}(""); require(success, "Address: unable to send value, recipient may have reverted"); } /** * @dev Performs a Solidity function call using a low level `call`. A * plain `call` is an unsafe replacement for a function call: use this * function instead. * * If `target` reverts with a revert reason, it is bubbled up by this * function (like regular Solidity function calls). * * Returns the raw returned data. To convert to the expected return value, * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`]. * * Requirements: * * - `target` must be a contract. * - calling `target` with `data` must not revert. * * _Available since v3.1._ */ function functionCall(address target, bytes memory data) internal returns (bytes memory) { return functionCallWithValue(target, data, 0, "Address: low-level call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with * `errorMessage` as a fallback revert reason when `target` reverts. * * _Available since v3.1._ */ function functionCall( address target, bytes memory data, string memory errorMessage ) internal returns (bytes memory) { return functionCallWithValue(target, data, 0, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but also transferring `value` wei to `target`. * * Requirements: * * - the calling contract must have an ETH balance of at least `value`. * - the called Solidity function must be `payable`. * * _Available since v3.1._ */ function functionCallWithValue( address target, bytes memory data, uint256 value ) internal returns (bytes memory) { return functionCallWithValue(target, data, value, "Address: low-level call with value failed"); } /** * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but * with `errorMessage` as a fallback revert reason when `target` reverts. * * _Available since v3.1._ */ function functionCallWithValue( address target, bytes memory data, uint256 value, string memory errorMessage ) internal returns (bytes memory) { require(address(this).balance >= value, "Address: insufficient balance for call"); (bool success, bytes memory returndata) = target.call{value: value}(data); return verifyCallResultFromTarget(target, success, returndata, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but performing a static call. * * _Available since v3.3._ */ function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) { return functionStaticCall(target, data, "Address: low-level static call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`], * but performing a static call. * * _Available since v3.3._ */ function functionStaticCall( address target, bytes memory data, string memory errorMessage ) internal view returns (bytes memory) { (bool success, bytes memory returndata) = target.staticcall(data); return verifyCallResultFromTarget(target, success, returndata, errorMessage); } /** * @dev Tool to verify that a low level call to smart-contract was successful, and revert (either by bubbling * the revert reason or using the provided one) in case of unsuccessful call or if target was not a contract. * * _Available since v4.8._ */ function verifyCallResultFromTarget( address target, bool success, bytes memory returndata, string memory errorMessage ) internal view returns (bytes memory) { if (success) { if (returndata.length == 0) { // only check isContract if the call was successful and the return data is empty // otherwise we already know that it was a contract require(isContract(target), "Address: call to non-contract"); } return returndata; } else { _revert(returndata, errorMessage); } } /** * @dev Tool to verify that a low level call was successful, and revert if it wasn't, either by bubbling the * revert reason or using the provided one. * * _Available since v4.3._ */ function verifyCallResult( bool success, bytes memory returndata, string memory errorMessage ) internal pure returns (bytes memory) { if (success) { return returndata; } else { _revert(returndata, errorMessage); } } function _revert(bytes memory returndata, string memory errorMessage) private pure { // Look for revert reason and bubble it up if present if (returndata.length > 0) { // The easiest way to bubble the revert reason is using memory via assembly /// @solidity memory-safe-assembly assembly { let returndata_size := mload(returndata) revert(add(32, returndata), returndata_size) } } else { revert(errorMessage); } } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.7.0) (utils/StorageSlot.sol) pragma solidity ^0.8.0; /** * @dev Library for reading and writing primitive types to specific storage slots. * * Storage slots are often used to avoid storage conflict when dealing with upgradeable contracts. * This library helps with reading and writing to such slots without the need for inline assembly. * * The functions in this library return Slot structs that contain a `value` member that can be used to read or write. * * Example usage to set ERC1967 implementation slot: * ``` * contract ERC1967 { * bytes32 internal constant _IMPLEMENTATION_SLOT = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc; * * function _getImplementation() internal view returns (address) { * return StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value; * } * * function _setImplementation(address newImplementation) internal { * require(Address.isContract(newImplementation), "ERC1967: new implementation is not a contract"); * StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value = newImplementation; * } * } * ``` * * _Available since v4.1 for `address`, `bool`, `bytes32`, and `uint256`._ */ library StorageSlotUpgradeable { struct AddressSlot { address value; } struct BooleanSlot { bool value; } struct Bytes32Slot { bytes32 value; } struct Uint256Slot { uint256 value; } /** * @dev Returns an `AddressSlot` with member `value` located at `slot`. */ function getAddressSlot(bytes32 slot) internal pure returns (AddressSlot storage r) { /// @solidity memory-safe-assembly assembly { r.slot := slot } } /** * @dev Returns an `BooleanSlot` with member `value` located at `slot`. */ function getBooleanSlot(bytes32 slot) internal pure returns (BooleanSlot storage r) { /// @solidity memory-safe-assembly assembly { r.slot := slot } } /** * @dev Returns an `Bytes32Slot` with member `value` located at `slot`. */ function getBytes32Slot(bytes32 slot) internal pure returns (Bytes32Slot storage r) { /// @solidity memory-safe-assembly assembly { r.slot := slot } } /** * @dev Returns an `Uint256Slot` with member `value` located at `slot`. */ function getUint256Slot(bytes32 slot) internal pure returns (Uint256Slot storage r) { /// @solidity memory-safe-assembly assembly { r.slot := slot } } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.6.0) (token/ERC20/IERC20.sol) pragma solidity ^0.8.0; /** * @dev Interface of the ERC20 standard as defined in the EIP. */ interface IERC20 { /** * @dev Emitted when `value` tokens are moved from one account (`from`) to * another (`to`). * * Note that `value` may be zero. */ event Transfer(address indexed from, address indexed to, uint256 value); /** * @dev Emitted when the allowance of a `spender` for an `owner` is set by * a call to {approve}. `value` is the new allowance. */ event Approval(address indexed owner, address indexed spender, uint256 value); /** * @dev Returns the amount of tokens in existence. */ function totalSupply() external view returns (uint256); /** * @dev Returns the amount of tokens owned by `account`. */ function balanceOf(address account) external view returns (uint256); /** * @dev Moves `amount` tokens from the caller's account to `to`. * * Returns a boolean value indicating whether the operation succeeded. * * Emits a {Transfer} event. */ function transfer(address to, uint256 amount) external returns (bool); /** * @dev Returns the remaining number of tokens that `spender` will be * allowed to spend on behalf of `owner` through {transferFrom}. This is * zero by default. * * This value changes when {approve} or {transferFrom} are called. */ function allowance(address owner, address spender) external view returns (uint256); /** * @dev Sets `amount` as the allowance of `spender` over the caller's tokens. * * Returns a boolean value indicating whether the operation succeeded. * * IMPORTANT: Beware that changing an allowance with this method brings the risk * that someone may use both the old and the new allowance by unfortunate * transaction ordering. One possible solution to mitigate this race * condition is to first reduce the spender's allowance to 0 and set the * desired value afterwards: * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729 * * Emits an {Approval} event. */ function approve(address spender, uint256 amount) external returns (bool); /** * @dev Moves `amount` tokens from `from` to `to` using the * allowance mechanism. `amount` is then deducted from the caller's * allowance. * * Returns a boolean value indicating whether the operation succeeded. * * Emits a {Transfer} event. */ function transferFrom( address from, address to, uint256 amount ) external returns (bool); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (token/ERC20/extensions/IERC20Metadata.sol) pragma solidity ^0.8.0; import "../IERC20.sol"; /** * @dev Interface for the optional metadata functions from the ERC20 standard. * * _Available since v4.1._ */ interface IERC20Metadata is IERC20 { /** * @dev Returns the name of the token. */ function name() external view returns (string memory); /** * @dev Returns the symbol of the token. */ function symbol() external view returns (string memory); /** * @dev Returns the decimals places of the token. */ function decimals() external view returns (uint8); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (token/ERC20/extensions/draft-IERC20Permit.sol) pragma solidity ^0.8.0; /** * @dev Interface of the ERC20 Permit extension allowing approvals to be made via signatures, as defined in * https://eips.ethereum.org/EIPS/eip-2612[EIP-2612]. * * Adds the {permit} method, which can be used to change an account's ERC20 allowance (see {IERC20-allowance}) by * presenting a message signed by the account. By not relying on {IERC20-approve}, the token holder account doesn't * need to send a transaction, and thus is not required to hold Ether at all. */ interface IERC20Permit { /** * @dev Sets `value` as the allowance of `spender` over ``owner``'s tokens, * given ``owner``'s signed approval. * * IMPORTANT: The same issues {IERC20-approve} has related to transaction * ordering also apply here. * * Emits an {Approval} event. * * Requirements: * * - `spender` cannot be the zero address. * - `deadline` must be a timestamp in the future. * - `v`, `r` and `s` must be a valid `secp256k1` signature from `owner` * over the EIP712-formatted function arguments. * - the signature must use ``owner``'s current nonce (see {nonces}). * * For more information on the signature format, see the * https://eips.ethereum.org/EIPS/eip-2612#specification[relevant EIP * section]. */ function permit( address owner, address spender, uint256 value, uint256 deadline, uint8 v, bytes32 r, bytes32 s ) external; /** * @dev Returns the current nonce for `owner`. This value must be * included whenever a signature is generated for {permit}. * * Every successful call to {permit} increases ``owner``'s nonce by one. This * prevents a signature from being used multiple times. */ function nonces(address owner) external view returns (uint256); /** * @dev Returns the domain separator used in the encoding of the signature for {permit}, as defined by {EIP712}. */ // solhint-disable-next-line func-name-mixedcase function DOMAIN_SEPARATOR() external view returns (bytes32); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.8.0) (token/ERC20/utils/SafeERC20.sol) pragma solidity ^0.8.0; import "../IERC20.sol"; import "../extensions/draft-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; function safeTransfer( IERC20 token, address to, uint256 value ) internal { _callOptionalReturn(token, abi.encodeWithSelector(token.transfer.selector, to, value)); } function safeTransferFrom( IERC20 token, address from, address to, uint256 value ) internal { _callOptionalReturn(token, abi.encodeWithSelector(token.transferFrom.selector, from, to, value)); } /** * @dev Deprecated. This function has issues similar to the ones found in * {IERC20-approve}, and its usage is discouraged. * * Whenever possible, use {safeIncreaseAllowance} and * {safeDecreaseAllowance} instead. */ function safeApprove( IERC20 token, address spender, uint256 value ) internal { // safeApprove should only be called when setting an initial allowance, // or when resetting it to zero. To increase and decrease it, use // 'safeIncreaseAllowance' and 'safeDecreaseAllowance' require( (value == 0) || (token.allowance(address(this), spender) == 0), "SafeERC20: approve from non-zero to non-zero allowance" ); _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, value)); } function safeIncreaseAllowance( IERC20 token, address spender, uint256 value ) internal { uint256 newAllowance = token.allowance(address(this), spender) + value; _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance)); } function safeDecreaseAllowance( IERC20 token, address spender, uint256 value ) internal { unchecked { uint256 oldAllowance = token.allowance(address(this), spender); require(oldAllowance >= value, "SafeERC20: decreased allowance below zero"); uint256 newAllowance = oldAllowance - value; _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance)); } } 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"); if (returndata.length > 0) { // Return data is optional require(abi.decode(returndata, (bool)), "SafeERC20: ERC20 operation did not succeed"); } } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.8.0) (utils/Address.sol) pragma solidity ^0.8.1; /** * @dev Collection of functions related to the address type */ library Address { /** * @dev Returns true if `account` is a contract. * * [IMPORTANT] * ==== * It is unsafe to assume that an address for which this function returns * false is an externally-owned account (EOA) and not a contract. * * Among others, `isContract` will return false for the following * types of addresses: * * - an externally-owned account * - a contract in construction * - an address where a contract will be created * - an address where a contract lived, but was destroyed * ==== * * [IMPORTANT] * ==== * You shouldn't rely on `isContract` to protect against flash loan attacks! * * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract * constructor. * ==== */ function isContract(address account) internal view returns (bool) { // This method relies on extcodesize/address.code.length, which returns 0 // for contracts in construction, since the code is only stored at the end // of the constructor execution. return account.code.length > 0; } /** * @dev Replacement for Solidity's `transfer`: sends `amount` wei to * `recipient`, forwarding all available gas and reverting on errors. * * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost * of certain opcodes, possibly making contracts go over the 2300 gas limit * imposed by `transfer`, making them unable to receive funds via * `transfer`. {sendValue} removes this limitation. * * https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more]. * * IMPORTANT: because control is transferred to `recipient`, care must be * taken to not create reentrancy vulnerabilities. Consider using * {ReentrancyGuard} or the * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern]. */ function sendValue(address payable recipient, uint256 amount) internal { require(address(this).balance >= amount, "Address: insufficient balance"); (bool success, ) = recipient.call{value: amount}(""); require(success, "Address: unable to send value, recipient may have reverted"); } /** * @dev Performs a Solidity function call using a low level `call`. A * plain `call` is an unsafe replacement for a function call: use this * function instead. * * If `target` reverts with a revert reason, it is bubbled up by this * function (like regular Solidity function calls). * * Returns the raw returned data. To convert to the expected return value, * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`]. * * Requirements: * * - `target` must be a contract. * - calling `target` with `data` must not revert. * * _Available since v3.1._ */ function functionCall(address target, bytes memory data) internal returns (bytes memory) { return 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.8.0) (utils/Strings.sol) pragma solidity ^0.8.0; import "./math/Math.sol"; /** * @dev String operations. */ library Strings { bytes16 private constant _SYMBOLS = "0123456789abcdef"; uint8 private constant _ADDRESS_LENGTH = 20; /** * @dev Converts a `uint256` to its ASCII `string` decimal representation. */ function toString(uint256 value) internal pure returns (string memory) { unchecked { uint256 length = Math.log10(value) + 1; string memory buffer = new string(length); uint256 ptr; /// @solidity memory-safe-assembly assembly { ptr := add(buffer, add(32, length)) } while (true) { ptr--; /// @solidity memory-safe-assembly assembly { mstore8(ptr, byte(mod(value, 10), _SYMBOLS)) } value /= 10; if (value == 0) break; } return buffer; } } /** * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation. */ function toHexString(uint256 value) internal pure returns (string memory) { unchecked { return toHexString(value, Math.log256(value) + 1); } } /** * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation with fixed length. */ function toHexString(uint256 value, uint256 length) internal pure returns (string memory) { bytes memory buffer = new bytes(2 * length + 2); buffer[0] = "0"; buffer[1] = "x"; for (uint256 i = 2 * length + 1; i > 1; --i) { buffer[i] = _SYMBOLS[value & 0xf]; value >>= 4; } require(value == 0, "Strings: hex length insufficient"); return string(buffer); } /** * @dev Converts an `address` with fixed length of 20 bytes to its not checksummed ASCII `string` hexadecimal representation. */ function toHexString(address addr) internal pure returns (string memory) { return toHexString(uint256(uint160(addr)), _ADDRESS_LENGTH); } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.8.0) (utils/cryptography/ECDSA.sol) pragma solidity ^0.8.0; import "../Strings.sol"; /** * @dev Elliptic Curve Digital Signature Algorithm (ECDSA) operations. * * These functions can be used to verify that a message was signed by the holder * of the private keys of a given address. */ library ECDSA { enum RecoverError { NoError, InvalidSignature, InvalidSignatureLength, InvalidSignatureS, InvalidSignatureV // Deprecated in v4.8 } function _throwError(RecoverError error) private pure { if (error == RecoverError.NoError) { return; // no error: do nothing } else if (error == RecoverError.InvalidSignature) { revert("ECDSA: invalid signature"); } else if (error == RecoverError.InvalidSignatureLength) { revert("ECDSA: invalid signature length"); } else if (error == RecoverError.InvalidSignatureS) { revert("ECDSA: invalid signature 's' value"); } } /** * @dev Returns the address that signed a hashed message (`hash`) with * `signature` or error string. This address can then be used for verification purposes. * * The `ecrecover` EVM opcode allows for malleable (non-unique) signatures: * this function rejects them by requiring the `s` value to be in the lower * half order, and the `v` value to be either 27 or 28. * * IMPORTANT: `hash` _must_ be the result of a hash operation for the * verification to be secure: it is possible to craft signatures that * recover to arbitrary addresses for non-hashed data. A safe way to ensure * this is by receiving a hash of the original message (which may otherwise * be too long), and then calling {toEthSignedMessageHash} on it. * * Documentation for signature generation: * - with https://web3js.readthedocs.io/en/v1.3.4/web3-eth-accounts.html#sign[Web3.js] * - with https://docs.ethers.io/v5/api/signer/#Signer-signMessage[ethers] * * _Available since v4.3._ */ function tryRecover(bytes32 hash, bytes memory signature) internal pure returns (address, RecoverError) { if (signature.length == 65) { bytes32 r; bytes32 s; uint8 v; // ecrecover takes the signature parameters, and the only way to get them // currently is to use assembly. /// @solidity memory-safe-assembly assembly { r := mload(add(signature, 0x20)) s := mload(add(signature, 0x40)) v := byte(0, mload(add(signature, 0x60))) } return tryRecover(hash, v, r, s); } else { return (address(0), RecoverError.InvalidSignatureLength); } } /** * @dev Returns the address that signed a hashed message (`hash`) with * `signature`. This address can then be used for verification purposes. * * The `ecrecover` EVM opcode allows for malleable (non-unique) signatures: * this function rejects them by requiring the `s` value to be in the lower * half order, and the `v` value to be either 27 or 28. * * IMPORTANT: `hash` _must_ be the result of a hash operation for the * verification to be secure: it is possible to craft signatures that * recover to arbitrary addresses for non-hashed data. A safe way to ensure * this is by receiving a hash of the original message (which may otherwise * be too long), and then calling {toEthSignedMessageHash} on it. */ function recover(bytes32 hash, bytes memory signature) internal pure returns (address) { (address recovered, RecoverError error) = tryRecover(hash, signature); _throwError(error); return recovered; } /** * @dev Overload of {ECDSA-tryRecover} that receives the `r` and `vs` short-signature fields separately. * * See https://eips.ethereum.org/EIPS/eip-2098[EIP-2098 short signatures] * * _Available since v4.3._ */ function tryRecover( bytes32 hash, bytes32 r, bytes32 vs ) internal pure returns (address, RecoverError) { bytes32 s = vs & bytes32(0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff); uint8 v = uint8((uint256(vs) >> 255) + 27); return tryRecover(hash, v, r, s); } /** * @dev Overload of {ECDSA-recover} that receives the `r and `vs` short-signature fields separately. * * _Available since v4.2._ */ function recover( bytes32 hash, bytes32 r, bytes32 vs ) internal pure returns (address) { (address recovered, RecoverError error) = tryRecover(hash, r, vs); _throwError(error); return recovered; } /** * @dev Overload of {ECDSA-tryRecover} that receives the `v`, * `r` and `s` signature fields separately. * * _Available since v4.3._ */ function tryRecover( bytes32 hash, uint8 v, bytes32 r, bytes32 s ) internal pure returns (address, RecoverError) { // EIP-2 still allows signature malleability for ecrecover(). Remove this possibility and make the signature // unique. Appendix F in the Ethereum Yellow paper (https://ethereum.github.io/yellowpaper/paper.pdf), defines // the valid range for s in (301): 0 < s < secp256k1n ÷ 2 + 1, and for v in (302): v ∈ {27, 28}. Most // signatures from current libraries generate a unique signature with an s-value in the lower half order. // // If your library generates malleable signatures, such as s-values in the upper range, calculate a new s-value // with 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEBAAEDCE6AF48A03BBFD25E8CD0364141 - s1 and flip v from 27 to 28 or // vice versa. If your library also generates signatures with 0/1 for v instead 27/28, add 27 to v to accept // these malleable signatures as well. if (uint256(s) > 0x7FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF5D576E7357A4501DDFE92F46681B20A0) { return (address(0), RecoverError.InvalidSignatureS); } // If the signature is valid (and not malleable), return the signer address address signer = ecrecover(hash, v, r, s); if (signer == address(0)) { return (address(0), RecoverError.InvalidSignature); } return (signer, RecoverError.NoError); } /** * @dev Overload of {ECDSA-recover} that receives the `v`, * `r` and `s` signature fields separately. */ function recover( bytes32 hash, uint8 v, bytes32 r, bytes32 s ) internal pure returns (address) { (address recovered, RecoverError error) = tryRecover(hash, v, r, s); _throwError(error); return recovered; } /** * @dev Returns an Ethereum Signed Message, created from a `hash`. This * produces hash corresponding to the one signed with the * https://eth.wiki/json-rpc/API#eth_sign[`eth_sign`] * JSON-RPC method as part of EIP-191. * * See {recover}. */ function toEthSignedMessageHash(bytes32 hash) internal pure returns (bytes32) { // 32 is the length in bytes of hash, // enforced by the type signature above return keccak256(abi.encodePacked("\x19Ethereum Signed Message:\n32", hash)); } /** * @dev Returns an Ethereum Signed Message, created from `s`. This * produces hash corresponding to the one signed with the * https://eth.wiki/json-rpc/API#eth_sign[`eth_sign`] * JSON-RPC method as part of EIP-191. * * See {recover}. */ function toEthSignedMessageHash(bytes memory s) internal pure returns (bytes32) { return keccak256(abi.encodePacked("\x19Ethereum Signed Message:\n", Strings.toString(s.length), s)); } /** * @dev Returns an Ethereum Signed Typed Data, created from a * `domainSeparator` and a `structHash`. This produces hash corresponding * to the one signed with the * https://eips.ethereum.org/EIPS/eip-712[`eth_signTypedData`] * JSON-RPC method as part of EIP-712. * * See {recover}. */ function toTypedDataHash(bytes32 domainSeparator, bytes32 structHash) internal pure returns (bytes32) { return keccak256(abi.encodePacked("\x19\x01", domainSeparator, structHash)); } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.8.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) { return prod0 / denominator; } // Make sure the result is less than 2^256. Also prevents denominator == 0. require(denominator > prod1); /////////////////////////////////////////////// // 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 10, 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 * 8) < value ? 1 : 0); } } }
// SPDX-License-Identifier: BUSL-1.1 /* * █ ***** ▓▓▓ * ▓▓▓▓▓▓▓ * ///. ▓▓▓▓▓▓▓▓▓▓▓▓▓ ***** //////// ▓▓▓▓▓▓▓ * ///////////// ▓▓▓ ▓▓ ////////////////// █ ▓▓ ▓▓ ▓▓ /////////////////////// ▓▓ ▓▓ ▓▓ ▓▓ //////////////////////////// ▓▓ ▓▓ ▓▓ ▓▓ /////////▓▓▓///////▓▓▓///////// ▓▓ ▓▓ ▓▓ ,////////////////////////////////////// ▓▓ ▓▓ ▓▓ ////////////////////////////////////////// ▓▓ ▓▓ //////////////////////▓▓▓▓///////////////////// ,//////////////////////////////////////////////////// .////////////////////////////////////////////////////////// .//////////////////////////██.,//////////////////////////█ .//////////////////////████..,./////////////////////██ ...////////////////███████.....,.////////////////███ ,.,////////////████████ ........,///////////████ .,.,//////█████████ ,.......///////████ ,..//████████ ........./████ ..,██████ .....,███ .██ ,.,█ ▓▓ ▓▓▓▓▓▓▓▓▓▓ ▓▓▓▓▓▓▓▓▓▓ ▓▓ ▓▓▓▓▓▓▓▓▓▓ ▓▓▓▓▓▓ ▓▓▓ ▓▓▓ ▓▓▓ ▓▓ ▓▓ ▓▓▓▓ ▓▓▓ ▓▓▓ ▓▓▓ ▓▓▓ ▓▓▓ ▓▓▓ ▓▓ ▓▓▓▓▓ ▓▓▓ ▓▓ ▓▓▓ ▓▓▓ ▓▓▓▓▓▓▓▓▓▓ ▓▓▓▓▓▓▓▓▓▓ ▓▓▓▓▓▓▓▓▓▓ */ pragma solidity ^0.8.17; import "@openzeppelin/contracts-upgradeable/security/ReentrancyGuardUpgradeable.sol"; import "@openzeppelin/contracts/token/ERC20/extensions/IERC20Metadata.sol"; import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol"; import "@openzeppelin/contracts/utils/cryptography/ECDSA.sol"; import "./interfaces/external/uniswap/IUniswapV3Pool.sol"; import "./utils/UUPSHelper.sol"; import "./struct/DistributionParameters.sol"; import "./struct/ExtensiveDistributionParameters.sol"; import "./struct/RewardTokenAmounts.sol"; /// @title DistributionCreator /// @author Angle Labs, Inc. /// @notice Manages the distribution of rewards across different pools with concentrated liquidity (like on Uniswap V3) /// @dev This contract is mostly a helper for APIs built on top of Merkl /// @dev People depositing rewards must have signed a `message` with the conditions for using the /// product //solhint-disable contract DistributionCreator is UUPSHelper, ReentrancyGuardUpgradeable { using SafeERC20 for IERC20; // =========================== CONSTANTS / VARIABLES =========================== /// @notice Epoch duration uint32 public constant EPOCH_DURATION = 3600; /// @notice Base for fee computation uint256 public constant BASE_9 = 1e9; /// @notice `Core` contract handling access control ICore public core; /// @notice User contract for distributing rewards address public distributor; /// @notice Address to which fees are forwarded address public feeRecipient; /// @notice Value (in base 10**9) of the fees taken when creating a distribution for a pool which do not /// have a whitelisted token in it uint256 public fees; /// @notice Message that needs to be acknowledged by users creating a distribution string public message; /// @notice Hash of the message that needs to be signed bytes32 public messageHash; /// @notice List of all rewards ever distributed or to be distributed in the contract /// @dev An attacker could try to populate this list. It shouldn't be an issue as only view functions /// iterate on it DistributionParameters[] public distributionList; /// @notice Maps an address to its fee rebate mapping(address => uint256) public feeRebate; /// @notice Maps a token to whether it is whitelisted or not. No fees are to be paid for incentives given /// on pools with whitelisted tokens mapping(address => uint256) public isWhitelistedToken; /// @notice Maps an address to its nonce for creating a distribution mapping(address => uint256) public nonces; /// @notice Maps an address to the last valid hash signed mapping(address => bytes32) public userSignatures; /// @notice Maps a user to whether it is whitelisted for not signing mapping(address => uint256) public userSignatureWhitelist; /// @notice Maps a token to the minimum amount that must be sent per epoch for a distribution to be valid /// @dev If `rewardTokenMinAmounts[token] == 0`, then `token` cannot be used as a reward mapping(address => uint256) public rewardTokenMinAmounts; /// @notice List of all reward tokens that have at some point been accepted address[] public rewardTokens; uint256[36] private __gap; // =================================== EVENTS ================================== event DistributorUpdated(address indexed _distributor); event FeeRebateUpdated(address indexed user, uint256 userFeeRebate); event FeeRecipientUpdated(address indexed _feeRecipient); event FeesSet(uint256 _fees); event MessageUpdated(bytes32 _messageHash); event NewDistribution(DistributionParameters distribution, address indexed sender); event RewardTokenMinimumAmountUpdated(address indexed token, uint256 amount); event TokenWhitelistToggled(address indexed token, uint256 toggleStatus); event UserSigned(bytes32 messageHash, address indexed user); event UserSigningWhitelistToggled(address indexed user, uint256 toggleStatus); // ================================= MODIFIERS ================================= /// @notice Checks whether the `msg.sender` has the governor role or the guardian role modifier onlyGovernorOrGuardian() { if (!core.isGovernorOrGuardian(msg.sender)) revert NotGovernorOrGuardian(); _; } /// @notice Checks whether an address has signed the message or not modifier hasSigned() { if (userSignatureWhitelist[msg.sender] == 0 && userSignatures[msg.sender] != messageHash) revert NotSigned(); _; } // ================================ CONSTRUCTOR ================================ function initialize(ICore _core, address _distributor, uint256 _fees) external initializer { if (address(_core) == address(0) || _distributor == address(0)) revert ZeroAddress(); if (_fees > BASE_9) revert InvalidParam(); distributor = _distributor; core = _core; fees = _fees; } constructor() initializer {} /// @inheritdoc UUPSUpgradeable function _authorizeUpgrade(address) internal view override onlyGuardianUpgrader(core) {} // ============================== DEPOSIT FUNCTION ============================= /// @notice Creates a `distribution` to incentivize a given pool for a specific period of time /// @return distributionAmount How many reward tokens are actually taken into consideration in the contract /// @dev If the address specified as a UniV3 pool is not effectively a pool, it will not be handled by the /// distribution script and rewards may be lost /// @dev Reward tokens sent as part of distributions must have been whitelisted before and amounts /// sent should be bigger than a minimum amount specific to each token /// @dev The `positionWrappers` specified in the `distribution` struct need to be supported by the script /// List of supported `positionWrappers` can be found in the docs. /// @dev If the pool incentivized contains one whitelisted token, then no fees are taken on the rewards /// @dev This function reverts if the sender has not signed the message `messageHash` once through one of /// the functions enabling to sign function createDistribution( DistributionParameters memory distribution ) external hasSigned returns (uint256 distributionAmount) { return _createDistribution(distribution); } /// @notice Same as the function above but for multiple distributions at once /// @return List of all the distribution amounts actually deposited for each `distribution` in the `distributions` list function createDistributions( DistributionParameters[] memory distributions ) external hasSigned returns (uint256[] memory) { uint256 distributionsLength = distributions.length; uint256[] memory distributionAmounts = new uint256[](distributionsLength); for (uint256 i; i < distributionsLength; ) { distributionAmounts[i] = _createDistribution(distributions[i]); unchecked { ++i; } } return distributionAmounts; } /// @notice Checks whether the `msg.sender`'s `signature` is compatible with the message /// to sign and stores the signature /// @dev If you signed the message once, and the message has not been modified, then you do not /// need to sign again function sign(bytes calldata signature) external { _sign(signature); } /// @notice Combines signing the message and creating a distribution function signAndCreateDistribution( DistributionParameters memory distribution, bytes calldata signature ) external returns (uint256 distributionAmount) { _sign(signature); return _createDistribution(distribution); } /// @notice Internal version of `createDistribution` function _createDistribution( DistributionParameters memory distribution ) internal nonReentrant returns (uint256 distributionAmount) { uint32 epochStart = _getRoundedEpoch(distribution.epochStart); uint256 minDistributionAmount = rewardTokenMinAmounts[distribution.rewardToken]; distribution.epochStart = epochStart; // Reward are not accepted in the following conditions: if ( // if epoch parameters lead to a past distribution epochStart + EPOCH_DURATION < block.timestamp || // if the amount of epochs for which this distribution should last is zero distribution.numEpoch == 0 || // if the distribution parameters are not correctly specified distribution.propFees + distribution.propToken0 + distribution.propToken1 != 1e4 || // if boosted addresses get less than non-boosted addresses in case of (distribution.boostingAddress != address(0) && distribution.boostedReward < 1e4) || // if the type of the position wrappers is not well specified distribution.positionWrappers.length != distribution.wrapperTypes.length || // if the reward token is not whitelisted as an incentive token minDistributionAmount == 0 || // if the amount distributed is too small with respect to what is allowed distribution.amount / distribution.numEpoch < minDistributionAmount ) revert InvalidReward(); distributionAmount = distribution.amount; // Computing fees: these are waived for whitelisted addresses and if there is a whitelisted token in a pool uint256 userFeeRebate = feeRebate[msg.sender]; if ( userFeeRebate < BASE_9 && isWhitelistedToken[IUniswapV3Pool(distribution.uniV3Pool).token0()] == 0 && isWhitelistedToken[IUniswapV3Pool(distribution.uniV3Pool).token1()] == 0 ) { uint256 _fees = (fees * (BASE_9 - userFeeRebate)) / BASE_9; uint256 distributionAmountMinusFees = (distributionAmount * (BASE_9 - _fees)) / BASE_9; address _feeRecipient = feeRecipient; _feeRecipient = _feeRecipient == address(0) ? address(this) : _feeRecipient; IERC20(distribution.rewardToken).safeTransferFrom( msg.sender, _feeRecipient, distributionAmount - distributionAmountMinusFees ); distributionAmount = distributionAmountMinusFees; distribution.amount = distributionAmount; } IERC20(distribution.rewardToken).safeTransferFrom(msg.sender, distributor, distributionAmount); uint256 senderNonce = nonces[msg.sender]; nonces[msg.sender] = senderNonce + 1; distribution.rewardId = bytes32(keccak256(abi.encodePacked(msg.sender, senderNonce))); distributionList.push(distribution); emit NewDistribution(distribution, msg.sender); } /// @notice Internal version of the `sign` function function _sign(bytes calldata signature) internal { bytes32 _messageHash = messageHash; if (ECDSA.recover(_messageHash, signature) != msg.sender) revert InvalidSignature(); userSignatures[msg.sender] = _messageHash; emit UserSigned(_messageHash, msg.sender); } // ================================= UI HELPERS ================================ // These functions are not to be queried on-chain and hence are not optimized for gas consumption /// @notice Returns the list of all distributions ever made or to be done in the future function getAllDistributions() external view returns (DistributionParameters[] memory) { return distributionList; } /// @notice Returns the list of all currently active distributions on pools of supported AMMs (like Uniswap V3) function getActiveDistributions() external view returns (ExtensiveDistributionParameters[] memory) { uint32 roundedEpoch = _getRoundedEpoch(uint32(block.timestamp)); return _getPoolDistributionsBetweenEpochs(address(0), roundedEpoch, roundedEpoch + EPOCH_DURATION); } /// @notice Returns the list of all the reward tokens supported as well as their minimum amounts function getValidRewardTokens() external view returns (RewardTokenAmounts[] memory) { uint256 length; uint256 rewardTokenListLength = rewardTokens.length; RewardTokenAmounts[] memory validRewardTokens = new RewardTokenAmounts[](rewardTokenListLength); for (uint32 i; i < rewardTokenListLength; ) { address token = rewardTokens[i]; uint256 minAmount = rewardTokenMinAmounts[token]; if (minAmount > 0) { validRewardTokens[length] = RewardTokenAmounts(token, minAmount); length += 1; } unchecked { ++i; } } RewardTokenAmounts[] memory validRewardTokensShort = new RewardTokenAmounts[](length); for (uint32 i; i < length; ) { validRewardTokensShort[i] = validRewardTokens[i]; unchecked { ++i; } } return validRewardTokensShort; } /// @notice Returns the list of all the distributions that were or that are going to be live at /// a specific epoch function getDistributionsForEpoch(uint32 epoch) external view returns (ExtensiveDistributionParameters[] memory) { uint32 roundedEpoch = _getRoundedEpoch(epoch); return _getPoolDistributionsBetweenEpochs(address(0), roundedEpoch, roundedEpoch + EPOCH_DURATION); } /// @notice Gets the distributions that were or will be live at some point between `epochStart` (included) and `epochEnd` (excluded) /// @dev If a distribution starts during `epochEnd`, it is not be returned by this function /// @dev Conversely, if a distribution starts after `epochStart` and ends before `epochEnd`, it is returned by this function function getDistributionsBetweenEpochs( uint32 epochStart, uint32 epochEnd ) external view returns (ExtensiveDistributionParameters[] memory) { return _getPoolDistributionsBetweenEpochs(address(0), _getRoundedEpoch(epochStart), _getRoundedEpoch(epochEnd)); } /// @notice Returns the list of all distributions that were or will be live after `epochStart` (included) function getDistributionsAfterEpoch( uint32 epochStart ) external view returns (ExtensiveDistributionParameters[] memory) { return _getPoolDistributionsBetweenEpochs(address(0), _getRoundedEpoch(epochStart), type(uint32).max); } /// @notice Returns the list of all currently active distributions for a specific UniswapV3 pool function getActivePoolDistributions( address uniV3Pool ) external view returns (ExtensiveDistributionParameters[] memory) { uint32 roundedEpoch = _getRoundedEpoch(uint32(block.timestamp)); return _getPoolDistributionsBetweenEpochs(uniV3Pool, roundedEpoch, roundedEpoch + EPOCH_DURATION); } /// @notice Returns the list of all the distributions that were or that are going to be live at a /// specific epoch and for a specific pool function getPoolDistributionsForEpoch( address uniV3Pool, uint32 epoch ) external view returns (ExtensiveDistributionParameters[] memory) { uint32 roundedEpoch = _getRoundedEpoch(epoch); return _getPoolDistributionsBetweenEpochs(uniV3Pool, roundedEpoch, roundedEpoch + EPOCH_DURATION); } /// @notice Returns the list of all distributions that were or will be live between `epochStart` (included) and `epochEnd` (excluded) /// for a specific pool function getPoolDistributionsBetweenEpochs( address uniV3Pool, uint32 epochStart, uint32 epochEnd ) external view returns (ExtensiveDistributionParameters[] memory) { return _getPoolDistributionsBetweenEpochs(uniV3Pool, _getRoundedEpoch(epochStart), _getRoundedEpoch(epochEnd)); } /// @notice Returns the list of all distributions that were or will be live after `epochStart` (included) /// for a specific pool function getPoolDistributionsAfterEpoch( address uniV3Pool, uint32 epochStart ) external view returns (ExtensiveDistributionParameters[] memory) { return _getPoolDistributionsBetweenEpochs(uniV3Pool, _getRoundedEpoch(epochStart), type(uint32).max); } // ============================ GOVERNANCE FUNCTIONS =========================== /// @notice Sets a new `distributor` to which rewards should be distributed function setNewDistributor(address _distributor) external onlyGovernorOrGuardian { if (_distributor == address(0)) revert InvalidParam(); distributor = _distributor; emit DistributorUpdated(_distributor); } /// @notice Sets the fees on deposit function setFees(uint256 _fees) external onlyGovernorOrGuardian { if (_fees >= BASE_9) revert InvalidParam(); fees = _fees; emit FeesSet(_fees); } /// @notice Sets fee rebates for a given user function setUserFeeRebate(address user, uint256 userFeeRebate) external onlyGovernorOrGuardian { feeRebate[user] = userFeeRebate; emit FeeRebateUpdated(user, userFeeRebate); } /// @notice Toggles the fee whitelist for `token` function toggleTokenWhitelist(address token) external onlyGovernorOrGuardian { uint256 toggleStatus = 1 - isWhitelistedToken[token]; isWhitelistedToken[token] = toggleStatus; emit TokenWhitelistToggled(token, toggleStatus); } /// @notice Recovers fees accrued on the contract for a list of `tokens` function recoverFees(IERC20[] calldata tokens, address to) external onlyGovernorOrGuardian { uint256 tokensLength = tokens.length; for (uint256 i; i < tokensLength; ) { tokens[i].safeTransfer(to, tokens[i].balanceOf(address(this))); unchecked { ++i; } } } /// @notice Sets the minimum amounts per distribution epoch for different reward tokens function setRewardTokenMinAmounts( address[] calldata tokens, uint256[] calldata amounts ) external onlyGovernorOrGuardian { uint256 tokensLength = tokens.length; for (uint256 i; i < tokensLength; ++i) { uint256 amount = amounts[i]; // Basic logic check to make sure there are no duplicates in the `rewardTokens` table. If a token is // removed then re-added, it will appear as a duplicate in the list if (amount > 0 && rewardTokenMinAmounts[tokens[i]] == 0) rewardTokens.push(tokens[i]); rewardTokenMinAmounts[tokens[i]] = amount; emit RewardTokenMinimumAmountUpdated(tokens[i], amount); } } /// @notice Sets a new address to receive fees function setFeeRecipient(address _feeRecipient) external onlyGovernorOrGuardian { feeRecipient = _feeRecipient; emit FeeRecipientUpdated(_feeRecipient); } /// @notice Sets the message that needs to be signed by users before posting rewards function setMessage(string memory _message) external onlyGovernorOrGuardian { message = _message; bytes32 _messageHash = ECDSA.toEthSignedMessageHash(bytes(_message)); messageHash = _messageHash; emit MessageUpdated(_messageHash); } /// @notice Toggles the whitelist status for `user` when it comes to signing messages before depositing rewards. function toggleSigningWhitelist(address user) external onlyGovernorOrGuardian { uint256 whitelistStatus = 1 - userSignatureWhitelist[user]; userSignatureWhitelist[user] = whitelistStatus; emit UserSigningWhitelistToggled(user, whitelistStatus); } // ============================== INTERNAL HELPERS ============================= /// @notice Rounds an `epoch` timestamp to the start of the corresponding period function _getRoundedEpoch(uint32 epoch) internal pure returns (uint32) { return (epoch / EPOCH_DURATION) * EPOCH_DURATION; } /// @notice Checks whether `distribution` was live between `roundedEpochStart` and `roundedEpochEnd` function _isDistributionLiveBetweenEpochs( DistributionParameters storage distribution, uint32 roundedEpochStart, uint32 roundedEpochEnd ) internal view returns (bool) { uint256 distributionEpochStart = distribution.epochStart; return (distributionEpochStart + distribution.numEpoch * EPOCH_DURATION > roundedEpochStart && distributionEpochStart < roundedEpochEnd); } /// @notice Fetches data for `token` on the Uniswap `pool` function _getUniswapTokenData( IERC20Metadata token, address pool ) internal view returns (UniswapTokenData memory data) { data.add = address(token); data.decimals = token.decimals(); data.symbol = token.symbol(); data.poolBalance = token.balanceOf(pool); } /// @notice Fetches extra data about the parameters in a distribution function _getExtensiveDistributionParameters( DistributionParameters memory distribution ) internal view returns (ExtensiveDistributionParameters memory extensiveParams) { extensiveParams.base = distribution; try IUniswapV3Pool(distribution.uniV3Pool).fee() returns (uint24 fee) { extensiveParams.poolFee = fee; } catch { extensiveParams.poolFee = 0; } extensiveParams.token0 = _getUniswapTokenData( IERC20Metadata(IUniswapV3Pool(distribution.uniV3Pool).token0()), distribution.uniV3Pool ); extensiveParams.token1 = _getUniswapTokenData( IERC20Metadata(IUniswapV3Pool(distribution.uniV3Pool).token1()), distribution.uniV3Pool ); extensiveParams.rewardTokenSymbol = IERC20Metadata(distribution.rewardToken).symbol(); extensiveParams.rewardTokenDecimals = IERC20Metadata(distribution.rewardToken).decimals(); } /// @notice Gets the list of all the distributions for `uniV3Pool` that have been active between `epochStart` and `epochEnd` (excluded) /// @dev If the `uniV3Pool` parameter is equal to 0, then this function will return the distributions for all pools function _getPoolDistributionsBetweenEpochs( address uniV3Pool, uint32 epochStart, uint32 epochEnd ) internal view returns (ExtensiveDistributionParameters[] memory) { uint256 length; uint256 distributionListLength = distributionList.length; DistributionParameters[] memory longActiveRewards = new DistributionParameters[](distributionListLength); for (uint32 i; i < distributionListLength; ) { DistributionParameters storage distribution = distributionList[i]; if ( _isDistributionLiveBetweenEpochs(distribution, epochStart, epochEnd) && (uniV3Pool == address(0) || distribution.uniV3Pool == uniV3Pool) ) { longActiveRewards[length] = distribution; length += 1; } unchecked { ++i; } } ExtensiveDistributionParameters[] memory activeRewards = new ExtensiveDistributionParameters[](length); for (uint32 i; i < length; ) { activeRewards[i] = _getExtensiveDistributionParameters(longActiveRewards[i]); unchecked { ++i; } } return activeRewards; } }
// SPDX-License-Identifier: GPL-3.0 pragma solidity 0.8.17; /// @title ICore /// @author Angle Labs, Inc. /// @notice Interface for the `Core` contracts of smart contract modules used in Angle Labs contracts interface ICore { /// @notice Checks whether an address is governor /// @param admin Address to check /// @return Whether the address has the `GOVERNOR_ROLE` or not function isGovernor(address admin) external view returns (bool); /// @notice Checks whether an address is a governor or a guardian of a module /// @param admin Address to check /// @return Whether the address has the `GUARDIAN_ROLE` or not /// @dev Governance should make sure when adding a governor to also give this governor the guardian /// role by calling the `addGovernor` function function isGovernorOrGuardian(address admin) external view returns (bool); }
// SPDX-License-Identifier: GPL-3.0 pragma solidity >=0.5.0; /// @title Pool state that never changes /// @notice These parameters are fixed for a pool forever, i.e., the methods will always return the same values interface IUniswapV3Pool { /// @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 pool's fee in hundredths of a bip, i.e. 1e-6 /// @return The fee function fee() external view returns (uint24); }
// SPDX-License-Identifier: BUSL-1.1 pragma solidity ^0.8.17; struct DistributionParameters { // ID of the reward (populated once created) bytes32 rewardId; // Address of the UniswapV3 pool that needs to be incentivized address uniV3Pool; // Address of the reward token for the incentives address rewardToken; // Amount of `rewardToken` to distribute across all the epochs // Amount distributed per epoch is `amount/numEpoch` uint256 amount; // List of all UniV3 position wrappers to consider for this contract // (this can include addresses of Arrakis or Gamma smart contracts for instance) address[] positionWrappers; // Type (Arrakis, Gamma, ...) encoded as a `uint32` for each wrapper in the list above. Mapping between wrapper types and their // corresponding `uint32` value can be found in Angle Docs uint32[] wrapperTypes; // In the incentivization formula, how much of the fees should go to holders of token0 // in base 10**4 uint32 propToken0; // Proportion for holding token1 (in base 10**4) uint32 propToken1; // Proportion for providing a useful liquidity (in base 10**4) that generates fees uint32 propFees; // Timestamp at which the incentivization should start uint32 epochStart; // Amount of epochs for which incentivization should last uint32 numEpoch; // Whether out of range liquidity should still be incentivized or not // This should be equal to 1 if out of range liquidity should still be incentivized // and 0 otherwise uint32 isOutOfRangeIncentivized; // How much more addresses with a maximum boost can get with respect to addresses // which do not have a boost (in base 4). In the case of Curve where addresses get 2.5x more // this would be 25000 uint32 boostedReward; // Address of the token which dictates who gets boosted rewards or not. This is optional // and if the zero address is given no boost will be taken into account address boostingAddress; // Additional data passed when distributing rewards. This parameter may be used in case // the reward distribution script needs to look into other parameters beyond the ones above. bytes additionalData; }
// SPDX-License-Identifier: BUSL-1.1 pragma solidity ^0.8.17; import "./DistributionParameters.sol"; struct UniswapTokenData { address add; uint8 decimals; string symbol; uint256 poolBalance; } struct ExtensiveDistributionParameters { DistributionParameters base; // Uniswap pool data uint24 poolFee; UniswapTokenData token0; UniswapTokenData token1; // rewardToken data string rewardTokenSymbol; uint8 rewardTokenDecimals; }
// SPDX-License-Identifier: BUSL-1.1 pragma solidity ^0.8.17; struct RewardTokenAmounts { address token; uint256 minimumAmountPerEpoch; }
// SPDX-License-Identifier: GPL-3.0 pragma solidity ^0.8.17; error InvalidDispute(); error InvalidLengths(); error InvalidParam(); error InvalidParams(); error InvalidProof(); error InvalidUninitializedRoot(); error InvalidReward(); error InvalidSignature(); error NoDispute(); error NotGovernor(); error NotGovernorOrGuardian(); error NotSigned(); error NotTrusted(); error NotWhitelisted(); error UnresolvedDispute(); error ZeroAddress();
// SPDX-License-Identifier: GPL-3.0 /* * █ ***** ▓▓▓ * ▓▓▓▓▓▓▓ * ///. ▓▓▓▓▓▓▓▓▓▓▓▓▓ ***** //////// ▓▓▓▓▓▓▓ * ///////////// ▓▓▓ ▓▓ ////////////////// █ ▓▓ ▓▓ ▓▓ /////////////////////// ▓▓ ▓▓ ▓▓ ▓▓ //////////////////////////// ▓▓ ▓▓ ▓▓ ▓▓ /////////▓▓▓///////▓▓▓///////// ▓▓ ▓▓ ▓▓ ,////////////////////////////////////// ▓▓ ▓▓ ▓▓ ////////////////////////////////////////// ▓▓ ▓▓ //////////////////////▓▓▓▓///////////////////// ,//////////////////////////////////////////////////// .////////////////////////////////////////////////////////// .//////////////////////////██.,//////////////////////////█ .//////////////////////████..,./////////////////////██ ...////////////////███████.....,.////////////////███ ,.,////////////████████ ........,///////////████ .,.,//////█████████ ,.......///////████ ,..//████████ ........./████ ..,██████ .....,███ .██ ,.,█ ▓▓ ▓▓▓▓▓▓▓▓▓▓ ▓▓▓▓▓▓▓▓▓▓ ▓▓ ▓▓▓▓▓▓▓▓▓▓ ▓▓▓▓▓▓ ▓▓▓ ▓▓▓ ▓▓▓ ▓▓ ▓▓ ▓▓▓▓ ▓▓▓ ▓▓▓ ▓▓▓ ▓▓▓ ▓▓▓ ▓▓▓ ▓▓ ▓▓▓▓▓ ▓▓▓ ▓▓ ▓▓▓ ▓▓▓ ▓▓▓▓▓▓▓▓▓▓ ▓▓▓▓▓▓▓▓▓▓ ▓▓▓▓▓▓▓▓▓▓ */ pragma solidity ^0.8.17; import "@openzeppelin/contracts-upgradeable/proxy/utils/UUPSUpgradeable.sol"; import "../interfaces/ICore.sol"; import "../utils/Errors.sol"; /// @title UUPSHelper /// @notice Helper contract for UUPSUpgradeable contracts where the upgradeability is controlled by a specific address /// @author Angle Labs., Inc /// @dev The 0 address check in the modifier allows the use of these modifiers during initialization abstract contract UUPSHelper is UUPSUpgradeable { modifier onlyGuardianUpgrader(ICore _core) { if (address(_core) != address(0) && !_core.isGovernorOrGuardian(msg.sender)) revert NotGovernorOrGuardian(); _; } modifier onlyGovernorUpgrader(ICore _core) { if (address(_core) != address(0) && !_core.isGovernor(msg.sender)) revert NotGovernor(); _; } constructor() initializer {} }
{ "evmVersion": "london", "libraries": {}, "metadata": { "bytecodeHash": "ipfs", "useLiteralContent": true }, "optimizer": { "enabled": true, "runs": 100000 }, "remappings": [], "viaIR": true, "outputSelection": { "*": { "*": [ "evm.bytecode", "evm.deployedBytecode", "devdoc", "userdoc", "metadata", "abi" ] } } }
Contract Security Audit
- No Contract Security Audit Submitted- Submit Audit Here
[{"inputs":[{"internalType":"contract ICore","name":"_accessControlManager","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[],"name":"InvalidParams","type":"error"},{"inputs":[],"name":"NotGovernorOrGuardian","type":"error"},{"inputs":[],"name":"ZeroAddress","type":"error"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"gauge","type":"address"}],"name":"GaugeSet","type":"event"},{"inputs":[],"name":"accessControlManager","outputs":[{"internalType":"contract ICore","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"angle","outputs":[{"internalType":"contract IERC20","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"gaugeParams","outputs":[{"internalType":"bytes32","name":"rewardId","type":"bytes32"},{"internalType":"address","name":"uniV3Pool","type":"address"},{"internalType":"address","name":"rewardToken","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"uint32","name":"propToken0","type":"uint32"},{"internalType":"uint32","name":"propToken1","type":"uint32"},{"internalType":"uint32","name":"propFees","type":"uint32"},{"internalType":"uint32","name":"epochStart","type":"uint32"},{"internalType":"uint32","name":"numEpoch","type":"uint32"},{"internalType":"uint32","name":"isOutOfRangeIncentivized","type":"uint32"},{"internalType":"uint32","name":"boostedReward","type":"uint32"},{"internalType":"address","name":"boostingAddress","type":"address"},{"internalType":"bytes","name":"additionalData","type":"bytes"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"merklDistributionCreator","outputs":[{"internalType":"contract DistributionCreator","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"gauge","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"notifyReward","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"gauge","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"notifyRewardWithTransfer","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"setAngleAllowance","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"gauge","type":"address"},{"components":[{"internalType":"bytes32","name":"rewardId","type":"bytes32"},{"internalType":"address","name":"uniV3Pool","type":"address"},{"internalType":"address","name":"rewardToken","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"address[]","name":"positionWrappers","type":"address[]"},{"internalType":"uint32[]","name":"wrapperTypes","type":"uint32[]"},{"internalType":"uint32","name":"propToken0","type":"uint32"},{"internalType":"uint32","name":"propToken1","type":"uint32"},{"internalType":"uint32","name":"propFees","type":"uint32"},{"internalType":"uint32","name":"epochStart","type":"uint32"},{"internalType":"uint32","name":"numEpoch","type":"uint32"},{"internalType":"uint32","name":"isOutOfRangeIncentivized","type":"uint32"},{"internalType":"uint32","name":"boostedReward","type":"uint32"},{"internalType":"address","name":"boostingAddress","type":"address"},{"internalType":"bytes","name":"additionalData","type":"bytes"}],"internalType":"struct DistributionParameters","name":"params","type":"tuple"}],"name":"setGauge","outputs":[],"stateMutability":"nonpayable","type":"function"}]
Contract Creation Code
608060409080825234620002ce5780620022ae8038038091620000238285620002d3565b8339602092839181010312620002ce57516001600160a01b0381169190829003620002ce578115620002bd5760009160018060a01b0319835416178255825190636eb1769f60e11b82526004923084840152738bb4c975ff3c250e0ceea271728547f3802b36fd60249381858201527331429d1856ad1377a8a0079410b297e1a9e214c28482604481845afa918215620002b35784926200027a575b50600019820180921162000268578751918583019363095ea7b360e01b855287840152604483015260448252608082019260018060401b039280851084861117620002565760c081018581108582111762000244578a528685527f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c656460a082015251859283929083905af13d1562000234573d9182116200022257906200018692918851916200017887601f19601f8401160184620002d3565b82523d858784013e6200030d565b8051806200019e575b8651611eb59081620003f98239f35b818491810103126200021e57820151908115918215036200021b5750620001c8578080806200018f565b90602a91608494519362461bcd60e51b85528401528201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b6064820152fd5b80fd5b5080fd5b634e487b7160e01b8452604187528584fd5b620001869291506060906200030d565b634e487b7160e01b875260418a528887fd5b634e487b7160e01b8652604189528786fd5b634e487b7160e01b8452601187528584fd5b9091508481813d8311620002ab575b620002958183620002d3565b81010312620002a757519038620000bf565b8380fd5b503d62000289565b88513d86823e3d90fd5b825163d92e233d60e01b8152600490fd5b600080fd5b601f909101601f19168101906001600160401b03821190821017620002f757604052565b634e487b7160e01b600052604160045260246000fd5b90919015620003865750805115620003225790565b7331429d1856ad1377a8a0079410b297e1a9e214c23b15620003415790565b60405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e74726163740000006044820152606490fd5b815115620003975750805190602001fd5b6040519062461bcd60e51b82528160208060048301528251908160248401526000935b828510620003de575050604492506000838284010152601f80199101168101030190fd5b8481018201518686016044015293810193859350620003ba56fe6080604052600436101561001257600080fd5b60003560e01c8063031ccdda146110f05780630ee60494146110a3578063154eb20914610e9d5780631df2f4e014610232578063230cfbc41461015d5780639b79c20414610110578063b4a0bdf3146100be5763e32471801461007457600080fd5b346100b95760407ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc3601126100b9576100b76100ae611204565b60243590611701565b005b600080fd5b346100b95760007ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc3601126100b957602073ffffffffffffffffffffffffffffffffffffffff60005416604051908152f35b346100b95760007ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc3601126100b95760206040517331429d1856ad1377a8a0079410b297e1a9e214c28152f35b346100b95760407ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc3601126100b957610194611204565b602435604051917f23b872dd0000000000000000000000000000000000000000000000000000000060208401523360248401523060448401528160648401526064835260a0830183811067ffffffffffffffff821117610203576100b7936101fe91604052611496565b611701565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b346100b9577ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc6040813601126100b95761026a611204565b60243567ffffffffffffffff81116100b9576101e0809382360301126100b95760405192830183811067ffffffffffffffff82111761020357604052806004013583526102b960248201611227565b60208401526102ca60448201611227565b604084015260648101356060840152608481013567ffffffffffffffff81116100b9578101366023820112156100b9576004810135906103098261141b565b9161031760405193846112b7565b8083526024602084019160051b830101913683116100b957602401905b828210610e8557505050608084015260a481013567ffffffffffffffff81116100b9578101366023820112156100b9576004810135906103738261141b565b9161038160405193846112b7565b8083526024602084019160051b830101913683116100b957602401905b828210610e6d5750505060a08401526103b960c48201611433565b60c08401526103ca60e48201611433565b60e08401526103dc6101048201611433565b6101008401526103ef6101248201611433565b6101208401526104026101448201611433565b6101408401526104156101648201611433565b6101608401526104286101848201611433565b61018084015261043b6101a48201611227565b6101a08401526101c48101359067ffffffffffffffff82116100b9573660238383010112156100b95761047360048383010135611444565b9161048160405193846112b7565b8181016004810135808552369101602401116100b957600481838260209460009601013560248383010185880137010135830101526101c08301526024602073ffffffffffffffffffffffffffffffffffffffff60005416604051928380927f521d4de90000000000000000000000000000000000000000000000000000000082523360048301525afa908115610d5057600091610e3e575b5015610e145773ffffffffffffffffffffffffffffffffffffffff8116158015610ddc575b8015610b7d575b610b535773ffffffffffffffffffffffffffffffffffffffff8116600052600160205260406000208251815573ffffffffffffffffffffffffffffffffffffffff6020840151167fffffffffffffffffffffffff00000000000000000000000000000000000000006001830154161760018201556002810173ffffffffffffffffffffffffffffffffffffffff6040850151167fffffffffffffffffffffffff000000000000000000000000000000000000000082541617905560608301516003820155608083015180519067ffffffffffffffff821161020357680100000000000000008211610203576020906004840154836004860155808410610b33575b500160048301600052602060002060005b838110610b09575050505060a0830151805167ffffffffffffffff81116102035768010000000000000000811161020357602060058401928354838555808410610a9b575b50019160005260206000209060005b8160031c8110610a4c57507ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8811681036109d3575b50505060088160066101c0930163ffffffff60c0870151168682549167ffffffff0000000060e083015160201b166bffffffff000000000000000061010084015160401b166fffffffff00000000000000000000000061012085015160601b169173ffffffff0000000000000000000000000000000061014086015160801b16937fffffffff000000000000000000000000000000000000000000000000000000007bffffffff00000000000000000000000000000000000000000000000061018077ffffffff00000000000000000000000000000000000000006101608a015160a01b1698015160c01b1697161717171717171790556007810173ffffffffffffffffffffffffffffffffffffffff6101a0870151167fffffffffffffffffffffffff0000000000000000000000000000000000000000825416179055019201519182519267ffffffffffffffff8411610203576108408254611248565b601f8111610996575b50602090601f85116001146108dd5773ffffffffffffffffffffffffffffffffffffffff9491600091836108d2575b50507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8260011b9260031b1c19161790555b167fb947d28129d3b40272a411eeee3a2842c6335a0f0269abf492e8c20218bf02b0600080a2005b015190508580610878565b907fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe08516918360005260206000209260005b81811061097e575091600193918773ffffffffffffffffffffffffffffffffffffffff989410610947575b505050811b0190556108aa565b01517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff60f88460031b161c1916905585808061093a565b9293602060018192878601518155019501930161090f565b6109c390836000526020600020601f870160051c810191602088106109c9575b601f0160051c01906116ea565b84610849565b90915081906109b6565b60009260005b7ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8831683038110610a1657505060031c015560086101c0856106e1565b90936020610a4360019263ffffffff885116908560021b60031b63ffffffff811b9283911b169119161790565b950191016109d9565b6000805b60088110610a655750838201556001016106ac565b94906020610a9260019263ffffffff855116908960021b60031b63ffffffff811b9283911b169119161790565b92019501610a50565b610acb908560005283600020600780870160031c820192601c8860021b1680610ad1575b500160031c01906116ea565b8761069d565b7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff90818601918254918a0360031b1c1690558c610abf565b600190602073ffffffffffffffffffffffffffffffffffffffff8551169401938184015501610658565b610b4d9060048601600052848460002091820191016116ea565b86610647565b60046040517fa86b6512000000000000000000000000000000000000000000000000000000008152fd5b506004602073ffffffffffffffffffffffffffffffffffffffff8185015116604051928380927f0dfe16810000000000000000000000000000000000000000000000000000000082525afa908115610d5057600091610dbd575b5073ffffffffffffffffffffffffffffffffffffffff604051917fab37f486000000000000000000000000000000000000000000000000000000008352166004820152602081602481738bb4c975ff3c250e0ceea271728547f3802b36fd5afa908115610d5057600091610d8b575b5015801561054657506004602073ffffffffffffffffffffffffffffffffffffffff8185015116604051928380927fd21220a70000000000000000000000000000000000000000000000000000000082525afa908115610d5057600091610d5c575b5073ffffffffffffffffffffffffffffffffffffffff604051917fab37f486000000000000000000000000000000000000000000000000000000008352166004820152602081602481738bb4c975ff3c250e0ceea271728547f3802b36fd5afa908115610d5057600091610d1e575b5015610546565b90506020813d602011610d48575b81610d39602093836112b7565b810103126100b9575183610d17565b3d9150610d2c565b6040513d6000823e3d90fd5b610d7e915060203d602011610d84575b610d7681836112b7565b8101906116be565b83610ca8565b503d610d6c565b90506020813d602011610db5575b81610da6602093836112b7565b810103126100b9575183610c46565b3d9150610d99565b610dd6915060203d602011610d8457610d7681836112b7565b83610bd7565b507331429d1856ad1377a8a0079410b297e1a9e214c273ffffffffffffffffffffffffffffffffffffffff604084015116141561053f565b60046040517f99e120bc000000000000000000000000000000000000000000000000000000008152fd5b610e60915060203d602011610e66575b610e5881836112b7565b81019061147e565b8361051a565b503d610e4e565b60208091610e7a84611433565b81520191019061039e565b60208091610e9284611227565b815201910190610334565b346100b95760007ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc3601126100b9576040517fdd62ed3e00000000000000000000000000000000000000000000000000000000808252306004830152738bb4c975ff3c250e0ceea271728547f3802b36fd60248301527331429d1856ad1377a8a0079410b297e1a9e214c2916020918282604481875afa918215610d5057600092611074575b507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8210610f6d57005b604051908152306004820152738bb4c975ff3c250e0ceea271728547f3802b36fd6024820152928290849060449082905afa928315610d5057600093611045575b50198201809211611016576100b7917f095ea7b30000000000000000000000000000000000000000000000000000000060405192830152738bb4c975ff3c250e0ceea271728547f3802b36fd60248301526044820152604481526110118161129b565b611496565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b9092508181813d831161106d575b61105d81836112b7565b810103126100b957519183610fae565b503d611053565b9091508281813d831161109c575b61108c81836112b7565b810103126100b957519084610f43565b503d611082565b346100b95760007ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc3601126100b9576020604051738bb4c975ff3c250e0ceea271728547f3802b36fd8152f35b346100b95760207ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc3601126100b95773ffffffffffffffffffffffffffffffffffffffff8061113d611204565b16600052600160205260406000209061120082549180600185015416938160028201541691600382015461117f600860068501549360078601541694016112f8565b93604051978897885260208801526040870152606086015263ffffffff908181166080870152818160201c1660a0870152818160401c1660c0870152818160601c1660e0870152818160801c16610100870152818160a01c1661012087015260c01c166101408501526101608401526101a0806101808501528301906113bd565b0390f35b6004359073ffffffffffffffffffffffffffffffffffffffff821682036100b957565b359073ffffffffffffffffffffffffffffffffffffffff821682036100b957565b90600182811c92168015611291575b602083101461126257565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602260045260246000fd5b91607f1691611257565b6080810190811067ffffffffffffffff82111761020357604052565b90601f7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0910116810190811067ffffffffffffffff82111761020357604052565b906040519182600082549261130c84611248565b90818452600194858116908160001461137b5750600114611338575b5050611336925003836112b7565b565b9093915060005260209081600020936000915b81831061136357505061133693508201013880611328565b8554888401850152948501948794509183019161134b565b90506113369550602093507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0091501682840152151560051b8201013880611328565b919082519283825260005b8481106114075750507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0601f8460006020809697860101520116010190565b6020818301810151848301820152016113c8565b67ffffffffffffffff81116102035760051b60200190565b359063ffffffff821682036100b957565b67ffffffffffffffff811161020357601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe01660200190565b908160209103126100b9575180151581036100b95790565b604051604081019080821067ffffffffffffffff83111761020357611530916040526000806020948584527f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564868501528581519101827331429d1856ad1377a8a0079410b297e1a9e214c25af13d156115d9573d9061151482611444565b9161152260405193846112b7565b82523d60008684013e6115dd565b8051908161153d57505050565b828061154d93830101910161147e565b156115555750565b608490604051907f08c379a00000000000000000000000000000000000000000000000000000000082526004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e60448201527f6f742073756363656564000000000000000000000000000000000000000000006064820152fd5b6060905b9091901561166c57508051156115f05790565b7331429d1856ad1377a8a0079410b297e1a9e214c23b1561160e5790565b60646040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e74726163740000006044820152fd5b81511561167c5750805190602001fd5b6116ba906040519182917f08c379a00000000000000000000000000000000000000000000000000000000083526020600484015260248301906113bd565b0390fd5b908160209103126100b9575173ffffffffffffffffffffffffffffffffffffffff811681036100b95790565b8181106116f5575050565b600081556001016116ea565b73ffffffffffffffffffffffffffffffffffffffff166000526001602052604060002090604051916101e0830183811067ffffffffffffffff821117610203576040528054835273ffffffffffffffffffffffffffffffffffffffff600182015416602084015273ffffffffffffffffffffffffffffffffffffffff600282015416604084015260038101546060840152600481016040518082602082945493848152019060005260206000209260005b818110611e505750506117c7925003826112b7565b6080840152600581016040519081602082549182815201916000526020600020906000915b816007840110611de557936118d09593819361184d936008975491818110611dce575b818110611db5575b818110611d9b575b818110611d81575b818110611d67575b818110611d4d575b818110611d33575b10611d25575b5003826112b7565b60a086015263ffffffff600682015481811660c0880152818160201c1660e0880152818160401c16610100880152818160601c16610120880152818160801c16610140880152818160a01c1661016088015260c01c1661018086015273ffffffffffffffffffffffffffffffffffffffff6007820154166101a0860152016112f8565b6101c083015273ffffffffffffffffffffffffffffffffffffffff60208301511615610b53578015611c94575b63ffffffff421661012083015280606083015280611919575050565b6040517f2acd7ec40000000000000000000000000000000000000000000000000000000081527331429d1856ad1377a8a0079410b297e1a9e214c26004820152602081602481738bb4c975ff3c250e0ceea271728547f3802b36fd5afa908115610d5057600091611c62575b5063ffffffff610140840151169080828102048214811517156110165702811115611c1b5750604051907fb9d81abc000000000000000000000000000000000000000000000000000000008252602060048301528161020481018251602483015273ffffffffffffffffffffffffffffffffffffffff602084015116604483015273ffffffffffffffffffffffffffffffffffffffff6040840151166064830152606083015160848301526080830151906101e060a484015281518091526020610224840192019060005b818110611bec5750505060a0830151907fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffdc8382030160c48401526020808351928381520192019060005b818110611bcd57505050611b7e82916101c08563ffffffff60c060209801511660e486015263ffffffff60e08201511661010486015263ffffffff6101008201511661012486015263ffffffff6101208201511661014486015263ffffffff6101408201511661016486015263ffffffff6101608201511661018486015263ffffffff610180820151166101a486015273ffffffffffffffffffffffffffffffffffffffff6101a0820151166101c486015201517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffdc848303016101e48501526113bd565b03816000738bb4c975ff3c250e0ceea271728547f3802b36fd5af18015610d5057611ba65750565b602090813d8311611bc6575b611bbc81836112b7565b810103126100b957565b503d611bb2565b825163ffffffff16845286945060209384019390920191600101611a9a565b825173ffffffffffffffffffffffffffffffffffffffff16845286945060209384019390920191600101611a50565b6113369150604051907fa9059cbb0000000000000000000000000000000000000000000000000000000060208301523360248301526044820152604481526110118161129b565b90506020813d602011611c8c575b81611c7d602093836112b7565b810103126100b9575138611985565b3d9150611c70565b506040517f70a082310000000000000000000000000000000000000000000000000000000081523060048201526020816024817331429d1856ad1377a8a0079410b297e1a9e214c25afa908115610d5057600091611cf3575b506118fd565b90506020813d602011611d1d575b81611d0e602093836112b7565b810103126100b9575138611ced565b3d9150611d01565b60e01c815260200138611845565b92602060019163ffffffff8560c01c16815201930161183f565b92602060019163ffffffff8560a01c168152019301611837565b92602060019163ffffffff8560801c16815201930161182f565b92602060019163ffffffff8560601c168152019301611827565b92602060019163ffffffff8560401c16815201930161181f565b92602060019163ffffffff85831c168152019301611817565b92602060019163ffffffff8516815201930161180f565b926001610100600892865463ffffffff8082168352808260201c166020840152808260401c166040840152808260601c166060840152808260801c16608084015260a08183821c169084015260c09082821c169083015260e090811c908201520194019201916117ec565b845473ffffffffffffffffffffffffffffffffffffffff168352600194850194869450602090930192016117b256fea26469706673582212206f0d21f879d88312fdf17d8c8a48125fac8ce4f52166869a3e4cf1263fb89a1164736f6c634300081100330000000000000000000000000e632a15ebcba463151b5367b4fcf91313e389a6
Deployed Bytecode
0x6080604052600436101561001257600080fd5b60003560e01c8063031ccdda146110f05780630ee60494146110a3578063154eb20914610e9d5780631df2f4e014610232578063230cfbc41461015d5780639b79c20414610110578063b4a0bdf3146100be5763e32471801461007457600080fd5b346100b95760407ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc3601126100b9576100b76100ae611204565b60243590611701565b005b600080fd5b346100b95760007ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc3601126100b957602073ffffffffffffffffffffffffffffffffffffffff60005416604051908152f35b346100b95760007ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc3601126100b95760206040517331429d1856ad1377a8a0079410b297e1a9e214c28152f35b346100b95760407ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc3601126100b957610194611204565b602435604051917f23b872dd0000000000000000000000000000000000000000000000000000000060208401523360248401523060448401528160648401526064835260a0830183811067ffffffffffffffff821117610203576100b7936101fe91604052611496565b611701565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b346100b9577ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc6040813601126100b95761026a611204565b60243567ffffffffffffffff81116100b9576101e0809382360301126100b95760405192830183811067ffffffffffffffff82111761020357604052806004013583526102b960248201611227565b60208401526102ca60448201611227565b604084015260648101356060840152608481013567ffffffffffffffff81116100b9578101366023820112156100b9576004810135906103098261141b565b9161031760405193846112b7565b8083526024602084019160051b830101913683116100b957602401905b828210610e8557505050608084015260a481013567ffffffffffffffff81116100b9578101366023820112156100b9576004810135906103738261141b565b9161038160405193846112b7565b8083526024602084019160051b830101913683116100b957602401905b828210610e6d5750505060a08401526103b960c48201611433565b60c08401526103ca60e48201611433565b60e08401526103dc6101048201611433565b6101008401526103ef6101248201611433565b6101208401526104026101448201611433565b6101408401526104156101648201611433565b6101608401526104286101848201611433565b61018084015261043b6101a48201611227565b6101a08401526101c48101359067ffffffffffffffff82116100b9573660238383010112156100b95761047360048383010135611444565b9161048160405193846112b7565b8181016004810135808552369101602401116100b957600481838260209460009601013560248383010185880137010135830101526101c08301526024602073ffffffffffffffffffffffffffffffffffffffff60005416604051928380927f521d4de90000000000000000000000000000000000000000000000000000000082523360048301525afa908115610d5057600091610e3e575b5015610e145773ffffffffffffffffffffffffffffffffffffffff8116158015610ddc575b8015610b7d575b610b535773ffffffffffffffffffffffffffffffffffffffff8116600052600160205260406000208251815573ffffffffffffffffffffffffffffffffffffffff6020840151167fffffffffffffffffffffffff00000000000000000000000000000000000000006001830154161760018201556002810173ffffffffffffffffffffffffffffffffffffffff6040850151167fffffffffffffffffffffffff000000000000000000000000000000000000000082541617905560608301516003820155608083015180519067ffffffffffffffff821161020357680100000000000000008211610203576020906004840154836004860155808410610b33575b500160048301600052602060002060005b838110610b09575050505060a0830151805167ffffffffffffffff81116102035768010000000000000000811161020357602060058401928354838555808410610a9b575b50019160005260206000209060005b8160031c8110610a4c57507ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8811681036109d3575b50505060088160066101c0930163ffffffff60c0870151168682549167ffffffff0000000060e083015160201b166bffffffff000000000000000061010084015160401b166fffffffff00000000000000000000000061012085015160601b169173ffffffff0000000000000000000000000000000061014086015160801b16937fffffffff000000000000000000000000000000000000000000000000000000007bffffffff00000000000000000000000000000000000000000000000061018077ffffffff00000000000000000000000000000000000000006101608a015160a01b1698015160c01b1697161717171717171790556007810173ffffffffffffffffffffffffffffffffffffffff6101a0870151167fffffffffffffffffffffffff0000000000000000000000000000000000000000825416179055019201519182519267ffffffffffffffff8411610203576108408254611248565b601f8111610996575b50602090601f85116001146108dd5773ffffffffffffffffffffffffffffffffffffffff9491600091836108d2575b50507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8260011b9260031b1c19161790555b167fb947d28129d3b40272a411eeee3a2842c6335a0f0269abf492e8c20218bf02b0600080a2005b015190508580610878565b907fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe08516918360005260206000209260005b81811061097e575091600193918773ffffffffffffffffffffffffffffffffffffffff989410610947575b505050811b0190556108aa565b01517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff60f88460031b161c1916905585808061093a565b9293602060018192878601518155019501930161090f565b6109c390836000526020600020601f870160051c810191602088106109c9575b601f0160051c01906116ea565b84610849565b90915081906109b6565b60009260005b7ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8831683038110610a1657505060031c015560086101c0856106e1565b90936020610a4360019263ffffffff885116908560021b60031b63ffffffff811b9283911b169119161790565b950191016109d9565b6000805b60088110610a655750838201556001016106ac565b94906020610a9260019263ffffffff855116908960021b60031b63ffffffff811b9283911b169119161790565b92019501610a50565b610acb908560005283600020600780870160031c820192601c8860021b1680610ad1575b500160031c01906116ea565b8761069d565b7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff90818601918254918a0360031b1c1690558c610abf565b600190602073ffffffffffffffffffffffffffffffffffffffff8551169401938184015501610658565b610b4d9060048601600052848460002091820191016116ea565b86610647565b60046040517fa86b6512000000000000000000000000000000000000000000000000000000008152fd5b506004602073ffffffffffffffffffffffffffffffffffffffff8185015116604051928380927f0dfe16810000000000000000000000000000000000000000000000000000000082525afa908115610d5057600091610dbd575b5073ffffffffffffffffffffffffffffffffffffffff604051917fab37f486000000000000000000000000000000000000000000000000000000008352166004820152602081602481738bb4c975ff3c250e0ceea271728547f3802b36fd5afa908115610d5057600091610d8b575b5015801561054657506004602073ffffffffffffffffffffffffffffffffffffffff8185015116604051928380927fd21220a70000000000000000000000000000000000000000000000000000000082525afa908115610d5057600091610d5c575b5073ffffffffffffffffffffffffffffffffffffffff604051917fab37f486000000000000000000000000000000000000000000000000000000008352166004820152602081602481738bb4c975ff3c250e0ceea271728547f3802b36fd5afa908115610d5057600091610d1e575b5015610546565b90506020813d602011610d48575b81610d39602093836112b7565b810103126100b9575183610d17565b3d9150610d2c565b6040513d6000823e3d90fd5b610d7e915060203d602011610d84575b610d7681836112b7565b8101906116be565b83610ca8565b503d610d6c565b90506020813d602011610db5575b81610da6602093836112b7565b810103126100b9575183610c46565b3d9150610d99565b610dd6915060203d602011610d8457610d7681836112b7565b83610bd7565b507331429d1856ad1377a8a0079410b297e1a9e214c273ffffffffffffffffffffffffffffffffffffffff604084015116141561053f565b60046040517f99e120bc000000000000000000000000000000000000000000000000000000008152fd5b610e60915060203d602011610e66575b610e5881836112b7565b81019061147e565b8361051a565b503d610e4e565b60208091610e7a84611433565b81520191019061039e565b60208091610e9284611227565b815201910190610334565b346100b95760007ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc3601126100b9576040517fdd62ed3e00000000000000000000000000000000000000000000000000000000808252306004830152738bb4c975ff3c250e0ceea271728547f3802b36fd60248301527331429d1856ad1377a8a0079410b297e1a9e214c2916020918282604481875afa918215610d5057600092611074575b507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8210610f6d57005b604051908152306004820152738bb4c975ff3c250e0ceea271728547f3802b36fd6024820152928290849060449082905afa928315610d5057600093611045575b50198201809211611016576100b7917f095ea7b30000000000000000000000000000000000000000000000000000000060405192830152738bb4c975ff3c250e0ceea271728547f3802b36fd60248301526044820152604481526110118161129b565b611496565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b9092508181813d831161106d575b61105d81836112b7565b810103126100b957519183610fae565b503d611053565b9091508281813d831161109c575b61108c81836112b7565b810103126100b957519084610f43565b503d611082565b346100b95760007ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc3601126100b9576020604051738bb4c975ff3c250e0ceea271728547f3802b36fd8152f35b346100b95760207ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc3601126100b95773ffffffffffffffffffffffffffffffffffffffff8061113d611204565b16600052600160205260406000209061120082549180600185015416938160028201541691600382015461117f600860068501549360078601541694016112f8565b93604051978897885260208801526040870152606086015263ffffffff908181166080870152818160201c1660a0870152818160401c1660c0870152818160601c1660e0870152818160801c16610100870152818160a01c1661012087015260c01c166101408501526101608401526101a0806101808501528301906113bd565b0390f35b6004359073ffffffffffffffffffffffffffffffffffffffff821682036100b957565b359073ffffffffffffffffffffffffffffffffffffffff821682036100b957565b90600182811c92168015611291575b602083101461126257565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602260045260246000fd5b91607f1691611257565b6080810190811067ffffffffffffffff82111761020357604052565b90601f7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0910116810190811067ffffffffffffffff82111761020357604052565b906040519182600082549261130c84611248565b90818452600194858116908160001461137b5750600114611338575b5050611336925003836112b7565b565b9093915060005260209081600020936000915b81831061136357505061133693508201013880611328565b8554888401850152948501948794509183019161134b565b90506113369550602093507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0091501682840152151560051b8201013880611328565b919082519283825260005b8481106114075750507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0601f8460006020809697860101520116010190565b6020818301810151848301820152016113c8565b67ffffffffffffffff81116102035760051b60200190565b359063ffffffff821682036100b957565b67ffffffffffffffff811161020357601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe01660200190565b908160209103126100b9575180151581036100b95790565b604051604081019080821067ffffffffffffffff83111761020357611530916040526000806020948584527f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564868501528581519101827331429d1856ad1377a8a0079410b297e1a9e214c25af13d156115d9573d9061151482611444565b9161152260405193846112b7565b82523d60008684013e6115dd565b8051908161153d57505050565b828061154d93830101910161147e565b156115555750565b608490604051907f08c379a00000000000000000000000000000000000000000000000000000000082526004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e60448201527f6f742073756363656564000000000000000000000000000000000000000000006064820152fd5b6060905b9091901561166c57508051156115f05790565b7331429d1856ad1377a8a0079410b297e1a9e214c23b1561160e5790565b60646040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e74726163740000006044820152fd5b81511561167c5750805190602001fd5b6116ba906040519182917f08c379a00000000000000000000000000000000000000000000000000000000083526020600484015260248301906113bd565b0390fd5b908160209103126100b9575173ffffffffffffffffffffffffffffffffffffffff811681036100b95790565b8181106116f5575050565b600081556001016116ea565b73ffffffffffffffffffffffffffffffffffffffff166000526001602052604060002090604051916101e0830183811067ffffffffffffffff821117610203576040528054835273ffffffffffffffffffffffffffffffffffffffff600182015416602084015273ffffffffffffffffffffffffffffffffffffffff600282015416604084015260038101546060840152600481016040518082602082945493848152019060005260206000209260005b818110611e505750506117c7925003826112b7565b6080840152600581016040519081602082549182815201916000526020600020906000915b816007840110611de557936118d09593819361184d936008975491818110611dce575b818110611db5575b818110611d9b575b818110611d81575b818110611d67575b818110611d4d575b818110611d33575b10611d25575b5003826112b7565b60a086015263ffffffff600682015481811660c0880152818160201c1660e0880152818160401c16610100880152818160601c16610120880152818160801c16610140880152818160a01c1661016088015260c01c1661018086015273ffffffffffffffffffffffffffffffffffffffff6007820154166101a0860152016112f8565b6101c083015273ffffffffffffffffffffffffffffffffffffffff60208301511615610b53578015611c94575b63ffffffff421661012083015280606083015280611919575050565b6040517f2acd7ec40000000000000000000000000000000000000000000000000000000081527331429d1856ad1377a8a0079410b297e1a9e214c26004820152602081602481738bb4c975ff3c250e0ceea271728547f3802b36fd5afa908115610d5057600091611c62575b5063ffffffff610140840151169080828102048214811517156110165702811115611c1b5750604051907fb9d81abc000000000000000000000000000000000000000000000000000000008252602060048301528161020481018251602483015273ffffffffffffffffffffffffffffffffffffffff602084015116604483015273ffffffffffffffffffffffffffffffffffffffff6040840151166064830152606083015160848301526080830151906101e060a484015281518091526020610224840192019060005b818110611bec5750505060a0830151907fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffdc8382030160c48401526020808351928381520192019060005b818110611bcd57505050611b7e82916101c08563ffffffff60c060209801511660e486015263ffffffff60e08201511661010486015263ffffffff6101008201511661012486015263ffffffff6101208201511661014486015263ffffffff6101408201511661016486015263ffffffff6101608201511661018486015263ffffffff610180820151166101a486015273ffffffffffffffffffffffffffffffffffffffff6101a0820151166101c486015201517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffdc848303016101e48501526113bd565b03816000738bb4c975ff3c250e0ceea271728547f3802b36fd5af18015610d5057611ba65750565b602090813d8311611bc6575b611bbc81836112b7565b810103126100b957565b503d611bb2565b825163ffffffff16845286945060209384019390920191600101611a9a565b825173ffffffffffffffffffffffffffffffffffffffff16845286945060209384019390920191600101611a50565b6113369150604051907fa9059cbb0000000000000000000000000000000000000000000000000000000060208301523360248301526044820152604481526110118161129b565b90506020813d602011611c8c575b81611c7d602093836112b7565b810103126100b9575138611985565b3d9150611c70565b506040517f70a082310000000000000000000000000000000000000000000000000000000081523060048201526020816024817331429d1856ad1377a8a0079410b297e1a9e214c25afa908115610d5057600091611cf3575b506118fd565b90506020813d602011611d1d575b81611d0e602093836112b7565b810103126100b9575138611ced565b3d9150611d01565b60e01c815260200138611845565b92602060019163ffffffff8560c01c16815201930161183f565b92602060019163ffffffff8560a01c168152019301611837565b92602060019163ffffffff8560801c16815201930161182f565b92602060019163ffffffff8560601c168152019301611827565b92602060019163ffffffff8560401c16815201930161181f565b92602060019163ffffffff85831c168152019301611817565b92602060019163ffffffff8516815201930161180f565b926001610100600892865463ffffffff8082168352808260201c166020840152808260401c166040840152808260601c166060840152808260801c16608084015260a08183821c169084015260c09082821c169083015260e090811c908201520194019201916117ec565b845473ffffffffffffffffffffffffffffffffffffffff168352600194850194869450602090930192016117b256fea26469706673582212206f0d21f879d88312fdf17d8c8a48125fac8ce4f52166869a3e4cf1263fb89a1164736f6c63430008110033
Constructor Arguments (ABI-Encoded and is the last bytes of the Contract Creation Code above)
0000000000000000000000000e632a15ebcba463151b5367b4fcf91313e389a6
-----Decoded View---------------
Arg [0] : _accessControlManager (address): 0x0E632a15EbCBa463151B5367B4fCF91313e389a6
-----Encoded View---------------
1 Constructor Arguments found :
Arg [0] : 0000000000000000000000000e632a15ebcba463151b5367b4fcf91313e389a6
Loading...
Loading
Loading...
Loading
Multichain Portfolio | 30 Chains
Chain | Token | Portfolio % | Price | Amount | Value |
---|
Loading...
Loading
A contract address hosts a smart contract, which is a set of code stored on the blockchain that runs when predetermined conditions are met. Learn more about addresses in our Knowledge Base.