Source Code
Overview
ETH Balance
0 ETH
ETH Value
$0.00Multichain Info
N/A
Transaction Hash |
Method
|
Block
|
From
|
To
|
|||||
---|---|---|---|---|---|---|---|---|---|
Latest 1 internal transaction
Advanced mode:
Parent Transaction Hash | Block | From | To | |||
---|---|---|---|---|---|---|
2237076 | 127 days ago | Contract Creation | 0 ETH |
Loading...
Loading
Contract Name:
RoleManager
Compiler Version
v0.8.18+commit.87f61d96
Contract Source Code (Solidity)
/** *Submitted for verification at KatanaScan.com on 2025-08-01 */ // SPDX-License-Identifier: AGPL-3.0 pragma solidity >=0.8.18 ^0.8.0 ^0.8.1 ^0.8.18; // lib/openzeppelin-contracts/contracts/token/ERC20/IERC20.sol // OpenZeppelin Contracts (last updated v4.9.0) (token/ERC20/IERC20.sol) /** * @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); } // lib/openzeppelin-contracts/contracts/token/ERC20/extensions/IERC20Permit.sol // OpenZeppelin Contracts (last updated v4.9.4) (token/ERC20/extensions/IERC20Permit.sol) /** * @dev Interface of the ERC20 Permit extension allowing approvals to be made via signatures, as defined in * https://eips.ethereum.org/EIPS/eip-2612[EIP-2612]. * * Adds the {permit} method, which can be used to change an account's ERC20 allowance (see {IERC20-allowance}) by * presenting a message signed by the account. By not relying on {IERC20-approve}, the token holder account doesn't * need to send a transaction, and thus is not required to hold Ether at all. * * ==== Security Considerations * * There are two important considerations concerning the use of `permit`. The first is that a valid permit signature * expresses an allowance, and it should not be assumed to convey additional meaning. In particular, it should not be * considered as an intention to spend the allowance in any specific way. The second is that because permits have * built-in replay protection and can be submitted by anyone, they can be frontrun. A protocol that uses permits should * take this into consideration and allow a `permit` call to fail. Combining these two aspects, a pattern that may be * generally recommended is: * * ```solidity * function doThingWithPermit(..., uint256 value, uint256 deadline, uint8 v, bytes32 r, bytes32 s) public { * try token.permit(msg.sender, address(this), value, deadline, v, r, s) {} catch {} * doThing(..., value); * } * * function doThing(..., uint256 value) public { * token.safeTransferFrom(msg.sender, address(this), value); * ... * } * ``` * * Observe that: 1) `msg.sender` is used as the owner, leaving no ambiguity as to the signer intent, and 2) the use of * `try/catch` allows the permit to fail and makes the code tolerant to frontrunning. (See also * {SafeERC20-safeTransferFrom}). * * Additionally, note that smart contract wallets (such as Argent or Safe) are not able to produce permit signatures, so * contracts should have entry points that don't rely on permit. */ interface IERC20Permit { /** * @dev Sets `value` as the allowance of `spender` over ``owner``'s tokens, * given ``owner``'s signed approval. * * IMPORTANT: The same issues {IERC20-approve} has related to transaction * ordering also apply here. * * Emits an {Approval} event. * * Requirements: * * - `spender` cannot be the zero address. * - `deadline` must be a timestamp in the future. * - `v`, `r` and `s` must be a valid `secp256k1` signature from `owner` * over the EIP712-formatted function arguments. * - the signature must use ``owner``'s current nonce (see {nonces}). * * For more information on the signature format, see the * https://eips.ethereum.org/EIPS/eip-2612#specification[relevant EIP * section]. * * CAUTION: See Security Considerations above. */ function permit( address owner, address spender, uint256 value, uint256 deadline, uint8 v, bytes32 r, bytes32 s ) external; /** * @dev Returns the current nonce for `owner`. This value must be * included whenever a signature is generated for {permit}. * * Every successful call to {permit} increases ``owner``'s nonce by one. This * prevents a signature from being used multiple times. */ function nonces(address owner) external view returns (uint256); /** * @dev Returns the domain separator used in the encoding of the signature for {permit}, as defined by {EIP712}. */ // solhint-disable-next-line func-name-mixedcase function DOMAIN_SEPARATOR() external view returns (bytes32); } // lib/openzeppelin-contracts/contracts/utils/Address.sol // OpenZeppelin Contracts (last updated v4.9.0) (utils/Address.sol) /** * @dev Collection of functions related to the address type */ library Address { /** * @dev Returns true if `account` is a contract. * * [IMPORTANT] * ==== * It is unsafe to assume that an address for which this function returns * false is an externally-owned account (EOA) and not a contract. * * Among others, `isContract` will return false for the following * types of addresses: * * - an externally-owned account * - a contract in construction * - an address where a contract will be created * - an address where a contract lived, but was destroyed * * Furthermore, `isContract` will also return true if the target contract within * the same transaction is already scheduled for destruction by `SELFDESTRUCT`, * which only has an effect at the end of a transaction. * ==== * * [IMPORTANT] * ==== * You shouldn't rely on `isContract` to protect against flash loan attacks! * * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract * constructor. * ==== */ function isContract(address account) internal view returns (bool) { // This method relies on extcodesize/address.code.length, which returns 0 // for contracts in construction, since the code is only stored at the end // of the constructor execution. return account.code.length > 0; } /** * @dev Replacement for Solidity's `transfer`: sends `amount` wei to * `recipient`, forwarding all available gas and reverting on errors. * * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost * of certain opcodes, possibly making contracts go over the 2300 gas limit * imposed by `transfer`, making them unable to receive funds via * `transfer`. {sendValue} removes this limitation. * * https://consensys.net/diligence/blog/2019/09/stop-using-soliditys-transfer-now/[Learn more]. * * IMPORTANT: because control is transferred to `recipient`, care must be * taken to not create reentrancy vulnerabilities. Consider using * {ReentrancyGuard} or the * https://solidity.readthedocs.io/en/v0.8.0/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern]. */ function sendValue(address payable recipient, uint256 amount) internal { require(address(this).balance >= amount, "Address: insufficient balance"); (bool success, ) = recipient.call{value: amount}(""); require(success, "Address: unable to send value, recipient may have reverted"); } /** * @dev Performs a Solidity function call using a low level `call`. A * plain `call` is an unsafe replacement for a function call: use this * function instead. * * If `target` reverts with a revert reason, it is bubbled up by this * function (like regular Solidity function calls). * * Returns the raw returned data. To convert to the expected return value, * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`]. * * Requirements: * * - `target` must be a contract. * - calling `target` with `data` must not revert. * * _Available since v3.1._ */ function functionCall(address target, bytes memory data) internal returns (bytes memory) { return functionCallWithValue(target, data, 0, "Address: low-level call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with * `errorMessage` as a fallback revert reason when `target` reverts. * * _Available since v3.1._ */ function functionCall( address target, bytes memory data, string memory errorMessage ) internal returns (bytes memory) { return functionCallWithValue(target, data, 0, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but also transferring `value` wei to `target`. * * Requirements: * * - the calling contract must have an ETH balance of at least `value`. * - the called Solidity function must be `payable`. * * _Available since v3.1._ */ function functionCallWithValue(address target, bytes memory data, uint256 value) internal returns (bytes memory) { return functionCallWithValue(target, data, value, "Address: low-level call with value failed"); } /** * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but * with `errorMessage` as a fallback revert reason when `target` reverts. * * _Available since v3.1._ */ function functionCallWithValue( address target, bytes memory data, uint256 value, string memory errorMessage ) internal returns (bytes memory) { require(address(this).balance >= value, "Address: insufficient balance for call"); (bool success, bytes memory returndata) = target.call{value: value}(data); return verifyCallResultFromTarget(target, success, returndata, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but performing a static call. * * _Available since v3.3._ */ function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) { return functionStaticCall(target, data, "Address: low-level static call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`], * but performing a static call. * * _Available since v3.3._ */ function functionStaticCall( address target, bytes memory data, string memory errorMessage ) internal view returns (bytes memory) { (bool success, bytes memory returndata) = target.staticcall(data); return verifyCallResultFromTarget(target, success, returndata, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but performing a delegate call. * * _Available since v3.4._ */ function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) { return functionDelegateCall(target, data, "Address: low-level delegate call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`], * but performing a delegate call. * * _Available since v3.4._ */ function functionDelegateCall( address target, bytes memory data, string memory errorMessage ) internal returns (bytes memory) { (bool success, bytes memory returndata) = target.delegatecall(data); return verifyCallResultFromTarget(target, success, returndata, errorMessage); } /** * @dev Tool to verify that a low level call to smart-contract was successful, and revert (either by bubbling * the revert reason or using the provided one) in case of unsuccessful call or if target was not a contract. * * _Available since v4.8._ */ function verifyCallResultFromTarget( address target, bool success, bytes memory returndata, string memory errorMessage ) internal view returns (bytes memory) { if (success) { if (returndata.length == 0) { // only check isContract if the call was successful and the return data is empty // otherwise we already know that it was a contract require(isContract(target), "Address: call to non-contract"); } return returndata; } else { _revert(returndata, errorMessage); } } /** * @dev Tool to verify that a low level call was successful, and revert if it wasn't, either by bubbling the * revert reason or using the provided one. * * _Available since v4.3._ */ function verifyCallResult( bool success, bytes memory returndata, string memory errorMessage ) internal pure returns (bytes memory) { if (success) { return returndata; } else { _revert(returndata, errorMessage); } } function _revert(bytes memory returndata, string memory errorMessage) private pure { // Look for revert reason and bubble it up if present if (returndata.length > 0) { // The easiest way to bubble the revert reason is using memory via assembly /// @solidity memory-safe-assembly assembly { let returndata_size := mload(returndata) revert(add(32, returndata), returndata_size) } } else { revert(errorMessage); } } } // lib/openzeppelin-contracts/contracts/utils/Context.sol // OpenZeppelin Contracts (last updated v4.9.4) (utils/Context.sol) /** * @dev Provides information about the current execution context, including the * sender of the transaction and its data. While these are generally available * via msg.sender and msg.data, they should not be accessed in such a direct * manner, since when dealing with meta-transactions the account sending and * paying for execution may not be the actual sender (as far as an application * is concerned). * * This contract is only required for intermediate, library-like contracts. */ abstract contract Context { function _msgSender() internal view virtual returns (address) { return msg.sender; } function _msgData() internal view virtual returns (bytes calldata) { return msg.data; } function _contextSuffixLength() internal view virtual returns (uint256) { return 0; } } // lib/openzeppelin-contracts/contracts/utils/math/Math.sol // OpenZeppelin Contracts (last updated v4.9.0) (utils/math/Math.sol) /** * @dev Standard math utilities missing in the Solidity language. */ library Math { enum Rounding { Down, // Toward negative infinity Up, // Toward infinity Zero // Toward zero } /** * @dev Returns the largest of two numbers. */ function max(uint256 a, uint256 b) internal pure returns (uint256) { return a > b ? a : b; } /** * @dev Returns the smallest of two numbers. */ function min(uint256 a, uint256 b) internal pure returns (uint256) { return a < b ? a : b; } /** * @dev Returns the average of two numbers. The result is rounded towards * zero. */ function average(uint256 a, uint256 b) internal pure returns (uint256) { // (a + b) / 2 can overflow. return (a & b) + (a ^ b) / 2; } /** * @dev Returns the ceiling of the division of two numbers. * * This differs from standard division with `/` in that it rounds up instead * of rounding down. */ function ceilDiv(uint256 a, uint256 b) internal pure returns (uint256) { // (a + b - 1) / b can overflow on addition, so we distribute. return a == 0 ? 0 : (a - 1) / b + 1; } /** * @notice Calculates floor(x * y / denominator) with full precision. Throws if result overflows a uint256 or denominator == 0 * @dev Original credit to Remco Bloemen under MIT license (https://xn--2-umb.com/21/muldiv) * with further edits by Uniswap Labs also under MIT license. */ function mulDiv(uint256 x, uint256 y, uint256 denominator) internal pure returns (uint256 result) { unchecked { // 512-bit multiply [prod1 prod0] = x * y. Compute the product mod 2^256 and mod 2^256 - 1, then use // use the Chinese Remainder Theorem to reconstruct the 512 bit result. The result is stored in two 256 // variables such that product = prod1 * 2^256 + prod0. uint256 prod0; // Least significant 256 bits of the product uint256 prod1; // Most significant 256 bits of the product assembly { let mm := mulmod(x, y, not(0)) prod0 := mul(x, y) prod1 := sub(sub(mm, prod0), lt(mm, prod0)) } // Handle non-overflow cases, 256 by 256 division. if (prod1 == 0) { // Solidity will revert if denominator == 0, unlike the div opcode on its own. // The surrounding unchecked block does not change this fact. // See https://docs.soliditylang.org/en/latest/control-structures.html#checked-or-unchecked-arithmetic. return prod0 / denominator; } // Make sure the result is less than 2^256. Also prevents denominator == 0. require(denominator > prod1, "Math: mulDiv overflow"); /////////////////////////////////////////////// // 512 by 256 division. /////////////////////////////////////////////// // Make division exact by subtracting the remainder from [prod1 prod0]. uint256 remainder; assembly { // Compute remainder using mulmod. remainder := mulmod(x, y, denominator) // Subtract 256 bit number from 512 bit number. prod1 := sub(prod1, gt(remainder, prod0)) prod0 := sub(prod0, remainder) } // Factor powers of two out of denominator and compute largest power of two divisor of denominator. Always >= 1. // See https://cs.stackexchange.com/q/138556/92363. // Does not overflow because the denominator cannot be zero at this stage in the function. uint256 twos = denominator & (~denominator + 1); assembly { // Divide denominator by twos. denominator := div(denominator, twos) // Divide [prod1 prod0] by twos. prod0 := div(prod0, twos) // Flip twos such that it is 2^256 / twos. If twos is zero, then it becomes one. twos := add(div(sub(0, twos), twos), 1) } // Shift in bits from prod1 into prod0. prod0 |= prod1 * twos; // Invert denominator mod 2^256. Now that denominator is an odd number, it has an inverse modulo 2^256 such // that denominator * inv = 1 mod 2^256. Compute the inverse by starting with a seed that is correct for // four bits. That is, denominator * inv = 1 mod 2^4. uint256 inverse = (3 * denominator) ^ 2; // Use the Newton-Raphson iteration to improve the precision. Thanks to Hensel's lifting lemma, this also works // in modular arithmetic, doubling the correct bits in each step. inverse *= 2 - denominator * inverse; // inverse mod 2^8 inverse *= 2 - denominator * inverse; // inverse mod 2^16 inverse *= 2 - denominator * inverse; // inverse mod 2^32 inverse *= 2 - denominator * inverse; // inverse mod 2^64 inverse *= 2 - denominator * inverse; // inverse mod 2^128 inverse *= 2 - denominator * inverse; // inverse mod 2^256 // Because the division is now exact we can divide by multiplying with the modular inverse of denominator. // This will give us the correct result modulo 2^256. Since the preconditions guarantee that the outcome is // less than 2^256, this is the final result. We don't need to compute the high bits of the result and prod1 // is no longer required. result = prod0 * inverse; return result; } } /** * @notice Calculates x * y / denominator with full precision, following the selected rounding direction. */ function mulDiv(uint256 x, uint256 y, uint256 denominator, Rounding rounding) internal pure returns (uint256) { uint256 result = mulDiv(x, y, denominator); if (rounding == Rounding.Up && mulmod(x, y, denominator) > 0) { result += 1; } return result; } /** * @dev Returns the square root of a number. If the number is not a perfect square, the value is rounded down. * * Inspired by Henry S. Warren, Jr.'s "Hacker's Delight" (Chapter 11). */ function sqrt(uint256 a) internal pure returns (uint256) { if (a == 0) { return 0; } // For our first guess, we get the biggest power of 2 which is smaller than the square root of the target. // // We know that the "msb" (most significant bit) of our target number `a` is a power of 2 such that we have // `msb(a) <= a < 2*msb(a)`. This value can be written `msb(a)=2**k` with `k=log2(a)`. // // This can be rewritten `2**log2(a) <= a < 2**(log2(a) + 1)` // → `sqrt(2**k) <= sqrt(a) < sqrt(2**(k+1))` // → `2**(k/2) <= sqrt(a) < 2**((k+1)/2) <= 2**(k/2 + 1)` // // Consequently, `2**(log2(a) / 2)` is a good first approximation of `sqrt(a)` with at least 1 correct bit. uint256 result = 1 << (log2(a) >> 1); // At this point `result` is an estimation with one bit of precision. We know the true value is a uint128, // since it is the square root of a uint256. Newton's method converges quadratically (precision doubles at // every iteration). We thus need at most 7 iteration to turn our partial result with one bit of precision // into the expected uint128 result. unchecked { result = (result + a / result) >> 1; result = (result + a / result) >> 1; result = (result + a / result) >> 1; result = (result + a / result) >> 1; result = (result + a / result) >> 1; result = (result + a / result) >> 1; result = (result + a / result) >> 1; return min(result, a / result); } } /** * @notice Calculates sqrt(a), following the selected rounding direction. */ function sqrt(uint256 a, Rounding rounding) internal pure returns (uint256) { unchecked { uint256 result = sqrt(a); return result + (rounding == Rounding.Up && result * result < a ? 1 : 0); } } /** * @dev Return the log in base 2, rounded down, of a positive value. * Returns 0 if given 0. */ function log2(uint256 value) internal pure returns (uint256) { uint256 result = 0; unchecked { if (value >> 128 > 0) { value >>= 128; result += 128; } if (value >> 64 > 0) { value >>= 64; result += 64; } if (value >> 32 > 0) { value >>= 32; result += 32; } if (value >> 16 > 0) { value >>= 16; result += 16; } if (value >> 8 > 0) { value >>= 8; result += 8; } if (value >> 4 > 0) { value >>= 4; result += 4; } if (value >> 2 > 0) { value >>= 2; result += 2; } if (value >> 1 > 0) { result += 1; } } return result; } /** * @dev Return the log in base 2, following the selected rounding direction, of a positive value. * Returns 0 if given 0. */ function log2(uint256 value, Rounding rounding) internal pure returns (uint256) { unchecked { uint256 result = log2(value); return result + (rounding == Rounding.Up && 1 << result < value ? 1 : 0); } } /** * @dev Return the log in base 10, rounded down, of a positive value. * Returns 0 if given 0. */ function log10(uint256 value) internal pure returns (uint256) { uint256 result = 0; unchecked { if (value >= 10 ** 64) { value /= 10 ** 64; result += 64; } if (value >= 10 ** 32) { value /= 10 ** 32; result += 32; } if (value >= 10 ** 16) { value /= 10 ** 16; result += 16; } if (value >= 10 ** 8) { value /= 10 ** 8; result += 8; } if (value >= 10 ** 4) { value /= 10 ** 4; result += 4; } if (value >= 10 ** 2) { value /= 10 ** 2; result += 2; } if (value >= 10 ** 1) { result += 1; } } return result; } /** * @dev Return the log in base 10, following the selected rounding direction, of a positive value. * Returns 0 if given 0. */ function log10(uint256 value, Rounding rounding) internal pure returns (uint256) { unchecked { uint256 result = log10(value); return result + (rounding == Rounding.Up && 10 ** result < value ? 1 : 0); } } /** * @dev Return the log in base 256, rounded down, of a positive value. * Returns 0 if given 0. * * Adding one to the result gives the number of pairs of hex symbols needed to represent `value` as a hex string. */ function log256(uint256 value) internal pure returns (uint256) { uint256 result = 0; unchecked { if (value >> 128 > 0) { value >>= 128; result += 16; } if (value >> 64 > 0) { value >>= 64; result += 8; } if (value >> 32 > 0) { value >>= 32; result += 4; } if (value >> 16 > 0) { value >>= 16; result += 2; } if (value >> 8 > 0) { result += 1; } } return result; } /** * @dev Return the log in base 256, following the selected rounding direction, of a positive value. * Returns 0 if given 0. */ function log256(uint256 value, Rounding rounding) internal pure returns (uint256) { unchecked { uint256 result = log256(value); return result + (rounding == Rounding.Up && 1 << (result << 3) < value ? 1 : 0); } } } // lib/tokenized-strategy-periphery/src/utils/Governance.sol contract Governance { /// @notice Emitted when the governance address is updated. event GovernanceTransferred( address indexed previousGovernance, address indexed newGovernance ); modifier onlyGovernance() { _checkGovernance(); _; } /// @notice Checks if the msg sender is the governance. function _checkGovernance() internal view virtual { require(governance == msg.sender, "!governance"); } /// @notice Address that can set the default base fee and provider address public governance; constructor(address _governance) { governance = _governance; emit GovernanceTransferred(address(0), _governance); } /** * @notice Sets a new address as the governance of the contract. * @dev Throws if the caller is not current governance. * @param _newGovernance The new governance address. */ function transferGovernance( address _newGovernance ) external virtual onlyGovernance { require(_newGovernance != address(0), "ZERO ADDRESS"); address oldGovernance = governance; governance = _newGovernance; emit GovernanceTransferred(oldGovernance, _newGovernance); } } // lib/yearn-vaults-v3/contracts/interfaces/Roles.sol // prettier-ignore library Roles { uint256 internal constant ADD_STRATEGY_MANAGER = 1; uint256 internal constant REVOKE_STRATEGY_MANAGER = 2; uint256 internal constant FORCE_REVOKE_MANAGER = 4; uint256 internal constant ACCOUNTANT_MANAGER = 8; uint256 internal constant QUEUE_MANAGER = 16; uint256 internal constant REPORTING_MANAGER = 32; uint256 internal constant DEBT_MANAGER = 64; uint256 internal constant MAX_DEBT_MANAGER = 128; uint256 internal constant DEPOSIT_LIMIT_MANAGER = 256; uint256 internal constant WITHDRAW_LIMIT_MANAGER = 512; uint256 internal constant MINIMUM_IDLE_MANAGER = 1024; uint256 internal constant PROFIT_UNLOCK_MANAGER = 2048; uint256 internal constant DEBT_PURCHASER = 4096; uint256 internal constant EMERGENCY_MANAGER = 8192; uint256 internal constant ALL = 16383; } // src/managers/Positions.sol contract Positions { /// @notice Emitted when a new address is set for a position. event UpdatePositionHolder( bytes32 indexed position, address indexed newAddress ); /// @notice Emitted when a new set of roles is set for a position event UpdatePositionRoles(bytes32 indexed position, uint256 newRoles); /// @notice Position struct struct Position { address holder; uint96 roles; } /// @notice Only allow position holder to call. modifier onlyPositionHolder(bytes32 _positionId) { _isPositionHolder(_positionId); _; } /// @notice Check if the msg sender is specified position holder. function _isPositionHolder(bytes32 _positionId) internal view virtual { require(msg.sender == getPositionHolder(_positionId), "!allowed"); } /// @notice Mapping of position ID to position information. mapping(bytes32 => Position) internal _positions; /** * @notice Setter function for updating a positions holder. */ function _setPositionHolder( bytes32 _position, address _newHolder ) internal virtual { _positions[_position].holder = _newHolder; emit UpdatePositionHolder(_position, _newHolder); } /** * @notice Setter function for updating a positions roles. */ function _setPositionRoles( bytes32 _position, uint256 _newRoles ) internal virtual { _positions[_position].roles = uint96(_newRoles); emit UpdatePositionRoles(_position, _newRoles); } /** * @notice Get the address and roles given to a specific position. * @param _positionId The position identifier. * @return The address that holds that position. * @return The roles given to the specified position. */ function getPosition( bytes32 _positionId ) public view virtual returns (address, uint256) { Position memory _position = _positions[_positionId]; return (_position.holder, uint256(_position.roles)); } /** * @notice Get the current address assigned to a specific position. * @param _positionId The position identifier. * @return The current address assigned to the specified position. */ function getPositionHolder( bytes32 _positionId ) public view virtual returns (address) { return _positions[_positionId].holder; } /** * @notice Get the current roles given to a specific position ID. * @param _positionId The position identifier. * @return The current roles given to the specified position ID. */ function getPositionRoles( bytes32 _positionId ) public view virtual returns (uint256) { return uint256(_positions[_positionId].roles); } } // lib/openzeppelin-contracts/contracts/token/ERC20/extensions/IERC20Metadata.sol // OpenZeppelin Contracts v4.4.1 (token/ERC20/extensions/IERC20Metadata.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); } // lib/tokenized-strategy-periphery/src/utils/Governance2Step.sol contract Governance2Step is Governance { /// @notice Emitted when the pending governance address is set. event UpdatePendingGovernance(address indexed newPendingGovernance); /// @notice Address that is set to take over governance. address public pendingGovernance; constructor(address _governance) Governance(_governance) {} /** * @notice Sets a new address as the `pendingGovernance` of the contract. * @dev Throws if the caller is not current governance. * @param _newGovernance The new governance address. */ function transferGovernance( address _newGovernance ) external virtual override onlyGovernance { require(_newGovernance != address(0), "ZERO ADDRESS"); pendingGovernance = _newGovernance; emit UpdatePendingGovernance(_newGovernance); } /** * @notice Allows the `pendingGovernance` to accept the role. */ function acceptGovernance() external virtual { require(msg.sender == pendingGovernance, "!pending governance"); emit GovernanceTransferred(governance, msg.sender); governance = msg.sender; pendingGovernance = address(0); } } // lib/openzeppelin-contracts/contracts/interfaces/IERC4626.sol // OpenZeppelin Contracts (last updated v4.9.0) (interfaces/IERC4626.sol) /** * @dev Interface of the ERC4626 "Tokenized Vault Standard", as defined in * https://eips.ethereum.org/EIPS/eip-4626[ERC-4626]. * * _Available since v4.7._ */ interface IERC4626 is IERC20, IERC20Metadata { event Deposit(address indexed sender, address indexed owner, uint256 assets, uint256 shares); event Withdraw( address indexed sender, address indexed receiver, address indexed owner, uint256 assets, uint256 shares ); /** * @dev Returns the address of the underlying token used for the Vault for accounting, depositing, and withdrawing. * * - MUST be an ERC-20 token contract. * - MUST NOT revert. */ function asset() external view returns (address assetTokenAddress); /** * @dev Returns the total amount of the underlying asset that is “managed” by Vault. * * - SHOULD include any compounding that occurs from yield. * - MUST be inclusive of any fees that are charged against assets in the Vault. * - MUST NOT revert. */ function totalAssets() external view returns (uint256 totalManagedAssets); /** * @dev Returns the amount of shares that the Vault would exchange for the amount of assets provided, in an ideal * scenario where all the conditions are met. * * - MUST NOT be inclusive of any fees that are charged against assets in the Vault. * - MUST NOT show any variations depending on the caller. * - MUST NOT reflect slippage or other on-chain conditions, when performing the actual exchange. * - MUST NOT revert. * * NOTE: This calculation MAY NOT reflect the “per-user” price-per-share, and instead should reflect the * “average-user’s” price-per-share, meaning what the average user should expect to see when exchanging to and * from. */ function convertToShares(uint256 assets) external view returns (uint256 shares); /** * @dev Returns the amount of assets that the Vault would exchange for the amount of shares provided, in an ideal * scenario where all the conditions are met. * * - MUST NOT be inclusive of any fees that are charged against assets in the Vault. * - MUST NOT show any variations depending on the caller. * - MUST NOT reflect slippage or other on-chain conditions, when performing the actual exchange. * - MUST NOT revert. * * NOTE: This calculation MAY NOT reflect the “per-user” price-per-share, and instead should reflect the * “average-user’s” price-per-share, meaning what the average user should expect to see when exchanging to and * from. */ function convertToAssets(uint256 shares) external view returns (uint256 assets); /** * @dev Returns the maximum amount of the underlying asset that can be deposited into the Vault for the receiver, * through a deposit call. * * - MUST return a limited value if receiver is subject to some deposit limit. * - MUST return 2 ** 256 - 1 if there is no limit on the maximum amount of assets that may be deposited. * - MUST NOT revert. */ function maxDeposit(address receiver) external view returns (uint256 maxAssets); /** * @dev Allows an on-chain or off-chain user to simulate the effects of their deposit at the current block, given * current on-chain conditions. * * - MUST return as close to and no more than the exact amount of Vault shares that would be minted in a deposit * call in the same transaction. I.e. deposit should return the same or more shares as previewDeposit if called * in the same transaction. * - MUST NOT account for deposit limits like those returned from maxDeposit and should always act as though the * deposit would be accepted, regardless if the user has enough tokens approved, etc. * - MUST be inclusive of deposit fees. Integrators should be aware of the existence of deposit fees. * - MUST NOT revert. * * NOTE: any unfavorable discrepancy between convertToShares and previewDeposit SHOULD be considered slippage in * share price or some other type of condition, meaning the depositor will lose assets by depositing. */ function previewDeposit(uint256 assets) external view returns (uint256 shares); /** * @dev Mints shares Vault shares to receiver by depositing exactly amount of underlying tokens. * * - MUST emit the Deposit event. * - MAY support an additional flow in which the underlying tokens are owned by the Vault contract before the * deposit execution, and are accounted for during deposit. * - MUST revert if all of assets cannot be deposited (due to deposit limit being reached, slippage, the user not * approving enough underlying tokens to the Vault contract, etc). * * NOTE: most implementations will require pre-approval of the Vault with the Vault’s underlying asset token. */ function deposit(uint256 assets, address receiver) external returns (uint256 shares); /** * @dev Returns the maximum amount of the Vault shares that can be minted for the receiver, through a mint call. * - MUST return a limited value if receiver is subject to some mint limit. * - MUST return 2 ** 256 - 1 if there is no limit on the maximum amount of shares that may be minted. * - MUST NOT revert. */ function maxMint(address receiver) external view returns (uint256 maxShares); /** * @dev Allows an on-chain or off-chain user to simulate the effects of their mint at the current block, given * current on-chain conditions. * * - MUST return as close to and no fewer than the exact amount of assets that would be deposited in a mint call * in the same transaction. I.e. mint should return the same or fewer assets as previewMint if called in the * same transaction. * - MUST NOT account for mint limits like those returned from maxMint and should always act as though the mint * would be accepted, regardless if the user has enough tokens approved, etc. * - MUST be inclusive of deposit fees. Integrators should be aware of the existence of deposit fees. * - MUST NOT revert. * * NOTE: any unfavorable discrepancy between convertToAssets and previewMint SHOULD be considered slippage in * share price or some other type of condition, meaning the depositor will lose assets by minting. */ function previewMint(uint256 shares) external view returns (uint256 assets); /** * @dev Mints exactly shares Vault shares to receiver by depositing amount of underlying tokens. * * - MUST emit the Deposit event. * - MAY support an additional flow in which the underlying tokens are owned by the Vault contract before the mint * execution, and are accounted for during mint. * - MUST revert if all of shares cannot be minted (due to deposit limit being reached, slippage, the user not * approving enough underlying tokens to the Vault contract, etc). * * NOTE: most implementations will require pre-approval of the Vault with the Vault’s underlying asset token. */ function mint(uint256 shares, address receiver) external returns (uint256 assets); /** * @dev Returns the maximum amount of the underlying asset that can be withdrawn from the owner balance in the * Vault, through a withdraw call. * * - MUST return a limited value if owner is subject to some withdrawal limit or timelock. * - MUST NOT revert. */ function maxWithdraw(address owner) external view returns (uint256 maxAssets); /** * @dev Allows an on-chain or off-chain user to simulate the effects of their withdrawal at the current block, * given current on-chain conditions. * * - MUST return as close to and no fewer than the exact amount of Vault shares that would be burned in a withdraw * call in the same transaction. I.e. withdraw should return the same or fewer shares as previewWithdraw if * called * in the same transaction. * - MUST NOT account for withdrawal limits like those returned from maxWithdraw and should always act as though * the withdrawal would be accepted, regardless if the user has enough shares, etc. * - MUST be inclusive of withdrawal fees. Integrators should be aware of the existence of withdrawal fees. * - MUST NOT revert. * * NOTE: any unfavorable discrepancy between convertToShares and previewWithdraw SHOULD be considered slippage in * share price or some other type of condition, meaning the depositor will lose assets by depositing. */ function previewWithdraw(uint256 assets) external view returns (uint256 shares); /** * @dev Burns shares from owner and sends exactly assets of underlying tokens to receiver. * * - MUST emit the Withdraw event. * - MAY support an additional flow in which the underlying tokens are owned by the Vault contract before the * withdraw execution, and are accounted for during withdraw. * - MUST revert if all of assets cannot be withdrawn (due to withdrawal limit being reached, slippage, the owner * not having enough shares, etc). * * Note that some implementations will require pre-requesting to the Vault before a withdrawal may be performed. * Those methods should be performed separately. */ function withdraw(uint256 assets, address receiver, address owner) external returns (uint256 shares); /** * @dev Returns the maximum amount of Vault shares that can be redeemed from the owner balance in the Vault, * through a redeem call. * * - MUST return a limited value if owner is subject to some withdrawal limit or timelock. * - MUST return balanceOf(owner) if owner is not subject to any withdrawal limit or timelock. * - MUST NOT revert. */ function maxRedeem(address owner) external view returns (uint256 maxShares); /** * @dev Allows an on-chain or off-chain user to simulate the effects of their redeemption at the current block, * given current on-chain conditions. * * - MUST return as close to and no more than the exact amount of assets that would be withdrawn in a redeem call * in the same transaction. I.e. redeem should return the same or more assets as previewRedeem if called in the * same transaction. * - MUST NOT account for redemption limits like those returned from maxRedeem and should always act as though the * redemption would be accepted, regardless if the user has enough shares, etc. * - MUST be inclusive of withdrawal fees. Integrators should be aware of the existence of withdrawal fees. * - MUST NOT revert. * * NOTE: any unfavorable discrepancy between convertToAssets and previewRedeem SHOULD be considered slippage in * share price or some other type of condition, meaning the depositor will lose assets by redeeming. */ function previewRedeem(uint256 shares) external view returns (uint256 assets); /** * @dev Burns exactly shares from owner and sends assets of underlying tokens to receiver. * * - MUST emit the Withdraw event. * - MAY support an additional flow in which the underlying tokens are owned by the Vault contract before the * redeem execution, and are accounted for during redeem. * - MUST revert if all of shares cannot be redeemed (due to withdrawal limit being reached, slippage, the owner * not having enough shares, etc). * * NOTE: some implementations will require pre-requesting to the Vault before a withdrawal may be performed. * Those methods should be performed separately. */ function redeem(uint256 shares, address receiver, address owner) external returns (uint256 assets); } // src/registry/ReleaseRegistry.sol interface IFactory { function apiVersion() external view returns (string memory); } interface ITokenizedStrategy { function apiVersion() external view returns (string memory); } /** * @title YearnV3 Release Registry * @author yearn.finance * @notice * Used by Yearn Governance to track on chain all * releases of the V3 vaults by API Version. */ contract ReleaseRegistry is Governance2Step { event NewRelease( uint256 indexed releaseId, address indexed factory, address indexed tokenizedStrategy, string apiVersion ); string public constant name = "Yearn V3 Release Registry"; // The total number of releases that have been deployed uint256 public numReleases; // Mapping of release id starting at 0 to the address // of the corresponding factory for that release. mapping(uint256 => address) public factories; // Mapping of release id starting at 0 to the address // of the corresponding Tokenized Strategy for that release. mapping(uint256 => address) public tokenizedStrategies; // Mapping of the API version for a specific release to the // place in the order it was released. mapping(string => uint256) public releaseTargets; constructor(address _governance) Governance2Step(_governance) {} /** * @notice Returns the latest factory. * @return The address of the factory for the latest release. */ function latestFactory() external view virtual returns (address) { uint256 _numReleases = numReleases; if (_numReleases == 0) return address(0); return factories[numReleases - 1]; } /** * @notice Returns the latest tokenized strategy. * @return The address of the tokenized strategy for the latest release. */ function latestTokenizedStrategy() external view virtual returns (address) { uint256 _numReleases = numReleases; if (_numReleases == 0) return address(0); return tokenizedStrategies[numReleases - 1]; } /** * @notice Returns the api version of the latest release. * @return The api version of the latest release. */ function latestRelease() external view virtual returns (string memory) { uint256 _numReleases = numReleases; if (_numReleases == 0) return ""; return IFactory(factories[numReleases - 1]).apiVersion(); } /** * @notice Issue a new release using a deployed factory. * @dev Stores the factory address in `factories` and the release * target in `releaseTargets` with its associated API version. * * Throws if caller isn't `governance`. * Throws if the api version is the same as the previous release. * Throws if the factory does not have the same api version as the tokenized strategy. * Emits a `NewRelease` event. * * @param _factory The factory that will be used create new vaults. */ function newRelease( address _factory, address _tokenizedStrategy ) external virtual onlyGovernance { // Check if the release is different from the current one uint256 releaseId = numReleases; string memory apiVersion = IFactory(_factory).apiVersion(); string memory tokenizedStrategyApiVersion = ITokenizedStrategy( _tokenizedStrategy ).apiVersion(); require( keccak256(bytes(apiVersion)) == keccak256(bytes(tokenizedStrategyApiVersion)), "ReleaseRegistry: api version mismatch" ); if (releaseId > 0) { // Make sure this isn't the same as the last one require( keccak256( bytes(IFactory(factories[releaseId - 1]).apiVersion()) ) != keccak256(bytes(apiVersion)), "ReleaseRegistry: same api version" ); } // Update latest release. factories[releaseId] = _factory; tokenizedStrategies[releaseId] = _tokenizedStrategy; // Set the api to the target. releaseTargets[apiVersion] = releaseId; // Increase our number of releases. numReleases = releaseId + 1; // Log the release for external listeners emit NewRelease(releaseId, _factory, _tokenizedStrategy, apiVersion); } } // lib/openzeppelin-contracts/contracts/token/ERC20/ERC20.sol // OpenZeppelin Contracts (last updated v4.9.0) (token/ERC20/ERC20.sol) /** * @dev Implementation of the {IERC20} interface. * * This implementation is agnostic to the way tokens are created. This means * that a supply mechanism has to be added in a derived contract using {_mint}. * For a generic mechanism see {ERC20PresetMinterPauser}. * * TIP: For a detailed writeup see our guide * https://forum.openzeppelin.com/t/how-to-implement-erc20-supply-mechanisms/226[How * to implement supply mechanisms]. * * The default value of {decimals} is 18. To change this, you should override * this function so it returns a different value. * * We have followed general OpenZeppelin Contracts guidelines: functions revert * instead returning `false` on failure. This behavior is nonetheless * conventional and does not conflict with the expectations of ERC20 * applications. * * Additionally, an {Approval} event is emitted on calls to {transferFrom}. * This allows applications to reconstruct the allowance for all accounts just * by listening to said events. Other implementations of the EIP may not emit * these events, as it isn't required by the specification. * * Finally, the non-standard {decreaseAllowance} and {increaseAllowance} * functions have been added to mitigate the well-known issues around setting * allowances. See {IERC20-approve}. */ contract ERC20 is Context, IERC20, IERC20Metadata { mapping(address => uint256) private _balances; mapping(address => mapping(address => uint256)) private _allowances; uint256 private _totalSupply; string private _name; string private _symbol; /** * @dev Sets the values for {name} and {symbol}. * * All two of these values are immutable: they can only be set once during * construction. */ constructor(string memory name_, string memory symbol_) { _name = name_; _symbol = symbol_; } /** * @dev Returns the name of the token. */ function name() public view virtual override returns (string memory) { return _name; } /** * @dev Returns the symbol of the token, usually a shorter version of the * name. */ function symbol() public view virtual override returns (string memory) { return _symbol; } /** * @dev Returns the number of decimals used to get its user representation. * For example, if `decimals` equals `2`, a balance of `505` tokens should * be displayed to a user as `5.05` (`505 / 10 ** 2`). * * Tokens usually opt for a value of 18, imitating the relationship between * Ether and Wei. This is the default value returned by this function, unless * it's overridden. * * NOTE: This information is only used for _display_ purposes: it in * no way affects any of the arithmetic of the contract, including * {IERC20-balanceOf} and {IERC20-transfer}. */ function decimals() public view virtual override returns (uint8) { return 18; } /** * @dev See {IERC20-totalSupply}. */ function totalSupply() public view virtual override returns (uint256) { return _totalSupply; } /** * @dev See {IERC20-balanceOf}. */ function balanceOf(address account) public view virtual override returns (uint256) { return _balances[account]; } /** * @dev See {IERC20-transfer}. * * Requirements: * * - `to` cannot be the zero address. * - the caller must have a balance of at least `amount`. */ function transfer(address to, uint256 amount) public virtual override returns (bool) { address owner = _msgSender(); _transfer(owner, to, amount); return true; } /** * @dev See {IERC20-allowance}. */ function allowance(address owner, address spender) public view virtual override returns (uint256) { return _allowances[owner][spender]; } /** * @dev See {IERC20-approve}. * * NOTE: If `amount` is the maximum `uint256`, the allowance is not updated on * `transferFrom`. This is semantically equivalent to an infinite approval. * * Requirements: * * - `spender` cannot be the zero address. */ function approve(address spender, uint256 amount) public virtual override returns (bool) { address owner = _msgSender(); _approve(owner, spender, amount); return true; } /** * @dev See {IERC20-transferFrom}. * * Emits an {Approval} event indicating the updated allowance. This is not * required by the EIP. See the note at the beginning of {ERC20}. * * NOTE: Does not update the allowance if the current allowance * is the maximum `uint256`. * * Requirements: * * - `from` and `to` cannot be the zero address. * - `from` must have a balance of at least `amount`. * - the caller must have allowance for ``from``'s tokens of at least * `amount`. */ function transferFrom(address from, address to, uint256 amount) public virtual override returns (bool) { address spender = _msgSender(); _spendAllowance(from, spender, amount); _transfer(from, to, amount); return true; } /** * @dev Atomically increases the allowance granted to `spender` by the caller. * * This is an alternative to {approve} that can be used as a mitigation for * problems described in {IERC20-approve}. * * Emits an {Approval} event indicating the updated allowance. * * Requirements: * * - `spender` cannot be the zero address. */ function increaseAllowance(address spender, uint256 addedValue) public virtual returns (bool) { address owner = _msgSender(); _approve(owner, spender, allowance(owner, spender) + addedValue); return true; } /** * @dev Atomically decreases the allowance granted to `spender` by the caller. * * This is an alternative to {approve} that can be used as a mitigation for * problems described in {IERC20-approve}. * * Emits an {Approval} event indicating the updated allowance. * * Requirements: * * - `spender` cannot be the zero address. * - `spender` must have allowance for the caller of at least * `subtractedValue`. */ function decreaseAllowance(address spender, uint256 subtractedValue) public virtual returns (bool) { address owner = _msgSender(); uint256 currentAllowance = allowance(owner, spender); require(currentAllowance >= subtractedValue, "ERC20: decreased allowance below zero"); unchecked { _approve(owner, spender, currentAllowance - subtractedValue); } return true; } /** * @dev Moves `amount` of tokens from `from` to `to`. * * This internal function is equivalent to {transfer}, and can be used to * e.g. implement automatic token fees, slashing mechanisms, etc. * * Emits a {Transfer} event. * * Requirements: * * - `from` cannot be the zero address. * - `to` cannot be the zero address. * - `from` must have a balance of at least `amount`. */ function _transfer(address from, address to, uint256 amount) internal virtual { require(from != address(0), "ERC20: transfer from the zero address"); require(to != address(0), "ERC20: transfer to the zero address"); _beforeTokenTransfer(from, to, amount); uint256 fromBalance = _balances[from]; require(fromBalance >= amount, "ERC20: transfer amount exceeds balance"); unchecked { _balances[from] = fromBalance - amount; // Overflow not possible: the sum of all balances is capped by totalSupply, and the sum is preserved by // decrementing then incrementing. _balances[to] += amount; } emit Transfer(from, to, amount); _afterTokenTransfer(from, to, amount); } /** @dev Creates `amount` tokens and assigns them to `account`, increasing * the total supply. * * Emits a {Transfer} event with `from` set to the zero address. * * Requirements: * * - `account` cannot be the zero address. */ function _mint(address account, uint256 amount) internal virtual { require(account != address(0), "ERC20: mint to the zero address"); _beforeTokenTransfer(address(0), account, amount); _totalSupply += amount; unchecked { // Overflow not possible: balance + amount is at most totalSupply + amount, which is checked above. _balances[account] += amount; } emit Transfer(address(0), account, amount); _afterTokenTransfer(address(0), account, amount); } /** * @dev Destroys `amount` tokens from `account`, reducing the * total supply. * * Emits a {Transfer} event with `to` set to the zero address. * * Requirements: * * - `account` cannot be the zero address. * - `account` must have at least `amount` tokens. */ function _burn(address account, uint256 amount) internal virtual { require(account != address(0), "ERC20: burn from the zero address"); _beforeTokenTransfer(account, address(0), amount); uint256 accountBalance = _balances[account]; require(accountBalance >= amount, "ERC20: burn amount exceeds balance"); unchecked { _balances[account] = accountBalance - amount; // Overflow not possible: amount <= accountBalance <= totalSupply. _totalSupply -= amount; } emit Transfer(account, address(0), amount); _afterTokenTransfer(account, address(0), amount); } /** * @dev Sets `amount` as the allowance of `spender` over the `owner` s tokens. * * This internal function is equivalent to `approve`, and can be used to * e.g. set automatic allowances for certain subsystems, etc. * * Emits an {Approval} event. * * Requirements: * * - `owner` cannot be the zero address. * - `spender` cannot be the zero address. */ function _approve(address owner, address spender, uint256 amount) internal virtual { require(owner != address(0), "ERC20: approve from the zero address"); require(spender != address(0), "ERC20: approve to the zero address"); _allowances[owner][spender] = amount; emit Approval(owner, spender, amount); } /** * @dev Updates `owner` s allowance for `spender` based on spent `amount`. * * Does not update the allowance amount in case of infinite allowance. * Revert if not enough allowance is available. * * Might emit an {Approval} event. */ function _spendAllowance(address owner, address spender, uint256 amount) internal virtual { uint256 currentAllowance = allowance(owner, spender); if (currentAllowance != type(uint256).max) { require(currentAllowance >= amount, "ERC20: insufficient allowance"); unchecked { _approve(owner, spender, currentAllowance - amount); } } } /** * @dev Hook that is called before any transfer of tokens. This includes * minting and burning. * * Calling conditions: * * - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens * will be transferred to `to`. * - when `from` is zero, `amount` tokens will be minted for `to`. * - when `to` is zero, `amount` of ``from``'s tokens will be burned. * - `from` and `to` are never both zero. * * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks]. */ function _beforeTokenTransfer(address from, address to, uint256 amount) internal virtual {} /** * @dev Hook that is called after any transfer of tokens. This includes * minting and burning. * * Calling conditions: * * - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens * has been transferred to `to`. * - when `from` is zero, `amount` tokens have been minted for `to`. * - when `to` is zero, `amount` of ``from``'s tokens have been burned. * - `from` and `to` are never both zero. * * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks]. */ function _afterTokenTransfer(address from, address to, uint256 amount) internal virtual {} } // lib/openzeppelin-contracts/contracts/token/ERC20/utils/SafeERC20.sol // OpenZeppelin Contracts (last updated v4.9.3) (token/ERC20/utils/SafeERC20.sol) /** * @title SafeERC20 * @dev Wrappers around ERC20 operations that throw on failure (when the token * contract returns false). Tokens that return no value (and instead revert or * throw on failure) are also supported, non-reverting calls are assumed to be * successful. * To use this library you can add a `using SafeERC20 for IERC20;` statement to your contract, * which allows you to call the safe operations as `token.safeTransfer(...)`, etc. */ library SafeERC20 { using Address for address; /** * @dev Transfer `value` amount of `token` from the calling contract to `to`. If `token` returns no value, * non-reverting calls are assumed to be successful. */ function safeTransfer(IERC20 token, address to, uint256 value) internal { _callOptionalReturn(token, abi.encodeWithSelector(token.transfer.selector, to, value)); } /** * @dev Transfer `value` amount of `token` from `from` to `to`, spending the approval given by `from` to the * calling contract. If `token` returns no value, non-reverting calls are assumed to be successful. */ function safeTransferFrom(IERC20 token, address from, address to, uint256 value) internal { _callOptionalReturn(token, abi.encodeWithSelector(token.transferFrom.selector, from, to, value)); } /** * @dev Deprecated. This function has issues similar to the ones found in * {IERC20-approve}, and its usage is discouraged. * * Whenever possible, use {safeIncreaseAllowance} and * {safeDecreaseAllowance} instead. */ function safeApprove(IERC20 token, address spender, uint256 value) internal { // safeApprove should only be called when setting an initial allowance, // or when resetting it to zero. To increase and decrease it, use // 'safeIncreaseAllowance' and 'safeDecreaseAllowance' require( (value == 0) || (token.allowance(address(this), spender) == 0), "SafeERC20: approve from non-zero to non-zero allowance" ); _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, value)); } /** * @dev Increase the calling contract's allowance toward `spender` by `value`. If `token` returns no value, * non-reverting calls are assumed to be successful. */ function safeIncreaseAllowance(IERC20 token, address spender, uint256 value) internal { uint256 oldAllowance = token.allowance(address(this), spender); _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, oldAllowance + value)); } /** * @dev Decrease the calling contract's allowance toward `spender` by `value`. If `token` returns no value, * non-reverting calls are assumed to be successful. */ function safeDecreaseAllowance(IERC20 token, address spender, uint256 value) internal { unchecked { uint256 oldAllowance = token.allowance(address(this), spender); require(oldAllowance >= value, "SafeERC20: decreased allowance below zero"); _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, oldAllowance - value)); } } /** * @dev Set the calling contract's allowance toward `spender` to `value`. If `token` returns no value, * non-reverting calls are assumed to be successful. Meant to be used with tokens that require the approval * to be set to zero before setting it to a non-zero value, such as USDT. */ function forceApprove(IERC20 token, address spender, uint256 value) internal { bytes memory approvalCall = abi.encodeWithSelector(token.approve.selector, spender, value); if (!_callOptionalReturnBool(token, approvalCall)) { _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, 0)); _callOptionalReturn(token, approvalCall); } } /** * @dev Use a ERC-2612 signature to set the `owner` approval toward `spender` on `token`. * Revert on invalid signature. */ function safePermit( IERC20Permit token, address owner, address spender, uint256 value, uint256 deadline, uint8 v, bytes32 r, bytes32 s ) internal { uint256 nonceBefore = token.nonces(owner); token.permit(owner, spender, value, deadline, v, r, s); uint256 nonceAfter = token.nonces(owner); require(nonceAfter == nonceBefore + 1, "SafeERC20: permit did not succeed"); } /** * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement * on the return value: the return value is optional (but if data is returned, it must not be false). * @param token The token targeted by the call. * @param data The call data (encoded using abi.encode or one of its variants). */ function _callOptionalReturn(IERC20 token, bytes memory data) private { // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since // we're implementing it ourselves. We use {Address-functionCall} to perform this call, which verifies that // the target address contains contract code and also asserts for success in the low-level call. bytes memory returndata = address(token).functionCall(data, "SafeERC20: low-level call failed"); require(returndata.length == 0 || abi.decode(returndata, (bool)), "SafeERC20: ERC20 operation did not succeed"); } /** * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement * on the return value: the return value is optional (but if data is returned, it must not be false). * @param token The token targeted by the call. * @param data The call data (encoded using abi.encode or one of its variants). * * This is a variant of {_callOptionalReturn} that silents catches all reverts and returns a bool instead. */ function _callOptionalReturnBool(IERC20 token, bytes memory data) private returns (bool) { // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since // we're implementing it ourselves. We cannot use {Address-functionCall} here since this should return false // and not revert is the subcall reverts. (bool success, bytes memory returndata) = address(token).call(data); return success && (returndata.length == 0 || abi.decode(returndata, (bool))) && Address.isContract(address(token)); } } // lib/yearn-vaults-v3/contracts/interfaces/IVault.sol interface IVault is IERC4626 { // STRATEGY EVENTS event StrategyChanged(address indexed strategy, uint256 change_type); event StrategyReported( address indexed strategy, uint256 gain, uint256 loss, uint256 current_debt, uint256 protocol_fees, uint256 total_fees, uint256 total_refunds ); // DEBT MANAGEMENT EVENTS event DebtUpdated( address indexed strategy, uint256 current_debt, uint256 new_debt ); // ROLE UPDATES event RoleSet(address indexed account, uint256 role); event UpdateRoleManager(address indexed role_manager); event UpdateAccountant(address indexed accountant); event UpdateDefaultQueue(address[] new_default_queue); event UpdateUseDefaultQueue(bool use_default_queue); event UpdatedMaxDebtForStrategy( address indexed sender, address indexed strategy, uint256 new_debt ); event UpdateAutoAllocate(bool auto_allocate); event UpdateDepositLimit(uint256 deposit_limit); event UpdateMinimumTotalIdle(uint256 minimum_total_idle); event UpdateProfitMaxUnlockTime(uint256 profit_max_unlock_time); event DebtPurchased(address indexed strategy, uint256 amount); event Shutdown(); struct StrategyParams { uint256 activation; uint256 last_report; uint256 current_debt; uint256 max_debt; } function FACTORY() external view returns (uint256); function strategies(address) external view returns (StrategyParams memory); function default_queue(uint256) external view returns (address); function use_default_queue() external view returns (bool); function auto_allocate() external view returns (bool); function minimum_total_idle() external view returns (uint256); function deposit_limit() external view returns (uint256); function deposit_limit_module() external view returns (address); function withdraw_limit_module() external view returns (address); function accountant() external view returns (address); function roles(address) external view returns (uint256); function role_manager() external view returns (address); function future_role_manager() external view returns (address); function isShutdown() external view returns (bool); function nonces(address) external view returns (uint256); function initialize( address, string memory, string memory, address, uint256 ) external; function setName(string memory) external; function setSymbol(string memory) external; function set_accountant(address new_accountant) external; function set_default_queue(address[] memory new_default_queue) external; function set_use_default_queue(bool) external; function set_auto_allocate(bool) external; function set_deposit_limit(uint256 deposit_limit) external; function set_deposit_limit( uint256 deposit_limit, bool should_override ) external; function set_deposit_limit_module( address new_deposit_limit_module ) external; function set_deposit_limit_module( address new_deposit_limit_module, bool should_override ) external; function set_withdraw_limit_module( address new_withdraw_limit_module ) external; function set_minimum_total_idle(uint256 minimum_total_idle) external; function setProfitMaxUnlockTime( uint256 new_profit_max_unlock_time ) external; function set_role(address account, uint256 role) external; function add_role(address account, uint256 role) external; function remove_role(address account, uint256 role) external; function transfer_role_manager(address role_manager) external; function accept_role_manager() external; function unlockedShares() external view returns (uint256); function pricePerShare() external view returns (uint256); function get_default_queue() external view returns (address[] memory); function process_report( address strategy ) external returns (uint256, uint256); function buy_debt(address strategy, uint256 amount) external; function add_strategy(address new_strategy) external; function revoke_strategy(address strategy) external; function force_revoke_strategy(address strategy) external; function update_max_debt_for_strategy( address strategy, uint256 new_max_debt ) external; function update_debt( address strategy, uint256 target_debt ) external returns (uint256); function update_debt( address strategy, uint256 target_debt, uint256 max_loss ) external returns (uint256); function shutdown_vault() external; function totalIdle() external view returns (uint256); function totalDebt() external view returns (uint256); function apiVersion() external view returns (string memory); function assess_share_of_unrealised_losses( address strategy, uint256 assets_needed ) external view returns (uint256); function profitMaxUnlockTime() external view returns (uint256); function fullProfitUnlockDate() external view returns (uint256); function profitUnlockingRate() external view returns (uint256); function lastProfitUpdate() external view returns (uint256); //// NON-STANDARD ERC-4626 FUNCTIONS \\\\ function withdraw( uint256 assets, address receiver, address owner, uint256 max_loss ) external returns (uint256); function withdraw( uint256 assets, address receiver, address owner, uint256 max_loss, address[] memory strategies ) external returns (uint256); function redeem( uint256 shares, address receiver, address owner, uint256 max_loss ) external returns (uint256); function redeem( uint256 shares, address receiver, address owner, uint256 max_loss, address[] memory strategies ) external returns (uint256); function maxWithdraw( address owner, uint256 max_loss ) external view returns (uint256); function maxWithdraw( address owner, uint256 max_loss, address[] memory strategies ) external view returns (uint256); function maxRedeem( address owner, uint256 max_loss ) external view returns (uint256); function maxRedeem( address owner, uint256 max_loss, address[] memory strategies ) external view returns (uint256); //// NON-STANDARD ERC-20 FUNCTIONS \\\\ function DOMAIN_SEPARATOR() external view returns (bytes32); function permit( address owner, address spender, uint256 amount, uint256 deadline, uint8 v, bytes32 r, bytes32 s ) external returns (bool); } // lib/yearn-vaults-v3/contracts/interfaces/IVaultFactory.sol interface IVaultFactory_0 { event NewVault(address indexed vaultAddress, address indexed asset); event UpdateProtocolFeeBps( uint16 oldProtocolFeeBps, uint16 newProtocolFeeBps ); event UpdateProtocolFeeRecipient( address oldProtocolFeeRecipient, address newProtocolFeeRecipient ); event UpdateCustomProtocolFee(address vault, uint16 newCustomProtocolFee); event RemovedCustomProtocolFee(address vault); event FactoryShutdown(); event UpdatePendingGovernance(address newPendingGovernance); event GovernanceTransferred( address previousGovernance, address newGovernance ); function shutdown() external view returns (bool); function governance() external view returns (address); function pendingGovernance() external view returns (address); function name() external view returns (string memory); function use_custom_protocol_fee(address) external view returns (bool); function deploy_new_vault( address asset, string memory name, string memory symbol, address role_manager, uint256 profit_max_unlock_time ) external returns (address); function vault_original() external view returns (address); function apiVersion() external view returns (string memory); function protocol_fee_config() external view returns (uint16 fee_bps, address fee_recipient); function protocol_fee_config( address vault ) external view returns (uint16 fee_bps, address fee_recipient); function set_protocol_fee_bps(uint16 new_protocol_fee_bps) external; function set_protocol_fee_recipient( address new_protocol_fee_recipient ) external; function set_custom_protocol_fee_bps( address vault, uint16 new_custom_protocol_fee ) external; function remove_custom_protocol_fee(address vault) external; function shutdown_factory() external; function transferGovernance(address new_governance) external; function acceptGovernance() external; } // src/registry/Registry.sol interface IVaultFactory_1 { function deploy_new_vault( address asset, string memory name, string memory symbol, address role_manager, uint256 profit_max_unlock_time ) external returns (address); function apiVersion() external view returns (string memory); } /** * @title YearnV3 Registry * @author yearn.finance * @notice * Serves as an on chain registry to track any Yearn V3 * vaults and strategies that a certain party wants to * endorse. * * Can also be used to deploy new vaults of any specific * API version. */ contract Registry is Governance { /// @notice Emitted when a new vault is deployed or added. event NewEndorsedVault( address indexed vault, address indexed asset, uint256 releaseVersion, uint256 vaultType ); /// @notice Emitted when a vault is removed. event RemovedVault( address indexed vault, address indexed asset, uint256 releaseVersion, uint256 vaultType ); /// @notice Emitted when a vault is tagged with a string. event VaultTagged(address indexed vault); /// @notice Emitted when gov adds ore removes a `tagger`. event UpdateTagger(address indexed account, bool status); /// @notice Emitted when gov adds ore removes a `endorser`. event UpdateEndorser(address indexed account, bool status); /// @notice Can only be gov or an `endorser`. modifier onlyEndorsers() { _isEndorser(); _; } /// @notice Can only be gov or a `tagger`. modifier onlyTaggers() { _isTagger(); _; } /// @notice Check is gov or an `endorser`. function _isEndorser() internal view { require(msg.sender == governance || endorsers[msg.sender], "!endorser"); } /// @notice Check is gov or a `tagger`. function _isTagger() internal view { require(msg.sender == governance || taggers[msg.sender], "!tagger"); } // Struct stored for every endorsed vault or strategy for // off chain use to easily retrieve info. struct Info { // The token thats being used. address asset; // The release number corresponding to the release registries version. uint96 releaseVersion; // Type of vault. uint64 vaultType; // Time when the vault was deployed for easier indexing. uint128 deploymentTimestamp; // Index the vault is at in array for easy removals. uint64 index; // String so that management can tag a vault with any info for FE's. string tag; } // Address used to get the specific versions from. address public immutable releaseRegistry; // Default type used for Multi strategy "Allocator" vaults. uint256 public constant MULTI_STRATEGY_TYPE = 1; // Default type used for Single "Tokenized" Strategy vaults. uint256 public constant SINGLE_STRATEGY_TYPE = 2; // Custom name for this Registry. string public name; // Old version of the registry to fall back to if exists. address public legacyRegistry; // Mapping for any address that is allowed to tag a vault. mapping(address => bool) public taggers; // Mapping for any address that is allowed to deploy or endorse. mapping(address => bool) public endorsers; // vault/strategy address => Info struct. mapping(address => Info) public vaultInfo; // Mapping to check if a specific `asset` has a vault. mapping(address => bool) public assetIsUsed; // asset => array of all endorsed vaults. mapping(address => address[]) internal _endorsedVaults; // Array of all tokens used as the underlying. address[] public assets; /** * @param _governance Address to set as owner of the Registry. * @param _name The custom string for this custom registry to be called. * @param _releaseRegistry The Permissionless releaseRegistry to deploy vaults through. */ constructor( address _governance, string memory _name, address _releaseRegistry ) Governance(_governance) { // Set name. name = _name; // Set releaseRegistry. releaseRegistry = _releaseRegistry; } /** * @notice Returns the total number of assets being used as the underlying. * @return The amount of assets. */ function numAssets() external view virtual returns (uint256) { return assets.length; } /** * @notice Get the full array of tokens being used. * @return The full array of underlying tokens being used/. */ function getAssets() external view virtual returns (address[] memory) { return assets; } /** * @notice The amount of endorsed vaults for a specific token. * @return The amount of endorsed vaults. */ function numEndorsedVaults( address _asset ) public view virtual returns (uint256) { return _endorsedVaults[_asset].length; } /** * @notice Get the array of vaults endorsed for an `_asset`. * @param _asset The underlying token used by the vaults. * @return The endorsed vaults. */ function getEndorsedVaults( address _asset ) external view virtual returns (address[] memory) { return _endorsedVaults[_asset]; } /** * @notice Get all endorsed vaults deployed using the Registry. * @dev This will return a nested array of all vaults deployed * separated by their underlying asset. * * This is only meant for off chain viewing and should not be used during any * on chain tx's. * * @return allEndorsedVaults A nested array containing all vaults. */ function getAllEndorsedVaults() external view virtual returns (address[][] memory allEndorsedVaults) { address[] memory allAssets = assets; uint256 length = assets.length; allEndorsedVaults = new address[][](length); for (uint256 i; i < length; ++i) { allEndorsedVaults[i] = _endorsedVaults[allAssets[i]]; } } /** * @notice Check if a vault is endorsed in this registry. * @dev This will check if the `asset` variable in the struct has been * set for an easy external view check. * @param _vault Address of the vault to check. * @return . The vaults endorsement status. */ function isEndorsed(address _vault) external view virtual returns (bool) { return vaultInfo[_vault].asset != address(0) || isLegacyVault(_vault); } /** * @notice Check if a vault is endorsed in the legacy registry. * @param _vault The vault to check. * @return True if the vault is endorsed in the legacy registry, false otherwise. */ function isLegacyVault(address _vault) public view virtual returns (bool) { address _legacy = legacyRegistry; if (_legacy == address(0)) return false; return Registry(_legacy).isEndorsed(_vault); } /** * @notice * Create and endorse a new multi strategy "Allocator" * vault and endorse it in this registry. * @dev * Throws if caller isn't `owner`. * Throws if no releases are registered yet. * Emits a `NewEndorsedVault` event. * @param _asset The asset that may be deposited into the new Vault. * @param _name Specify a custom Vault name. . * @param _symbol Specify a custom Vault symbol name. * @param _roleManager The address authorized for guardian interactions in the new Vault. * @param _profitMaxUnlockTime The time strategy profits will unlock over. * @return _vault address of the newly-deployed vault */ function newEndorsedVault( address _asset, string memory _name, string memory _symbol, address _roleManager, uint256 _profitMaxUnlockTime ) public virtual returns (address _vault) { return newEndorsedVault( _asset, _name, _symbol, _roleManager, _profitMaxUnlockTime, 0 // Default to latest version. ); } /** * @notice * Create and endorse a new multi strategy "Allocator" * vault and endorse it in this registry. * @dev * Throws if caller isn't `owner`. * Throws if no releases are registered yet. * Emits a `NewEndorsedVault` event. * @param _asset The asset that may be deposited into the new Vault. * @param _name Specify a custom Vault name. . * @param _symbol Specify a custom Vault symbol name. * @param _roleManager The address authorized for guardian interactions in the new Vault. * @param _profitMaxUnlockTime The time strategy profits will unlock over. * @param _releaseDelta The number of releases prior to the latest to use as a target. NOTE: Set to 0 for latest. * @return _vault address of the newly-deployed vault */ function newEndorsedVault( address _asset, string memory _name, string memory _symbol, address _roleManager, uint256 _profitMaxUnlockTime, uint256 _releaseDelta ) public virtual onlyEndorsers returns (address _vault) { // Get the target release based on the delta given. uint256 _releaseTarget = ReleaseRegistry(releaseRegistry) .numReleases() - 1 - _releaseDelta; // Get the factory address for that specific Api version. address factory = ReleaseRegistry(releaseRegistry).factories( _releaseTarget ); // Make sure we got an actual factory require(factory != address(0), "Registry: unknown release"); // Deploy New vault. _vault = IVaultFactory_1(factory).deploy_new_vault( _asset, _name, _symbol, _roleManager, _profitMaxUnlockTime ); // Register the vault with this Registry _registerVault( _vault, _asset, _releaseTarget, MULTI_STRATEGY_TYPE, block.timestamp ); } /** * @notice Endorse an already deployed multi strategy vault. * @dev To be used with default values for `_releaseDelta`, `_vaultType` * and `_deploymentTimestamp`. * * @param _vault Address of the vault to endorse. */ function endorseMultiStrategyVault(address _vault) external virtual { endorseVault(_vault, 0, MULTI_STRATEGY_TYPE, 0); } /** * @notice Endorse an already deployed Single Strategy vault. * @dev To be used with default values for `_releaseDelta`, `_vaultType` * and `_deploymentTimestamp`. * * @param _vault Address of the vault to endorse. */ function endorseSingleStrategyVault(address _vault) external virtual { endorseVault(_vault, 0, SINGLE_STRATEGY_TYPE, 0); } /** * @notice * Adds an existing vault to the list of "endorsed" vaults for that asset. * @dev * Throws if caller isn't `owner`. * Throws if no releases are registered yet. * Throws if `vault`'s api version does not match the release specified. * Emits a `NewEndorsedVault` event. * @param _vault The vault that will be endorsed by the Registry. * @param _releaseDelta Specify the number of releases prior to the latest to use as a target. * @param _vaultType Type of vault to endorse. * @param _deploymentTimestamp The timestamp of when the vault was deployed for FE use. */ function endorseVault( address _vault, uint256 _releaseDelta, uint256 _vaultType, uint256 _deploymentTimestamp ) public virtual onlyEndorsers { // Cannot endorse twice. require(vaultInfo[_vault].asset == address(0), "endorsed"); require(_vaultType != 0, "no 0 type"); require(_vaultType <= type(uint128).max, "type too high"); require(_deploymentTimestamp <= block.timestamp, "!deployment time"); // Will underflow if no releases created yet, or targeting prior to release history uint256 _releaseTarget = ReleaseRegistry(releaseRegistry) .numReleases() - 1 - _releaseDelta; // dev: no releases // Get the API version for the target specified string memory apiVersion = IVaultFactory_1( ReleaseRegistry(releaseRegistry).factories(_releaseTarget) ).apiVersion(); require( keccak256(bytes(IVault(_vault).apiVersion())) == keccak256(bytes((apiVersion))), "Wrong API Version" ); // Add to the end of the list of vaults for asset _registerVault( _vault, IVault(_vault).asset(), _releaseTarget, _vaultType, _deploymentTimestamp ); } /** * @dev Function used to register a newly deployed or added vault. * * This well set all of the values for the vault in the `vaultInfo` * mapping as well as add the vault and the underlying asset to any * relevant arrays for tracking. * */ function _registerVault( address _vault, address _asset, uint256 _releaseTarget, uint256 _vaultType, uint256 _deploymentTimestamp ) internal virtual { // Set the Info struct for this vault vaultInfo[_vault] = Info({ asset: _asset, releaseVersion: uint96(_releaseTarget), vaultType: uint64(_vaultType), deploymentTimestamp: uint128(_deploymentTimestamp), index: uint64(_endorsedVaults[_asset].length), tag: "" }); // Add to the endorsed vaults array. _endorsedVaults[_asset].push(_vault); if (!assetIsUsed[_asset]) { // We have a new asset to add assets.push(_asset); assetIsUsed[_asset] = true; } emit NewEndorsedVault(_vault, _asset, _releaseTarget, _vaultType); } /** * @notice Tag a vault with a specific string. * @dev This is available to governance to tag any vault or strategy * on chain if desired to arbitrarily classify any vaults. * i.e. Certain ratings ("A") / Vault status ("Shutdown") etc. * * @param _vault Address of the vault or strategy to tag. * @param _tag The string to tag the vault or strategy with. */ function tagVault( address _vault, string memory _tag ) external virtual onlyTaggers { require(vaultInfo[_vault].asset != address(0), "!Endorsed"); vaultInfo[_vault].tag = _tag; emit VaultTagged(_vault); } /** * @notice Remove a `_vault`. * @dev Can be used as an efficient way to remove a vault * to not have to iterate over the full array. * * NOTE: This will not remove the asset from the `assets` array * if it is no longer in use and will have to be done manually. * * @param _vault Address of the vault to remove. */ function removeVault(address _vault) external virtual onlyEndorsers { // Get the struct with all the vaults data. Info memory info = vaultInfo[_vault]; require(info.asset != address(0), "!endorsed"); require( _endorsedVaults[info.asset][info.index] == _vault, "wrong vault" ); // Get the vault at the end of the array address lastVault = _endorsedVaults[info.asset][ _endorsedVaults[info.asset].length - 1 ]; // If `_vault` is not the last item in the array. if (lastVault != _vault) { // Set the last index to the spot we are removing. _endorsedVaults[info.asset][info.index] = lastVault; // Update the index of the vault we moved vaultInfo[lastVault].index = uint64(info.index); } // Pop the last item off the array. _endorsedVaults[info.asset].pop(); // Emit the event. emit RemovedVault( _vault, info.asset, info.releaseVersion, info.vaultType ); // Delete the struct. delete vaultInfo[_vault]; } /** * @notice Removes a specific `_asset` at `_index` from `assets`. * @dev Can be used if an asset is no longer in use after a vault or * strategy has also been removed. * * @param _asset The asset to remove from the array. * @param _index The index it sits at. */ function removeAsset( address _asset, uint256 _index ) external virtual onlyEndorsers { require(assetIsUsed[_asset], "!in use"); require(_endorsedVaults[_asset].length == 0, "still in use"); require(assets[_index] == _asset, "wrong asset"); // Replace `_asset` with the last index. assets[_index] = assets[assets.length - 1]; // Pop last item off the array. assets.pop(); // No longer used. assetIsUsed[_asset] = false; } /** * @notice Set a new address to be able to endorse or remove an existing endorser. * @param _account The address to set. * @param _canEndorse Bool if the `_account` can or cannot endorse. */ function setEndorser( address _account, bool _canEndorse ) external virtual onlyGovernance { endorsers[_account] = _canEndorse; emit UpdateEndorser(_account, _canEndorse); } /** * @notice Set a new address to be able to tag a vault. * @param _account The address to set. * @param _canTag Bool if the `_account` can or cannot tag. */ function setTagger( address _account, bool _canTag ) external virtual onlyGovernance { taggers[_account] = _canTag; emit UpdateTagger(_account, _canTag); } /** * @notice Set a legacy registry if one exists. * @param _legacyRegistry The address of the legacy registry. */ function setLegacyRegistry( address _legacyRegistry ) external virtual onlyGovernance { legacyRegistry = _legacyRegistry; } } // src/accountants/Accountant.sol /// @title Accountant. /// @dev Will charge fees, issue refunds, and run health check on any reported /// gains or losses during a strategy's report. contract Accountant { using SafeERC20 for ERC20; /// @notice An event emitted when a vault is added or removed. event VaultChanged(address indexed vault, ChangeType change); /// @notice An event emitted when the default fee configuration is updated. event UpdateDefaultFeeConfig(Fee defaultFeeConfig); /// @notice An event emitted when the future fee manager is set. event SetFutureFeeManager(address indexed futureFeeManager); /// @notice An event emitted when a new fee manager is accepted. event NewFeeManager(address indexed feeManager); /// @notice An event emitted when a new vault manager is set. event UpdateVaultManager(address indexed newVaultManager); /// @notice An event emitted when the fee recipient is updated. event UpdateFeeRecipient( address indexed oldFeeRecipient, address indexed newFeeRecipient ); /// @notice An event emitted when a custom fee configuration is updated. event UpdateCustomFeeConfig(address indexed vault, Fee custom_config); /// @notice An event emitted when a custom fee configuration is removed. event RemovedCustomFeeConfig(address indexed vault); /// @notice An event emitted when the `maxLoss` parameter is updated. event UpdateMaxLoss(uint256 maxLoss); /// @notice An event emitted when rewards are distributed. event DistributeRewards(address indexed token, uint256 rewards); /// @notice Enum defining change types (added or removed). enum ChangeType { NULL, ADDED, REMOVED } /// @notice Struct representing fee details. struct Fee { uint16 managementFee; // Annual management fee to charge. uint16 performanceFee; // Performance fee to charge. uint16 refundRatio; // Refund ratio to give back on losses. uint16 maxFee; // Max fee allowed as a percent of gain. uint16 maxGain; // Max percent gain a strategy can report. uint16 maxLoss; // Max percent loss a strategy can report. bool custom; // Flag to set for custom configs. } modifier onlyFeeManager() { _checkFeeManager(); _; } modifier onlyVaultOrFeeManager() { _checkVaultOrFeeManager(); _; } modifier onlyFeeManagerOrRecipient() { _checkFeeManagerOrRecipient(); _; } modifier onlyAddedVaults() { _checkVaultIsAdded(); _; } function _checkFeeManager() internal view virtual { require(msg.sender == feeManager, "!fee manager"); } function _checkVaultOrFeeManager() internal view virtual { require( msg.sender == feeManager || msg.sender == vaultManager, "!vault manager" ); } function _checkFeeManagerOrRecipient() internal view virtual { require( msg.sender == feeRecipient || msg.sender == feeManager, "!recipient" ); } function _checkVaultIsAdded() internal view virtual { require(vaults[msg.sender], "vault not added"); } /// @notice Constant defining the maximum basis points. uint256 internal constant MAX_BPS = 10_000; /// @notice Constant defining the number of seconds in a year. uint256 internal constant SECS_PER_YEAR = 31_556_952; /// @notice Constant defining the management fee threshold. uint16 public constant MANAGEMENT_FEE_THRESHOLD = 200; /// @notice Constant defining the performance fee threshold. uint16 public constant PERFORMANCE_FEE_THRESHOLD = 5_000; /// @notice The amount of max loss to use when redeeming from vaults. uint256 public maxLoss; /// @notice The address of the fee manager. address public feeManager; /// @notice The address of the fee recipient. address public feeRecipient; /// @notice An address that can add or remove vaults. address public vaultManager; /// @notice The address of the future fee manager. address public futureFeeManager; /// @notice The default fee configuration. Fee public defaultConfig; /// @notice Mapping to track added vaults. mapping(address => bool) public vaults; /// @notice Mapping vault => custom Fee config if any. mapping(address => Fee) public customConfig; /// @notice Mapping vault => strategy => flag for one time healthcheck skips. mapping(address => mapping(address => bool)) skipHealthCheck; constructor( address _feeManager, address _feeRecipient, uint16 defaultManagement, uint16 defaultPerformance, uint16 defaultRefund, uint16 defaultMaxFee, uint16 defaultMaxGain, uint16 defaultMaxLoss ) { require(_feeManager != address(0), "ZERO ADDRESS"); require(_feeRecipient != address(0), "ZERO ADDRESS"); feeManager = _feeManager; feeRecipient = _feeRecipient; _updateDefaultConfig( defaultManagement, defaultPerformance, defaultRefund, defaultMaxFee, defaultMaxGain, defaultMaxLoss ); } /** * @notice Called by a vault when a `strategy` is reporting. * @dev The msg.sender must have been added to the `vaults` mapping. * @param strategy Address of the strategy reporting. * @param gain Amount of the gain if any. * @param loss Amount of the loss if any. * @return totalFees if any to charge. * @return totalRefunds if any for the vault to pull. */ function report( address strategy, uint256 gain, uint256 loss ) public virtual onlyAddedVaults returns (uint256 totalFees, uint256 totalRefunds) { // Declare the config to use as the custom. Fee memory fee = customConfig[msg.sender]; // Check if there is a custom config to use. if (!fee.custom) { // Otherwise use the default. fee = defaultConfig; } // Retrieve the strategy's params from the vault. IVault.StrategyParams memory strategyParams = IVault(msg.sender) .strategies(strategy); // Charge management fees no matter gain or loss. if (fee.managementFee > 0) { // Time since the last harvest. uint256 duration = block.timestamp - strategyParams.last_report; // managementFee is an annual amount, so charge based on the time passed. totalFees = ((strategyParams.current_debt * duration * (fee.managementFee)) / MAX_BPS / SECS_PER_YEAR); } // Only charge performance fees if there is a gain. if (gain > 0) { // If we are skipping the healthcheck this report if (skipHealthCheck[msg.sender][strategy]) { // Make sure it is reset for the next one. skipHealthCheck[msg.sender][strategy] = false; // Setting `maxGain` to 0 will disable the healthcheck on profits. } else if (fee.maxGain > 0) { require( gain <= (strategyParams.current_debt * (fee.maxGain)) / MAX_BPS, "too much gain" ); } totalFees += (gain * (fee.performanceFee)) / MAX_BPS; } else { // If we are skipping the healthcheck this report if (skipHealthCheck[msg.sender][strategy]) { // Make sure it is reset for the next one. skipHealthCheck[msg.sender][strategy] = false; // Setting `maxLoss` to 10_000 will disable the healthcheck on losses. } else if (fee.maxLoss < MAX_BPS) { require( loss <= (strategyParams.current_debt * (fee.maxLoss)) / MAX_BPS, "too much loss" ); } // Means we should have a loss. if (fee.refundRatio > 0) { // Cache the underlying asset the vault uses. address asset = IVault(msg.sender).asset(); // Give back either all we have or based on the refund ratio. totalRefunds = Math.min( (loss * (fee.refundRatio)) / MAX_BPS, ERC20(asset).balanceOf(address(this)) ); if (totalRefunds > 0) { // Approve the vault to pull the underlying asset. _checkAllowance(msg.sender, asset, totalRefunds); } } } // 0 Max fee means it is not enforced. if (fee.maxFee > 0) { // Ensure fee does not exceed the maxFee %. totalFees = Math.min((gain * (fee.maxFee)) / MAX_BPS, totalFees); } return (totalFees, totalRefunds); } /** * @notice Function to add a new vault for this accountant to charge fees for. * @dev This is not used to set any of the fees for the specific vault or strategy. Each fee will be set separately. * @param vault The address of a vault to allow to use this accountant. */ function addVault(address vault) external virtual onlyVaultOrFeeManager { // Ensure the vault has not already been added. require(!vaults[vault], "already added"); vaults[vault] = true; emit VaultChanged(vault, ChangeType.ADDED); } /** * @notice Function to remove a vault from this accountant's fee charging list. * @param vault The address of the vault to be removed from this accountant. */ function removeVault(address vault) external virtual onlyVaultOrFeeManager { // Ensure the vault has been previously added. require(vaults[vault], "not added"); address asset = IVault(vault).asset(); // Remove any allowances left. if (ERC20(asset).allowance(address(this), vault) != 0) { ERC20(asset).safeApprove(vault, 0); } vaults[vault] = false; emit VaultChanged(vault, ChangeType.REMOVED); } /** * @notice Function to update the default fee configuration used for * all strategies that don't have a custom config set. * @param defaultManagement Default annual management fee to charge. * @param defaultPerformance Default performance fee to charge. * @param defaultRefund Default refund ratio to give back on losses. * @param defaultMaxFee Default max fee to allow as a percent of gain. * @param defaultMaxGain Default max percent gain a strategy can report. * @param defaultMaxLoss Default max percent loss a strategy can report. */ function updateDefaultConfig( uint16 defaultManagement, uint16 defaultPerformance, uint16 defaultRefund, uint16 defaultMaxFee, uint16 defaultMaxGain, uint16 defaultMaxLoss ) external virtual onlyFeeManager { _updateDefaultConfig( defaultManagement, defaultPerformance, defaultRefund, defaultMaxFee, defaultMaxGain, defaultMaxLoss ); } /** * @dev Updates the Accountant's default fee config. * Is used during deployment and during any future updates. */ function _updateDefaultConfig( uint16 defaultManagement, uint16 defaultPerformance, uint16 defaultRefund, uint16 defaultMaxFee, uint16 defaultMaxGain, uint16 defaultMaxLoss ) internal virtual { // Check for threshold and limit conditions. require( defaultManagement <= MANAGEMENT_FEE_THRESHOLD, "management fee threshold" ); require( defaultPerformance <= PERFORMANCE_FEE_THRESHOLD, "performance fee threshold" ); require(defaultMaxLoss <= MAX_BPS, "too high"); // Update the default fee configuration. defaultConfig = Fee({ managementFee: defaultManagement, performanceFee: defaultPerformance, refundRatio: defaultRefund, maxFee: defaultMaxFee, maxGain: defaultMaxGain, maxLoss: defaultMaxLoss, custom: false }); emit UpdateDefaultFeeConfig(defaultConfig); } /** * @notice Function to set a custom fee configuration for a specific vault. * @param vault The vault the strategy is hooked up to. * @param customManagement Custom annual management fee to charge. * @param customPerformance Custom performance fee to charge. * @param customRefund Custom refund ratio to give back on losses. * @param customMaxFee Custom max fee to allow as a percent of gain. * @param customMaxGain Custom max percent gain a strategy can report. * @param customMaxLoss Custom max percent loss a strategy can report. */ function setCustomConfig( address vault, uint16 customManagement, uint16 customPerformance, uint16 customRefund, uint16 customMaxFee, uint16 customMaxGain, uint16 customMaxLoss ) external virtual onlyFeeManager { // Ensure the vault has been added. require(vaults[vault], "vault not added"); // Check for threshold and limit conditions. require( customManagement <= MANAGEMENT_FEE_THRESHOLD, "management fee threshold" ); require( customPerformance <= PERFORMANCE_FEE_THRESHOLD, "performance fee threshold" ); require(customMaxLoss <= MAX_BPS, "too high"); // Create the vault's custom config. Fee memory _config = Fee({ managementFee: customManagement, performanceFee: customPerformance, refundRatio: customRefund, maxFee: customMaxFee, maxGain: customMaxGain, maxLoss: customMaxLoss, custom: true }); // Store the config. customConfig[vault] = _config; emit UpdateCustomFeeConfig(vault, _config); } /** * @notice Function to remove a previously set custom fee configuration for a vault. * @param vault The vault to remove custom setting for. */ function removeCustomConfig(address vault) external virtual onlyFeeManager { // Ensure custom fees are set for the specified vault. require(customConfig[vault].custom, "No custom fees set"); // Set all the vaults's custom fees to 0. delete customConfig[vault]; // Emit relevant event. emit RemovedCustomFeeConfig(vault); } /** * @notice Turn off the health check for a specific `vault` `strategy` combo. * @dev This will only last for one report and get automatically turned back on. * @param vault Address of the vault. * @param strategy Address of the strategy. */ function turnOffHealthCheck( address vault, address strategy ) external virtual onlyFeeManager { // Ensure the vault has been added. require(vaults[vault], "vault not added"); skipHealthCheck[vault][strategy] = true; } /** * @notice Public getter to check for custom setting. * @dev We use uint256 for the flag since its cheaper so this * will convert it to a bool for easy view functions. * * @param vault Address of the vault. * @return If a custom fee config is set. */ function useCustomConfig( address vault ) external view virtual returns (bool) { return customConfig[vault].custom; } /** * @notice Get the full config used for a specific `vault`. * @param vault Address of the vault. * @return fee The config that would be used during the report. */ function getVaultConfig( address vault ) external view returns (Fee memory fee) { fee = customConfig[vault]; // Check if there is a custom config to use. if (!fee.custom) { // Otherwise use the default. fee = defaultConfig; } } /** * @notice Function to redeem the underlying asset from a vault. * @dev Will default to using the full balance of the vault. * @param vault The vault to redeem from. */ function redeemUnderlying(address vault) external virtual { redeemUnderlying(vault, IVault(vault).balanceOf(address(this))); } /** * @notice Function to redeem the underlying asset from a vault. * @param vault The vault to redeem from. * @param amount The amount in vault shares to redeem. */ function redeemUnderlying( address vault, uint256 amount ) public virtual onlyFeeManager { IVault(vault).redeem(amount, address(this), address(this), maxLoss); } /** * @notice Sets the `maxLoss` parameter to be used on redeems. * @param _maxLoss The amount in basis points to set as the maximum loss. */ function setMaxLoss(uint256 _maxLoss) external virtual onlyFeeManager { // Ensure that the provided `maxLoss` does not exceed 100% (in basis points). require(_maxLoss <= MAX_BPS, "higher than 100%"); maxLoss = _maxLoss; // Emit an event to signal the update of the `maxLoss` parameter. emit UpdateMaxLoss(_maxLoss); } /** * @notice Function to distribute all accumulated fees to the designated recipient. * @param token The token to distribute. */ function distribute(address token) external virtual { distribute(token, ERC20(token).balanceOf(address(this))); } /** * @notice Function to distribute accumulated fees to the designated recipient. * @param token The token to distribute. * @param amount amount of token to distribute. */ function distribute( address token, uint256 amount ) public virtual onlyFeeManagerOrRecipient { ERC20(token).safeTransfer(feeRecipient, amount); emit DistributeRewards(token, amount); } /** * @notice Function to set a future fee manager address. * @param _futureFeeManager The address to set as the future fee manager. */ function setFutureFeeManager( address _futureFeeManager ) external virtual onlyFeeManager { // Ensure the futureFeeManager is not a zero address. require(_futureFeeManager != address(0), "ZERO ADDRESS"); futureFeeManager = _futureFeeManager; emit SetFutureFeeManager(_futureFeeManager); } /** * @notice Function to accept the role change and become the new fee manager. * @dev This function allows the future fee manager to accept the role change and become the new fee manager. */ function acceptFeeManager() external virtual { // Make sure the sender is the future fee manager. require(msg.sender == futureFeeManager, "not future fee manager"); feeManager = futureFeeManager; futureFeeManager = address(0); emit NewFeeManager(msg.sender); } /** * @notice Function to set a new vault manager. * @param newVaultManager Address to add or remove vaults. */ function setVaultManager( address newVaultManager ) external virtual onlyFeeManager { vaultManager = newVaultManager; emit UpdateVaultManager(newVaultManager); } /** * @notice Function to set a new address to receive distributed rewards. * @param newFeeRecipient Address to receive distributed fees. */ function setFeeRecipient( address newFeeRecipient ) external virtual onlyFeeManager { // Ensure the newFeeRecipient is not a zero address. require(newFeeRecipient != address(0), "ZERO ADDRESS"); address oldRecipient = feeRecipient; feeRecipient = newFeeRecipient; emit UpdateFeeRecipient(oldRecipient, newFeeRecipient); } /** * @dev Internal safe function to make sure the contract you want to * interact with has enough allowance to pull the desired tokens. * * @param _contract The address of the contract that will move the token. * @param _token The ERC-20 token that will be getting spent. * @param _amount The amount of `_token` to be spent. */ function _checkAllowance( address _contract, address _token, uint256 _amount ) internal { if (ERC20(_token).allowance(address(this), _contract) < _amount) { ERC20(_token).safeApprove(_contract, 0); ERC20(_token).safeApprove(_contract, _amount); } } } // src/managers/RoleManager.sol /// @title Yearn V3 Vault Role Manager. contract RoleManager is Positions { /// @notice Revert message for when a vault has already been deployed. error AlreadyDeployed(address _vault); /// @notice Emitted when a new vault has been deployed or added. event AddedNewVault( address indexed vault, address indexed debtAllocator, uint256 category ); /// @notice Emitted when a vaults debt allocator is updated. event UpdateDebtAllocator( address indexed vault, address indexed debtAllocator ); /// @notice Emitted when a vault is removed. event RemovedVault(address indexed vault); /// @notice Emitted when the defaultProfitMaxUnlockTime variable is updated. event UpdateDefaultProfitMaxUnlockTime( uint256 newDefaultProfitMaxUnlockTime ); /// @notice Config that holds all vault info. struct VaultConfig { address asset; uint256 category; address debtAllocator; uint256 index; } /*////////////////////////////////////////////////////////////// POSITION ID'S //////////////////////////////////////////////////////////////*/ /// @notice Position ID for "Pending Governance". bytes32 public constant PENDING_GOVERNANCE = keccak256("Pending Governance"); /// @notice Position ID for "Governance". bytes32 public constant GOVERNANCE = keccak256("Governance"); /// @notice Position ID for "Brain". bytes32 public constant MANAGEMENT = keccak256("Management"); /// @notice Position ID for "Keeper". bytes32 public constant KEEPER = keccak256("Keeper"); /// @notice Position ID for the "Registry". bytes32 public constant REGISTRY = keccak256("Registry"); /// @notice Position ID for the "Accountant". bytes32 public constant ACCOUNTANT = keccak256("Accountant"); /// @notice Position ID for the "Debt Allocator". bytes32 public constant DEBT_ALLOCATOR = keccak256("Debt Allocator"); /*////////////////////////////////////////////////////////////// STORAGE //////////////////////////////////////////////////////////////*/ /// @notice Immutable address that the `role_manager` position // will be transferred to when a vault is removed. address public chad; /// @notice Array storing addresses of all managed vaults. address[] public vaults; // Encoded name so that it can be held as a constant. string internal projectName; /// @notice Default time until profits are fully unlocked for new vaults. uint256 public defaultProfitMaxUnlockTime; /// @notice Mapping of vault addresses to its config. mapping(address => VaultConfig) public vaultConfig; /// @notice Mapping of underlying asset, api version and category to vault. mapping(address => mapping(string => mapping(uint256 => address))) internal _assetToVault; constructor() { chad = address(1); } function initialize( string calldata _projectName, address _governance, address _management, address _keeper, address _registry, address _accountant, address _debtAllocator ) external { require(chad == address(0), "initialized"); require(_governance != address(0), "ZERO ADDRESS"); chad = _governance; projectName = _projectName; defaultProfitMaxUnlockTime = 7 days; // Governance gets all the roles. _setPositionHolder(GOVERNANCE, _governance); _setPositionRoles(GOVERNANCE, Roles.ALL); // Management reports, can update debt, queue, deposit limits and unlock time. _setPositionHolder(MANAGEMENT, _management); _setPositionRoles( MANAGEMENT, Roles.REPORTING_MANAGER | Roles.DEBT_MANAGER | Roles.QUEUE_MANAGER | Roles.DEPOSIT_LIMIT_MANAGER | Roles.DEBT_PURCHASER | Roles.PROFIT_UNLOCK_MANAGER ); // The keeper can process reports. _setPositionHolder(KEEPER, _keeper); _setPositionRoles(KEEPER, Roles.REPORTING_MANAGER); // Debt allocators manage debt and also need to process reports. _setPositionHolder(DEBT_ALLOCATOR, _debtAllocator); _setPositionRoles( DEBT_ALLOCATOR, Roles.REPORTING_MANAGER | Roles.DEBT_MANAGER ); _setPositionHolder(REGISTRY, _registry); _setPositionHolder(ACCOUNTANT, _accountant); } /*////////////////////////////////////////////////////////////// VAULT CREATION //////////////////////////////////////////////////////////////*/ /** * @notice Creates a new endorsed vault with default profit max unlock time. * @param _asset Address of the underlying asset. * @param _category Category of the vault. * @param _name Name of the vault. * @param _symbol Symbol of the vault. * @return _vault Address of the newly created vault. */ function newVault( address _asset, uint256 _category, string calldata _name, string calldata _symbol ) external virtual onlyPositionHolder(GOVERNANCE) returns (address) { return _newVault(_asset, _category, _name, _symbol, type(uint256).max); } /** * @notice Creates a new endorsed vault with default profit max unlock time. * @param _asset Address of the underlying asset. * @param _category Category of the vault. * @param _name Name of the vault. * @param _symbol Symbol of the vault. * @param _depositLimit The deposit limit to start the vault with. * @return _vault Address of the newly created vault. */ function newVault( address _asset, uint256 _category, string calldata _name, string calldata _symbol, uint256 _depositLimit ) external virtual onlyPositionHolder(GOVERNANCE) returns (address) { return _newVault(_asset, _category, _name, _symbol, _depositLimit); } /** * @notice Creates a new endorsed vault. * @param _asset Address of the underlying asset. * @param _category Category of the vault. * @param _name Name of the vault. * @param _symbol Symbol of the vault. * @param _depositLimit The deposit limit to start the vault with. * @return _vault Address of the newly created vault. */ function _newVault( address _asset, uint256 _category, string memory _name, string memory _symbol, uint256 _depositLimit ) internal virtual returns (address _vault) { // Deploy through the registry so it is automatically endorsed. _vault = Registry(getPositionHolder(REGISTRY)).newEndorsedVault( _asset, _name, _symbol, address(this), defaultProfitMaxUnlockTime ); // Check that a vault does not exist for that asset, api and category. // This reverts late to not waste gas when used correctly. string memory _apiVersion = IVault(_vault).apiVersion(); if (_assetToVault[_asset][_apiVersion][_category] != address(0)) { revert AlreadyDeployed( _assetToVault[_asset][_apiVersion][_category] ); } address _debtAllocator = getPositionHolder(DEBT_ALLOCATOR); // Give out roles on the new vault. _sanctify(_vault, _debtAllocator); // Set up the accountant. _setAccountant(_vault); if (_depositLimit != 0) { _setDepositLimit(_vault, _depositLimit); } // Add the vault config to the mapping. vaultConfig[_vault] = VaultConfig({ asset: _asset, category: _category, debtAllocator: _debtAllocator, index: vaults.length }); // Add the vault to the mapping. _assetToVault[_asset][_apiVersion][_category] = _vault; // Add the vault to the array. vaults.push(_vault); // Emit event for new vault. emit AddedNewVault(_vault, _debtAllocator, _category); } /** * @dev Assigns roles to the newly added vault. * * This will override any previously set roles for the holders. But not effect * the roles held by other addresses. * * @param _vault Address of the vault to sanctify. * @param _debtAllocator Address of the debt allocator for the vault. */ function _sanctify( address _vault, address _debtAllocator ) internal virtual { // Set the roles for daddy. _setRole(_vault, _positions[GOVERNANCE]); // Set the roles for Management. _setRole(_vault, _positions[MANAGEMENT]); // Set the roles for the Keeper. _setRole(_vault, _positions[KEEPER]); // Give the specific debt allocator its roles. _setRole( _vault, Position(_debtAllocator, _positions[DEBT_ALLOCATOR].roles) ); } /** * @dev Used internally to set the roles on a vault for a given position. * Will not set the roles if the position holder is address(0). * This does not check that the roles are !=0 because it is expected that * the holder will be set to 0 if the position is not being used. * * @param _vault Address of the vault. * @param _position Holder address and roles to set. */ function _setRole( address _vault, Position memory _position ) internal virtual { if (_position.holder != address(0)) { IVault(_vault).set_role(_position.holder, uint256(_position.roles)); } } /** * @dev Sets the accountant on the vault and adds the vault to the accountant. * This temporarily gives the `ACCOUNTANT_MANAGER` role to this contract. * @param _vault Address of the vault to set up the accountant for. */ function _setAccountant(address _vault) internal virtual { // Get the current accountant. address accountant = getPositionHolder(ACCOUNTANT); // If there is an accountant set. if (accountant != address(0)) { // Temporarily give this contract the ability to set the accountant. IVault(_vault).add_role(address(this), Roles.ACCOUNTANT_MANAGER); // Set the account on the vault. IVault(_vault).set_accountant(accountant); // Take away the role. IVault(_vault).remove_role(address(this), Roles.ACCOUNTANT_MANAGER); // Whitelist the vault in the accountant. Accountant(accountant).addVault(_vault); } } /** * @dev Used to set an initial deposit limit when a new vault is deployed. * Any further updates to the limit will need to be done by an address that * holds the `DEPOSIT_LIMIT_MANAGER` role. * @param _vault Address of the newly deployed vault. * @param _depositLimit The deposit limit to set. */ function _setDepositLimit( address _vault, uint256 _depositLimit ) internal virtual { // Temporarily give this contract the ability to set the deposit limit. IVault(_vault).add_role(address(this), Roles.DEPOSIT_LIMIT_MANAGER); // Set the initial deposit limit on the vault. IVault(_vault).set_deposit_limit(_depositLimit); // Take away the role. IVault(_vault).remove_role(address(this), Roles.DEPOSIT_LIMIT_MANAGER); } /*////////////////////////////////////////////////////////////// VAULT MANAGEMENT //////////////////////////////////////////////////////////////*/ /** * @notice Adds a new vault to the RoleManager with the specified category. * @dev If not already endorsed this function will endorse the vault. * A new debt allocator will be deployed and configured. * @param _vault Address of the vault to be added. * @param _category Category associated with the vault. */ function addNewVault(address _vault, uint256 _category) external virtual { addNewVault(_vault, _category, getPositionHolder(DEBT_ALLOCATOR)); } /** * @notice Adds a new vault to the RoleManager with the specified category and debt allocator. * @dev If not already endorsed this function will endorse the vault. * @param _vault Address of the vault to be added. * @param _category Category associated with the vault. * @param _debtAllocator Address of the debt allocator for the vault. */ function addNewVault( address _vault, uint256 _category, address _debtAllocator ) public virtual onlyPositionHolder(GOVERNANCE) { // Check that a vault does not exist for that asset, api and category. address _asset = IVault(_vault).asset(); string memory _apiVersion = IVault(_vault).apiVersion(); if (_assetToVault[_asset][_apiVersion][_category] != address(0)) { revert AlreadyDeployed( _assetToVault[_asset][_apiVersion][_category] ); } // If not the current role manager. if (IVault(_vault).role_manager() != address(this)) { // Accept the position of role manager. IVault(_vault).accept_role_manager(); } // Get the current registry. address registry = getPositionHolder(REGISTRY); // Check if the vault has been endorsed yet in the registry. if (!Registry(registry).isEndorsed(_vault)) { // If not endorse it. // NOTE: This will revert if adding a vault of an older version. Registry(registry).endorseMultiStrategyVault(_vault); } // Set the roles up. _sanctify(_vault, _debtAllocator); // Only set an accountant if there is not one set yet. if (IVault(_vault).accountant() == address(0)) { _setAccountant(_vault); } // Add the vault config to the mapping. vaultConfig[_vault] = VaultConfig({ asset: _asset, category: _category, debtAllocator: _debtAllocator, index: vaults.length }); // Add the vault to the mapping. _assetToVault[_asset][_apiVersion][_category] = _vault; // Add the vault to the array. vaults.push(_vault); // Emit event. emit AddedNewVault(_vault, _debtAllocator, _category); } /** * @notice Update a `_vault`s debt allocator. * @dev This will use the default Debt Allocator currently set. * @param _vault Address of the vault to update the allocator for. */ function updateDebtAllocator( address _vault ) external virtual returns (address _newDebtAllocator) { _newDebtAllocator = getPositionHolder(DEBT_ALLOCATOR); updateDebtAllocator(_vault, _newDebtAllocator); } /** * @notice Update a `_vault`s debt allocator to a specified `_debtAllocator`. * @param _vault Address of the vault to update the allocator for. * @param _debtAllocator Address of the new debt allocator. */ function updateDebtAllocator( address _vault, address _debtAllocator ) public virtual onlyPositionHolder(MANAGEMENT) { // Make sure the vault has been added to the role manager. require(vaultConfig[_vault].asset != address(0), "vault not added"); // Remove the roles from the old allocator. _setRole(_vault, Position(vaultConfig[_vault].debtAllocator, 0)); // Give the new debt allocator the relevant roles. _setRole( _vault, Position(_debtAllocator, _positions[DEBT_ALLOCATOR].roles) ); // Update the vaults config. vaultConfig[_vault].debtAllocator = _debtAllocator; // Emit event. emit UpdateDebtAllocator(_vault, _debtAllocator); } /** * @notice Update a `_vault`s keeper to a specified `_keeper`. * @param _vault Address of the vault to update the keeper for. * @param _keeper Address of the new keeper. */ function updateKeeper( address _vault, address _keeper ) external virtual onlyPositionHolder(MANAGEMENT) { // Make sure the vault has been added to the role manager. require(vaultConfig[_vault].asset != address(0), "vault not added"); // Remove the roles from the old keeper if active. address defaultKeeper = getPositionHolder(KEEPER); if ( _keeper != defaultKeeper && IVault(_vault).roles(defaultKeeper) != 0 ) { _setRole(_vault, Position(defaultKeeper, 0)); } // Give the new keeper the relevant roles. _setRole(_vault, Position(_keeper, _positions[KEEPER].roles)); } function updateVaultName( address _vault, string calldata _name ) external onlyPositionHolder(GOVERNANCE) { require(vaultConfig[_vault].asset != address(0), "vault not added"); IVault(_vault).setName(_name); } function updateVaultSymbol( address _vault, string calldata _symbol ) external onlyPositionHolder(GOVERNANCE) { require(vaultConfig[_vault].asset != address(0), "vault not added"); IVault(_vault).setSymbol(_symbol); } /** * @notice Removes a vault from the RoleManager. * @dev This will NOT un-endorse the vault from the registry. * @param _vault Address of the vault to be removed. */ function removeVault( address _vault ) external virtual onlyPositionHolder(MANAGEMENT) { // Get the vault specific config. VaultConfig memory config = vaultConfig[_vault]; // Make sure the vault has been added to the role manager. require(config.asset != address(0), "vault not added"); // Transfer the role manager position. IVault(_vault).transfer_role_manager(chad); // Address of the vault to replace it with. address vaultToMove = vaults[vaults.length - 1]; // Move the last vault to the index of `_vault` vaults[config.index] = vaultToMove; vaultConfig[vaultToMove].index = config.index; // Remove the last item. vaults.pop(); // Delete the vault from the mapping. delete _assetToVault[config.asset][IVault(_vault).apiVersion()][ config.category ]; // Delete the config for `_vault`. delete vaultConfig[_vault]; emit RemovedVault(_vault); } /** * @notice Removes a specific role(s) for a `_holder` from the `_vaults`. * @dev Can be used to remove one specific role or multiple. * @param _vaults Array of vaults to adjust. * @param _holder Address who's having a role removed. * @param _role The role or roles to remove from the `_holder`. */ function removeRoles( address[] calldata _vaults, address _holder, uint256 _role ) external virtual onlyPositionHolder(GOVERNANCE) { address _vault; for (uint256 i = 0; i < _vaults.length; ++i) { _vault = _vaults[i]; // Make sure the vault is added to this Role Manager. require(vaultConfig[_vault].asset != address(0), "vault not added"); // Remove the role. IVault(_vault).remove_role(_holder, _role); } } /*////////////////////////////////////////////////////////////// SETTERS //////////////////////////////////////////////////////////////*/ /** * @notice Setter function for updating a positions roles. * @param _position Identifier for the position. * @param _newRoles New roles for the position. */ function setPositionRoles( bytes32 _position, uint256 _newRoles ) external virtual onlyPositionHolder(GOVERNANCE) { // Cannot change the debt allocator or keeper roles since holder can be updated. require( _position != DEBT_ALLOCATOR && _position != KEEPER, "cannot update" ); _setPositionRoles(_position, _newRoles); } /** * @notice Setter function for updating a positions holder. * @dev Updating `Governance` requires setting `PENDING_GOVERNANCE` * and then the pending address calling {acceptGovernance}. * @param _position Identifier for the position. * @param _newHolder New address for position. */ function setPositionHolder( bytes32 _position, address _newHolder ) external virtual onlyPositionHolder(GOVERNANCE) { require(_position != GOVERNANCE, "!two step flow"); _setPositionHolder(_position, _newHolder); } /** * @notice Sets the default time until profits are fully unlocked for new vaults. * @param _newDefaultProfitMaxUnlockTime New value for defaultProfitMaxUnlockTime. */ function setDefaultProfitMaxUnlockTime( uint256 _newDefaultProfitMaxUnlockTime ) external virtual onlyPositionHolder(GOVERNANCE) { defaultProfitMaxUnlockTime = _newDefaultProfitMaxUnlockTime; emit UpdateDefaultProfitMaxUnlockTime(_newDefaultProfitMaxUnlockTime); } /** * @notice Accept the Governance role. * @dev Caller must be the Pending Governance. */ function acceptGovernance() external virtual onlyPositionHolder(PENDING_GOVERNANCE) { // Set the Governance role to the caller. _setPositionHolder(GOVERNANCE, msg.sender); // Reset the Pending Governance. _setPositionHolder(PENDING_GOVERNANCE, address(0)); } /*////////////////////////////////////////////////////////////// VIEW METHODS //////////////////////////////////////////////////////////////*/ /** * @notice Get the name of this contract. */ function name() external view virtual returns (string memory) { return string(abi.encodePacked(projectName, " Role Manager")); } /** * @notice Get all vaults that this role manager controls.. * @return The full array of vault addresses. */ function getAllVaults() external view virtual returns (address[] memory) { return vaults; } /** * @notice Get the vault for a specific asset, api and category. * @dev This will return address(0) if one has not been added or deployed. * * @param _asset The underlying asset used. * @param _apiVersion The version of the vault. * @param _category The category of the vault. * @return The vault for the specified `_asset`, `_apiVersion` and `_category`. */ function getVault( address _asset, string memory _apiVersion, uint256 _category ) external view virtual returns (address) { return _assetToVault[_asset][_apiVersion][_category]; } /** * @notice Get the latest vault for a specific asset. * @dev This will default to using category 1. * @param _asset The underlying asset used. * @return _vault latest vault for the specified `_asset` if any. */ function latestVault( address _asset ) external view virtual returns (address) { return latestVault(_asset, 1); } /** * @notice Get the latest vault for a specific asset. * @param _asset The underlying asset used. * @param _category The category of the vault. * @return _vault latest vault for the specified `_asset` if any. */ function latestVault( address _asset, uint256 _category ) public view virtual returns (address _vault) { address releaseRegistry = Registry(getPositionHolder(REGISTRY)) .releaseRegistry(); uint256 numReleases = ReleaseRegistry(releaseRegistry).numReleases(); for (uint256 i = numReleases; i > 0; --i) { string memory apiVersion = IVaultFactory_0( ReleaseRegistry(releaseRegistry).factories(i - 1) ).apiVersion(); _vault = _assetToVault[_asset][apiVersion][_category]; if (_vault != address(0)) { break; } } } /** * @notice Check if a vault is managed by this contract. * @dev This will check if the `asset` variable in the struct has been * set for an easy external view check. * * Does not check the vaults `role_manager` position since that can be set * by anyone for a random vault. * * @param _vault Address of the vault to check. * @return . The vaults role manager status. */ function isVaultsRoleManager( address _vault ) external view virtual returns (bool) { return vaultConfig[_vault].asset != address(0); } /** * @notice Get the debt allocator for a specific vault. * @dev Will return address(0) if the vault is not managed by this contract. * @param _vault Address of the vault. * @return . Address of the debt allocator if any. */ function getDebtAllocator( address _vault ) external view virtual returns (address) { return vaultConfig[_vault].debtAllocator; } /** * @notice Get the category for a specific vault. * @dev Will return 0 if the vault is not managed by this contract. * @param _vault Address of the vault. * @return . The category of the vault if any. */ function getCategory( address _vault ) external view virtual returns (uint256) { return vaultConfig[_vault].category; } /** * @notice Get the address assigned to the Governance position. * @return The address assigned to the Governance position. */ function getGovernance() external view virtual returns (address) { return getPositionHolder(GOVERNANCE); } /** * @notice Get the address assigned to the Pending Governance position. * @return The address assigned to the Pending Governance position. */ function getPendingGovernance() external view virtual returns (address) { return getPositionHolder(PENDING_GOVERNANCE); } /** * @notice Get the address assigned to the Management position. * @return The address assigned to the Management position. */ function getManagement() external view virtual returns (address) { return getPositionHolder(MANAGEMENT); } /** * @notice Get the address assigned to the Keeper position. * @return The address assigned to the Keeper position. */ function getKeeper() external view virtual returns (address) { return getPositionHolder(KEEPER); } /** * @notice Get the address assigned to the Registry. * @return The address assigned to the Registry. */ function getRegistry() external view virtual returns (address) { return getPositionHolder(REGISTRY); } /** * @notice Get the address assigned to the accountant. * @return The address assigned to the accountant. */ function getAccountant() external view virtual returns (address) { return getPositionHolder(ACCOUNTANT); } /** * @notice Get the address assigned to be the debt allocator if any. * @return The address assigned to be the debt allocator if any. */ function getDebtAllocator() external view virtual returns (address) { return getPositionHolder(DEBT_ALLOCATOR); } /** * @notice Get the roles given to the Governance position. * @return The roles given to the Governance position. */ function getGovernanceRoles() external view virtual returns (uint256) { return getPositionRoles(GOVERNANCE); } /** * @notice Get the roles given to the Management position. * @return The roles given to the Management position. */ function getManagementRoles() external view virtual returns (uint256) { return getPositionRoles(MANAGEMENT); } /** * @notice Get the roles given to the Keeper position. * @return The roles given to the Keeper position. */ function getKeeperRoles() external view virtual returns (uint256) { return getPositionRoles(KEEPER); } /** * @notice Get the roles given to the debt allocators. * @return The roles given to the debt allocators. */ function getDebtAllocatorRoles() external view virtual returns (uint256) { return getPositionRoles(DEBT_ALLOCATOR); } }
Contract Security Audit
- No Contract Security Audit Submitted- Submit Audit Here
Contract ABI
API[{"inputs":[],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[{"internalType":"address","name":"_vault","type":"address"}],"name":"AlreadyDeployed","type":"error"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"vault","type":"address"},{"indexed":true,"internalType":"address","name":"debtAllocator","type":"address"},{"indexed":false,"internalType":"uint256","name":"category","type":"uint256"}],"name":"AddedNewVault","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"vault","type":"address"}],"name":"RemovedVault","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"vault","type":"address"},{"indexed":true,"internalType":"address","name":"debtAllocator","type":"address"}],"name":"UpdateDebtAllocator","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"newDefaultProfitMaxUnlockTime","type":"uint256"}],"name":"UpdateDefaultProfitMaxUnlockTime","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"position","type":"bytes32"},{"indexed":true,"internalType":"address","name":"newAddress","type":"address"}],"name":"UpdatePositionHolder","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"position","type":"bytes32"},{"indexed":false,"internalType":"uint256","name":"newRoles","type":"uint256"}],"name":"UpdatePositionRoles","type":"event"},{"inputs":[],"name":"ACCOUNTANT","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"DEBT_ALLOCATOR","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"GOVERNANCE","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"KEEPER","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"MANAGEMENT","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"PENDING_GOVERNANCE","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"REGISTRY","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"acceptGovernance","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_vault","type":"address"},{"internalType":"uint256","name":"_category","type":"uint256"},{"internalType":"address","name":"_debtAllocator","type":"address"}],"name":"addNewVault","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_vault","type":"address"},{"internalType":"uint256","name":"_category","type":"uint256"}],"name":"addNewVault","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"chad","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"defaultProfitMaxUnlockTime","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getAccountant","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getAllVaults","outputs":[{"internalType":"address[]","name":"","type":"address[]"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_vault","type":"address"}],"name":"getCategory","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_vault","type":"address"}],"name":"getDebtAllocator","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getDebtAllocator","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getDebtAllocatorRoles","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getGovernance","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getGovernanceRoles","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getKeeper","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getKeeperRoles","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getManagement","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getManagementRoles","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getPendingGovernance","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"_positionId","type":"bytes32"}],"name":"getPosition","outputs":[{"internalType":"address","name":"","type":"address"},{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"_positionId","type":"bytes32"}],"name":"getPositionHolder","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"_positionId","type":"bytes32"}],"name":"getPositionRoles","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getRegistry","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_asset","type":"address"},{"internalType":"string","name":"_apiVersion","type":"string"},{"internalType":"uint256","name":"_category","type":"uint256"}],"name":"getVault","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"string","name":"_projectName","type":"string"},{"internalType":"address","name":"_governance","type":"address"},{"internalType":"address","name":"_management","type":"address"},{"internalType":"address","name":"_keeper","type":"address"},{"internalType":"address","name":"_registry","type":"address"},{"internalType":"address","name":"_accountant","type":"address"},{"internalType":"address","name":"_debtAllocator","type":"address"}],"name":"initialize","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_vault","type":"address"}],"name":"isVaultsRoleManager","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_asset","type":"address"},{"internalType":"uint256","name":"_category","type":"uint256"}],"name":"latestVault","outputs":[{"internalType":"address","name":"_vault","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_asset","type":"address"}],"name":"latestVault","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"name","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_asset","type":"address"},{"internalType":"uint256","name":"_category","type":"uint256"},{"internalType":"string","name":"_name","type":"string"},{"internalType":"string","name":"_symbol","type":"string"},{"internalType":"uint256","name":"_depositLimit","type":"uint256"}],"name":"newVault","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_asset","type":"address"},{"internalType":"uint256","name":"_category","type":"uint256"},{"internalType":"string","name":"_name","type":"string"},{"internalType":"string","name":"_symbol","type":"string"}],"name":"newVault","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address[]","name":"_vaults","type":"address[]"},{"internalType":"address","name":"_holder","type":"address"},{"internalType":"uint256","name":"_role","type":"uint256"}],"name":"removeRoles","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_vault","type":"address"}],"name":"removeVault","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_newDefaultProfitMaxUnlockTime","type":"uint256"}],"name":"setDefaultProfitMaxUnlockTime","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"_position","type":"bytes32"},{"internalType":"address","name":"_newHolder","type":"address"}],"name":"setPositionHolder","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"_position","type":"bytes32"},{"internalType":"uint256","name":"_newRoles","type":"uint256"}],"name":"setPositionRoles","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_vault","type":"address"},{"internalType":"address","name":"_debtAllocator","type":"address"}],"name":"updateDebtAllocator","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_vault","type":"address"}],"name":"updateDebtAllocator","outputs":[{"internalType":"address","name":"_newDebtAllocator","type":"address"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_vault","type":"address"},{"internalType":"address","name":"_keeper","type":"address"}],"name":"updateKeeper","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_vault","type":"address"},{"internalType":"string","name":"_name","type":"string"}],"name":"updateVaultName","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_vault","type":"address"},{"internalType":"string","name":"_symbol","type":"string"}],"name":"updateVaultSymbol","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"vaultConfig","outputs":[{"internalType":"address","name":"asset","type":"address"},{"internalType":"uint256","name":"category","type":"uint256"},{"internalType":"address","name":"debtAllocator","type":"address"},{"internalType":"uint256","name":"index","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"vaults","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"}]
Contract Creation Code
608060405234801561001057600080fd5b50600180546001600160a01b031916811790556131e4806100326000396000f3fe608060405234801561001057600080fd5b50600436106102bb5760003560e01c8063862a179e11610182578063ba628b27116100e9578063e0a4edf3116100a2578063ef8d03da1161007c578063ef8d03da1461068d578063f796e587146106a0578063f857ef67146106b3578063fecad85a1461072b57600080fd5b8063e0a4edf314610654578063e177dc7014610667578063e7c512771461067a57600080fd5b8063ba628b27146105ed578063bfb7d4a314610600578063caa61cb014610613578063ceb68c2314610626578063d013355a14610639578063deb20d871461064157600080fd5b806397331bf91161013b57806397331bf9146105825780639cf0e60714610597578063a1b77046146105aa578063b4936a59146105b2578063b53f0d00146105c5578063b8efd717146105da57600080fd5b8063862a179e146105205780638808f66d146105355780638b9d29401461054a5780638c64ea4a1461055f5780638e8a3a4c1461057257806390ca03d01461057a57600080fd5b806338906554116102265780635ab1bd53116101df5780635ab1bd53146104645780635dcd67451461046c57806364724604146104aa5780637a0c2b70146104d95780637de9cd22146104ec5780638440d167146104f457600080fd5b80633890655414610411578063391b6f4e146104245780633b1100fa1461042c5780633bc3f9ea146104415780633dcd4f2e146104495780633f6054681461045157600080fd5b806314f675d21161027857806314f675d2146103585780631507a04d1461036d5780631928b3cb14610380578063238efcbc146103ee578063289b3c0d146103f65780633080cef1146103fe57600080fd5b806306433b1b146102c057806306fdde03146102e85780630a1c187c146102fd5780630b63a38a14610328578063146278341461033b57806314adb2f314610350575b600080fd5b6102d56000805160206130cf83398151915281565b6040519081526020015b60405180910390f35b6102f0610734565b6040516102df9190612746565b61031061030b366004612760565b61075c565b6040516001600160a01b0390911681526020016102df565b6103106103363660046127d7565b610777565b6102d560008051602061318f83398151915281565b6102d5610815565b61036b61036636600461286c565b610833565b005b61036b61037b3660046128a5565b610994565b6103cf61038e366004612760565b600090815260208181526040918290208251808401909352546001600160a01b038116808452600160a01b9091046001600160601b03169290910182905291565b604080516001600160a01b0390931683526020830191909152016102df565b61036b610a95565b610310610ae1565b61036b61040c366004612931565b610afa565b61036b61041f36600461286c565b611029565b6103106111c9565b6102d560008051602061314f83398151915281565b6103106111e2565b6102d56111fb565b61036b61045f366004612760565b611214565b610310611268565b61049a61047a366004612973565b6001600160a01b0390811660009081526005602052604090205416151590565b60405190151581526020016102df565b6103106104b8366004612973565b6001600160a01b039081166000908152600560205260409020600201541690565b61036b6104e7366004612990565b611281565b610310611336565b6102d5610502366004612973565b6001600160a01b031660009081526005602052604090206001015490565b6102d560008051602061312f83398151915281565b6102d56000805160206130ef83398151915281565b6102d560008051602061310f83398151915281565b61031061056d366004612760565b61134f565b6102d5611379565b610310611392565b61058a6113ab565b6040516102df91906129e5565b6103106105a5366004612a32565b61140d565b61031061164f565b61036b6105c0366004612a5e565b611668565b6102d560008051602061316f83398151915281565b61036b6105e8366004612990565b6116dd565b6103106105fb366004612a83565b61175a565b61031061060e366004612973565b6117f9565b61036b610621366004612b0f565b611823565b61036b610634366004612973565b6118ad565b6102d5611b7e565b61036b61064f366004612a32565b611b97565b6102d5610662366004612760565b611bb7565b610310610675366004612973565b611bd9565b610310610688366004612ba0565b611bec565b600154610310906001600160a01b031681565b61036b6106ae366004612c3c565b611c3f565b6106f66106c1366004612973565b60056020526000908152604090208054600182015460028301546003909301546001600160a01b039283169391929091169084565b6040516102df94939291906001600160a01b039485168152602081019390935292166040820152606081019190915260800190565b6102d560045481565b606060036040516020016107489190612d2a565b604051602081830303815290604052905090565b6000908152602081905260409020546001600160a01b031690565b600060008051602061318f83398151915261079181611df1565b610808898989898080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525050604080516020601f8d018190048102820181019092528b815292508b91508a90819084018382808284376000920191909152508a9250611e45915050565b9998505050505050505050565b600061082e60008051602061312f833981519152611bb7565b905090565b60008051602061316f83398151915261084b81611df1565b6001600160a01b038381166000908152600560205260409020541661088b5760405162461bcd60e51b815260040161088290612db5565b60405180910390fd5b6040805180820182526001600160a01b03808616600090815260056020908152938120600201549091168252918101919091526108c9908490612186565b604080518082019091526001600160a01b03831681526000805160206130ef833981519152600090815260209081527f7373cba22413404e2328a4d29e64d2e6ec188b66fc2482ce280da4cc9e1010ec54600160a01b90046001600160601b031690820152610939908490612186565b6001600160a01b0383811660008181526005602052604080822060020180546001600160a01b0319169487169485179055517f46b03560e5440592db04cf536396abd2d0e1da05cd4bab259a01af406a8686ed9190a3505050565b60008051602061318f8339815191526109ac81611df1565b6000805b85811015610a8c578686828181106109ca576109ca612dde565b90506020020160208101906109df9190612973565b6001600160a01b0380821660009081526005602052604090205491935016610a195760405162461bcd60e51b815260040161088290612db5565b60405163e2bf56dd60e01b81526001600160a01b0386811660048301526024820186905283169063e2bf56dd90604401600060405180830381600087803b158015610a6357600080fd5b505af1158015610a77573d6000803e3d6000fd5b5050505080610a8590612e0a565b90506109b0565b50505050505050565b60008051602061314f833981519152610aad81611df1565b610ac560008051602061318f8339815191523361220e565b610ade60008051602061314f833981519152600061220e565b50565b600061082e60008051602061318f83398151915261075c565b60008051602061318f833981519152610b1281611df1565b6000846001600160a01b03166338d52e0f6040518163ffffffff1660e01b8152600401602060405180830381865afa158015610b52573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610b769190612e23565b90506000856001600160a01b031663258294106040518163ffffffff1660e01b8152600401600060405180830381865afa158015610bb8573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f19168201604052610be09190810190612e40565b6001600160a01b03831660009081526006602052604080822090519293509091610c0b908490612eb7565b9081526040805160209281900383019020600089815292529020546001600160a01b031614610c96576001600160a01b038216600090815260066020526040908190209051610c5b908390612eb7565b9081526040805160209281900383018120600089815293529120546329ab51bf60e01b82526001600160a01b03166004820152602401610882565b306001600160a01b0316866001600160a01b03166379b989176040518163ffffffff1660e01b8152600401602060405180830381865afa158015610cde573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610d029190612e23565b6001600160a01b031614610d6457856001600160a01b031663f776bf1f6040518163ffffffff1660e01b8152600401600060405180830381600087803b158015610d4b57600080fd5b505af1158015610d5f573d6000803e3d6000fd5b505050505b6000610d7d6000805160206130cf83398151915261075c565b60405163a237e94d60e01b81526001600160a01b0389811660048301529192509082169063a237e94d90602401602060405180830381865afa158015610dc7573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610deb9190612ed3565b610e4b57604051630ab322d960e01b81526001600160a01b038881166004830152821690630ab322d990602401600060405180830381600087803b158015610e3257600080fd5b505af1158015610e46573d6000803e3d6000fd5b505050505b610e558786612267565b60006001600160a01b0316876001600160a01b0316634fb3ccc56040518163ffffffff1660e01b8152600401602060405180830381865afa158015610e9e573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610ec29190612e23565b6001600160a01b031603610ed957610ed987612430565b604080516080810182526001600160a01b0380861680835260208084018b81528a841685870190815260028054606088019081528f8716600090815260058652898120985189549089166001600160a01b0319918216178a55945160018a01559251918801805492909716919093161790945551600390940193909355815260069091528190209051889190610f70908590612eb7565b90815260408051918290036020908101832060008b8152915290812080546001600160a01b039485166001600160a01b0319918216179091556002805460018101825592527f405787fa12a823e0f2b7631cc41b3ba8828b3321ca811111fa75cd3aa3bb5ace90910180548b851692168217905591871691907f65fe7f527479e9a13137b5a7af43efff08bb8e165ff5897ad493bb0362a690c190611018908a815260200190565b60405180910390a350505050505050565b60008051602061316f83398151915261104181611df1565b6001600160a01b03838116600090815260056020526040902054166110785760405162461bcd60e51b815260040161088290612db5565b600061109160008051602061312f83398151915261075c565b9050806001600160a01b0316836001600160a01b03161415801561111d5750604051634c9ba32160e11b81526001600160a01b038281166004830152851690639937464290602401602060405180830381865afa1580156110f6573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061111a9190612ef5565b15155b1561115357611153846040518060400160405280846001600160a01b0316815260200160006001600160601b0316815250612186565b604080518082019091526001600160a01b038416815260008051602061312f833981519152600090815260209081527fe9cef8c56ab338574202f8c771407288ad562b542c26961a2a1a71f5e7e837c254600160a01b90046001600160601b0316908201526111c3908590612186565b50505050565b600061082e60008051602061312f83398151915261075c565b600061082e60008051602061314f83398151915261075c565b600061082e60008051602061318f833981519152611bb7565b60008051602061318f83398151915261122c81611df1565b60048290556040518281527feef7977251e5a99397bd5b40ed665b5ca8745df0f6bce919d03ce09c7eeb8d829060200160405180910390a15050565b600061082e6000805160206130cf83398151915261075c565b60008051602061318f83398151915261129981611df1565b6001600160a01b03848116600090815260056020526040902054166112d05760405162461bcd60e51b815260040161088290612db5565b60405163c47f002760e01b81526001600160a01b0385169063c47f0027906112fe9086908690600401612f0e565b600060405180830381600087803b15801561131857600080fd5b505af115801561132c573d6000803e3d6000fd5b5050505050505050565b600061082e60008051602061310f83398151915261075c565b6002818154811061135f57600080fd5b6000918252602090912001546001600160a01b0316905081565b600061082e60008051602061316f833981519152611bb7565b600061082e60008051602061316f83398151915261075c565b6060600280548060200260200160405190810160405280929190818152602001828054801561140357602002820191906000526020600020905b81546001600160a01b031681526001909101906020018083116113e5575b5050505050905090565b6000806114276000805160206130cf83398151915261075c565b6001600160a01b03166319ee073e6040518163ffffffff1660e01b8152600401602060405180830381865afa158015611464573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906114889190612e23565b90506000816001600160a01b03166356e0a94b6040518163ffffffff1660e01b8152600401602060405180830381865afa1580156114ca573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906114ee9190612ef5565b9050805b80156116465760006001600160a01b03841663672383c4611514600185612f3d565b6040518263ffffffff1660e01b815260040161153291815260200190565b602060405180830381865afa15801561154f573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906115739190612e23565b6001600160a01b031663258294106040518163ffffffff1660e01b8152600401600060405180830381865afa1580156115b0573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f191682016040526115d89190810190612e40565b6001600160a01b03881660009081526006602052604090819020905191925090611603908390612eb7565b9081526040805160209281900383019020600089815292529020546001600160a01b0316945084156116355750611646565b5061163f81612f50565b90506114f2565b50505092915050565b600061082e6000805160206130ef83398151915261075c565b60008051602061318f83398151915261168081611df1565b60008051602061318f83398151915283036116ce5760405162461bcd60e51b815260206004820152600e60248201526d2174776f207374657020666c6f7760901b6044820152606401610882565b6116d8838361220e565b505050565b60008051602061318f8339815191526116f581611df1565b6001600160a01b038481166000908152600560205260409020541661172c5760405162461bcd60e51b815260040161088290612db5565b604051635c26412360e11b81526001600160a01b0385169063b84c8246906112fe9086908690600401612f0e565b600060008051602061318f83398151915261177481611df1565b6117ed888888888080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525050604080516020601f8c018190048102820181019092528a815292508a91508990819084018382808284376000920191909152506000199250611e45915050565b98975050505050505050565b60006118126000805160206130ef83398151915261075c565b905061181e8282610833565b919050565b60008051602061318f83398151915261183b81611df1565b6000805160206130ef8339815191528314158015611867575060008051602061312f8339815191528314155b6118a35760405162461bcd60e51b815260206004820152600d60248201526c63616e6e6f742075706461746560981b6044820152606401610882565b6116d883836125a3565b60008051602061316f8339815191526118c581611df1565b6001600160a01b0380831660009081526005602090815260409182902082516080810184528154851680825260018301549382019390935260028201549094169284019290925260039091015460608301526119335760405162461bcd60e51b815260040161088290612db5565b60015460405163ef54cefd60e01b81526001600160a01b0391821660048201529084169063ef54cefd90602401600060405180830381600087803b15801561197a57600080fd5b505af115801561198e573d6000803e3d6000fd5b505050506000600260016002805490506119a89190612f3d565b815481106119b8576119b8612dde565b9060005260206000200160009054906101000a90046001600160a01b031690508060028360600151815481106119f0576119f0612dde565b600091825260208083209190910180546001600160a01b0319166001600160a01b03948516179055606085015192841682526005905260409020600301556002805480611a3f57611a3f612f67565b60008281526020808220830160001990810180546001600160a01b031916905590920190925583516001600160a01b039081168352600690915260408083208151630258294160e41b81529151909392881692632582941092600480820193918290030181865afa158015611ab8573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f19168201604052611ae09190810190612e40565b604051611aed9190612eb7565b908152604080516020928190038301812085840151600090815290845282812080546001600160a01b03199081169091556001600160a01b03891680835260059095529281208054841681556001810182905560028101805490941690935560039092018290557fa40a7d97cd4243d8bcd193dc4d709afc3717750c5996d9e7216d1a5e0288c4949190a250505050565b600061082e6000805160206130ef833981519152611bb7565b611bb3828261040c6000805160206130ef83398151915261075c565b5050565b600090815260208190526040902054600160a01b90046001600160601b031690565b6000611be682600161140d565b92915050565b6001600160a01b0383166000908152600660205260408082209051611c12908590612eb7565b90815260408051602092819003830190206000948552909152909120546001600160a01b03169392505050565b6001546001600160a01b031615611c865760405162461bcd60e51b815260206004820152600b60248201526a1a5b9a5d1a585b1a5e995960aa1b6044820152606401610882565b6001600160a01b038616611ccb5760405162461bcd60e51b815260206004820152600c60248201526b5a45524f204144445245535360a01b6044820152606401610882565b600180546001600160a01b0319166001600160a01b0388161790556003611cf3888a83612fc3565b5062093a80600455611d1360008051602061318f8339815191528761220e565b611d2d60008051602061318f833981519152613fff6125a3565b611d4560008051602061316f8339815191528661220e565b611d5f60008051602061316f8339815191526119706125a3565b611d7760008051602061312f8339815191528561220e565b611d9060008051602061312f83398151915260206125a3565b611da86000805160206130ef8339815191528261220e565b611dc16000805160206130ef83398151915260606125a3565b611dd96000805160206130cf8339815191528461220e565b61132c60008051602061310f8339815191528361220e565b611dfa8161075c565b6001600160a01b0316336001600160a01b031614610ade5760405162461bcd60e51b815260206004820152600860248201526708585b1b1bddd95960c21b6044820152606401610882565b6000611e5e6000805160206130cf83398151915261075c565b6001600160a01b03166317bdd312878686306004546040518663ffffffff1660e01b8152600401611e93959493929190613084565b6020604051808303816000875af1158015611eb2573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611ed69190612e23565b90506000816001600160a01b031663258294106040518163ffffffff1660e01b8152600401600060405180830381865afa158015611f18573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f19168201604052611f409190810190612e40565b6001600160a01b03881660009081526006602052604080822090519293509091611f6b908490612eb7565b908152604080516020928190038301902060008a815292529020546001600160a01b031614611ff6576001600160a01b038716600090815260066020526040908190209051611fbb908390612eb7565b908152604080516020928190038301812060008a815293529120546329ab51bf60e01b82526001600160a01b03166004820152602401610882565b600061200f6000805160206130ef83398151915261075c565b905061201b8382612267565b61202483612430565b8315612034576120348385612607565b604080516080810182526001600160a01b03808b1680835260208084018c815286841685870190815260028054606088019081528b8716600090815260058652898120985189549089166001600160a01b0319918216178a55945160018a015592519188018054929097169190931617909455516003909401939093558152600690915281902090518491906120cb908590612eb7565b90815260408051918290036020908101832060008c8152915290812080546001600160a01b039485166001600160a01b0319918216179091556002805460018101825592527f405787fa12a823e0f2b7631cc41b3ba8828b3321ca811111fa75cd3aa3bb5ace909101805487851692168217905591831691907f65fe7f527479e9a13137b5a7af43efff08bb8e165ff5897ad493bb0362a690c190612173908b815260200190565b60405180910390a3505095945050505050565b80516001600160a01b031615611bb35780516020820151604051632cf7fd8560e01b81526001600160a01b0392831660048201526001600160601b03909116602482015290831690632cf7fd85906044015b600060405180830381600087803b1580156121f257600080fd5b505af1158015612206573d6000803e3d6000fd5b505050505050565b60008281526020819052604080822080546001600160a01b0319166001600160a01b0385169081179091559051909184917f8c42303edb98aad4f3e4f1a15363dda2db344e9fd66ecff9acf62f770c474fa39190a35050565b60008051602061318f83398151915260009081526020908152604080518082019091527f624ef3c7d6e705ccd5cf44dbc65d64ed664f093a9431ff0584a58a9846ac3d0d546001600160a01b0381168252600160a01b90046001600160601b0316918101919091526122da908390612186565b60008051602061316f83398151915260009081526020908152604080518082019091527f4829c109b61fea6781bd77c95626b114c88442499c00e59076c6d85e749d9674546001600160a01b0381168252600160a01b90046001600160601b03169181019190915261234d908390612186565b60008051602061312f83398151915260009081526020908152604080518082019091527fe9cef8c56ab338574202f8c771407288ad562b542c26961a2a1a71f5e7e837c2546001600160a01b0381168252600160a01b90046001600160601b0316918101919091526123c0908390612186565b604080518082019091526001600160a01b03821681526000805160206130ef833981519152600090815260209081527f7373cba22413404e2328a4d29e64d2e6ec188b66fc2482ce280da4cc9e1010ec54600160a01b90046001600160601b031690820152611bb3908390612186565b600061244960008051602061310f83398151915261075c565b90506001600160a01b03811615611bb3576040516354be77d160e11b8152306004820152600860248201526001600160a01b0383169063a97cefa290604401600060405180830381600087803b1580156124a257600080fd5b505af11580156124b6573d6000803e3d6000fd5b50506040516371da8a8d60e01b81526001600160a01b038481166004830152851692506371da8a8d9150602401600060405180830381600087803b1580156124fd57600080fd5b505af1158015612511573d6000803e3d6000fd5b505060405163e2bf56dd60e01b8152306004820152600860248201526001600160a01b038516925063e2bf56dd9150604401600060405180830381600087803b15801561255d57600080fd5b505af1158015612571573d6000803e3d6000fd5b50506040516312b5ad0160e11b81526001600160a01b0385811660048301528416925063256b5a0291506024016121d8565b6000828152602081815260409182902080546001600160a01b0316600160a01b6001600160601b03861602179055905182815283917ff8a7e043f1e7310711bc663ed81ae8855aa474348c57a6461b9f52a4fa88a94d910160405180910390a25050565b6040516354be77d160e11b815230600482015261010060248201526001600160a01b0383169063a97cefa290604401600060405180830381600087803b15801561265057600080fd5b505af1158015612664573d6000803e3d6000fd5b50506040516337f00e8f60e11b8152600481018490526001600160a01b0385169250636fe01d1e9150602401600060405180830381600087803b1580156126aa57600080fd5b505af11580156126be573d6000803e3d6000fd5b505060405163e2bf56dd60e01b815230600482015261010060248201526001600160a01b038516925063e2bf56dd91506044016121d8565b60005b838110156127115781810151838201526020016126f9565b50506000910152565b600081518084526127328160208601602086016126f6565b601f01601f19169290920160200192915050565b602081526000612759602083018461271a565b9392505050565b60006020828403121561277257600080fd5b5035919050565b6001600160a01b0381168114610ade57600080fd5b60008083601f8401126127a057600080fd5b50813567ffffffffffffffff8111156127b857600080fd5b6020830191508360208285010111156127d057600080fd5b9250929050565b600080600080600080600060a0888a0312156127f257600080fd5b87356127fd81612779565b965060208801359550604088013567ffffffffffffffff8082111561282157600080fd5b61282d8b838c0161278e565b909750955060608a013591508082111561284657600080fd5b506128538a828b0161278e565b989b979a50959894979596608090950135949350505050565b6000806040838503121561287f57600080fd5b823561288a81612779565b9150602083013561289a81612779565b809150509250929050565b600080600080606085870312156128bb57600080fd5b843567ffffffffffffffff808211156128d357600080fd5b818701915087601f8301126128e757600080fd5b8135818111156128f657600080fd5b8860208260051b850101111561290b57600080fd5b6020928301965094505085013561292181612779565b9396929550929360400135925050565b60008060006060848603121561294657600080fd5b833561295181612779565b925060208401359150604084013561296881612779565b809150509250925092565b60006020828403121561298557600080fd5b813561275981612779565b6000806000604084860312156129a557600080fd5b83356129b081612779565b9250602084013567ffffffffffffffff8111156129cc57600080fd5b6129d88682870161278e565b9497909650939450505050565b6020808252825182820181905260009190848201906040850190845b81811015612a265783516001600160a01b031683529284019291840191600101612a01565b50909695505050505050565b60008060408385031215612a4557600080fd5b8235612a5081612779565b946020939093013593505050565b60008060408385031215612a7157600080fd5b82359150602083013561289a81612779565b60008060008060008060808789031215612a9c57600080fd5b8635612aa781612779565b955060208701359450604087013567ffffffffffffffff80821115612acb57600080fd5b612ad78a838b0161278e565b90965094506060890135915080821115612af057600080fd5b50612afd89828a0161278e565b979a9699509497509295939492505050565b60008060408385031215612b2257600080fd5b50508035926020909101359150565b634e487b7160e01b600052604160045260246000fd5b604051601f8201601f1916810167ffffffffffffffff81118282101715612b7057612b70612b31565b604052919050565b600067ffffffffffffffff821115612b9257612b92612b31565b50601f01601f191660200190565b600080600060608486031215612bb557600080fd5b8335612bc081612779565b9250602084013567ffffffffffffffff811115612bdc57600080fd5b8401601f81018613612bed57600080fd5b8035612c00612bfb82612b78565b612b47565b818152876020838501011115612c1557600080fd5b81602084016020830137600060208383010152809450505050604084013590509250925092565b60008060008060008060008060e0898b031215612c5857600080fd5b883567ffffffffffffffff811115612c6f57600080fd5b612c7b8b828c0161278e565b9099509750506020890135612c8f81612779565b95506040890135612c9f81612779565b94506060890135612caf81612779565b93506080890135612cbf81612779565b925060a0890135612ccf81612779565b915060c0890135612cdf81612779565b809150509295985092959890939650565b600181811c90821680612d0457607f821691505b602082108103612d2457634e487b7160e01b600052602260045260246000fd5b50919050565b6000808354612d3881612cf0565b60018281168015612d505760018114612d6557612d94565b60ff1984168752821515830287019450612d94565b8760005260208060002060005b85811015612d8b5781548a820152908401908201612d72565b50505082870194505b50506c102937b6329026b0b730b3b2b960991b83525050600d019392505050565b6020808252600f908201526e1d985d5b1d081b9bdd081859191959608a1b604082015260600190565b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052601160045260246000fd5b600060018201612e1c57612e1c612df4565b5060010190565b600060208284031215612e3557600080fd5b815161275981612779565b600060208284031215612e5257600080fd5b815167ffffffffffffffff811115612e6957600080fd5b8201601f81018413612e7a57600080fd5b8051612e88612bfb82612b78565b818152856020838501011115612e9d57600080fd5b612eae8260208301602086016126f6565b95945050505050565b60008251612ec98184602087016126f6565b9190910192915050565b600060208284031215612ee557600080fd5b8151801515811461275957600080fd5b600060208284031215612f0757600080fd5b5051919050565b60208152816020820152818360408301376000818301604090810191909152601f909201601f19160101919050565b81810381811115611be657611be6612df4565b600081612f5f57612f5f612df4565b506000190190565b634e487b7160e01b600052603160045260246000fd5b601f8211156116d857600081815260208120601f850160051c81016020861015612fa45750805b601f850160051c820191505b8181101561220657828155600101612fb0565b67ffffffffffffffff831115612fdb57612fdb612b31565b612fef83612fe98354612cf0565b83612f7d565b6000601f841160018114613023576000851561300b5750838201355b600019600387901b1c1916600186901b17835561307d565b600083815260209020601f19861690835b828110156130545786850135825560209485019460019092019101613034565b50868210156130715760001960f88860031b161c19848701351681555b505060018560011b0183555b5050505050565b600060018060a01b03808816835260a060208401526130a660a084018861271a565b83810360408501526130b8818861271a565b959091166060840152505060800152939250505056fe8c53ae70b0aa86068023c633abcdda89c433a8a76949ea111f756c171fa23663e36275342c99ede79a003741503250226904c6a298f8766fdff5fe056b171b701629cfbd564ce33f37c84741f82a28dcd353c97db5819722102f8704671969be4f78afe9dfc9a0cb0441c27b9405070cd2a48b490636a7bdd09f355e33a5d7de01c38a7d6f5f636faa4e9982efc7dc023d5598f663e3a2a2d4008a5ff3c2de210a0e28cff0ad91cc255a2c6f970ad7d0cc9855e3f9229ce313219b7b468394589409903de1e6fd852dfc61c9dacb48196c48535b60e25abf92acc92dd689078da264697066735822122071530ed176281faa365249f326cb8bb2abd880405e8662ed67c067227fe1b6be64736f6c63430008120033
Deployed Bytecode
0x608060405234801561001057600080fd5b50600436106102bb5760003560e01c8063862a179e11610182578063ba628b27116100e9578063e0a4edf3116100a2578063ef8d03da1161007c578063ef8d03da1461068d578063f796e587146106a0578063f857ef67146106b3578063fecad85a1461072b57600080fd5b8063e0a4edf314610654578063e177dc7014610667578063e7c512771461067a57600080fd5b8063ba628b27146105ed578063bfb7d4a314610600578063caa61cb014610613578063ceb68c2314610626578063d013355a14610639578063deb20d871461064157600080fd5b806397331bf91161013b57806397331bf9146105825780639cf0e60714610597578063a1b77046146105aa578063b4936a59146105b2578063b53f0d00146105c5578063b8efd717146105da57600080fd5b8063862a179e146105205780638808f66d146105355780638b9d29401461054a5780638c64ea4a1461055f5780638e8a3a4c1461057257806390ca03d01461057a57600080fd5b806338906554116102265780635ab1bd53116101df5780635ab1bd53146104645780635dcd67451461046c57806364724604146104aa5780637a0c2b70146104d95780637de9cd22146104ec5780638440d167146104f457600080fd5b80633890655414610411578063391b6f4e146104245780633b1100fa1461042c5780633bc3f9ea146104415780633dcd4f2e146104495780633f6054681461045157600080fd5b806314f675d21161027857806314f675d2146103585780631507a04d1461036d5780631928b3cb14610380578063238efcbc146103ee578063289b3c0d146103f65780633080cef1146103fe57600080fd5b806306433b1b146102c057806306fdde03146102e85780630a1c187c146102fd5780630b63a38a14610328578063146278341461033b57806314adb2f314610350575b600080fd5b6102d56000805160206130cf83398151915281565b6040519081526020015b60405180910390f35b6102f0610734565b6040516102df9190612746565b61031061030b366004612760565b61075c565b6040516001600160a01b0390911681526020016102df565b6103106103363660046127d7565b610777565b6102d560008051602061318f83398151915281565b6102d5610815565b61036b61036636600461286c565b610833565b005b61036b61037b3660046128a5565b610994565b6103cf61038e366004612760565b600090815260208181526040918290208251808401909352546001600160a01b038116808452600160a01b9091046001600160601b03169290910182905291565b604080516001600160a01b0390931683526020830191909152016102df565b61036b610a95565b610310610ae1565b61036b61040c366004612931565b610afa565b61036b61041f36600461286c565b611029565b6103106111c9565b6102d560008051602061314f83398151915281565b6103106111e2565b6102d56111fb565b61036b61045f366004612760565b611214565b610310611268565b61049a61047a366004612973565b6001600160a01b0390811660009081526005602052604090205416151590565b60405190151581526020016102df565b6103106104b8366004612973565b6001600160a01b039081166000908152600560205260409020600201541690565b61036b6104e7366004612990565b611281565b610310611336565b6102d5610502366004612973565b6001600160a01b031660009081526005602052604090206001015490565b6102d560008051602061312f83398151915281565b6102d56000805160206130ef83398151915281565b6102d560008051602061310f83398151915281565b61031061056d366004612760565b61134f565b6102d5611379565b610310611392565b61058a6113ab565b6040516102df91906129e5565b6103106105a5366004612a32565b61140d565b61031061164f565b61036b6105c0366004612a5e565b611668565b6102d560008051602061316f83398151915281565b61036b6105e8366004612990565b6116dd565b6103106105fb366004612a83565b61175a565b61031061060e366004612973565b6117f9565b61036b610621366004612b0f565b611823565b61036b610634366004612973565b6118ad565b6102d5611b7e565b61036b61064f366004612a32565b611b97565b6102d5610662366004612760565b611bb7565b610310610675366004612973565b611bd9565b610310610688366004612ba0565b611bec565b600154610310906001600160a01b031681565b61036b6106ae366004612c3c565b611c3f565b6106f66106c1366004612973565b60056020526000908152604090208054600182015460028301546003909301546001600160a01b039283169391929091169084565b6040516102df94939291906001600160a01b039485168152602081019390935292166040820152606081019190915260800190565b6102d560045481565b606060036040516020016107489190612d2a565b604051602081830303815290604052905090565b6000908152602081905260409020546001600160a01b031690565b600060008051602061318f83398151915261079181611df1565b610808898989898080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525050604080516020601f8d018190048102820181019092528b815292508b91508a90819084018382808284376000920191909152508a9250611e45915050565b9998505050505050505050565b600061082e60008051602061312f833981519152611bb7565b905090565b60008051602061316f83398151915261084b81611df1565b6001600160a01b038381166000908152600560205260409020541661088b5760405162461bcd60e51b815260040161088290612db5565b60405180910390fd5b6040805180820182526001600160a01b03808616600090815260056020908152938120600201549091168252918101919091526108c9908490612186565b604080518082019091526001600160a01b03831681526000805160206130ef833981519152600090815260209081527f7373cba22413404e2328a4d29e64d2e6ec188b66fc2482ce280da4cc9e1010ec54600160a01b90046001600160601b031690820152610939908490612186565b6001600160a01b0383811660008181526005602052604080822060020180546001600160a01b0319169487169485179055517f46b03560e5440592db04cf536396abd2d0e1da05cd4bab259a01af406a8686ed9190a3505050565b60008051602061318f8339815191526109ac81611df1565b6000805b85811015610a8c578686828181106109ca576109ca612dde565b90506020020160208101906109df9190612973565b6001600160a01b0380821660009081526005602052604090205491935016610a195760405162461bcd60e51b815260040161088290612db5565b60405163e2bf56dd60e01b81526001600160a01b0386811660048301526024820186905283169063e2bf56dd90604401600060405180830381600087803b158015610a6357600080fd5b505af1158015610a77573d6000803e3d6000fd5b5050505080610a8590612e0a565b90506109b0565b50505050505050565b60008051602061314f833981519152610aad81611df1565b610ac560008051602061318f8339815191523361220e565b610ade60008051602061314f833981519152600061220e565b50565b600061082e60008051602061318f83398151915261075c565b60008051602061318f833981519152610b1281611df1565b6000846001600160a01b03166338d52e0f6040518163ffffffff1660e01b8152600401602060405180830381865afa158015610b52573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610b769190612e23565b90506000856001600160a01b031663258294106040518163ffffffff1660e01b8152600401600060405180830381865afa158015610bb8573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f19168201604052610be09190810190612e40565b6001600160a01b03831660009081526006602052604080822090519293509091610c0b908490612eb7565b9081526040805160209281900383019020600089815292529020546001600160a01b031614610c96576001600160a01b038216600090815260066020526040908190209051610c5b908390612eb7565b9081526040805160209281900383018120600089815293529120546329ab51bf60e01b82526001600160a01b03166004820152602401610882565b306001600160a01b0316866001600160a01b03166379b989176040518163ffffffff1660e01b8152600401602060405180830381865afa158015610cde573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610d029190612e23565b6001600160a01b031614610d6457856001600160a01b031663f776bf1f6040518163ffffffff1660e01b8152600401600060405180830381600087803b158015610d4b57600080fd5b505af1158015610d5f573d6000803e3d6000fd5b505050505b6000610d7d6000805160206130cf83398151915261075c565b60405163a237e94d60e01b81526001600160a01b0389811660048301529192509082169063a237e94d90602401602060405180830381865afa158015610dc7573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610deb9190612ed3565b610e4b57604051630ab322d960e01b81526001600160a01b038881166004830152821690630ab322d990602401600060405180830381600087803b158015610e3257600080fd5b505af1158015610e46573d6000803e3d6000fd5b505050505b610e558786612267565b60006001600160a01b0316876001600160a01b0316634fb3ccc56040518163ffffffff1660e01b8152600401602060405180830381865afa158015610e9e573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610ec29190612e23565b6001600160a01b031603610ed957610ed987612430565b604080516080810182526001600160a01b0380861680835260208084018b81528a841685870190815260028054606088019081528f8716600090815260058652898120985189549089166001600160a01b0319918216178a55945160018a01559251918801805492909716919093161790945551600390940193909355815260069091528190209051889190610f70908590612eb7565b90815260408051918290036020908101832060008b8152915290812080546001600160a01b039485166001600160a01b0319918216179091556002805460018101825592527f405787fa12a823e0f2b7631cc41b3ba8828b3321ca811111fa75cd3aa3bb5ace90910180548b851692168217905591871691907f65fe7f527479e9a13137b5a7af43efff08bb8e165ff5897ad493bb0362a690c190611018908a815260200190565b60405180910390a350505050505050565b60008051602061316f83398151915261104181611df1565b6001600160a01b03838116600090815260056020526040902054166110785760405162461bcd60e51b815260040161088290612db5565b600061109160008051602061312f83398151915261075c565b9050806001600160a01b0316836001600160a01b03161415801561111d5750604051634c9ba32160e11b81526001600160a01b038281166004830152851690639937464290602401602060405180830381865afa1580156110f6573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061111a9190612ef5565b15155b1561115357611153846040518060400160405280846001600160a01b0316815260200160006001600160601b0316815250612186565b604080518082019091526001600160a01b038416815260008051602061312f833981519152600090815260209081527fe9cef8c56ab338574202f8c771407288ad562b542c26961a2a1a71f5e7e837c254600160a01b90046001600160601b0316908201526111c3908590612186565b50505050565b600061082e60008051602061312f83398151915261075c565b600061082e60008051602061314f83398151915261075c565b600061082e60008051602061318f833981519152611bb7565b60008051602061318f83398151915261122c81611df1565b60048290556040518281527feef7977251e5a99397bd5b40ed665b5ca8745df0f6bce919d03ce09c7eeb8d829060200160405180910390a15050565b600061082e6000805160206130cf83398151915261075c565b60008051602061318f83398151915261129981611df1565b6001600160a01b03848116600090815260056020526040902054166112d05760405162461bcd60e51b815260040161088290612db5565b60405163c47f002760e01b81526001600160a01b0385169063c47f0027906112fe9086908690600401612f0e565b600060405180830381600087803b15801561131857600080fd5b505af115801561132c573d6000803e3d6000fd5b5050505050505050565b600061082e60008051602061310f83398151915261075c565b6002818154811061135f57600080fd5b6000918252602090912001546001600160a01b0316905081565b600061082e60008051602061316f833981519152611bb7565b600061082e60008051602061316f83398151915261075c565b6060600280548060200260200160405190810160405280929190818152602001828054801561140357602002820191906000526020600020905b81546001600160a01b031681526001909101906020018083116113e5575b5050505050905090565b6000806114276000805160206130cf83398151915261075c565b6001600160a01b03166319ee073e6040518163ffffffff1660e01b8152600401602060405180830381865afa158015611464573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906114889190612e23565b90506000816001600160a01b03166356e0a94b6040518163ffffffff1660e01b8152600401602060405180830381865afa1580156114ca573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906114ee9190612ef5565b9050805b80156116465760006001600160a01b03841663672383c4611514600185612f3d565b6040518263ffffffff1660e01b815260040161153291815260200190565b602060405180830381865afa15801561154f573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906115739190612e23565b6001600160a01b031663258294106040518163ffffffff1660e01b8152600401600060405180830381865afa1580156115b0573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f191682016040526115d89190810190612e40565b6001600160a01b03881660009081526006602052604090819020905191925090611603908390612eb7565b9081526040805160209281900383019020600089815292529020546001600160a01b0316945084156116355750611646565b5061163f81612f50565b90506114f2565b50505092915050565b600061082e6000805160206130ef83398151915261075c565b60008051602061318f83398151915261168081611df1565b60008051602061318f83398151915283036116ce5760405162461bcd60e51b815260206004820152600e60248201526d2174776f207374657020666c6f7760901b6044820152606401610882565b6116d8838361220e565b505050565b60008051602061318f8339815191526116f581611df1565b6001600160a01b038481166000908152600560205260409020541661172c5760405162461bcd60e51b815260040161088290612db5565b604051635c26412360e11b81526001600160a01b0385169063b84c8246906112fe9086908690600401612f0e565b600060008051602061318f83398151915261177481611df1565b6117ed888888888080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525050604080516020601f8c018190048102820181019092528a815292508a91508990819084018382808284376000920191909152506000199250611e45915050565b98975050505050505050565b60006118126000805160206130ef83398151915261075c565b905061181e8282610833565b919050565b60008051602061318f83398151915261183b81611df1565b6000805160206130ef8339815191528314158015611867575060008051602061312f8339815191528314155b6118a35760405162461bcd60e51b815260206004820152600d60248201526c63616e6e6f742075706461746560981b6044820152606401610882565b6116d883836125a3565b60008051602061316f8339815191526118c581611df1565b6001600160a01b0380831660009081526005602090815260409182902082516080810184528154851680825260018301549382019390935260028201549094169284019290925260039091015460608301526119335760405162461bcd60e51b815260040161088290612db5565b60015460405163ef54cefd60e01b81526001600160a01b0391821660048201529084169063ef54cefd90602401600060405180830381600087803b15801561197a57600080fd5b505af115801561198e573d6000803e3d6000fd5b505050506000600260016002805490506119a89190612f3d565b815481106119b8576119b8612dde565b9060005260206000200160009054906101000a90046001600160a01b031690508060028360600151815481106119f0576119f0612dde565b600091825260208083209190910180546001600160a01b0319166001600160a01b03948516179055606085015192841682526005905260409020600301556002805480611a3f57611a3f612f67565b60008281526020808220830160001990810180546001600160a01b031916905590920190925583516001600160a01b039081168352600690915260408083208151630258294160e41b81529151909392881692632582941092600480820193918290030181865afa158015611ab8573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f19168201604052611ae09190810190612e40565b604051611aed9190612eb7565b908152604080516020928190038301812085840151600090815290845282812080546001600160a01b03199081169091556001600160a01b03891680835260059095529281208054841681556001810182905560028101805490941690935560039092018290557fa40a7d97cd4243d8bcd193dc4d709afc3717750c5996d9e7216d1a5e0288c4949190a250505050565b600061082e6000805160206130ef833981519152611bb7565b611bb3828261040c6000805160206130ef83398151915261075c565b5050565b600090815260208190526040902054600160a01b90046001600160601b031690565b6000611be682600161140d565b92915050565b6001600160a01b0383166000908152600660205260408082209051611c12908590612eb7565b90815260408051602092819003830190206000948552909152909120546001600160a01b03169392505050565b6001546001600160a01b031615611c865760405162461bcd60e51b815260206004820152600b60248201526a1a5b9a5d1a585b1a5e995960aa1b6044820152606401610882565b6001600160a01b038616611ccb5760405162461bcd60e51b815260206004820152600c60248201526b5a45524f204144445245535360a01b6044820152606401610882565b600180546001600160a01b0319166001600160a01b0388161790556003611cf3888a83612fc3565b5062093a80600455611d1360008051602061318f8339815191528761220e565b611d2d60008051602061318f833981519152613fff6125a3565b611d4560008051602061316f8339815191528661220e565b611d5f60008051602061316f8339815191526119706125a3565b611d7760008051602061312f8339815191528561220e565b611d9060008051602061312f83398151915260206125a3565b611da86000805160206130ef8339815191528261220e565b611dc16000805160206130ef83398151915260606125a3565b611dd96000805160206130cf8339815191528461220e565b61132c60008051602061310f8339815191528361220e565b611dfa8161075c565b6001600160a01b0316336001600160a01b031614610ade5760405162461bcd60e51b815260206004820152600860248201526708585b1b1bddd95960c21b6044820152606401610882565b6000611e5e6000805160206130cf83398151915261075c565b6001600160a01b03166317bdd312878686306004546040518663ffffffff1660e01b8152600401611e93959493929190613084565b6020604051808303816000875af1158015611eb2573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611ed69190612e23565b90506000816001600160a01b031663258294106040518163ffffffff1660e01b8152600401600060405180830381865afa158015611f18573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f19168201604052611f409190810190612e40565b6001600160a01b03881660009081526006602052604080822090519293509091611f6b908490612eb7565b908152604080516020928190038301902060008a815292529020546001600160a01b031614611ff6576001600160a01b038716600090815260066020526040908190209051611fbb908390612eb7565b908152604080516020928190038301812060008a815293529120546329ab51bf60e01b82526001600160a01b03166004820152602401610882565b600061200f6000805160206130ef83398151915261075c565b905061201b8382612267565b61202483612430565b8315612034576120348385612607565b604080516080810182526001600160a01b03808b1680835260208084018c815286841685870190815260028054606088019081528b8716600090815260058652898120985189549089166001600160a01b0319918216178a55945160018a015592519188018054929097169190931617909455516003909401939093558152600690915281902090518491906120cb908590612eb7565b90815260408051918290036020908101832060008c8152915290812080546001600160a01b039485166001600160a01b0319918216179091556002805460018101825592527f405787fa12a823e0f2b7631cc41b3ba8828b3321ca811111fa75cd3aa3bb5ace909101805487851692168217905591831691907f65fe7f527479e9a13137b5a7af43efff08bb8e165ff5897ad493bb0362a690c190612173908b815260200190565b60405180910390a3505095945050505050565b80516001600160a01b031615611bb35780516020820151604051632cf7fd8560e01b81526001600160a01b0392831660048201526001600160601b03909116602482015290831690632cf7fd85906044015b600060405180830381600087803b1580156121f257600080fd5b505af1158015612206573d6000803e3d6000fd5b505050505050565b60008281526020819052604080822080546001600160a01b0319166001600160a01b0385169081179091559051909184917f8c42303edb98aad4f3e4f1a15363dda2db344e9fd66ecff9acf62f770c474fa39190a35050565b60008051602061318f83398151915260009081526020908152604080518082019091527f624ef3c7d6e705ccd5cf44dbc65d64ed664f093a9431ff0584a58a9846ac3d0d546001600160a01b0381168252600160a01b90046001600160601b0316918101919091526122da908390612186565b60008051602061316f83398151915260009081526020908152604080518082019091527f4829c109b61fea6781bd77c95626b114c88442499c00e59076c6d85e749d9674546001600160a01b0381168252600160a01b90046001600160601b03169181019190915261234d908390612186565b60008051602061312f83398151915260009081526020908152604080518082019091527fe9cef8c56ab338574202f8c771407288ad562b542c26961a2a1a71f5e7e837c2546001600160a01b0381168252600160a01b90046001600160601b0316918101919091526123c0908390612186565b604080518082019091526001600160a01b03821681526000805160206130ef833981519152600090815260209081527f7373cba22413404e2328a4d29e64d2e6ec188b66fc2482ce280da4cc9e1010ec54600160a01b90046001600160601b031690820152611bb3908390612186565b600061244960008051602061310f83398151915261075c565b90506001600160a01b03811615611bb3576040516354be77d160e11b8152306004820152600860248201526001600160a01b0383169063a97cefa290604401600060405180830381600087803b1580156124a257600080fd5b505af11580156124b6573d6000803e3d6000fd5b50506040516371da8a8d60e01b81526001600160a01b038481166004830152851692506371da8a8d9150602401600060405180830381600087803b1580156124fd57600080fd5b505af1158015612511573d6000803e3d6000fd5b505060405163e2bf56dd60e01b8152306004820152600860248201526001600160a01b038516925063e2bf56dd9150604401600060405180830381600087803b15801561255d57600080fd5b505af1158015612571573d6000803e3d6000fd5b50506040516312b5ad0160e11b81526001600160a01b0385811660048301528416925063256b5a0291506024016121d8565b6000828152602081815260409182902080546001600160a01b0316600160a01b6001600160601b03861602179055905182815283917ff8a7e043f1e7310711bc663ed81ae8855aa474348c57a6461b9f52a4fa88a94d910160405180910390a25050565b6040516354be77d160e11b815230600482015261010060248201526001600160a01b0383169063a97cefa290604401600060405180830381600087803b15801561265057600080fd5b505af1158015612664573d6000803e3d6000fd5b50506040516337f00e8f60e11b8152600481018490526001600160a01b0385169250636fe01d1e9150602401600060405180830381600087803b1580156126aa57600080fd5b505af11580156126be573d6000803e3d6000fd5b505060405163e2bf56dd60e01b815230600482015261010060248201526001600160a01b038516925063e2bf56dd91506044016121d8565b60005b838110156127115781810151838201526020016126f9565b50506000910152565b600081518084526127328160208601602086016126f6565b601f01601f19169290920160200192915050565b602081526000612759602083018461271a565b9392505050565b60006020828403121561277257600080fd5b5035919050565b6001600160a01b0381168114610ade57600080fd5b60008083601f8401126127a057600080fd5b50813567ffffffffffffffff8111156127b857600080fd5b6020830191508360208285010111156127d057600080fd5b9250929050565b600080600080600080600060a0888a0312156127f257600080fd5b87356127fd81612779565b965060208801359550604088013567ffffffffffffffff8082111561282157600080fd5b61282d8b838c0161278e565b909750955060608a013591508082111561284657600080fd5b506128538a828b0161278e565b989b979a50959894979596608090950135949350505050565b6000806040838503121561287f57600080fd5b823561288a81612779565b9150602083013561289a81612779565b809150509250929050565b600080600080606085870312156128bb57600080fd5b843567ffffffffffffffff808211156128d357600080fd5b818701915087601f8301126128e757600080fd5b8135818111156128f657600080fd5b8860208260051b850101111561290b57600080fd5b6020928301965094505085013561292181612779565b9396929550929360400135925050565b60008060006060848603121561294657600080fd5b833561295181612779565b925060208401359150604084013561296881612779565b809150509250925092565b60006020828403121561298557600080fd5b813561275981612779565b6000806000604084860312156129a557600080fd5b83356129b081612779565b9250602084013567ffffffffffffffff8111156129cc57600080fd5b6129d88682870161278e565b9497909650939450505050565b6020808252825182820181905260009190848201906040850190845b81811015612a265783516001600160a01b031683529284019291840191600101612a01565b50909695505050505050565b60008060408385031215612a4557600080fd5b8235612a5081612779565b946020939093013593505050565b60008060408385031215612a7157600080fd5b82359150602083013561289a81612779565b60008060008060008060808789031215612a9c57600080fd5b8635612aa781612779565b955060208701359450604087013567ffffffffffffffff80821115612acb57600080fd5b612ad78a838b0161278e565b90965094506060890135915080821115612af057600080fd5b50612afd89828a0161278e565b979a9699509497509295939492505050565b60008060408385031215612b2257600080fd5b50508035926020909101359150565b634e487b7160e01b600052604160045260246000fd5b604051601f8201601f1916810167ffffffffffffffff81118282101715612b7057612b70612b31565b604052919050565b600067ffffffffffffffff821115612b9257612b92612b31565b50601f01601f191660200190565b600080600060608486031215612bb557600080fd5b8335612bc081612779565b9250602084013567ffffffffffffffff811115612bdc57600080fd5b8401601f81018613612bed57600080fd5b8035612c00612bfb82612b78565b612b47565b818152876020838501011115612c1557600080fd5b81602084016020830137600060208383010152809450505050604084013590509250925092565b60008060008060008060008060e0898b031215612c5857600080fd5b883567ffffffffffffffff811115612c6f57600080fd5b612c7b8b828c0161278e565b9099509750506020890135612c8f81612779565b95506040890135612c9f81612779565b94506060890135612caf81612779565b93506080890135612cbf81612779565b925060a0890135612ccf81612779565b915060c0890135612cdf81612779565b809150509295985092959890939650565b600181811c90821680612d0457607f821691505b602082108103612d2457634e487b7160e01b600052602260045260246000fd5b50919050565b6000808354612d3881612cf0565b60018281168015612d505760018114612d6557612d94565b60ff1984168752821515830287019450612d94565b8760005260208060002060005b85811015612d8b5781548a820152908401908201612d72565b50505082870194505b50506c102937b6329026b0b730b3b2b960991b83525050600d019392505050565b6020808252600f908201526e1d985d5b1d081b9bdd081859191959608a1b604082015260600190565b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052601160045260246000fd5b600060018201612e1c57612e1c612df4565b5060010190565b600060208284031215612e3557600080fd5b815161275981612779565b600060208284031215612e5257600080fd5b815167ffffffffffffffff811115612e6957600080fd5b8201601f81018413612e7a57600080fd5b8051612e88612bfb82612b78565b818152856020838501011115612e9d57600080fd5b612eae8260208301602086016126f6565b95945050505050565b60008251612ec98184602087016126f6565b9190910192915050565b600060208284031215612ee557600080fd5b8151801515811461275957600080fd5b600060208284031215612f0757600080fd5b5051919050565b60208152816020820152818360408301376000818301604090810191909152601f909201601f19160101919050565b81810381811115611be657611be6612df4565b600081612f5f57612f5f612df4565b506000190190565b634e487b7160e01b600052603160045260246000fd5b601f8211156116d857600081815260208120601f850160051c81016020861015612fa45750805b601f850160051c820191505b8181101561220657828155600101612fb0565b67ffffffffffffffff831115612fdb57612fdb612b31565b612fef83612fe98354612cf0565b83612f7d565b6000601f841160018114613023576000851561300b5750838201355b600019600387901b1c1916600186901b17835561307d565b600083815260209020601f19861690835b828110156130545786850135825560209485019460019092019101613034565b50868210156130715760001960f88860031b161c19848701351681555b505060018560011b0183555b5050505050565b600060018060a01b03808816835260a060208401526130a660a084018861271a565b83810360408501526130b8818861271a565b959091166060840152505060800152939250505056fe8c53ae70b0aa86068023c633abcdda89c433a8a76949ea111f756c171fa23663e36275342c99ede79a003741503250226904c6a298f8766fdff5fe056b171b701629cfbd564ce33f37c84741f82a28dcd353c97db5819722102f8704671969be4f78afe9dfc9a0cb0441c27b9405070cd2a48b490636a7bdd09f355e33a5d7de01c38a7d6f5f636faa4e9982efc7dc023d5598f663e3a2a2d4008a5ff3c2de210a0e28cff0ad91cc255a2c6f970ad7d0cc9855e3f9229ce313219b7b468394589409903de1e6fd852dfc61c9dacb48196c48535b60e25abf92acc92dd689078da264697066735822122071530ed176281faa365249f326cb8bb2abd880405e8662ed67c067227fe1b6be64736f6c63430008120033
Deployed Bytecode Sourcemap
125192:29577:0:-:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;126922:56;;-1:-1:-1;;;;;;;;;;;126922:56:0;;;;;160:25:1;;;148:2;133:18;126922:56:0;;;;;;;;147921:142;;;:::i;:::-;;;;;;;:::i;35428:158::-;;;;;;:::i;:::-;;:::i;:::-;;;-1:-1:-1;;;;;1301:32:1;;;1283:51;;1271:2;1256:18;35428:158:0;1137:203:1;131131:327:0;;;;;;:::i;:::-;;:::i;126593:60::-;;-1:-1:-1;;;;;;;;;;;126593:60:0;;154377:116;;;:::i;140918:796::-;;;;;;:::i;:::-;;:::i;:::-;;144788:538;;;;;;:::i;:::-;;:::i;34968:237::-;;;;;;:::i;:::-;35055:7;35112:23;;;;;;;;;;;;35084:51;;;;;;;;;-1:-1:-1;;;;;35084:51:0;;;;;-1:-1:-1;;;35084:51:0;;;-1:-1:-1;;;;;35084:51:0;;;;;;;;;34968:237;;;;;-1:-1:-1;;;;;4429:32:1;;;4411:51;;4493:2;4478:18;;4471:34;;;;4384:18;34968:237:0;4237:274:1;147333:331:0;;;:::i;151899:120::-;;;:::i;138236:1975::-;;;;;;:::i;:::-;;:::i;141927:709::-;;;;;;:::i;:::-;;:::i;152762:112::-;;;:::i;126454:85::-;;-1:-1:-1;;;;;;;;;;;126454:85:0;;152195:135;;;:::i;153837:124::-;;;:::i;146908:303::-;;;;;;:::i;:::-;;:::i;153012:116::-;;;:::i;150753:163::-;;;;;;:::i;:::-;-1:-1:-1;;;;;150869:19:0;;;150845:4;150869:19;;;:11;:19;;;;;:25;;:39;;;150753:163;;;;5579:14:1;;5572:22;5554:41;;5542:2;5527:18;150753:163:0;5414:187:1;151185:157:0;;;;;;:::i;:::-;-1:-1:-1;;;;;151301:19:0;;;151274:7;151301:19;;;:11;:19;;;;;:33;;;;;151185:157;142644:255;;;;;;:::i;:::-;;:::i;153270:120::-;;;:::i;151592:147::-;;;;;;:::i;:::-;-1:-1:-1;;;;;151703:19:0;151676:7;151703:19;;;:11;:19;;;;;:28;;;;151592:147;126814:52;;-1:-1:-1;;;;;;;;;;;126814:52:0;;127158:68;;-1:-1:-1;;;;;;;;;;;127158:68:0;;127036:60;;-1:-1:-1;;;;;;;;;;;127036:60:0;;127629:23;;;;;;:::i;:::-;;:::i;154111:124::-;;;:::i;152490:120::-;;;:::i;148205:105::-;;;:::i;:::-;;;;;;;:::i;149613:688::-;;;;;;:::i;:::-;;:::i;153560:127::-;;;:::i;146447:260::-;;;;;;:::i;:::-;;:::i;126702:60::-;;-1:-1:-1;;;;;;;;;;;126702:60:0;;142907:263;;;;;;:::i;:::-;;:::i;130406:299::-;;;;;;:::i;:::-;;:::i;140429:243::-;;;;;;:::i;:::-;;:::i;145702:409::-;;;;;;:::i;:::-;;:::i;143375:1063::-;;;;;;:::i;:::-;;:::i;154635:131::-;;;:::i;137686:157::-;;;;;;:::i;:::-;;:::i;35805:165::-;;;;;;:::i;:::-;;:::i;149215:141::-;;;;;;:::i;:::-;;:::i;148733:225::-;;;;;;:::i;:::-;;:::i;127537:19::-;;;;;-1:-1:-1;;;;;127537:19:0;;;128249:1618;;;;;;:::i;:::-;;:::i;127944:50::-;;;;;;:::i;:::-;;;;;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;;;;;127944:50:0;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;;;;;11675:15:1;;;11657:34;;11722:2;11707:18;;11700:34;;;;11770:15;;11765:2;11750:18;;11743:43;11817:2;11802:18;;11795:34;;;;11606:3;11591:19;;11388:447;127835:41:0;;;;;;147921:142;147968:13;148025:11;148008:46;;;;;;;;:::i;:::-;;;;;;;;;;;;;147994:61;;147921:142;:::o;35428:158::-;35521:7;35548:23;;;;;;;;;;:30;-1:-1:-1;;;;;35548:30:0;;35428:158::o;131131:327::-;131364:7;-1:-1:-1;;;;;;;;;;;33657:30:0;33675:11;33657:17;:30::i;:::-;131391:59:::1;131401:6;131409:9;131420:5;;131391:59;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;::::0;::::1;::::0;;;;-1:-1:-1;;131391:59:0::1;::::0;;::::1;;::::0;::::1;::::0;;::::1;::::0;::::1;::::0;;;;;;;;;;;-1:-1:-1;131427:7:0;;-1:-1:-1;131427:7:0;;;;131391:59;::::1;131427:7:::0;;;;131391:59;::::1;;::::0;::::1;::::0;;;;-1:-1:-1;131436:13:0;;-1:-1:-1;131391:9:0::1;::::0;-1:-1:-1;;131391:59:0:i:1;:::-;131384:66:::0;131131:327;-1:-1:-1;;;;;;;;;131131:327:0:o;154377:116::-;154434:7;154461:24;-1:-1:-1;;;;;;;;;;;154461:16:0;:24::i;:::-;154454:31;;154377:116;:::o;140918:796::-;-1:-1:-1;;;;;;;;;;;33657:30:0;33675:11;33657:17;:30::i;:::-;-1:-1:-1;;;;;141145:19:0;;::::1;141182:1;141145:19:::0;;;:11:::1;:19;::::0;;;;:25;::::1;141137:67;;;;-1:-1:-1::0;;;141137:67:0::1;;;;;;;:::i;:::-;;;;;;;;;141287:46;::::0;;;;::::1;::::0;;-1:-1:-1;;;;;141296:19:0;;::::1;-1:-1:-1::0;141296:19:0;;;:11:::1;:19;::::0;;;;;;:33:::1;;::::0;;;::::1;141287:46:::0;;;;::::1;::::0;;;;141270:64:::1;::::0;141279:6;;141270:8:::1;:64::i;:::-;141451:58;::::0;;;;::::1;::::0;;;-1:-1:-1;;;;;141451:58:0;::::1;::::0;;-1:-1:-1;;;;;;;;;;;;141476:26:0;;;141451:58:::1;141476:26:::0;;;;:32;-1:-1:-1;;;141476:32:0;::::1;-1:-1:-1::0;;;;;141476:32:0::1;141451:58:::0;;::::1;::::0;141407:113:::1;::::0;141430:6;;141407:8:::1;:113::i;:::-;-1:-1:-1::0;;;;;141571:19:0;;::::1;;::::0;;;:11:::1;:19;::::0;;;;;:33:::1;;:50:::0;;-1:-1:-1;;;;;;141571:50:0::1;::::0;;::::1;::::0;;::::1;::::0;;141663:43;::::1;::::0;141571:19;141663:43:::1;140918:796:::0;;;:::o;144788:538::-;-1:-1:-1;;;;;;;;;;;33657:30:0;33675:11;33657:17;:30::i;:::-;144962:14:::1;::::0;144987:332:::1;145007:18:::0;;::::1;144987:332;;;145056:7;;145064:1;145056:10;;;;;;;:::i;:::-;;;;;;;;;;;;;;:::i;:::-;-1:-1:-1::0;;;;;145156:19:0;;::::1;145193:1;145156:19:::0;;;:11:::1;:19;::::0;;;;:25;145047:19;;-1:-1:-1;145156:25:0::1;145148:67;;;;-1:-1:-1::0;;;145148:67:0::1;;;;;;;:::i;:::-;145265:42;::::0;-1:-1:-1;;;145265:42:0;;-1:-1:-1;;;;;4429:32:1;;;145265:42:0::1;::::0;::::1;4411:51:1::0;4478:18;;;4471:34;;;145265:26:0;::::1;::::0;::::1;::::0;4384:18:1;;145265:42:0::1;;;;;;;;;;;;;;;;;::::0;::::1;;;;;;;;;;;;::::0;::::1;;;;;;;;;145027:3;;;;:::i;:::-;;;144987:332;;;;144951:375;144788:538:::0;;;;;:::o;147333:331::-;-1:-1:-1;;;;;;;;;;;33657:30:0;33675:11;33657:17;:30::i;:::-;147511:42:::1;-1:-1:-1::0;;;;;;;;;;;147542:10:0::1;147511:18;:42::i;:::-;147606:50;-1:-1:-1::0;;;;;;;;;;;147653:1:0::1;147606:18;:50::i;:::-;147333:331:::0;:::o;151899:120::-;151955:7;151982:29;-1:-1:-1;;;;;;;;;;;151982:17:0;:29::i;138236:1975::-;-1:-1:-1;;;;;;;;;;;33657:30:0;33675:11;33657:17;:30::i;:::-;138487:14:::1;138511:6;-1:-1:-1::0;;;;;138504:20:0::1;;:22;;;;;;;;;;;;;;;;;;;;;;;;;;;;::::0;::::1;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;138487:39;;138537:25;138572:6;-1:-1:-1::0;;;;;138565:25:0::1;;:27;;;;;;;;;;;;;;;;;;;;;;;;;;;;::::0;::::1;;;;;;;;;;;;;;;;;::::0;;::::1;-1:-1:-1::0;;138565:27:0::1;::::0;::::1;;::::0;::::1;::::0;;;::::1;::::0;::::1;:::i;:::-;-1:-1:-1::0;;;;;138607:21:0;::::1;138664:1;138607:21:::0;;;:13:::1;:21;::::0;;;;;:34;;138537:55;;-1:-1:-1;138664:1:0;;138607:34:::1;::::0;138537:55;;138607:34:::1;:::i;:::-;::::0;;;::::1;::::0;;::::1;::::0;;;;;;;;:45:::1;::::0;;;;;;;;-1:-1:-1;;;;;138607:45:0::1;:59;138603:193;;-1:-1:-1::0;;;;;138724:21:0;::::1;;::::0;;;:13:::1;:21;::::0;;;;;;:34;;::::1;::::0;138746:11;;138724:34:::1;:::i;:::-;::::0;;;::::1;::::0;;::::1;::::0;;;;;;;;:45:::1;::::0;;;;;;;;-1:-1:-1;;;138690:94:0;;-1:-1:-1;;;;;138724:45:0::1;138690:94;::::0;::::1;1283:51:1::0;1256:18;;138690:94:0::1;1137:203:1::0;138603:193:0::1;138898:4;-1:-1:-1::0;;;;;138857:46:0::1;138864:6;-1:-1:-1::0;;;;;138857:27:0::1;;:29;;;;;;;;;;;;;;;;;;;;;;;;;;;;::::0;::::1;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;-1:-1:-1::0;;;;;138857:46:0::1;;138853:168;;138980:6;-1:-1:-1::0;;;;;138973:34:0::1;;:36;;;;;;;;;;;;;;;;;;;;;;;;;;;;::::0;::::1;;;;;;;;;;;;::::0;::::1;;;;;;;;;138853:168;139071:16;139090:27;-1:-1:-1::0;;;;;;;;;;;139090:17:0::1;:27::i;:::-;139205:37;::::0;-1:-1:-1;;;139205:37:0;;-1:-1:-1;;;;;1301:32:1;;;139205:37:0::1;::::0;::::1;1283:51:1::0;139071:46:0;;-1:-1:-1;139205:29:0;;::::1;::::0;::::1;::::0;1256:18:1;;139205:37:0::1;;;;;;;;;;;;;;;;;::::0;::::1;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;139200:236;;139372:52;::::0;-1:-1:-1;;;139372:52:0;;-1:-1:-1;;;;;1301:32:1;;;139372:52:0::1;::::0;::::1;1283:51:1::0;139372:44:0;::::1;::::0;::::1;::::0;1256:18:1;;139372:52:0::1;;;;;;;;;;;;;;;;;::::0;::::1;;;;;;;;;;;;::::0;::::1;;;;;;;;;139200:236;139478:33;139488:6;139496:14;139478:9;:33::i;:::-;139631:1;-1:-1:-1::0;;;;;139592:41:0::1;139599:6;-1:-1:-1::0;;;;;139592:25:0::1;;:27;;;;;;;;;;;;;;;;;;;;;;;;;;;;::::0;::::1;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;-1:-1:-1::0;;;;;139592:41:0::1;::::0;139588:96:::1;;139650:22;139665:6;139650:14;:22::i;:::-;139767:165;::::0;;::::1;::::0;::::1;::::0;;-1:-1:-1;;;;;139767:165:0;;::::1;::::0;;;::::1;::::0;;::::1;::::0;;;;;::::1;::::0;;;;;;139907:6:::1;:13:::0;;139767:165;;;;;;139745:19;;::::1;-1:-1:-1::0;139745:19:0;;;:11:::1;:19:::0;;;;;:187;;;;;;::::1;-1:-1:-1::0;;;;;;139745:187:0;;::::1;;::::0;;;;;;::::1;::::0;;;;;::::1;::::0;;;;;::::1;::::0;;;::::1;;::::0;;;;::::1;::::0;;::::1;::::0;;;;139987:21;;:13:::1;:21:::0;;;;;;:34;;139757:6;;139987:21;:34:::1;::::0;140009:11;;139987:34:::1;:::i;:::-;::::0;;;::::1;::::0;;;;;;::::1;::::0;;;;;:45:::1;::::0;;;;;;;;:54;;-1:-1:-1;;;;;139987:54:0;;::::1;-1:-1:-1::0;;;;;;139987:54:0;;::::1;;::::0;;;140094:6:::1;:19:::0;;139987:54;140094:19;::::1;::::0;;;;;;;::::1;::::0;;;;::::1;::::0;::::1;::::0;::::1;::::0;;140155:48;;::::1;::::0;140094:19;140155:48:::1;::::0;::::1;::::0;140022:9;160:25:1;;148:2;133:18;;14:177;140155:48:0::1;;;;;;;;138396:1815;;;138236:1975:::0;;;;:::o;141927:709::-;-1:-1:-1;;;;;;;;;;;33657:30:0;33675:11;33657:17;:30::i;:::-;-1:-1:-1;;;;;142142:19:0;;::::1;142179:1;142142:19:::0;;;:11:::1;:19;::::0;;;;:25;::::1;142134:67;;;;-1:-1:-1::0;;;142134:67:0::1;;;;;;;:::i;:::-;142274:21;142298:25;-1:-1:-1::0;;;;;;;;;;;142298:17:0::1;:25::i;:::-;142274:49;;142363:13;-1:-1:-1::0;;;;;142352:24:0::1;:7;-1:-1:-1::0;;;;;142352:24:0::1;;;:68;;;;-1:-1:-1::0;142380:35:0::1;::::0;-1:-1:-1;;;142380:35:0;;-1:-1:-1;;;;;1301:32:1;;;142380:35:0::1;::::0;::::1;1283:51:1::0;142380:20:0;::::1;::::0;::::1;::::0;1256:18:1;;142380:35:0::1;;;;;;;;;;;;;;;;;::::0;::::1;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;:40:::0;::::1;142352:68;142334:169;;;142447:44;142456:6;142464:26;;;;;;;;142473:13;-1:-1:-1::0;;;;;142464:26:0::1;;;;;142488:1;-1:-1:-1::0;;;;;142464:26:0::1;;;::::0;142447:8:::1;:44::i;:::-;142584:43;::::0;;;;::::1;::::0;;;-1:-1:-1;;;;;142584:43:0;::::1;::::0;;-1:-1:-1;;;;;;;;;;;;142602:18:0;;;142584:43:::1;142602:18:::0;;;;:24;-1:-1:-1;;;142602:24:0;::::1;-1:-1:-1::0;;;;;142602:24:0::1;142584:43:::0;;::::1;::::0;142567:61:::1;::::0;142576:6;;142567:8:::1;:61::i;:::-;142055:581;141927:709:::0;;;:::o;152762:112::-;152814:7;152841:25;-1:-1:-1;;;;;;;;;;;152841:17:0;:25::i;152195:135::-;152258:7;152285:37;-1:-1:-1;;;;;;;;;;;152285:17:0;:37::i;153837:124::-;153898:7;153925:28;-1:-1:-1;;;;;;;;;;;153925:16:0;:28::i;146908:303::-;-1:-1:-1;;;;;;;;;;;33657:30:0;33675:11;33657:17;:30::i;:::-;147062:26:::1;:59:::0;;;147139:64:::1;::::0;160:25:1;;;147139:64:0::1;::::0;148:2:1;133:18;147139:64:0::1;;;;;;;146908:303:::0;;:::o;153012:116::-;153066:7;153093:27;-1:-1:-1;;;;;;;;;;;153093:17:0;:27::i;142644:255::-;-1:-1:-1;;;;;;;;;;;33657:30:0;33675:11;33657:17;:30::i;:::-;-1:-1:-1;;;;;142792:19:0;;::::1;142829:1;142792:19:::0;;;:11:::1;:19;::::0;;;;:25;::::1;142784:67;;;;-1:-1:-1::0;;;142784:67:0::1;;;;;;;:::i;:::-;142862:29;::::0;-1:-1:-1;;;142862:29:0;;-1:-1:-1;;;;;142862:22:0;::::1;::::0;::::1;::::0;:29:::1;::::0;142885:5;;;;142862:29:::1;;;:::i;:::-;;;;;;;;;;;;;;;;;;::::0;::::1;;;;;;;;;;;;::::0;::::1;;;;;;;;;142644:255:::0;;;;:::o;153270:120::-;153326:7;153353:29;-1:-1:-1;;;;;;;;;;;153353:17:0;:29::i;127629:23::-;;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;;;;;127629:23:0;;-1:-1:-1;127629:23:0;:::o;154111:124::-;154172:7;154199:28;-1:-1:-1;;;;;;;;;;;154199:16:0;:28::i;152490:120::-;152546:7;152573:29;-1:-1:-1;;;;;;;;;;;152573:17:0;:29::i;148205:105::-;148260:16;148296:6;148289:13;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;;;;;148289:13:0;;;;;;;;;;;;;;;;;;;;;;;148205:105;:::o;149613:688::-;149723:14;149750:23;149785:27;-1:-1:-1;;;;;;;;;;;149785:17:0;:27::i;:::-;-1:-1:-1;;;;;149776:67:0;;:69;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;149750:95;;149856:19;149894:15;-1:-1:-1;;;;;149878:44:0;;:46;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;149856:68;-1:-1:-1;149856:68:0;149937:357;149967:5;;149937:357;;149994:24;-1:-1:-1;;;;;150055:42:0;;;150098:5;150102:1;150098;:5;:::i;:::-;150055:49;;;;;;;;;;;;;160:25:1;;148:2;133:18;;14:177;150055:49:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;-1:-1:-1;;;;;150021:109:0;;:111;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;;150021:111:0;;;;;;;;;;;;:::i;:::-;-1:-1:-1;;;;;150158:21:0;;;;;;:13;:21;;;;;;;:33;;149994:138;;-1:-1:-1;150158:21:0;:33;;149994:138;;150158:33;:::i;:::-;;;;;;;;;;;;;;;;:44;;;;;;;;;-1:-1:-1;;;;;150158:44:0;;-1:-1:-1;150221:20:0;;150217:66;;150262:5;;;150217:66;-1:-1:-1;149974:3:0;;;:::i;:::-;;;149937:357;;;;149739:562;;149613:688;;;;:::o;153560:127::-;153619:7;153646:33;-1:-1:-1;;;;;;;;;;;153646:17:0;:33::i;146447:260::-;-1:-1:-1;;;;;;;;;;;33657:30:0;33675:11;33657:17;:30::i;:::-;-1:-1:-1;;;;;;;;;;;146605:9:0::1;:23:::0;146597:50:::1;;;::::0;-1:-1:-1;;;146597:50:0;;16639:2:1;146597:50:0::1;::::0;::::1;16621:21:1::0;16678:2;16658:18;;;16651:30;-1:-1:-1;;;16697:18:1;;;16690:44;16751:18;;146597:50:0::1;16437:338:1::0;146597:50:0::1;146658:41;146677:9;146688:10;146658:18;:41::i;:::-;146447:260:::0;;;:::o;142907:263::-;-1:-1:-1;;;;;;;;;;;33657:30:0;33675:11;33657:17;:30::i;:::-;-1:-1:-1;;;;;143059:19:0;;::::1;143096:1;143059:19:::0;;;:11:::1;:19;::::0;;;;:25;::::1;143051:67;;;;-1:-1:-1::0;;;143051:67:0::1;;;;;;;:::i;:::-;143129:33;::::0;-1:-1:-1;;;143129:33:0;;-1:-1:-1;;;;;143129:24:0;::::1;::::0;::::1;::::0;:33:::1;::::0;143154:7;;;;143129:33:::1;;;:::i;130406:299::-:0;130607:7;-1:-1:-1;;;;;;;;;;;33657:30:0;33675:11;33657:17;:30::i;:::-;130634:63:::1;130644:6;130652:9;130663:5;;130634:63;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;::::0;::::1;::::0;;;;-1:-1:-1;;130634:63:0::1;::::0;;::::1;;::::0;::::1;::::0;;::::1;::::0;::::1;::::0;;;;;;;;;;;-1:-1:-1;130670:7:0;;-1:-1:-1;130670:7:0;;;;130634:63;::::1;130670:7:::0;;;;130634:63;::::1;;::::0;::::1;::::0;;;;-1:-1:-1;;;130679:17:0;-1:-1:-1;130634:9:0::1;::::0;-1:-1:-1;;130634:63:0:i:1;:::-;130627:70:::0;130406:299;-1:-1:-1;;;;;;;;130406:299:0:o;140429:243::-;140516:25;140574:33;-1:-1:-1;;;;;;;;;;;140574:17:0;:33::i;:::-;140554:53;;140618:46;140638:6;140646:17;140618:19;:46::i;:::-;140429:243;;;:::o;145702:409::-;-1:-1:-1;;;;;;;;;;;33657:30:0;33675:11;33657:17;:30::i;:::-;-1:-1:-1;;;;;;;;;;;145962:9:0::1;:27;;:50;;;;;-1:-1:-1::0;;;;;;;;;;;145993:9:0::1;:19;;145962:50;145940:113;;;::::0;-1:-1:-1;;;145940:113:0;;16982:2:1;145940:113:0::1;::::0;::::1;16964:21:1::0;17021:2;17001:18;;;16994:30;-1:-1:-1;;;17040:18:1;;;17033:43;17093:18;;145940:113:0::1;16780:337:1::0;145940:113:0::1;146064:39;146082:9;146093;146064:17;:39::i;143375:1063::-:0;-1:-1:-1;;;;;;;;;;;33657:30:0;33675:11;33657:17;:30::i;:::-;-1:-1:-1;;;;;143558:19:0;;::::1;143530:25;143558:19:::0;;;:11:::1;:19;::::0;;;;;;;;143530:47;;::::1;::::0;::::1;::::0;;;;;::::1;::::0;;;;;::::1;::::0;;;::::1;::::0;;;;::::1;::::0;::::1;::::0;;;::::1;::::0;;;;;;;::::1;::::0;;::::1;::::0;;;;;143656:54:::1;;;;-1:-1:-1::0;;;143656:54:0::1;;;;;;;:::i;:::-;143808:4;::::0;143771:42:::1;::::0;-1:-1:-1;;;143771:42:0;;-1:-1:-1;;;;;143808:4:0;;::::1;143771:42;::::0;::::1;1283:51:1::0;143771:36:0;;::::1;::::0;::::1;::::0;1256:18:1;;143771:42:0::1;;;;;;;;;;;;;;;;;::::0;::::1;;;;;;;;;;;;::::0;::::1;;;;;;;;;143879:19;143901:6;143924:1;143908:6;:13;;;;:17;;;;:::i;:::-;143901:25;;;;;;;;:::i;:::-;;;;;;;;;;;;;;;;-1:-1:-1::0;;;;;143901:25:0::1;143879:47;;144019:11;143996:6;144003;:12;;;143996:20;;;;;;;;:::i;:::-;;::::0;;;::::1;::::0;;;;;;::::1;:34:::0;;-1:-1:-1;;;;;;143996:34:0::1;-1:-1:-1::0;;;;;143996:34:0;;::::1;;::::0;;144074:12:::1;::::0;::::1;::::0;144041:24;;::::1;::::0;;:11:::1;:24:::0;;;;;:30:::1;;:45:::0;144133:6:::1;:12:::0;;;::::1;;;;:::i;:::-;;::::0;;;::::1;::::0;;;;;-1:-1:-1;;144133:12:0;;;;;-1:-1:-1;;;;;;144133:12:0::1;::::0;;;;;;;;144226;;-1:-1:-1;;;;;144212:27:0;;::::1;::::0;;:13:::1;:27:::0;;;;;;;144240;;-1:-1:-1;;;144240:27:0;;;;144212;;144240:25;;::::1;::::0;::::1;::::0;:27:::1;::::0;;::::1;::::0;;;;;;;:25;:27:::1;;;;;;;;;::::0;::::1;;;;;;;;;;;;;;;;;::::0;;::::1;-1:-1:-1::0;;144240:27:0::1;::::0;::::1;;::::0;::::1;::::0;;;::::1;::::0;::::1;:::i;:::-;144212:56;;;;;;:::i;:::-;::::0;;;::::1;::::0;;::::1;::::0;;;;;;;;144283:15;;::::1;::::0;144212:97:::1;::::0;;;;;;;;;144205:104;;-1:-1:-1;;;;;;144205:104:0;;::::1;::::0;;;-1:-1:-1;;;;;144373:19:0;::::1;::::0;;;:11:::1;:19:::0;;;;;;144366:26;;;::::1;::::0;;-1:-1:-1;144366:26:0;::::1;::::0;;;::::1;::::0;::::1;::::0;;;;::::1;::::0;;;::::1;::::0;;::::1;::::0;;;144410:20:::1;::::0;144212:97;144410:20:::1;143476:962;;143375:1063:::0;;:::o;154635:131::-;154699:7;154726:32;-1:-1:-1;;;;;;;;;;;154726:16:0;:32::i;137686:157::-;137770:65;137782:6;137790:9;137801:33;-1:-1:-1;;;;;;;;;;;137801:17:0;:33::i;137770:65::-;137686:157;;:::o;35805:165::-;35897:7;35932:23;;;;;;;;;;:29;-1:-1:-1;;;35932:29:0;;-1:-1:-1;;;;;35932:29:0;;35805:165::o;149215:141::-;149299:7;149326:22;149338:6;149346:1;149326:11;:22::i;:::-;149319:29;149215:141;-1:-1:-1;;149215:141:0:o;148733:225::-;-1:-1:-1;;;;;148905:21:0;;148878:7;148905:21;;;:13;:21;;;;;;:34;;;;148927:11;;148905:34;:::i;:::-;;;;;;;;;;;;;;;;:45;;;;;;;;;;;-1:-1:-1;;;;;148905:45:0;;148733:225;-1:-1:-1;;;148733:225:0:o;128249:1618::-;128520:4;;-1:-1:-1;;;;;128520:4:0;:18;128512:42;;;;-1:-1:-1;;;128512:42:0;;17456:2:1;128512:42:0;;;17438:21:1;17495:2;17475:18;;;17468:30;-1:-1:-1;;;17514:18:1;;;17507:41;17565:18;;128512:42:0;17254:335:1;128512:42:0;-1:-1:-1;;;;;128573:25:0;;128565:50;;;;-1:-1:-1;;;128565:50:0;;17796:2:1;128565:50:0;;;17778:21:1;17835:2;17815:18;;;17808:30;-1:-1:-1;;;17854:18:1;;;17847:42;17906:18;;128565:50:0;17594:336:1;128565:50:0;128628:4;:18;;-1:-1:-1;;;;;;128628:18:0;-1:-1:-1;;;;;128628:18:0;;;;;128657:11;:26;128671:12;;128657:11;:26;:::i;:::-;-1:-1:-1;128723:6:0;128694:26;:35;128785:43;-1:-1:-1;;;;;;;;;;;128816:11:0;128785:18;:43::i;:::-;128839:40;-1:-1:-1;;;;;;;;;;;33029:5:0;128839:17;:40::i;:::-;128980:43;-1:-1:-1;;;;;;;;;;;129011:11:0;128980:18;:43::i;:::-;129034:302;-1:-1:-1;;;;;;;;;;;129091:234:0;129034:17;:302::i;:::-;129393:35;-1:-1:-1;;;;;;;;;;;129420:7:0;129393:18;:35::i;:::-;129439:50;-1:-1:-1;;;;;;;;;;;32411:2:0;129439:17;:50::i;:::-;129576;-1:-1:-1;;;;;;;;;;;129611:14:0;129576:18;:50::i;:::-;129637:116;-1:-1:-1;;;;;;;;;;;129698:44:0;129637:17;:116::i;:::-;129766:39;-1:-1:-1;;;;;;;;;;;129795:9:0;129766:18;:39::i;:::-;129816:43;-1:-1:-1;;;;;;;;;;;129847:11:0;129816:18;:43::i;33786:154::-;33889:30;33907:11;33889:17;:30::i;:::-;-1:-1:-1;;;;;33875:44:0;:10;-1:-1:-1;;;;;33875:44:0;;33867:65;;;;-1:-1:-1;;;33867:65:0;;20069:2:1;33867:65:0;;;20051:21:1;20108:1;20088:18;;;20081:29;-1:-1:-1;;;20126:18:1;;;20119:38;20174:18;;33867:65:0;19867:331:1;131848:1798:0;132047:14;132165:27;-1:-1:-1;;;;;;;;;;;132165:17:0;:27::i;:::-;-1:-1:-1;;;;;132156:54:0;;132225:6;132246:5;132266:7;132296:4;132316:26;;132156:197;;;;;;;;;;;;;;;;;;;:::i;:::-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;132147:206;;132514:25;132549:6;-1:-1:-1;;;;;132542:25:0;;:27;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;;132542:27:0;;;;;;;;;;;;:::i;:::-;-1:-1:-1;;;;;132584:21:0;;132641:1;132584:21;;;:13;:21;;;;;;:34;;132514:55;;-1:-1:-1;132641:1:0;;132584:34;;132514:55;;132584:34;:::i;:::-;;;;;;;;;;;;;;;;:45;;;;;;;;;-1:-1:-1;;;;;132584:45:0;:59;132580:193;;-1:-1:-1;;;;;132701:21:0;;;;;;:13;:21;;;;;;;:34;;;;132723:11;;132701:34;:::i;:::-;;;;;;;;;;;;;;;;:45;;;;;;;;;-1:-1:-1;;;132667:94:0;;-1:-1:-1;;;;;132701:45:0;132667:94;;;1283:51:1;1256:18;;132667:94:0;1137:203:1;132580:193:0;132785:22;132810:33;-1:-1:-1;;;;;;;;;;;132810:17:0;:33::i;:::-;132785:58;;132899:33;132909:6;132917:14;132899:9;:33::i;:::-;132980:22;132995:6;132980:14;:22::i;:::-;133019:18;;133015:90;;133054:39;133071:6;133079:13;133054:16;:39::i;:::-;133188:165;;;;;;;;-1:-1:-1;;;;;133188:165:0;;;;;;;;;;;;;;;;;;;;;;133328:6;:13;;133188:165;;;;;;133166:19;;;-1:-1:-1;133166:19:0;;;:11;:19;;;;;:187;;;;;;;-1:-1:-1;;;;;;133166:187:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;133408:21;;:13;:21;;;;;;:34;;133178:6;;133408:21;:34;;133430:11;;133408:34;:::i;:::-;;;;;;;;;;;;;;;;;:45;;;;;;;;;:54;;-1:-1:-1;;;;;133408:54:0;;;-1:-1:-1;;;;;;133408:54:0;;;;;;;133515:6;:19;;133408:54;133515:19;;;;;;;;;;;;;;;;;;;;;133590:48;;;;133515:19;133590:48;;;;133443:9;160:25:1;;148:2;133:18;;14:177;133590:48:0;;;;;;;;132063:1583;;131848:1798;;;;;;;:::o;135004:251::-;135122:16;;-1:-1:-1;;;;;135122:30:0;;135118:130;;135193:16;;135219:15;;;;135169:67;;-1:-1:-1;;;135169:67:0;;-1:-1:-1;;;;;4429:32:1;;;135169:67:0;;;4411:51:1;-1:-1:-1;;;;;135211:24:0;;;4478:18:1;;;4471:34;135169:23:0;;;;;;4384:18:1;;135169:67:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;135004:251;;:::o;34153:230::-;34273:10;:21;;;;;;;;;;;:41;;-1:-1:-1;;;;;;34273:41:0;-1:-1:-1;;;;;34273:41:0;;;;;;;;34332:43;;34273:41;;:21;;34332:43;;34273:10;34332:43;34153:230;;:::o;133999:565::-;-1:-1:-1;;;;;;;;;;;134165:10:0;:22;;;;;;;;134148:40;;;;;;;;134165:22;134148:40;-1:-1:-1;;;;;134148:40:0;;;;-1:-1:-1;;;134148:40:0;;-1:-1:-1;;;;;134148:40:0;;;;;;;;;;134157:6;;134148:8;:40::i;:::-;-1:-1:-1;;;;;;;;;;;134260:10:0;:22;;;;;;;;134243:40;;;;;;;;134260:22;134243:40;-1:-1:-1;;;;;134243:40:0;;;;-1:-1:-1;;;134243:40:0;;-1:-1:-1;;;;;134243:40:0;;;;;;;;;;134252:6;;134243:8;:40::i;:::-;-1:-1:-1;;;;;;;;;;;134355:10:0;:18;;;;;;;;134338:36;;;;;;;;134355:18;134338:36;-1:-1:-1;;;;;134338:36:0;;;;-1:-1:-1;;;134338:36:0;;-1:-1:-1;;;;;134338:36:0;;;;;;;;;;134347:6;;134338:8;:36::i;:::-;134487:58;;;;;;;;;-1:-1:-1;;;;;134487:58:0;;;;-1:-1:-1;;;;;;;;;;;;134512:26:0;;;134487:58;134512:26;;;;:32;-1:-1:-1;;;134512:32:0;;-1:-1:-1;;;;;134512:32:0;134487:58;;;;134443:113;;134466:6;;134443:8;:113::i;135519:759::-;135627:18;135648:29;-1:-1:-1;;;;;;;;;;;135648:17:0;:29::i;:::-;135627:50;-1:-1:-1;;;;;;135737:24:0;;;135733:538;;135860:64;;-1:-1:-1;;;135860:64:0;;135892:4;135860:64;;;4411:51:1;32274:1:0;4478:18:1;;;4471:34;-1:-1:-1;;;;;135860:23:0;;;;;4384:18:1;;135860:64:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;;135987:41:0;;-1:-1:-1;;;135987:41:0;;-1:-1:-1;;;;;1301:32:1;;;135987:41:0;;;1283:51:1;135987:29:0;;;-1:-1:-1;135987:29:0;;-1:-1:-1;1256:18:1;;135987:41:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;;136081:67:0;;-1:-1:-1;;;136081:67:0;;136116:4;136081:67;;;4411:51:1;32274:1:0;4478:18:1;;;4471:34;-1:-1:-1;;;;;136081:26:0;;;-1:-1:-1;136081:26:0;;-1:-1:-1;4384:18:1;;136081:67:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;;136220:39:0;;-1:-1:-1;;;136220:39:0;;-1:-1:-1;;;;;1301:32:1;;;136220:39:0;;;1283:51:1;136220:31:0;;;-1:-1:-1;136220:31:0;;-1:-1:-1;1256:18:1;;136220:39:0;1137:203:1;34473:232:0;34591:10;:21;;;;;;;;;;;;:47;;-1:-1:-1;;;;;34591:47:0;-1:-1:-1;;;;;;;;34591:47:0;;;;;;34656:41;;160:25:1;;;34591:21:0;;34656:41;;133:18:1;34656:41:0;;;;;;;34473:232;;:::o;136631:505::-;136830:67;;-1:-1:-1;;;136830:67:0;;136862:4;136830:67;;;4411:51:1;32617:3:0;4478:18:1;;;4471:34;-1:-1:-1;;;;;136830:23:0;;;;;4384:18:1;;136830:67:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;;136966:47:0;;-1:-1:-1;;;136966:47:0;;;;;160:25:1;;;-1:-1:-1;;;;;136966:32:0;;;-1:-1:-1;136966:32:0;;-1:-1:-1;133:18:1;;136966:47:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;;137058:70:0;;-1:-1:-1;;;137058:70:0;;137093:4;137058:70;;;4411:51:1;32617:3:0;4478:18:1;;;4471:34;-1:-1:-1;;;;;137058:26:0;;;-1:-1:-1;137058:26:0;;-1:-1:-1;4384:18:1;;137058:70:0;4237:274:1;196:250;281:1;291:113;305:6;302:1;299:13;291:113;;;381:11;;;375:18;362:11;;;355:39;327:2;320:10;291:113;;;-1:-1:-1;;438:1:1;420:16;;413:27;196:250::o;451:271::-;493:3;531:5;525:12;558:6;553:3;546:19;574:76;643:6;636:4;631:3;627:14;620:4;613:5;609:16;574:76;:::i;:::-;704:2;683:15;-1:-1:-1;;679:29:1;670:39;;;;711:4;666:50;;451:271;-1:-1:-1;;451:271:1:o;727:220::-;876:2;865:9;858:21;839:4;896:45;937:2;926:9;922:18;914:6;896:45;:::i;:::-;888:53;727:220;-1:-1:-1;;;727:220:1:o;952:180::-;1011:6;1064:2;1052:9;1043:7;1039:23;1035:32;1032:52;;;1080:1;1077;1070:12;1032:52;-1:-1:-1;1103:23:1;;952:180;-1:-1:-1;952:180:1:o;1345:131::-;-1:-1:-1;;;;;1420:31:1;;1410:42;;1400:70;;1466:1;1463;1456:12;1481:348;1533:8;1543:6;1597:3;1590:4;1582:6;1578:17;1574:27;1564:55;;1615:1;1612;1605:12;1564:55;-1:-1:-1;1638:20:1;;1681:18;1670:30;;1667:50;;;1713:1;1710;1703:12;1667:50;1750:4;1742:6;1738:17;1726:29;;1802:3;1795:4;1786:6;1778;1774:19;1770:30;1767:39;1764:59;;;1819:1;1816;1809:12;1764:59;1481:348;;;;;:::o;1834:994::-;1953:6;1961;1969;1977;1985;1993;2001;2054:3;2042:9;2033:7;2029:23;2025:33;2022:53;;;2071:1;2068;2061:12;2022:53;2110:9;2097:23;2129:31;2154:5;2129:31;:::i;:::-;2179:5;-1:-1:-1;2231:2:1;2216:18;;2203:32;;-1:-1:-1;2286:2:1;2271:18;;2258:32;2309:18;2339:14;;;2336:34;;;2366:1;2363;2356:12;2336:34;2405:59;2456:7;2447:6;2436:9;2432:22;2405:59;:::i;:::-;2483:8;;-1:-1:-1;2379:85:1;-1:-1:-1;2571:2:1;2556:18;;2543:32;;-1:-1:-1;2587:16:1;;;2584:36;;;2616:1;2613;2606:12;2584:36;;2655:61;2708:7;2697:8;2686:9;2682:24;2655:61;:::i;:::-;1834:994;;;;-1:-1:-1;1834:994:1;;;;;;2817:3;2802:19;;;2789:33;;1834:994;-1:-1:-1;;;;1834:994:1:o;3015:388::-;3083:6;3091;3144:2;3132:9;3123:7;3119:23;3115:32;3112:52;;;3160:1;3157;3150:12;3112:52;3199:9;3186:23;3218:31;3243:5;3218:31;:::i;:::-;3268:5;-1:-1:-1;3325:2:1;3310:18;;3297:32;3338:33;3297:32;3338:33;:::i;:::-;3390:7;3380:17;;;3015:388;;;;;:::o;3408:824::-;3512:6;3520;3528;3536;3589:2;3577:9;3568:7;3564:23;3560:32;3557:52;;;3605:1;3602;3595:12;3557:52;3645:9;3632:23;3674:18;3715:2;3707:6;3704:14;3701:34;;;3731:1;3728;3721:12;3701:34;3769:6;3758:9;3754:22;3744:32;;3814:7;3807:4;3803:2;3799:13;3795:27;3785:55;;3836:1;3833;3826:12;3785:55;3876:2;3863:16;3902:2;3894:6;3891:14;3888:34;;;3918:1;3915;3908:12;3888:34;3973:7;3966:4;3956:6;3953:1;3949:14;3945:2;3941:23;3937:34;3934:47;3931:67;;;3994:1;3991;3984:12;3931:67;4025:4;4017:13;;;;-1:-1:-1;4049:6:1;-1:-1:-1;;4090:20:1;;4077:34;4120:31;4077:34;4120:31;:::i;:::-;3408:824;;;;-1:-1:-1;4170:5:1;;4222:2;4207:18;4194:32;;-1:-1:-1;;3408:824:1:o;4516:456::-;4593:6;4601;4609;4662:2;4650:9;4641:7;4637:23;4633:32;4630:52;;;4678:1;4675;4668:12;4630:52;4717:9;4704:23;4736:31;4761:5;4736:31;:::i;:::-;4786:5;-1:-1:-1;4838:2:1;4823:18;;4810:32;;-1:-1:-1;4894:2:1;4879:18;;4866:32;4907:33;4866:32;4907:33;:::i;:::-;4959:7;4949:17;;;4516:456;;;;;:::o;5162:247::-;5221:6;5274:2;5262:9;5253:7;5249:23;5245:32;5242:52;;;5290:1;5287;5280:12;5242:52;5329:9;5316:23;5348:31;5373:5;5348:31;:::i;5606:546::-;5686:6;5694;5702;5755:2;5743:9;5734:7;5730:23;5726:32;5723:52;;;5771:1;5768;5761:12;5723:52;5810:9;5797:23;5829:31;5854:5;5829:31;:::i;:::-;5879:5;-1:-1:-1;5935:2:1;5920:18;;5907:32;5962:18;5951:30;;5948:50;;;5994:1;5991;5984:12;5948:50;6033:59;6084:7;6075:6;6064:9;6060:22;6033:59;:::i;:::-;5606:546;;6111:8;;-1:-1:-1;6007:85:1;;-1:-1:-1;;;;5606:546:1:o;6157:658::-;6328:2;6380:21;;;6450:13;;6353:18;;;6472:22;;;6299:4;;6328:2;6551:15;;;;6525:2;6510:18;;;6299:4;6594:195;6608:6;6605:1;6602:13;6594:195;;;6673:13;;-1:-1:-1;;;;;6669:39:1;6657:52;;6764:15;;;;6729:12;;;;6705:1;6623:9;6594:195;;;-1:-1:-1;6806:3:1;;6157:658;-1:-1:-1;;;;;;6157:658:1:o;6820:315::-;6888:6;6896;6949:2;6937:9;6928:7;6924:23;6920:32;6917:52;;;6965:1;6962;6955:12;6917:52;7004:9;6991:23;7023:31;7048:5;7023:31;:::i;:::-;7073:5;7125:2;7110:18;;;;7097:32;;-1:-1:-1;;;6820:315:1:o;7140:::-;7208:6;7216;7269:2;7257:9;7248:7;7244:23;7240:32;7237:52;;;7285:1;7282;7275:12;7237:52;7321:9;7308:23;7298:33;;7381:2;7370:9;7366:18;7353:32;7394:31;7419:5;7394:31;:::i;7460:925::-;7570:6;7578;7586;7594;7602;7610;7663:3;7651:9;7642:7;7638:23;7634:33;7631:53;;;7680:1;7677;7670:12;7631:53;7719:9;7706:23;7738:31;7763:5;7738:31;:::i;:::-;7788:5;-1:-1:-1;7840:2:1;7825:18;;7812:32;;-1:-1:-1;7895:2:1;7880:18;;7867:32;7918:18;7948:14;;;7945:34;;;7975:1;7972;7965:12;7945:34;8014:59;8065:7;8056:6;8045:9;8041:22;8014:59;:::i;:::-;8092:8;;-1:-1:-1;7988:85:1;-1:-1:-1;8180:2:1;8165:18;;8152:32;;-1:-1:-1;8196:16:1;;;8193:36;;;8225:1;8222;8215:12;8193:36;;8264:61;8317:7;8306:8;8295:9;8291:24;8264:61;:::i;:::-;7460:925;;;;-1:-1:-1;7460:925:1;;-1:-1:-1;7460:925:1;;8344:8;;7460:925;-1:-1:-1;;;7460:925:1:o;8390:248::-;8458:6;8466;8519:2;8507:9;8498:7;8494:23;8490:32;8487:52;;;8535:1;8532;8525:12;8487:52;-1:-1:-1;;8558:23:1;;;8628:2;8613:18;;;8600:32;;-1:-1:-1;8390:248:1:o;8643:127::-;8704:10;8699:3;8695:20;8692:1;8685:31;8735:4;8732:1;8725:15;8759:4;8756:1;8749:15;8775:275;8846:2;8840:9;8911:2;8892:13;;-1:-1:-1;;8888:27:1;8876:40;;8946:18;8931:34;;8967:22;;;8928:62;8925:88;;;8993:18;;:::i;:::-;9029:2;9022:22;8775:275;;-1:-1:-1;8775:275:1:o;9055:187::-;9104:4;9137:18;9129:6;9126:30;9123:56;;;9159:18;;:::i;:::-;-1:-1:-1;9225:2:1;9204:15;-1:-1:-1;;9200:29:1;9231:4;9196:40;;9055:187::o;9247:876::-;9334:6;9342;9350;9403:2;9391:9;9382:7;9378:23;9374:32;9371:52;;;9419:1;9416;9409:12;9371:52;9458:9;9445:23;9477:31;9502:5;9477:31;:::i;:::-;9527:5;-1:-1:-1;9583:2:1;9568:18;;9555:32;9610:18;9599:30;;9596:50;;;9642:1;9639;9632:12;9596:50;9665:22;;9718:4;9710:13;;9706:27;-1:-1:-1;9696:55:1;;9747:1;9744;9737:12;9696:55;9783:2;9770:16;9808:49;9824:32;9853:2;9824:32;:::i;:::-;9808:49;:::i;:::-;9880:2;9873:5;9866:17;9920:7;9915:2;9910;9906;9902:11;9898:20;9895:33;9892:53;;;9941:1;9938;9931:12;9892:53;9996:2;9991;9987;9983:11;9978:2;9971:5;9967:14;9954:45;10040:1;10035:2;10030;10023:5;10019:14;10015:23;10008:34;10061:5;10051:15;;;;;10113:2;10102:9;10098:18;10085:32;10075:42;;9247:876;;;;;:::o;10128:1255::-;10253:6;10261;10269;10277;10285;10293;10301;10309;10362:3;10350:9;10341:7;10337:23;10333:33;10330:53;;;10379:1;10376;10369:12;10330:53;10419:9;10406:23;10452:18;10444:6;10441:30;10438:50;;;10484:1;10481;10474:12;10438:50;10523:59;10574:7;10565:6;10554:9;10550:22;10523:59;:::i;:::-;10601:8;;-1:-1:-1;10497:85:1;-1:-1:-1;;10686:2:1;10671:18;;10658:32;10699:31;10658:32;10699:31;:::i;:::-;10749:5;-1:-1:-1;10806:2:1;10791:18;;10778:32;10819:33;10778:32;10819:33;:::i;:::-;10871:7;-1:-1:-1;10930:2:1;10915:18;;10902:32;10943:33;10902:32;10943:33;:::i;:::-;10995:7;-1:-1:-1;11054:3:1;11039:19;;11026:33;11068;11026;11068;:::i;:::-;11120:7;-1:-1:-1;11179:3:1;11164:19;;11151:33;11193;11151;11193;:::i;:::-;11245:7;-1:-1:-1;11304:3:1;11289:19;;11276:33;11318;11276;11318;:::i;:::-;11370:7;11360:17;;;10128:1255;;;;;;;;;;;:::o;11840:380::-;11919:1;11915:12;;;;11962;;;11983:61;;12037:4;12029:6;12025:17;12015:27;;11983:61;12090:2;12082:6;12079:14;12059:18;12056:38;12053:161;;12136:10;12131:3;12127:20;12124:1;12117:31;12171:4;12168:1;12161:15;12199:4;12196:1;12189:15;12053:161;;11840:380;;;:::o;12351:989::-;12580:3;12609:1;12642:6;12636:13;12672:36;12698:9;12672:36;:::i;:::-;12727:1;12744:18;;;12771:133;;;;12918:1;12913:356;;;;12737:532;;12771:133;-1:-1:-1;;12804:24:1;;12792:37;;12877:14;;12870:22;12858:35;;12849:45;;;-1:-1:-1;12771:133:1;;12913:356;12944:6;12941:1;12934:17;12974:4;13019:2;13016:1;13006:16;13044:1;13058:165;13072:6;13069:1;13066:13;13058:165;;;13150:14;;13137:11;;;13130:35;13193:16;;;;13087:10;;13058:165;;;13062:3;;;13252:6;13247:3;13243:16;13236:23;;12737:532;-1:-1:-1;;;;;13278:28:1;;-1:-1:-1;;13331:2:1;13322:12;;12351:989;-1:-1:-1;;;12351:989:1:o;13345:339::-;13547:2;13529:21;;;13586:2;13566:18;;;13559:30;-1:-1:-1;;;13620:2:1;13605:18;;13598:45;13675:2;13660:18;;13345:339::o;13689:127::-;13750:10;13745:3;13741:20;13738:1;13731:31;13781:4;13778:1;13771:15;13805:4;13802:1;13795:15;13821:127;13882:10;13877:3;13873:20;13870:1;13863:31;13913:4;13910:1;13903:15;13937:4;13934:1;13927:15;13953:135;13992:3;14013:17;;;14010:43;;14033:18;;:::i;:::-;-1:-1:-1;14080:1:1;14069:13;;13953:135::o;14093:251::-;14163:6;14216:2;14204:9;14195:7;14191:23;14187:32;14184:52;;;14232:1;14229;14222:12;14184:52;14264:9;14258:16;14283:31;14308:5;14283:31;:::i;14349:649::-;14429:6;14482:2;14470:9;14461:7;14457:23;14453:32;14450:52;;;14498:1;14495;14488:12;14450:52;14531:9;14525:16;14564:18;14556:6;14553:30;14550:50;;;14596:1;14593;14586:12;14550:50;14619:22;;14672:4;14664:13;;14660:27;-1:-1:-1;14650:55:1;;14701:1;14698;14691:12;14650:55;14730:2;14724:9;14755:49;14771:32;14800:2;14771:32;:::i;14755:49::-;14827:2;14820:5;14813:17;14867:7;14862:2;14857;14853;14849:11;14845:20;14842:33;14839:53;;;14888:1;14885;14878:12;14839:53;14901:67;14965:2;14960;14953:5;14949:14;14944:2;14940;14936:11;14901:67;:::i;:::-;14987:5;14349:649;-1:-1:-1;;;;;14349:649:1:o;15003:289::-;15134:3;15172:6;15166:13;15188:66;15247:6;15242:3;15235:4;15227:6;15223:17;15188:66;:::i;:::-;15270:16;;;;;15003:289;-1:-1:-1;;15003:289:1:o;15297:277::-;15364:6;15417:2;15405:9;15396:7;15392:23;15388:32;15385:52;;;15433:1;15430;15423:12;15385:52;15465:9;15459:16;15518:5;15511:13;15504:21;15497:5;15494:32;15484:60;;15540:1;15537;15530:12;15579:184;15649:6;15702:2;15690:9;15681:7;15677:23;15673:32;15670:52;;;15718:1;15715;15708:12;15670:52;-1:-1:-1;15741:16:1;;15579:184;-1:-1:-1;15579:184:1:o;15768:390::-;15927:2;15916:9;15909:21;15966:6;15961:2;15950:9;15946:18;15939:34;16023:6;16015;16010:2;15999:9;15995:18;15982:48;16079:1;16050:22;;;16074:2;16046:31;;;16039:42;;;;16142:2;16121:15;;;-1:-1:-1;;16117:29:1;16102:45;16098:54;;15768:390;-1:-1:-1;15768:390:1:o;16163:128::-;16230:9;;;16251:11;;;16248:37;;;16265:18;;:::i;16296:136::-;16335:3;16363:5;16353:39;;16372:18;;:::i;:::-;-1:-1:-1;;;16408:18:1;;16296:136::o;17122:127::-;17183:10;17178:3;17174:20;17171:1;17164:31;17214:4;17211:1;17204:15;17238:4;17235:1;17228:15;17935:545;18037:2;18032:3;18029:11;18026:448;;;18073:1;18098:5;18094:2;18087:17;18143:4;18139:2;18129:19;18213:2;18201:10;18197:19;18194:1;18190:27;18184:4;18180:38;18249:4;18237:10;18234:20;18231:47;;;-1:-1:-1;18272:4:1;18231:47;18327:2;18322:3;18318:12;18315:1;18311:20;18305:4;18301:31;18291:41;;18382:82;18400:2;18393:5;18390:13;18382:82;;;18445:17;;;18426:1;18415:13;18382:82;;18656:1206;18780:18;18775:3;18772:27;18769:53;;;18802:18;;:::i;:::-;18831:94;18921:3;18881:38;18913:4;18907:11;18881:38;:::i;:::-;18875:4;18831:94;:::i;:::-;18951:1;18976:2;18971:3;18968:11;18993:1;18988:616;;;;19648:1;19665:3;19662:93;;;-1:-1:-1;19721:19:1;;;19708:33;19662:93;-1:-1:-1;;18613:1:1;18609:11;;;18605:24;18601:29;18591:40;18637:1;18633:11;;;18588:57;19768:78;;18961:895;;18988:616;12298:1;12291:14;;;12335:4;12322:18;;-1:-1:-1;;19024:17:1;;;19125:9;19147:229;19161:7;19158:1;19155:14;19147:229;;;19250:19;;;19237:33;19222:49;;19357:4;19342:20;;;;19310:1;19298:14;;;;19177:12;19147:229;;;19151:3;19404;19395:7;19392:16;19389:159;;;19528:1;19524:6;19518:3;19512;19509:1;19505:11;19501:21;19497:34;19493:39;19480:9;19475:3;19471:19;19458:33;19454:79;19446:6;19439:95;19389:159;;;19591:1;19585:3;19582:1;19578:11;19574:19;19568:4;19561:33;18961:895;;;18656:1206;;;:::o;20203:655::-;20447:4;20493:1;20489;20484:3;20480:11;20476:19;20534:2;20526:6;20522:15;20511:9;20504:34;20574:3;20569:2;20558:9;20554:18;20547:31;20601:46;20642:3;20631:9;20627:19;20619:6;20601:46;:::i;:::-;20695:9;20687:6;20683:22;20678:2;20667:9;20663:18;20656:50;20723:33;20749:6;20741;20723:33;:::i;:::-;20792:15;;;;20787:2;20772:18;;20765:43;-1:-1:-1;;20839:3:1;20824:19;20817:35;20715:41;20203:655;-1:-1:-1;;;20203:655:1:o
Swarm Source
ipfs://71530ed176281faa365249f326cb8bb2abd880405e8662ed67c067227fe1b6be
Loading...
Loading
Loading...
Loading

Loading...
Loading
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.