Overview
ETH Balance
0 ETH
Eth Value
$0.00More Info
Private Name Tags
ContractCreator
Loading...
Loading
Contract Name:
CNCMintingRebalancingRewardsHandlerV3
Compiler Version
v0.8.17+commit.8df45f5f
Contract Source Code (Solidity Standard Json-Input format)
// SPDX-License-Identifier: GPL-3.0-or-later pragma solidity 0.8.17; import "Ownable.sol"; import "Initializable.sol"; import "EnumerableSet.sol"; import "IERC20.sol"; import "SafeERC20.sol"; import "SafeERC20.sol"; import "ICNCMintingRebalancingRewardsHandlerV2.sol"; import "ICNCMintingRebalancingRewardsHandler.sol"; import "IInflationManager.sol"; import "ICNCToken.sol"; import "IConicPool.sol"; import "ScaledMath.sol"; import "BaseMinter.sol"; contract CNCMintingRebalancingRewardsHandlerV3 is ICNCMintingRebalancingRewardsHandlerV2, Ownable, BaseMinter, Initializable { using SafeERC20 for IERC20; using ScaledMath for uint256; using EnumerableSet for EnumerableSet.AddressSet; /// @dev the maximum amount of CNC that can be minted for rebalancing rewards uint256 internal constant _MAX_REBALANCING_REWARDS = 1_900_000e18; // 19% of total supply /// @dev gives out 5 dollars per 1 hour (assuming 1 CNC = 6 USD) for every 10,000 USD in TVL that needs to be shifted uint256 internal constant _INITIAL_REBALANCING_REWARD_PER_DOLLAR_PER_SECOND = 5e18 / uint256(3600 * 1 * 10_000 * 6); IController public immutable override controller; ICNCMintingRebalancingRewardsHandler public immutable previousRewardsHandler; uint256 public override totalCncMinted; uint256 public override cncRebalancingRewardPerDollarPerSecond; bool internal _isInternal; modifier onlyInflationManager() { require( msg.sender == address(controller.inflationManager()), "only InflationManager can call this function" ); _; } /// NOTE: we do not use the `emergencyMinter` anymore so we pass in address(0) as the emergency minter /// to disable the usage of `renounceMinterRights` /// From V3, we can remove the dependency on `BaseMinter` altogether but for now we need it /// to be able to call `EmergencyMinter.switchRebalancingRewardsHandler` constructor( IController _controller, ICNCToken _cnc, ICNCMintingRebalancingRewardsHandler _previousRewardsHandler ) BaseMinter(_cnc, address(0)) { cncRebalancingRewardPerDollarPerSecond = _INITIAL_REBALANCING_REWARD_PER_DOLLAR_PER_SECOND; controller = _controller; previousRewardsHandler = _previousRewardsHandler; } function initialize() external onlyOwner initializer { totalCncMinted = previousRewardsHandler.totalCncMinted(); } function setCncRebalancingRewardPerDollarPerSecond( uint256 _cncRebalancingRewardPerDollarPerSecond ) external override onlyOwner { cncRebalancingRewardPerDollarPerSecond = _cncRebalancingRewardPerDollarPerSecond; emit SetCncRebalancingRewardPerDollarPerSecond(_cncRebalancingRewardPerDollarPerSecond); } function _distributeRebalancingRewards(address pool, address account, uint256 amount) internal { if (totalCncMinted + amount > _MAX_REBALANCING_REWARDS) { amount = _MAX_REBALANCING_REWARDS - totalCncMinted; } if (amount == 0) return; uint256 mintedAmount = cnc.mint(account, amount); if (mintedAmount > 0) { totalCncMinted += mintedAmount; emit RebalancingRewardDistributed(pool, account, address(cnc), mintedAmount); } } function handleRebalancingRewards( IConicPool conicPool, address account, uint256 deviationBefore, uint256 deviationAfter ) external onlyInflationManager { _handleRebalancingRewards(conicPool, account, deviationBefore, deviationAfter); } function _handleRebalancingRewards( IConicPool conicPool, address account, uint256 deviationBefore, uint256 deviationAfter ) internal { if (_isInternal) return; uint256 cncRewardAmount = computeRebalancingRewards( address(conicPool), deviationBefore, deviationAfter ); _distributeRebalancingRewards(address(conicPool), account, cncRewardAmount); } /// @dev this computes how much CNC a user should get when depositing /// this does not check whether the rewards should still be distributed /// amount CNC = t * CNC/s * (1 - (Δdeviation / initialDeviation)) /// where /// CNC/s: the amount of CNC per second to distributed for rebalancing /// t: the time elapsed since the weight update /// Δdeviation: the deviation difference caused by this deposit /// initialDeviation: the deviation after updating weights /// @return the amount of CNC to give to the user as reward function computeRebalancingRewards( address conicPool, uint256 deviationBefore, uint256 deviationAfter ) public view override returns (uint256) { if (deviationBefore < deviationAfter) return 0; uint8 decimals = IConicPool(conicPool).underlying().decimals(); uint256 deviationDelta = deviationBefore - deviationAfter; uint256 lastWeightUpdate = controller.lastWeightUpdate(conicPool); uint256 elapsedSinceUpdate = uint256(block.timestamp) - lastWeightUpdate; return (elapsedSinceUpdate * cncRebalancingRewardPerDollarPerSecond).mulDown( deviationDelta.convertScale(decimals, 18) ); } function rebalance( address conicPool, uint256 underlyingAmount, uint256 minUnderlyingReceived, uint256 minCNCReceived ) external override returns (uint256 underlyingReceived, uint256 cncReceived) { require(controller.isPool(conicPool), "not a pool"); IConicPool conicPool_ = IConicPool(conicPool); bool rebalancingRewardActive = conicPool_.rebalancingRewardActive(); IERC20 underlying = conicPool_.underlying(); require(underlying.balanceOf(msg.sender) >= underlyingAmount, "insufficient underlying"); uint256 deviationBefore = conicPool_.computeTotalDeviation(); underlying.safeTransferFrom(msg.sender, address(this), underlyingAmount); underlying.safeApprove(conicPool, underlyingAmount); _isInternal = true; uint256 lpTokenAmount = conicPool_.deposit(underlyingAmount, 0, false); _isInternal = false; underlyingReceived = conicPool_.withdraw(lpTokenAmount, 0); require(underlyingReceived >= minUnderlyingReceived, "insufficient underlying received"); uint256 cncBefore = cnc.balanceOf(msg.sender); // Only distribute rebalancing rewards if active if (rebalancingRewardActive) { uint256 deviationAfter = conicPool_.computeTotalDeviation(); _handleRebalancingRewards(conicPool_, msg.sender, deviationBefore, deviationAfter); } cncReceived = cnc.balanceOf(msg.sender) - cncBefore; require(cncReceived >= minCNCReceived, "insufficient CNC received"); underlying.safeTransfer(msg.sender, underlyingReceived); } /// @notice switches the minting rebalancing reward handler by granting the new one minting rights /// and renouncing his own /// `InflationManager.removePoolRebalancingRewardHandler` should be called on every pool before this is called /// this should typically be done as a single batched governance action /// The same governance action should also call `InflationManager.addPoolRebalancingRewardHandler` for each pool /// passing in `newRebalancingRewardsHandler` so that the whole operation is atomic /// @param newRebalancingRewardsHandler the address of the new rebalancing rewards handler function switchMintingRebalancingRewardsHandler( address newRebalancingRewardsHandler ) external onlyOwner { address[] memory pools = controller.listPools(); for (uint256 i; i < pools.length; i++) { require( !controller.inflationManager().hasPoolRebalancingRewardHandlers( pools[i], address(this) ), "handler is still registered for a pool" ); } cnc.addMinter(newRebalancingRewardsHandler); cnc.renounceMinterRights(); } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.7.0) (access/Ownable.sol) pragma solidity ^0.8.0; import "Context.sol"; /** * @dev Contract module which provides a basic access control mechanism, where * there is an account (an owner) that can be granted exclusive access to * specific functions. * * By default, the owner account will be the one that deploys the contract. This * can later be changed with {transferOwnership}. * * This module is used through inheritance. It will make available the modifier * `onlyOwner`, which can be applied to your functions to restrict their use to * the owner. */ abstract contract Ownable is Context { address private _owner; event OwnershipTransferred(address indexed previousOwner, address indexed newOwner); /** * @dev Initializes the contract setting the deployer as the initial owner. */ constructor() { _transferOwnership(_msgSender()); } /** * @dev Throws if called by any account other than the owner. */ modifier onlyOwner() { _checkOwner(); _; } /** * @dev Returns the address of the current owner. */ function owner() public view virtual returns (address) { return _owner; } /** * @dev Throws if the sender is not the owner. */ function _checkOwner() internal view virtual { require(owner() == _msgSender(), "Ownable: caller is not the owner"); } /** * @dev Leaves the contract without owner. It will not be possible to call * `onlyOwner` functions anymore. Can only be called by the current owner. * * NOTE: Renouncing ownership will leave the contract without an owner, * thereby removing any functionality that is only available to the owner. */ function renounceOwnership() public virtual onlyOwner { _transferOwnership(address(0)); } /** * @dev Transfers ownership of the contract to a new account (`newOwner`). * Can only be called by the current owner. */ function transferOwnership(address newOwner) public virtual onlyOwner { require(newOwner != address(0), "Ownable: new owner is the zero address"); _transferOwnership(newOwner); } /** * @dev Transfers ownership of the contract to a new account (`newOwner`). * Internal function without access restriction. */ function _transferOwnership(address newOwner) internal virtual { address oldOwner = _owner; _owner = newOwner; emit OwnershipTransferred(oldOwner, newOwner); } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (utils/Context.sol) pragma solidity ^0.8.0; /** * @dev Provides information about the current execution context, including the * sender of the transaction and its data. While these are generally available * via msg.sender and msg.data, they should not be accessed in such a direct * manner, since when dealing with meta-transactions the account sending and * paying for execution may not be the actual sender (as far as an application * is concerned). * * This contract is only required for intermediate, library-like contracts. */ abstract contract Context { function _msgSender() internal view virtual returns (address) { return msg.sender; } function _msgData() internal view virtual returns (bytes calldata) { return msg.data; } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.8.0) (proxy/utils/Initializable.sol) pragma solidity ^0.8.2; import "Address.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) || (!Address.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 Internal function that returns the initialized version. Returns `_initialized` */ function _getInitializedVersion() internal view returns (uint8) { return _initialized; } /** * @dev Internal function that returns the initialized version. Returns `_initializing` */ function _isInitializing() internal view returns (bool) { return _initializing; } }
// 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/structs/EnumerableSet.sol) // This file was procedurally generated from scripts/generate/templates/EnumerableSet.js. pragma solidity ^0.8.0; /** * @dev Library for managing * https://en.wikipedia.org/wiki/Set_(abstract_data_type)[sets] of primitive * types. * * Sets have the following properties: * * - Elements are added, removed, and checked for existence in constant time * (O(1)). * - Elements are enumerated in O(n). No guarantees are made on the ordering. * * ``` * contract Example { * // Add the library methods * using EnumerableSet for EnumerableSet.AddressSet; * * // Declare a set state variable * EnumerableSet.AddressSet private mySet; * } * ``` * * As of v3.3.0, sets of type `bytes32` (`Bytes32Set`), `address` (`AddressSet`) * and `uint256` (`UintSet`) are supported. * * [WARNING] * ==== * Trying to delete such a structure from storage will likely result in data corruption, rendering the structure * unusable. * See https://github.com/ethereum/solidity/pull/11843[ethereum/solidity#11843] for more info. * * In order to clean an EnumerableSet, you can either remove all elements one by one or create a fresh instance using an * array of EnumerableSet. * ==== */ library EnumerableSet { // To implement this library for multiple types with as little code // repetition as possible, we write it in terms of a generic Set type with // bytes32 values. // The Set implementation uses private functions, and user-facing // implementations (such as AddressSet) are just wrappers around the // underlying Set. // This means that we can only create new EnumerableSets for types that fit // in bytes32. struct Set { // Storage of set values bytes32[] _values; // Position of the value in the `values` array, plus 1 because index 0 // means a value is not in the set. mapping(bytes32 => uint256) _indexes; } /** * @dev Add a value to a set. O(1). * * Returns true if the value was added to the set, that is if it was not * already present. */ function _add(Set storage set, bytes32 value) private returns (bool) { if (!_contains(set, value)) { set._values.push(value); // The value is stored at length-1, but we add 1 to all indexes // and use 0 as a sentinel value set._indexes[value] = set._values.length; return true; } else { return false; } } /** * @dev Removes a value from a set. O(1). * * Returns true if the value was removed from the set, that is if it was * present. */ function _remove(Set storage set, bytes32 value) private returns (bool) { // We read and store the value's index to prevent multiple reads from the same storage slot uint256 valueIndex = set._indexes[value]; if (valueIndex != 0) { // Equivalent to contains(set, value) // To delete an element from the _values array in O(1), we swap the element to delete with the last one in // the array, and then remove the last element (sometimes called as 'swap and pop'). // This modifies the order of the array, as noted in {at}. uint256 toDeleteIndex = valueIndex - 1; uint256 lastIndex = set._values.length - 1; if (lastIndex != toDeleteIndex) { bytes32 lastValue = set._values[lastIndex]; // Move the last value to the index where the value to delete is set._values[toDeleteIndex] = lastValue; // Update the index for the moved value set._indexes[lastValue] = valueIndex; // Replace lastValue's index to valueIndex } // Delete the slot where the moved value was stored set._values.pop(); // Delete the index for the deleted slot delete set._indexes[value]; return true; } else { return false; } } /** * @dev Returns true if the value is in the set. O(1). */ function _contains(Set storage set, bytes32 value) private view returns (bool) { return set._indexes[value] != 0; } /** * @dev Returns the number of values on the set. O(1). */ function _length(Set storage set) private view returns (uint256) { return set._values.length; } /** * @dev Returns the value stored at position `index` in the set. O(1). * * Note that there are no guarantees on the ordering of values inside the * array, and it may change when more values are added or removed. * * Requirements: * * - `index` must be strictly less than {length}. */ function _at(Set storage set, uint256 index) private view returns (bytes32) { return set._values[index]; } /** * @dev Return the entire set in an array * * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that * this function has an unbounded cost, and using it as part of a state-changing function may render the function * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block. */ function _values(Set storage set) private view returns (bytes32[] memory) { return set._values; } // Bytes32Set struct Bytes32Set { Set _inner; } /** * @dev Add a value to a set. O(1). * * Returns true if the value was added to the set, that is if it was not * already present. */ function add(Bytes32Set storage set, bytes32 value) internal returns (bool) { return _add(set._inner, value); } /** * @dev Removes a value from a set. O(1). * * Returns true if the value was removed from the set, that is if it was * present. */ function remove(Bytes32Set storage set, bytes32 value) internal returns (bool) { return _remove(set._inner, value); } /** * @dev Returns true if the value is in the set. O(1). */ function contains(Bytes32Set storage set, bytes32 value) internal view returns (bool) { return _contains(set._inner, value); } /** * @dev Returns the number of values in the set. O(1). */ function length(Bytes32Set storage set) internal view returns (uint256) { return _length(set._inner); } /** * @dev Returns the value stored at position `index` in the set. O(1). * * Note that there are no guarantees on the ordering of values inside the * array, and it may change when more values are added or removed. * * Requirements: * * - `index` must be strictly less than {length}. */ function at(Bytes32Set storage set, uint256 index) internal view returns (bytes32) { return _at(set._inner, index); } /** * @dev Return the entire set in an array * * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that * this function has an unbounded cost, and using it as part of a state-changing function may render the function * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block. */ function values(Bytes32Set storage set) internal view returns (bytes32[] memory) { bytes32[] memory store = _values(set._inner); bytes32[] memory result; /// @solidity memory-safe-assembly assembly { result := store } return result; } // AddressSet struct AddressSet { Set _inner; } /** * @dev Add a value to a set. O(1). * * Returns true if the value was added to the set, that is if it was not * already present. */ function add(AddressSet storage set, address value) internal returns (bool) { return _add(set._inner, bytes32(uint256(uint160(value)))); } /** * @dev Removes a value from a set. O(1). * * Returns true if the value was removed from the set, that is if it was * present. */ function remove(AddressSet storage set, address value) internal returns (bool) { return _remove(set._inner, bytes32(uint256(uint160(value)))); } /** * @dev Returns true if the value is in the set. O(1). */ function contains(AddressSet storage set, address value) internal view returns (bool) { return _contains(set._inner, bytes32(uint256(uint160(value)))); } /** * @dev Returns the number of values in the set. O(1). */ function length(AddressSet storage set) internal view returns (uint256) { return _length(set._inner); } /** * @dev Returns the value stored at position `index` in the set. O(1). * * Note that there are no guarantees on the ordering of values inside the * array, and it may change when more values are added or removed. * * Requirements: * * - `index` must be strictly less than {length}. */ function at(AddressSet storage set, uint256 index) internal view returns (address) { return address(uint160(uint256(_at(set._inner, index)))); } /** * @dev Return the entire set in an array * * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that * this function has an unbounded cost, and using it as part of a state-changing function may render the function * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block. */ function values(AddressSet storage set) internal view returns (address[] memory) { bytes32[] memory store = _values(set._inner); address[] memory result; /// @solidity memory-safe-assembly assembly { result := store } return result; } // UintSet struct UintSet { Set _inner; } /** * @dev Add a value to a set. O(1). * * Returns true if the value was added to the set, that is if it was not * already present. */ function add(UintSet storage set, uint256 value) internal returns (bool) { return _add(set._inner, bytes32(value)); } /** * @dev Removes a value from a set. O(1). * * Returns true if the value was removed from the set, that is if it was * present. */ function remove(UintSet storage set, uint256 value) internal returns (bool) { return _remove(set._inner, bytes32(value)); } /** * @dev Returns true if the value is in the set. O(1). */ function contains(UintSet storage set, uint256 value) internal view returns (bool) { return _contains(set._inner, bytes32(value)); } /** * @dev Returns the number of values in the set. O(1). */ function length(UintSet storage set) internal view returns (uint256) { return _length(set._inner); } /** * @dev Returns the value stored at position `index` in the set. O(1). * * Note that there are no guarantees on the ordering of values inside the * array, and it may change when more values are added or removed. * * Requirements: * * - `index` must be strictly less than {length}. */ function at(UintSet storage set, uint256 index) internal view returns (uint256) { return uint256(_at(set._inner, index)); } /** * @dev Return the entire set in an array * * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that * this function has an unbounded cost, and using it as part of a state-changing function may render the function * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block. */ function values(UintSet storage set) internal view returns (uint256[] memory) { bytes32[] memory store = _values(set._inner); uint256[] memory result; /// @solidity memory-safe-assembly assembly { result := store } return result; } }
// 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 (last updated v4.8.0) (token/ERC20/utils/SafeERC20.sol) pragma solidity ^0.8.0; import "IERC20.sol"; import "draft-IERC20Permit.sol"; import "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 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: GPL-3.0-or-later pragma solidity 0.8.17; import "IConicPool.sol"; import "IController.sol"; import "IRebalancingRewardsHandler.sol"; interface ICNCMintingRebalancingRewardsHandlerV2 is IRebalancingRewardsHandler { event SetCncRebalancingRewardPerDollarPerSecond(uint256 cncRebalancingRewardPerDollarPerSecond); function initialize() external; function controller() external view returns (IController); function totalCncMinted() external view returns (uint256); function cncRebalancingRewardPerDollarPerSecond() external view returns (uint256); function setCncRebalancingRewardPerDollarPerSecond( uint256 _cncRebalancingRewardPerDollarPerSecond ) external; function computeRebalancingRewards( address conicPool, uint256 deviationBefore, uint256 deviationAfter ) external view returns (uint256); function rebalance( address conicPool, uint256 underlyingAmount, uint256 minUnderlyingReceived, uint256 minCNCReceived ) external returns (uint256 underlyingReceived, uint256 cncReceived); function switchMintingRebalancingRewardsHandler(address newRebalancingRewardsHandler) external; }
// SPDX-License-Identifier: GPL-3.0-or-later pragma solidity 0.8.17; import "ILpToken.sol"; import "IRewardManager.sol"; import "IOracle.sol"; import "IController.sol"; interface IConicPool { event Deposit( address indexed sender, address indexed receiver, uint256 depositedAmount, uint256 lpReceived ); event Withdraw(address indexed account, uint256 amount); event NewWeight(address indexed curvePool, uint256 newWeight); event NewMaxIdleCurveLpRatio(uint256 newRatio); event ClaimedRewards(uint256 claimedCrv, uint256 claimedCvx); event HandledDepeggedCurvePool(address curvePool_); event HandledInvalidConvexPid(address curvePool_, uint256 pid_); event CurvePoolAdded(address curvePool_); event CurvePoolRemoved(address curvePool_); event Shutdown(); event DepegThresholdUpdated(uint256 newThreshold); event MaxDeviationUpdated(uint256 newMaxDeviation); struct PoolWeight { address poolAddress; uint256 weight; } struct PoolWithAmount { address poolAddress; uint256 amount; } function underlying() external view returns (IERC20Metadata); function lpToken() external view returns (ILpToken); function rewardManager() external view returns (IRewardManager); function controller() external view returns (IController); function depegThreshold() external view returns (uint256); function maxIdleCurveLpRatio() external view returns (uint256); function getPoolWeight(address curvePool) external view returns (uint256); function setMaxIdleCurveLpRatio(uint256 value) external; function updateDepegThreshold(uint256 value) external; function computeDeviationRatio() external view returns (uint256); function depositFor( address _account, uint256 _amount, uint256 _minLpReceived, bool stake ) external returns (uint256); function deposit(uint256 _amount, uint256 _minLpReceived) external returns (uint256); function deposit( uint256 _amount, uint256 _minLpReceived, bool stake ) external returns (uint256); function exchangeRate() external view returns (uint256); function usdExchangeRate() external view returns (uint256); function allCurvePools() external view returns (address[] memory); function curvePoolsCount() external view returns (uint256); function getCurvePoolAtIndex(uint256 _index) external view returns (address); function unstakeAndWithdraw(uint256 _amount, uint256 _minAmount) external returns (uint256); function withdraw(uint256 _amount, uint256 _minAmount) external returns (uint256); function updateWeights(PoolWeight[] memory poolWeights) external; function getWeight(address curvePool) external view returns (uint256); function getWeights() external view returns (PoolWeight[] memory); function getAllocatedUnderlying() external view returns (PoolWithAmount[] memory); function removeCurvePool(address pool) external; function addCurvePool(address pool) external; function totalCurveLpBalance(address curvePool_) external view returns (uint256); function rebalancingRewardActive() external view returns (bool); function totalDeviationAfterWeightUpdate() external view returns (uint256); function computeTotalDeviation() external view returns (uint256); /// @notice returns the total amount of funds held by this pool in terms of underlying function totalUnderlying() external view returns (uint256); function getTotalAndPerPoolUnderlying() external view returns ( uint256 totalUnderlying_, uint256 totalAllocated_, uint256[] memory perPoolUnderlying_ ); /// @notice same as `totalUnderlying` but returns a cached version /// that might be slightly outdated if oracle prices have changed /// @dev this is useful in cases where we want to reduce gas usage and do /// not need a precise value function cachedTotalUnderlying() external view returns (uint256); function handleInvalidConvexPid(address pool) external; function shutdownPool() external; function isShutdown() external view returns (bool); function handleDepeggedCurvePool(address curvePool_) external; function isBalanced() external view returns (bool); }
// SPDX-License-Identifier: GPL-3.0-or-later pragma solidity 0.8.17; import "IERC20Metadata.sol"; interface ILpToken is IERC20Metadata { function mint(address account, uint256 amount) external returns (uint256); function burn(address _owner, uint256 _amount) external returns (uint256); }
// 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: GPL-3.0-or-later pragma solidity 0.8.17; interface IRewardManager { event ClaimedRewards(uint256 claimedCrv, uint256 claimedCvx); event SoldRewardTokens(uint256 targetTokenReceived); event ExtraRewardAdded(address reward); event ExtraRewardRemoved(address reward); event ExtraRewardsCurvePoolSet(address extraReward, address curvePool); event FeesSet(uint256 feePercentage); event FeesEnabled(uint256 feePercentage); event EarningsClaimed( address indexed claimedBy, uint256 cncEarned, uint256 crvEarned, uint256 cvxEarned ); function accountCheckpoint(address account) external; function poolCheckpoint() external returns (bool); function addExtraReward(address reward) external returns (bool); function addBatchExtraRewards(address[] memory rewards) external; function pool() external view returns (address); function setFeePercentage(uint256 _feePercentage) external; function claimableRewards( address account ) external view returns (uint256 cncRewards, uint256 crvRewards, uint256 cvxRewards); function claimEarnings() external returns (uint256, uint256, uint256); function claimPoolEarningsAndSellRewardTokens() external; }
// SPDX-License-Identifier: GPL-3.0-or-later pragma solidity 0.8.17; interface IOracle { event TokenUpdated(address indexed token, address feed, uint256 maxDelay, bool isEthPrice); /// @notice returns the price in USD of symbol. function getUSDPrice(address token) external view returns (uint256); /// @notice returns if the given token is supported for pricing. function isTokenSupported(address token) external view returns (bool); }
// SPDX-License-Identifier: GPL-3.0-or-later pragma solidity 0.8.17; import "IConicPool.sol"; import "IOracle.sol"; import "IInflationManager.sol"; import "ILpTokenStaker.sol"; import "ICurveRegistryCache.sol"; interface IController { event PoolAdded(address indexed pool); event PoolRemoved(address indexed pool); event PoolShutdown(address indexed pool); event ConvexBoosterSet(address convexBooster); event CurveHandlerSet(address curveHandler); event ConvexHandlerSet(address convexHandler); event CurveRegistryCacheSet(address curveRegistryCache); event InflationManagerSet(address inflationManager); event PriceOracleSet(address priceOracle); event WeightUpdateMinDelaySet(uint256 weightUpdateMinDelay); struct WeightUpdate { address conicPoolAddress; IConicPool.PoolWeight[] weights; } // inflation manager function inflationManager() external view returns (IInflationManager); function setInflationManager(address manager) external; // views function curveRegistryCache() external view returns (ICurveRegistryCache); /// lp token staker function setLpTokenStaker(address _lpTokenStaker) external; function lpTokenStaker() external view returns (ILpTokenStaker); // oracle function priceOracle() external view returns (IOracle); function setPriceOracle(address oracle) external; // pool functions function listPools() external view returns (address[] memory); function listActivePools() external view returns (address[] memory); function isPool(address poolAddress) external view returns (bool); function isActivePool(address poolAddress) external view returns (bool); function addPool(address poolAddress) external; function shutdownPool(address poolAddress) external; function removePool(address poolAddress) external; function cncToken() external view returns (address); function lastWeightUpdate(address poolAddress) external view returns (uint256); function updateWeights(WeightUpdate memory update) external; function updateAllWeights(WeightUpdate[] memory weights) external; // handler functions function convexBooster() external view returns (address); function curveHandler() external view returns (address); function convexHandler() external view returns (address); function setConvexBooster(address _convexBooster) external; function setCurveHandler(address _curveHandler) external; function setConvexHandler(address _convexHandler) external; function setCurveRegistryCache(address curveRegistryCache_) external; function emergencyMinter() external view returns (address); function setWeightUpdateMinDelay(uint256 delay) external; }
// SPDX-License-Identifier: GPL-3.0-or-later pragma solidity 0.8.17; interface IInflationManager { event TokensClaimed(address indexed pool, uint256 cncAmount); event RebalancingRewardHandlerAdded(address indexed pool, address indexed handler); event RebalancingRewardHandlerRemoved(address indexed pool, address indexed handler); event PoolWeightsUpdated(); function executeInflationRateUpdate() external; function updatePoolWeights() external; /// @notice returns the weights of the Conic pools to know how much inflation /// each of them will receive, as well as the total amount of USD value in all the pools function computePoolWeights() external view returns (address[] memory _pools, uint256[] memory poolWeights, uint256 totalUSDValue); function computePoolWeight( address pool ) external view returns (uint256 poolWeight, uint256 totalUSDValue); function currentInflationRate() external view returns (uint256); function getCurrentPoolInflationRate(address pool) external view returns (uint256); function handleRebalancingRewards( address account, uint256 deviationBefore, uint256 deviationAfter ) external; function addPoolRebalancingRewardHandler( address poolAddress, address rebalancingRewardHandler ) external; function removePoolRebalancingRewardHandler( address poolAddress, address rebalancingRewardHandler ) external; function rebalancingRewardHandlers( address poolAddress ) external view returns (address[] memory); function hasPoolRebalancingRewardHandlers( address poolAddress, address handler ) external view returns (bool); }
// SPDX-License-Identifier: GPL-3.0-or-later pragma solidity 0.8.17; interface ILpTokenStaker { event LpTokenStaked(address indexed account, uint256 amount); event LpTokenUnstaked(address indexed account, uint256 amount); event TokensClaimed(address indexed pool, uint256 cncAmount); event Shutdown(); function stake(uint256 amount, address conicPool) external; function unstake(uint256 amount, address conicPool) external; function stakeFor(uint256 amount, address conicPool, address account) external; function unstakeFor(uint256 amount, address conicPool, address account) external; function unstakeFrom(uint256 amount, address account) external; function getUserBalanceForPool( address conicPool, address account ) external view returns (uint256); function getBalanceForPool(address conicPool) external view returns (uint256); function updateBoost(address user) external; function claimCNCRewardsForPool(address pool) external; function claimableCnc(address pool) external view returns (uint256); function checkpoint(address pool) external returns (uint256); function shutdown() external; function getBoost(address user) external view returns (uint256); }
// SPDX-License-Identifier: GPL-3.0-or-later pragma solidity 0.8.17; import "IBooster.sol"; import "CurvePoolUtils.sol"; interface ICurveRegistryCache { event PoolInitialized(address indexed pool, uint256 indexed pid); function BOOSTER() external view returns (IBooster); function initPool(address pool_) external; function initPool(address pool_, uint256 pid_) external; function lpToken(address pool_) external view returns (address); function assetType(address pool_) external view returns (CurvePoolUtils.AssetType); function isRegistered(address pool_) external view returns (bool); function hasCoinDirectly(address pool_, address coin_) external view returns (bool); function hasCoinAnywhere(address pool_, address coin_) external view returns (bool); function basePool(address pool_) external view returns (address); function coinIndex(address pool_, address coin_) external view returns (int128); function nCoins(address pool_) external view returns (uint256); function coinIndices( address pool_, address from_, address to_ ) external view returns (int128, int128, bool); function decimals(address pool_) external view returns (uint256[] memory); function interfaceVersion(address pool_) external view returns (uint256); function poolFromLpToken(address lpToken_) external view returns (address); function coins(address pool_) external view returns (address[] memory); function getPid(address _pool) external view returns (uint256); function getRewardPool(address _pool) external view returns (address); function isShutdownPid(uint256 pid_) external view returns (bool); }
// SPDX-License-Identifier: UNLICENSED pragma solidity 0.8.17; interface IBooster { function poolInfo( uint256 pid ) external view returns ( address lpToken, address token, address gauge, address crvRewards, address stash, bool shutdown ); function poolLength() external view returns (uint256); function deposit(uint256 _pid, uint256 _amount, bool _stake) external returns (bool); function withdraw(uint256 _pid, uint256 _amount) external returns (bool); function withdrawAll(uint256 _pid) external returns (bool); function depositAll(uint256 _pid, bool _stake) external returns (bool); function earmarkRewards(uint256 _pid) external returns (bool); function isShutdown() external view returns (bool); }
// SPDX-License-Identifier: GPL-3.0-or-later pragma solidity 0.8.17; import "ICurvePoolV2.sol"; import "ICurvePoolV1.sol"; import "ScaledMath.sol"; library CurvePoolUtils { using ScaledMath for uint256; uint256 internal constant _DEFAULT_IMBALANCE_THRESHOLD = 0.02e18; enum AssetType { USD, ETH, BTC, OTHER, CRYPTO } struct PoolMeta { address pool; uint256 numberOfCoins; AssetType assetType; uint256[] decimals; uint256[] prices; uint256[] thresholds; } function ensurePoolBalanced(PoolMeta memory poolMeta) internal view { uint256 fromDecimals = poolMeta.decimals[0]; uint256 fromBalance = 10 ** fromDecimals; uint256 fromPrice = poolMeta.prices[0]; for (uint256 i = 1; i < poolMeta.numberOfCoins; i++) { uint256 toDecimals = poolMeta.decimals[i]; uint256 toPrice = poolMeta.prices[i]; uint256 toExpectedUnscaled = (fromBalance * fromPrice) / toPrice; uint256 toExpected = toExpectedUnscaled.convertScale( uint8(fromDecimals), uint8(toDecimals) ); uint256 toActual; if (poolMeta.assetType == AssetType.CRYPTO) { // Handling crypto pools toActual = ICurvePoolV2(poolMeta.pool).get_dy(0, i, fromBalance); } else { // Handling other pools toActual = ICurvePoolV1(poolMeta.pool).get_dy(0, int128(uint128(i)), fromBalance); } require( _isWithinThreshold(toExpected, toActual, poolMeta.thresholds[i]), "pool is not balanced" ); } } function _isWithinThreshold( uint256 a, uint256 b, uint256 imbalanceTreshold ) internal pure returns (bool) { if (imbalanceTreshold == 0) imbalanceTreshold = _DEFAULT_IMBALANCE_THRESHOLD; if (a > b) return (a - b).divDown(a) <= imbalanceTreshold; return (b - a).divDown(b) <= imbalanceTreshold; } }
// SPDX-License-Identifier: UNLICENSED pragma solidity 0.8.17; interface ICurvePoolV2 { function token() external view returns (address); function coins(uint256 i) external view returns (address); function factory() external view returns (address); function exchange( uint256 i, uint256 j, uint256 dx, uint256 min_dy, bool use_eth, address receiver ) external returns (uint256); function exchange_underlying( uint256 i, uint256 j, uint256 dx, uint256 min_dy, address receiver ) external returns (uint256); function add_liquidity( uint256[2] memory amounts, uint256 min_mint_amount, bool use_eth, address receiver ) external returns (uint256); function add_liquidity( uint256[2] memory amounts, uint256 min_mint_amount ) external returns (uint256); function add_liquidity( uint256[3] memory amounts, uint256 min_mint_amount, bool use_eth, address receiver ) external returns (uint256); function add_liquidity( uint256[3] memory amounts, uint256 min_mint_amount ) external returns (uint256); function remove_liquidity( uint256 _amount, uint256[2] memory min_amounts, bool use_eth, address receiver ) external; function remove_liquidity(uint256 _amount, uint256[2] memory min_amounts) external; function remove_liquidity( uint256 _amount, uint256[3] memory min_amounts, bool use_eth, address receiver ) external; function remove_liquidity(uint256 _amount, uint256[3] memory min_amounts) external; function remove_liquidity_one_coin( uint256 token_amount, uint256 i, uint256 min_amount, bool use_eth, address receiver ) external returns (uint256); function get_dy(uint256 i, uint256 j, uint256 dx) external view returns (uint256); function calc_token_amount(uint256[] memory amounts) external view returns (uint256); function calc_withdraw_one_coin( uint256 token_amount, uint256 i ) external view returns (uint256); function get_virtual_price() external view returns (uint256); }
// SPDX-License-Identifier: UNLICENSED pragma solidity 0.8.17; interface ICurvePoolV1 { function get_virtual_price() external view returns (uint256); function add_liquidity(uint256[8] calldata amounts, uint256 min_mint_amount) external; function add_liquidity(uint256[7] calldata amounts, uint256 min_mint_amount) external; function add_liquidity(uint256[6] calldata amounts, uint256 min_mint_amount) external; function add_liquidity(uint256[5] calldata amounts, uint256 min_mint_amount) external; function add_liquidity(uint256[4] calldata amounts, uint256 min_mint_amount) external; function add_liquidity(uint256[3] calldata amounts, uint256 min_mint_amount) external; function add_liquidity(uint256[2] calldata amounts, uint256 min_mint_amount) external; function remove_liquidity_imbalance( uint256[4] calldata amounts, uint256 max_burn_amount ) external; function remove_liquidity_imbalance( uint256[3] calldata amounts, uint256 max_burn_amount ) external; function remove_liquidity_imbalance( uint256[2] calldata amounts, uint256 max_burn_amount ) external; function lp_token() external view returns (address); function A_PRECISION() external view returns (uint256); function A_precise() external view returns (uint256); function remove_liquidity(uint256 _amount, uint256[3] calldata min_amounts) external; function exchange( int128 from, int128 to, uint256 _from_amount, uint256 _min_to_amount ) external; function coins(uint256 i) external view returns (address); function balances(uint256 i) external view returns (uint256); function get_dy(int128 i, int128 j, uint256 _dx) external view returns (uint256); function calc_token_amount( uint256[4] calldata amounts, bool deposit ) external view returns (uint256); function calc_token_amount( uint256[3] calldata amounts, bool deposit ) external view returns (uint256); function calc_token_amount( uint256[2] calldata amounts, bool deposit ) external view returns (uint256); function calc_withdraw_one_coin( uint256 _token_amount, int128 i ) external view returns (uint256); function remove_liquidity_one_coin( uint256 _token_amount, int128 i, uint256 min_amount ) external; }
// SPDX-License-Identifier: GPL-3.0-or-later pragma solidity 0.8.17; library ScaledMath { uint256 internal constant DECIMALS = 18; uint256 internal constant ONE = 10 ** DECIMALS; function mulDown(uint256 a, uint256 b) internal pure returns (uint256) { return (a * b) / ONE; } function mulDown(uint256 a, uint256 b, uint256 decimals) internal pure returns (uint256) { return (a * b) / (10 ** decimals); } function divDown(uint256 a, uint256 b) internal pure returns (uint256) { return (a * ONE) / b; } function divDown(uint256 a, uint256 b, uint256 decimals) internal pure returns (uint256) { return (a * 10 ** decimals) / b; } function divUp(uint256 a, uint256 b) internal pure returns (uint256) { if (a == 0) { return 0; } return ((a * ONE) - 1) / b + 1; } function mulDown(int256 a, int256 b) internal pure returns (int256) { return (a * b) / int256(ONE); } function mulDownUint128(uint128 a, uint128 b) internal pure returns (uint128) { return (a * b) / uint128(ONE); } function mulDown(int256 a, int256 b, uint256 decimals) internal pure returns (int256) { return (a * b) / int256(10 ** decimals); } function divDown(int256 a, int256 b) internal pure returns (int256) { return (a * int256(ONE)) / b; } function divDownUint128(uint128 a, uint128 b) internal pure returns (uint128) { return (a * uint128(ONE)) / b; } function divDown(int256 a, int256 b, uint256 decimals) internal pure returns (int256) { return (a * int256(10 ** decimals)) / b; } function convertScale( uint256 a, uint8 fromDecimals, uint8 toDecimals ) internal pure returns (uint256) { if (fromDecimals == toDecimals) return a; if (fromDecimals > toDecimals) return downscale(a, fromDecimals, toDecimals); return upscale(a, fromDecimals, toDecimals); } function convertScale( int256 a, uint8 fromDecimals, uint8 toDecimals ) internal pure returns (int256) { if (fromDecimals == toDecimals) return a; if (fromDecimals > toDecimals) return downscale(a, fromDecimals, toDecimals); return upscale(a, fromDecimals, toDecimals); } function upscale( uint256 a, uint8 fromDecimals, uint8 toDecimals ) internal pure returns (uint256) { return a * (10 ** (toDecimals - fromDecimals)); } function downscale( uint256 a, uint8 fromDecimals, uint8 toDecimals ) internal pure returns (uint256) { return a / (10 ** (fromDecimals - toDecimals)); } function upscale( int256 a, uint8 fromDecimals, uint8 toDecimals ) internal pure returns (int256) { return a * int256(10 ** (toDecimals - fromDecimals)); } function downscale( int256 a, uint8 fromDecimals, uint8 toDecimals ) internal pure returns (int256) { return a / int256(10 ** (fromDecimals - toDecimals)); } function intPow(uint256 a, uint256 n) internal pure returns (uint256) { uint256 result = ONE; for (uint256 i; i < n; ) { result = mulDown(result, a); unchecked { ++i; } } return result; } function absSub(uint256 a, uint256 b) internal pure returns (uint256) { unchecked { return a >= b ? a - b : b - a; } } }
// SPDX-License-Identifier: GPL-3.0-or-later pragma solidity 0.8.17; import "IConicPool.sol"; interface IRebalancingRewardsHandler { event RebalancingRewardDistributed( address indexed pool, address indexed account, address indexed token, uint256 tokenAmount ); /// @notice Handles the rewards distribution for the rebalancing of the pool /// @param conicPool The pool that is being rebalanced /// @param account The account that is rebalancing the pool /// @param deviationBefore The total absolute deviation of the Conic pool before the rebalancing /// @param deviationAfter The total absolute deviation of the Conic pool after the rebalancing function handleRebalancingRewards( IConicPool conicPool, address account, uint256 deviationBefore, uint256 deviationAfter ) external; }
// SPDX-License-Identifier: GPL-3.0-or-later pragma solidity 0.8.17; import "IConicPool.sol"; import "IController.sol"; import "IRebalancingRewardsHandler.sol"; interface ICNCMintingRebalancingRewardsHandler is IRebalancingRewardsHandler { event SetCncRebalancingRewardPerDollarPerSecond(uint256 cncRebalancingRewardPerDollarPerSecond); event SetMaxRebalancingRewardDollarMultiplier(uint256 maxRebalancingRewardDollarMultiplier); event SetMinRebalancingRewardDollarMultiplier(uint256 minRebalancingRewardDollarMultiplier); function controller() external view returns (IController); function totalCncMinted() external view returns (uint256); function cncRebalancingRewardPerDollarPerSecond() external view returns (uint256); function maxRebalancingRewardDollarMultiplier() external view returns (uint256); function minRebalancingRewardDollarMultiplier() external view returns (uint256); function setCncRebalancingRewardPerDollarPerSecond( uint256 _cncRebalancingRewardPerDollarPerSecond ) external; function setMaxRebalancingRewardDollarMultiplier( uint256 _maxRebalancingRewardDollarMultiplier ) external; function setMinRebalancingRewardDollarMultiplier( uint256 _minRebalancingRewardDollarMultiplier ) external; function poolCNCRebalancingRewardPerSecond(address pool) external view returns (uint256); function computeRebalancingRewards( address conicPool, uint256 deviationBefore, uint256 deviationAfter ) external view returns (uint256); }
// SPDX-License-Identifier: GPL-3.0-or-later pragma solidity 0.8.17; import "IERC20.sol"; interface ICNCToken is IERC20 { event MinterAdded(address minter); event MinterRemoved(address minter); event InitialDistributionMinted(uint256 amount); event AirdropMinted(uint256 amount); event AMMRewardsMinted(uint256 amount); event TreasuryRewardsMinted(uint256 amount); event SeedShareMinted(uint256 amount); /// @notice adds a new minter function addMinter(address newMinter) external; /// @notice renounces the minter rights of the sender function renounceMinterRights() external; /// @notice mints the initial distribution amount to the distribution contract function mintInitialDistribution(address distribution) external; /// @notice mints the airdrop amount to the airdrop contract function mintAirdrop(address airdropHandler) external; /// @notice mints the amm rewards function mintAMMRewards(address ammGauge) external; /// @notice mints `amount` to `account` function mint(address account, uint256 amount) external returns (uint256); /// @notice returns a list of all authorized minters function listMinters() external view returns (address[] memory); /// @notice returns the ratio of inflation already minted function inflationMintedRatio() external view returns (uint256); }
// SPDX-License-Identifier: GPL-3.0-or-later pragma solidity 0.8.17; import "ERC165Storage.sol"; import "IMinter.sol"; import "ICNCToken.sol"; /// @notice All contracts that are allowed to mint CNC should inherit from this contract /// This allows the emergency minter to switch to a new minter during the initial 3 months in case of an issue abstract contract BaseMinter is IMinter, ERC165Storage { address public immutable emergencyMinter; ICNCToken public immutable cnc; constructor(ICNCToken _cnc, address _emergencyMinter) { emergencyMinter = _emergencyMinter; cnc = _cnc; _registerInterface(IMinter.renounceMinterRights.selector); } function renounceMinterRights() external override { require(msg.sender == emergencyMinter, "only emergency minter can renounce minter rights"); cnc.renounceMinterRights(); } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (utils/introspection/ERC165Storage.sol) pragma solidity ^0.8.0; import "ERC165.sol"; /** * @dev Storage based implementation of the {IERC165} interface. * * Contracts may inherit from this and call {_registerInterface} to declare * their support of an interface. */ abstract contract ERC165Storage is ERC165 { /** * @dev Mapping of interface ids to whether or not it's supported. */ mapping(bytes4 => bool) private _supportedInterfaces; /** * @dev See {IERC165-supportsInterface}. */ function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) { return super.supportsInterface(interfaceId) || _supportedInterfaces[interfaceId]; } /** * @dev Registers the contract as an implementer of the interface defined by * `interfaceId`. Support of the actual ERC165 interface is automatic and * registering its interface id is not required. * * See {IERC165-supportsInterface}. * * Requirements: * * - `interfaceId` cannot be the ERC165 invalid interface (`0xffffffff`). */ function _registerInterface(bytes4 interfaceId) internal virtual { require(interfaceId != 0xffffffff, "ERC165: invalid interface id"); _supportedInterfaces[interfaceId] = true; } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (utils/introspection/ERC165.sol) pragma solidity ^0.8.0; import "IERC165.sol"; /** * @dev Implementation of the {IERC165} interface. * * Contracts that want to implement ERC165 should inherit from this contract and override {supportsInterface} to check * for the additional interface id that will be supported. For example: * * ```solidity * function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) { * return interfaceId == type(MyInterface).interfaceId || super.supportsInterface(interfaceId); * } * ``` * * Alternatively, {ERC165Storage} provides an easier to use but more expensive implementation. */ abstract contract ERC165 is IERC165 { /** * @dev See {IERC165-supportsInterface}. */ function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) { return interfaceId == type(IERC165).interfaceId; } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (utils/introspection/IERC165.sol) pragma solidity ^0.8.0; /** * @dev Interface of the ERC165 standard, as defined in the * https://eips.ethereum.org/EIPS/eip-165[EIP]. * * Implementers can declare support of contract interfaces, which can then be * queried by others ({ERC165Checker}). * * For an implementation, see {ERC165}. */ interface IERC165 { /** * @dev Returns true if this contract implements the interface defined by * `interfaceId`. See the corresponding * https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section] * to learn more about how these ids are created. * * This function call must use less than 30 000 gas. */ function supportsInterface(bytes4 interfaceId) external view returns (bool); }
// SPDX-License-Identifier: GPL-3.0-or-later pragma solidity 0.8.17; import "IERC165.sol"; interface IMinter is IERC165 { function renounceMinterRights() external; }
{ "evmVersion": "london", "optimizer": { "enabled": true, "runs": 200 }, "libraries": { "CNCMintingRebalancingRewardsHandlerV3.sol": {} }, "outputSelection": { "*": { "*": [ "evm.bytecode", "evm.deployedBytecode", "devdoc", "userdoc", "metadata", "abi" ] } } }
Contract Security Audit
- No Contract Security Audit Submitted- Submit Audit Here
[{"inputs":[{"internalType":"contract IController","name":"_controller","type":"address"},{"internalType":"contract ICNCToken","name":"_cnc","type":"address"},{"internalType":"contract ICNCMintingRebalancingRewardsHandler","name":"_previousRewardsHandler","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint8","name":"version","type":"uint8"}],"name":"Initialized","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"previousOwner","type":"address"},{"indexed":true,"internalType":"address","name":"newOwner","type":"address"}],"name":"OwnershipTransferred","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"pool","type":"address"},{"indexed":true,"internalType":"address","name":"account","type":"address"},{"indexed":true,"internalType":"address","name":"token","type":"address"},{"indexed":false,"internalType":"uint256","name":"tokenAmount","type":"uint256"}],"name":"RebalancingRewardDistributed","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"cncRebalancingRewardPerDollarPerSecond","type":"uint256"}],"name":"SetCncRebalancingRewardPerDollarPerSecond","type":"event"},{"inputs":[],"name":"cnc","outputs":[{"internalType":"contract ICNCToken","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"cncRebalancingRewardPerDollarPerSecond","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"conicPool","type":"address"},{"internalType":"uint256","name":"deviationBefore","type":"uint256"},{"internalType":"uint256","name":"deviationAfter","type":"uint256"}],"name":"computeRebalancingRewards","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"controller","outputs":[{"internalType":"contract IController","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"emergencyMinter","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"contract IConicPool","name":"conicPool","type":"address"},{"internalType":"address","name":"account","type":"address"},{"internalType":"uint256","name":"deviationBefore","type":"uint256"},{"internalType":"uint256","name":"deviationAfter","type":"uint256"}],"name":"handleRebalancingRewards","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"initialize","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"previousRewardsHandler","outputs":[{"internalType":"contract ICNCMintingRebalancingRewardsHandler","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"conicPool","type":"address"},{"internalType":"uint256","name":"underlyingAmount","type":"uint256"},{"internalType":"uint256","name":"minUnderlyingReceived","type":"uint256"},{"internalType":"uint256","name":"minCNCReceived","type":"uint256"}],"name":"rebalance","outputs":[{"internalType":"uint256","name":"underlyingReceived","type":"uint256"},{"internalType":"uint256","name":"cncReceived","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"renounceMinterRights","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"renounceOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_cncRebalancingRewardPerDollarPerSecond","type":"uint256"}],"name":"setCncRebalancingRewardPerDollarPerSecond","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes4","name":"interfaceId","type":"bytes4"}],"name":"supportsInterface","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"newRebalancingRewardsHandler","type":"address"}],"name":"switchMintingRebalancingRewardsHandler","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"totalCncMinted","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"}]
Contract Creation Code
6101006040523480156200001257600080fd5b50604051620020c8380380620020c8833981016040819052620000359162000191565b8160006200004333620000a1565b6001600160a01b03808216608052821660a05262000068633874ba4d60e11b620000f1565b50620000839050630cdfe600674563918244f40000620001e5565b6004556001600160a01b0392831660c05290911660e0525062000208565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b6001600160e01b03198082169003620001505760405162461bcd60e51b815260206004820152601c60248201527f4552433136353a20696e76616c696420696e7465726661636520696400000000604482015260640160405180910390fd5b6001600160e01b0319166000908152600160208190526040909120805460ff19169091179055565b6001600160a01b03811681146200018e57600080fd5b50565b600080600060608486031215620001a757600080fd5b8351620001b48162000178565b6020850151909350620001c78162000178565b6040850151909250620001da8162000178565b809150509250925092565b6000826200020357634e487b7160e01b600052601260045260246000fd5b500490565b60805160a05160c05160e051611e24620002a4600039600081816101e3015261100101526000818161028901528181610408015281816104bf01528181610553015281816107f6015261118301526000818161024f015281816106ff0152818161075d01528181610c2501528181610d2b01528181610eb0015281816116fe01526117900152600081816101a40152610e280152611e246000f3fe608060405234801561001057600080fd5b506004361061010b5760003560e01c8063715018a6116100a2578063d7cfbdf311610071578063d7cfbdf314610241578063f0aa0a1d1461024a578063f2fde38b14610271578063f77c479114610284578063f95878f5146102ab57600080fd5b8063715018a61461020d5780638129fc1c146102155780638da5cb5b1461021d5780638f3c14cb1461022e57600080fd5b80633d5d2cb2116100de5780633d5d2cb2146101965780635e2f23ce1461019f578063603293f1146101de57806370e9749a1461020557600080fd5b806301ffc9a71461011057806303de1eb014610138578063182ba0bf146101595780632332d74b1461016e575b600080fd5b61012361011e36600461192e565b6102be565b60405190151581526020015b60405180910390f35b61014b61014636600461196d565b6102fe565b60405190815260200161012f565b61016c6101673660046119a2565b6104b3565b005b61018161017c3660046119bf565b6107d2565b6040805192835260208301919091520161012f565b61014b60045481565b6101c67f000000000000000000000000000000000000000000000000000000000000000081565b6040516001600160a01b03909116815260200161012f565b6101c67f000000000000000000000000000000000000000000000000000000000000000081565b61016c610e1d565b61016c610f23565b61016c610f37565b6000546001600160a01b03166101c6565b61016c61023c3660046119fa565b6110ce565b61014b60035481565b6101c67f000000000000000000000000000000000000000000000000000000000000000081565b61016c61027f3660046119a2565b61110b565b6101c67f000000000000000000000000000000000000000000000000000000000000000081565b61016c6102b9366004611a13565b611181565b60006301ffc9a760e01b6001600160e01b0319831614806102f857506001600160e01b0319821660009081526001602052604090205460ff165b92915050565b600081831015610310575060006104ac565b6000846001600160a01b0316636f307dc36040518163ffffffff1660e01b8152600401602060405180830381865afa158015610350573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906103749190611a59565b6001600160a01b031663313ce5676040518163ffffffff1660e01b8152600401602060405180830381865afa1580156103b1573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906103d59190611a76565b905060006103e38486611aaf565b604051630850219760e01b81526001600160a01b0388811660048301529192506000917f00000000000000000000000000000000000000000000000000000000000000001690630850219790602401602060405180830381865afa15801561044f573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906104739190611ac2565b905060006104818242611aaf565b90506104a561049284866012611284565b60045461049f9084611adb565b906112cd565b9450505050505b9392505050565b6104bb6112ef565b60007f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031663687958626040518163ffffffff1660e01b8152600401600060405180830381865afa15801561051b573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f191682016040526105439190810190611b18565b905060005b81518110156106df577f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031663dbcd89fa6040518163ffffffff1660e01b8152600401602060405180830381865afa1580156105af573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906105d39190611a59565b6001600160a01b031663b46507a18383815181106105f3576105f3611bdd565b60209081029190910101516040516001600160e01b031960e084901b1681526001600160a01b039091166004820152306024820152604401602060405180830381865afa158015610648573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061066c9190611bf3565b156106cd5760405162461bcd60e51b815260206004820152602660248201527f68616e646c6572206973207374696c6c207265676973746572656420666f722060448201526518481c1bdbdb60d21b60648201526084015b60405180910390fd5b806106d781611c15565b915050610548565b50604051634c1d96ab60e11b81526001600160a01b0383811660048301527f0000000000000000000000000000000000000000000000000000000000000000169063983b2d5690602401600060405180830381600087803b15801561074357600080fd5b505af1158015610757573d6000803e3d6000fd5b505050507f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03166370e9749a6040518163ffffffff1660e01b8152600401600060405180830381600087803b1580156107b657600080fd5b505af11580156107ca573d6000803e3d6000fd5b505050505050565b604051635b16ebb760e01b81526001600160a01b03858116600483015260009182917f00000000000000000000000000000000000000000000000000000000000000001690635b16ebb790602401602060405180830381865afa15801561083d573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906108619190611bf3565b61089a5760405162461bcd60e51b815260206004820152600a6024820152691b9bdd0818481c1bdbdb60b21b60448201526064016106c4565b60008690506000816001600160a01b0316639e4865626040518163ffffffff1660e01b8152600401602060405180830381865afa1580156108df573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906109039190611bf3565b90506000826001600160a01b0316636f307dc36040518163ffffffff1660e01b8152600401602060405180830381865afa158015610945573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906109699190611a59565b6040516370a0823160e01b815233600482015290915088906001600160a01b038316906370a0823190602401602060405180830381865afa1580156109b2573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906109d69190611ac2565b1015610a245760405162461bcd60e51b815260206004820152601760248201527f696e73756666696369656e7420756e6465726c79696e6700000000000000000060448201526064016106c4565b6000836001600160a01b03166383645abf6040518163ffffffff1660e01b8152600401602060405180830381865afa158015610a64573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610a889190611ac2565b9050610a9f6001600160a01b03831633308c611349565b610ab36001600160a01b0383168b8b6113b4565b6005805460ff191660011790556040516321d0683360e11b8152600481018a905260006024820181905260448201819052906001600160a01b038616906343a0d066906064016020604051808303816000875af1158015610b18573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610b3c9190611ac2565b6005805460ff19169055604051630441a3e760e41b815260048101829052600060248201529091506001600160a01b0386169063441a3e70906044016020604051808303816000875af1158015610b97573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610bbb9190611ac2565b965088871015610c0d5760405162461bcd60e51b815260206004820181905260248201527f696e73756666696369656e7420756e6465726c79696e6720726563656976656460448201526064016106c4565b6040516370a0823160e01b81523360048201526000907f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316906370a0823190602401602060405180830381865afa158015610c74573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610c989190611ac2565b90508415610d14576000866001600160a01b03166383645abf6040518163ffffffff1660e01b8152600401602060405180830381865afa158015610ce0573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610d049190611ac2565b9050610d12873386846114ce565b505b6040516370a0823160e01b815233600482015281907f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316906370a0823190602401602060405180830381865afa158015610d7a573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610d9e9190611ac2565b610da89190611aaf565b965088871015610dfa5760405162461bcd60e51b815260206004820152601960248201527f696e73756666696369656e7420434e432072656365697665640000000000000060448201526064016106c4565b610e0e6001600160a01b038516338a6114f9565b50505050505094509492505050565b336001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001614610eae5760405162461bcd60e51b815260206004820152603060248201527f6f6e6c7920656d657267656e6379206d696e7465722063616e2072656e6f756e60448201526f6365206d696e7465722072696768747360801b60648201526084016106c4565b7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03166370e9749a6040518163ffffffff1660e01b8152600401600060405180830381600087803b158015610f0957600080fd5b505af1158015610f1d573d6000803e3d6000fd5b50505050565b610f2b6112ef565b610f356000611529565b565b610f3f6112ef565b600254610100900460ff1615808015610f5f5750600254600160ff909116105b80610f795750303b158015610f79575060025460ff166001145b610fdc5760405162461bcd60e51b815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201526d191e481a5b9a5d1a585b1a5e995960921b60648201526084016106c4565b6002805460ff191660011790558015610fff576002805461ff0019166101001790555b7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031663d7cfbdf36040518163ffffffff1660e01b8152600401602060405180830381865afa15801561105d573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906110819190611ac2565b60035580156110cb576002805461ff0019169055604051600181527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb3847402498906020015b60405180910390a15b50565b6110d66112ef565b60048190556040518181527f52e5ea693f3343bef45800ecec3dd0c08e360e7c6e3a589a8fa2e4ee226c8a12906020016110c2565b6111136112ef565b6001600160a01b0381166111785760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b60648201526084016106c4565b6110cb81611529565b7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031663dbcd89fa6040518163ffffffff1660e01b8152600401602060405180830381865afa1580156111df573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906112039190611a59565b6001600160a01b0316336001600160a01b0316146112785760405162461bcd60e51b815260206004820152602c60248201527f6f6e6c7920496e666c6174696f6e4d616e616765722063616e2063616c6c207460448201526b3434b990333ab731ba34b7b760a11b60648201526084016106c4565b610f1d848484846114ce565b60008160ff168360ff160361129a5750826104ac565b8160ff168360ff1611156112ba576112b3848484611579565b90506104ac565b6112c584848461159a565b949350505050565b60006112db6012600a611d12565b6112e58385611adb565b6104ac9190611d1e565b6000546001600160a01b03163314610f355760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657260448201526064016106c4565b6040516001600160a01b0380851660248301528316604482015260648101829052610f1d9085906323b872dd60e01b906084015b60408051601f198184030181529190526020810180516001600160e01b03166001600160e01b0319909316929092179091526115bb565b80158061142e5750604051636eb1769f60e11b81523060048201526001600160a01b03838116602483015284169063dd62ed3e90604401602060405180830381865afa158015611408573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061142c9190611ac2565b155b6114995760405162461bcd60e51b815260206004820152603660248201527f5361666545524332303a20617070726f76652066726f6d206e6f6e2d7a65726f60448201527520746f206e6f6e2d7a65726f20616c6c6f77616e636560501b60648201526084016106c4565b6040516001600160a01b0383166024820152604481018290526114c990849063095ea7b360e01b9060640161137d565b505050565b60055460ff16610f1d5760006114e58584846102fe565b90506114f285858361168d565b5050505050565b6040516001600160a01b0383166024820152604481018290526114c990849063a9059cbb60e01b9060640161137d565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b60006115858284611d40565b61159090600a611d59565b6112c59085611d1e565b60006115a68383611d40565b6115b190600a611d59565b6112c59085611adb565b6000611610826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b031661180b9092919063ffffffff16565b8051909150156114c9578080602001905181019061162e9190611bf3565b6114c95760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b60648201526084016106c4565b6a01925734d5b8904b800000816003546116a79190611d68565b11156116c8576003546116c5906a01925734d5b8904b800000611aaf565b90505b806000036116d557505050565b6040516340c10f1960e01b81526001600160a01b038381166004830152602482018390526000917f0000000000000000000000000000000000000000000000000000000000000000909116906340c10f19906044016020604051808303816000875af1158015611749573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061176d9190611ac2565b90508015610f1d5780600360008282546117879190611d68565b925050819055507f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316836001600160a01b0316856001600160a01b03167fc84ef7d7e740eeb018c01c28c59b82def5d19d93fb1c641a70e27665e16f282d846040516117fd91815260200190565b60405180910390a450505050565b60606112c5848460008585600080866001600160a01b031685876040516118329190611d9f565b60006040518083038185875af1925050503d806000811461186f576040519150601f19603f3d011682016040523d82523d6000602084013e611874565b606091505b509150915061188587838387611890565b979650505050505050565b606083156118ff5782516000036118f8576001600160a01b0385163b6118f85760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e747261637400000060448201526064016106c4565b50816112c5565b6112c583838151156119145781518083602001fd5b8060405162461bcd60e51b81526004016106c49190611dbb565b60006020828403121561194057600080fd5b81356001600160e01b0319811681146104ac57600080fd5b6001600160a01b03811681146110cb57600080fd5b60008060006060848603121561198257600080fd5b833561198d81611958565b95602085013595506040909401359392505050565b6000602082840312156119b457600080fd5b81356104ac81611958565b600080600080608085870312156119d557600080fd5b84356119e081611958565b966020860135965060408601359560600135945092505050565b600060208284031215611a0c57600080fd5b5035919050565b60008060008060808587031215611a2957600080fd5b8435611a3481611958565b93506020850135611a4481611958565b93969395505050506040820135916060013590565b600060208284031215611a6b57600080fd5b81516104ac81611958565b600060208284031215611a8857600080fd5b815160ff811681146104ac57600080fd5b634e487b7160e01b600052601160045260246000fd5b818103818111156102f8576102f8611a99565b600060208284031215611ad457600080fd5b5051919050565b80820281158282048414176102f8576102f8611a99565b634e487b7160e01b600052604160045260246000fd5b8051611b1381611958565b919050565b60006020808385031215611b2b57600080fd5b825167ffffffffffffffff80821115611b4357600080fd5b818501915085601f830112611b5757600080fd5b815181811115611b6957611b69611af2565b8060051b604051601f19603f83011681018181108582111715611b8e57611b8e611af2565b604052918252848201925083810185019188831115611bac57600080fd5b938501935b82851015611bd157611bc285611b08565b84529385019392850192611bb1565b98975050505050505050565b634e487b7160e01b600052603260045260246000fd5b600060208284031215611c0557600080fd5b815180151581146104ac57600080fd5b600060018201611c2757611c27611a99565b5060010190565b600181815b80851115611c69578160001904821115611c4f57611c4f611a99565b80851615611c5c57918102915b93841c9390800290611c33565b509250929050565b600082611c80575060016102f8565b81611c8d575060006102f8565b8160018114611ca35760028114611cad57611cc9565b60019150506102f8565b60ff841115611cbe57611cbe611a99565b50506001821b6102f8565b5060208310610133831016604e8410600b8410161715611cec575081810a6102f8565b611cf68383611c2e565b8060001904821115611d0a57611d0a611a99565b029392505050565b60006104ac8383611c71565b600082611d3b57634e487b7160e01b600052601260045260246000fd5b500490565b60ff82811682821603908111156102f8576102f8611a99565b60006104ac60ff841683611c71565b808201808211156102f8576102f8611a99565b60005b83811015611d96578181015183820152602001611d7e565b50506000910152565b60008251611db1818460208701611d7b565b9190910192915050565b6020815260008251806020840152611dda816040850160208701611d7b565b601f01601f1916919091016040019291505056fea264697066735822122005cd43accdafed0ea6731c47d3834edce2cd2a85819aedb0b059bcaf6240122f64736f6c63430008110033000000000000000000000000013a3da6591d3427f164862793ab4e388f9b587e0000000000000000000000009ae380f0272e2162340a5bb646c354271c0f5cfc0000000000000000000000004d080be793fb7934a920cbdd95010b893aeda545
Deployed Bytecode
0x608060405234801561001057600080fd5b506004361061010b5760003560e01c8063715018a6116100a2578063d7cfbdf311610071578063d7cfbdf314610241578063f0aa0a1d1461024a578063f2fde38b14610271578063f77c479114610284578063f95878f5146102ab57600080fd5b8063715018a61461020d5780638129fc1c146102155780638da5cb5b1461021d5780638f3c14cb1461022e57600080fd5b80633d5d2cb2116100de5780633d5d2cb2146101965780635e2f23ce1461019f578063603293f1146101de57806370e9749a1461020557600080fd5b806301ffc9a71461011057806303de1eb014610138578063182ba0bf146101595780632332d74b1461016e575b600080fd5b61012361011e36600461192e565b6102be565b60405190151581526020015b60405180910390f35b61014b61014636600461196d565b6102fe565b60405190815260200161012f565b61016c6101673660046119a2565b6104b3565b005b61018161017c3660046119bf565b6107d2565b6040805192835260208301919091520161012f565b61014b60045481565b6101c67f000000000000000000000000000000000000000000000000000000000000000081565b6040516001600160a01b03909116815260200161012f565b6101c67f0000000000000000000000004d080be793fb7934a920cbdd95010b893aeda54581565b61016c610e1d565b61016c610f23565b61016c610f37565b6000546001600160a01b03166101c6565b61016c61023c3660046119fa565b6110ce565b61014b60035481565b6101c67f0000000000000000000000009ae380f0272e2162340a5bb646c354271c0f5cfc81565b61016c61027f3660046119a2565b61110b565b6101c67f000000000000000000000000013a3da6591d3427f164862793ab4e388f9b587e81565b61016c6102b9366004611a13565b611181565b60006301ffc9a760e01b6001600160e01b0319831614806102f857506001600160e01b0319821660009081526001602052604090205460ff165b92915050565b600081831015610310575060006104ac565b6000846001600160a01b0316636f307dc36040518163ffffffff1660e01b8152600401602060405180830381865afa158015610350573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906103749190611a59565b6001600160a01b031663313ce5676040518163ffffffff1660e01b8152600401602060405180830381865afa1580156103b1573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906103d59190611a76565b905060006103e38486611aaf565b604051630850219760e01b81526001600160a01b0388811660048301529192506000917f000000000000000000000000013a3da6591d3427f164862793ab4e388f9b587e1690630850219790602401602060405180830381865afa15801561044f573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906104739190611ac2565b905060006104818242611aaf565b90506104a561049284866012611284565b60045461049f9084611adb565b906112cd565b9450505050505b9392505050565b6104bb6112ef565b60007f000000000000000000000000013a3da6591d3427f164862793ab4e388f9b587e6001600160a01b031663687958626040518163ffffffff1660e01b8152600401600060405180830381865afa15801561051b573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f191682016040526105439190810190611b18565b905060005b81518110156106df577f000000000000000000000000013a3da6591d3427f164862793ab4e388f9b587e6001600160a01b031663dbcd89fa6040518163ffffffff1660e01b8152600401602060405180830381865afa1580156105af573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906105d39190611a59565b6001600160a01b031663b46507a18383815181106105f3576105f3611bdd565b60209081029190910101516040516001600160e01b031960e084901b1681526001600160a01b039091166004820152306024820152604401602060405180830381865afa158015610648573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061066c9190611bf3565b156106cd5760405162461bcd60e51b815260206004820152602660248201527f68616e646c6572206973207374696c6c207265676973746572656420666f722060448201526518481c1bdbdb60d21b60648201526084015b60405180910390fd5b806106d781611c15565b915050610548565b50604051634c1d96ab60e11b81526001600160a01b0383811660048301527f0000000000000000000000009ae380f0272e2162340a5bb646c354271c0f5cfc169063983b2d5690602401600060405180830381600087803b15801561074357600080fd5b505af1158015610757573d6000803e3d6000fd5b505050507f0000000000000000000000009ae380f0272e2162340a5bb646c354271c0f5cfc6001600160a01b03166370e9749a6040518163ffffffff1660e01b8152600401600060405180830381600087803b1580156107b657600080fd5b505af11580156107ca573d6000803e3d6000fd5b505050505050565b604051635b16ebb760e01b81526001600160a01b03858116600483015260009182917f000000000000000000000000013a3da6591d3427f164862793ab4e388f9b587e1690635b16ebb790602401602060405180830381865afa15801561083d573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906108619190611bf3565b61089a5760405162461bcd60e51b815260206004820152600a6024820152691b9bdd0818481c1bdbdb60b21b60448201526064016106c4565b60008690506000816001600160a01b0316639e4865626040518163ffffffff1660e01b8152600401602060405180830381865afa1580156108df573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906109039190611bf3565b90506000826001600160a01b0316636f307dc36040518163ffffffff1660e01b8152600401602060405180830381865afa158015610945573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906109699190611a59565b6040516370a0823160e01b815233600482015290915088906001600160a01b038316906370a0823190602401602060405180830381865afa1580156109b2573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906109d69190611ac2565b1015610a245760405162461bcd60e51b815260206004820152601760248201527f696e73756666696369656e7420756e6465726c79696e6700000000000000000060448201526064016106c4565b6000836001600160a01b03166383645abf6040518163ffffffff1660e01b8152600401602060405180830381865afa158015610a64573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610a889190611ac2565b9050610a9f6001600160a01b03831633308c611349565b610ab36001600160a01b0383168b8b6113b4565b6005805460ff191660011790556040516321d0683360e11b8152600481018a905260006024820181905260448201819052906001600160a01b038616906343a0d066906064016020604051808303816000875af1158015610b18573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610b3c9190611ac2565b6005805460ff19169055604051630441a3e760e41b815260048101829052600060248201529091506001600160a01b0386169063441a3e70906044016020604051808303816000875af1158015610b97573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610bbb9190611ac2565b965088871015610c0d5760405162461bcd60e51b815260206004820181905260248201527f696e73756666696369656e7420756e6465726c79696e6720726563656976656460448201526064016106c4565b6040516370a0823160e01b81523360048201526000907f0000000000000000000000009ae380f0272e2162340a5bb646c354271c0f5cfc6001600160a01b0316906370a0823190602401602060405180830381865afa158015610c74573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610c989190611ac2565b90508415610d14576000866001600160a01b03166383645abf6040518163ffffffff1660e01b8152600401602060405180830381865afa158015610ce0573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610d049190611ac2565b9050610d12873386846114ce565b505b6040516370a0823160e01b815233600482015281907f0000000000000000000000009ae380f0272e2162340a5bb646c354271c0f5cfc6001600160a01b0316906370a0823190602401602060405180830381865afa158015610d7a573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610d9e9190611ac2565b610da89190611aaf565b965088871015610dfa5760405162461bcd60e51b815260206004820152601960248201527f696e73756666696369656e7420434e432072656365697665640000000000000060448201526064016106c4565b610e0e6001600160a01b038516338a6114f9565b50505050505094509492505050565b336001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001614610eae5760405162461bcd60e51b815260206004820152603060248201527f6f6e6c7920656d657267656e6379206d696e7465722063616e2072656e6f756e60448201526f6365206d696e7465722072696768747360801b60648201526084016106c4565b7f0000000000000000000000009ae380f0272e2162340a5bb646c354271c0f5cfc6001600160a01b03166370e9749a6040518163ffffffff1660e01b8152600401600060405180830381600087803b158015610f0957600080fd5b505af1158015610f1d573d6000803e3d6000fd5b50505050565b610f2b6112ef565b610f356000611529565b565b610f3f6112ef565b600254610100900460ff1615808015610f5f5750600254600160ff909116105b80610f795750303b158015610f79575060025460ff166001145b610fdc5760405162461bcd60e51b815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201526d191e481a5b9a5d1a585b1a5e995960921b60648201526084016106c4565b6002805460ff191660011790558015610fff576002805461ff0019166101001790555b7f0000000000000000000000004d080be793fb7934a920cbdd95010b893aeda5456001600160a01b031663d7cfbdf36040518163ffffffff1660e01b8152600401602060405180830381865afa15801561105d573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906110819190611ac2565b60035580156110cb576002805461ff0019169055604051600181527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb3847402498906020015b60405180910390a15b50565b6110d66112ef565b60048190556040518181527f52e5ea693f3343bef45800ecec3dd0c08e360e7c6e3a589a8fa2e4ee226c8a12906020016110c2565b6111136112ef565b6001600160a01b0381166111785760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b60648201526084016106c4565b6110cb81611529565b7f000000000000000000000000013a3da6591d3427f164862793ab4e388f9b587e6001600160a01b031663dbcd89fa6040518163ffffffff1660e01b8152600401602060405180830381865afa1580156111df573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906112039190611a59565b6001600160a01b0316336001600160a01b0316146112785760405162461bcd60e51b815260206004820152602c60248201527f6f6e6c7920496e666c6174696f6e4d616e616765722063616e2063616c6c207460448201526b3434b990333ab731ba34b7b760a11b60648201526084016106c4565b610f1d848484846114ce565b60008160ff168360ff160361129a5750826104ac565b8160ff168360ff1611156112ba576112b3848484611579565b90506104ac565b6112c584848461159a565b949350505050565b60006112db6012600a611d12565b6112e58385611adb565b6104ac9190611d1e565b6000546001600160a01b03163314610f355760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657260448201526064016106c4565b6040516001600160a01b0380851660248301528316604482015260648101829052610f1d9085906323b872dd60e01b906084015b60408051601f198184030181529190526020810180516001600160e01b03166001600160e01b0319909316929092179091526115bb565b80158061142e5750604051636eb1769f60e11b81523060048201526001600160a01b03838116602483015284169063dd62ed3e90604401602060405180830381865afa158015611408573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061142c9190611ac2565b155b6114995760405162461bcd60e51b815260206004820152603660248201527f5361666545524332303a20617070726f76652066726f6d206e6f6e2d7a65726f60448201527520746f206e6f6e2d7a65726f20616c6c6f77616e636560501b60648201526084016106c4565b6040516001600160a01b0383166024820152604481018290526114c990849063095ea7b360e01b9060640161137d565b505050565b60055460ff16610f1d5760006114e58584846102fe565b90506114f285858361168d565b5050505050565b6040516001600160a01b0383166024820152604481018290526114c990849063a9059cbb60e01b9060640161137d565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b60006115858284611d40565b61159090600a611d59565b6112c59085611d1e565b60006115a68383611d40565b6115b190600a611d59565b6112c59085611adb565b6000611610826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b031661180b9092919063ffffffff16565b8051909150156114c9578080602001905181019061162e9190611bf3565b6114c95760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b60648201526084016106c4565b6a01925734d5b8904b800000816003546116a79190611d68565b11156116c8576003546116c5906a01925734d5b8904b800000611aaf565b90505b806000036116d557505050565b6040516340c10f1960e01b81526001600160a01b038381166004830152602482018390526000917f0000000000000000000000009ae380f0272e2162340a5bb646c354271c0f5cfc909116906340c10f19906044016020604051808303816000875af1158015611749573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061176d9190611ac2565b90508015610f1d5780600360008282546117879190611d68565b925050819055507f0000000000000000000000009ae380f0272e2162340a5bb646c354271c0f5cfc6001600160a01b0316836001600160a01b0316856001600160a01b03167fc84ef7d7e740eeb018c01c28c59b82def5d19d93fb1c641a70e27665e16f282d846040516117fd91815260200190565b60405180910390a450505050565b60606112c5848460008585600080866001600160a01b031685876040516118329190611d9f565b60006040518083038185875af1925050503d806000811461186f576040519150601f19603f3d011682016040523d82523d6000602084013e611874565b606091505b509150915061188587838387611890565b979650505050505050565b606083156118ff5782516000036118f8576001600160a01b0385163b6118f85760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e747261637400000060448201526064016106c4565b50816112c5565b6112c583838151156119145781518083602001fd5b8060405162461bcd60e51b81526004016106c49190611dbb565b60006020828403121561194057600080fd5b81356001600160e01b0319811681146104ac57600080fd5b6001600160a01b03811681146110cb57600080fd5b60008060006060848603121561198257600080fd5b833561198d81611958565b95602085013595506040909401359392505050565b6000602082840312156119b457600080fd5b81356104ac81611958565b600080600080608085870312156119d557600080fd5b84356119e081611958565b966020860135965060408601359560600135945092505050565b600060208284031215611a0c57600080fd5b5035919050565b60008060008060808587031215611a2957600080fd5b8435611a3481611958565b93506020850135611a4481611958565b93969395505050506040820135916060013590565b600060208284031215611a6b57600080fd5b81516104ac81611958565b600060208284031215611a8857600080fd5b815160ff811681146104ac57600080fd5b634e487b7160e01b600052601160045260246000fd5b818103818111156102f8576102f8611a99565b600060208284031215611ad457600080fd5b5051919050565b80820281158282048414176102f8576102f8611a99565b634e487b7160e01b600052604160045260246000fd5b8051611b1381611958565b919050565b60006020808385031215611b2b57600080fd5b825167ffffffffffffffff80821115611b4357600080fd5b818501915085601f830112611b5757600080fd5b815181811115611b6957611b69611af2565b8060051b604051601f19603f83011681018181108582111715611b8e57611b8e611af2565b604052918252848201925083810185019188831115611bac57600080fd5b938501935b82851015611bd157611bc285611b08565b84529385019392850192611bb1565b98975050505050505050565b634e487b7160e01b600052603260045260246000fd5b600060208284031215611c0557600080fd5b815180151581146104ac57600080fd5b600060018201611c2757611c27611a99565b5060010190565b600181815b80851115611c69578160001904821115611c4f57611c4f611a99565b80851615611c5c57918102915b93841c9390800290611c33565b509250929050565b600082611c80575060016102f8565b81611c8d575060006102f8565b8160018114611ca35760028114611cad57611cc9565b60019150506102f8565b60ff841115611cbe57611cbe611a99565b50506001821b6102f8565b5060208310610133831016604e8410600b8410161715611cec575081810a6102f8565b611cf68383611c2e565b8060001904821115611d0a57611d0a611a99565b029392505050565b60006104ac8383611c71565b600082611d3b57634e487b7160e01b600052601260045260246000fd5b500490565b60ff82811682821603908111156102f8576102f8611a99565b60006104ac60ff841683611c71565b808201808211156102f8576102f8611a99565b60005b83811015611d96578181015183820152602001611d7e565b50506000910152565b60008251611db1818460208701611d7b565b9190910192915050565b6020815260008251806020840152611dda816040850160208701611d7b565b601f01601f1916919091016040019291505056fea264697066735822122005cd43accdafed0ea6731c47d3834edce2cd2a85819aedb0b059bcaf6240122f64736f6c63430008110033
Constructor Arguments (ABI-Encoded and is the last bytes of the Contract Creation Code above)
000000000000000000000000013a3da6591d3427f164862793ab4e388f9b587e0000000000000000000000009ae380f0272e2162340a5bb646c354271c0f5cfc0000000000000000000000004d080be793fb7934a920cbdd95010b893aeda545
-----Decoded View---------------
Arg [0] : _controller (address): 0x013A3Da6591d3427F164862793ab4e388F9B587e
Arg [1] : _cnc (address): 0x9aE380F0272E2162340a5bB646c354271c0F5cFC
Arg [2] : _previousRewardsHandler (address): 0x4D080be793fb7934a920cbDd95010b893AEda545
-----Encoded View---------------
3 Constructor Arguments found :
Arg [0] : 000000000000000000000000013a3da6591d3427f164862793ab4e388f9b587e
Arg [1] : 0000000000000000000000009ae380f0272e2162340a5bb646c354271c0f5cfc
Arg [2] : 0000000000000000000000004d080be793fb7934a920cbdd95010b893aeda545
Loading...
Loading
Loading...
Loading
Multichain Portfolio | 26 Chains
Chain | Token | Portfolio % | Price | Amount | Value |
---|
Loading...
Loading
[ Download: CSV Export ]
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.