More Info
Private Name Tags
ContractCreator
TokenTracker
Latest 25 from a total of 39 transactions
Transaction Hash |
Method
|
Block
|
From
|
To
|
|||||
---|---|---|---|---|---|---|---|---|---|
Approve | 22022728 | 212 days ago | IN | 0 ETH | 0.00002897 | ||||
Approve | 21028405 | 351 days ago | IN | 0 ETH | 0.00048206 | ||||
Approve | 20674667 | 400 days ago | IN | 0 ETH | 0.00001922 | ||||
Approve | 20470172 | 429 days ago | IN | 0 ETH | 0.00071464 | ||||
Approve | 20266106 | 457 days ago | IN | 0 ETH | 0.00013273 | ||||
Approve | 20179960 | 469 days ago | IN | 0 ETH | 0.00026899 | ||||
Approve | 20031798 | 490 days ago | IN | 0 ETH | 0.00071403 | ||||
Approve | 19809711 | 521 days ago | IN | 0 ETH | 0.00013156 | ||||
Approve | 19782369 | 525 days ago | IN | 0 ETH | 0.00037891 | ||||
Approve | 19782369 | 525 days ago | IN | 0 ETH | 0.00037891 | ||||
Approve | 19782368 | 525 days ago | IN | 0 ETH | 0.00038087 | ||||
Approve | 19151991 | 613 days ago | IN | 0 ETH | 0.00057754 | ||||
Approve | 19005155 | 634 days ago | IN | 0 ETH | 0.00267726 | ||||
Approve | 17433497 | 854 days ago | IN | 0 ETH | 0.00085722 | ||||
Approve | 17369587 | 863 days ago | IN | 0 ETH | 0.00250323 | ||||
Approve | 17223126 | 884 days ago | IN | 0 ETH | 0.00485073 | ||||
Approve | 17184141 | 889 days ago | IN | 0 ETH | 0.00327626 | ||||
Approve | 17184141 | 889 days ago | IN | 0 ETH | 0.0032805 | ||||
Approve | 17004918 | 915 days ago | IN | 0 ETH | 0.00101111 | ||||
Approve | 16992266 | 916 days ago | IN | 0 ETH | 0.00145042 | ||||
Approve | 16985034 | 917 days ago | IN | 0 ETH | 0.00099672 | ||||
Approve | 16984103 | 918 days ago | IN | 0 ETH | 0.00165807 | ||||
Approve | 16983579 | 918 days ago | IN | 0 ETH | 0.00199156 | ||||
Approve | 16982181 | 918 days ago | IN | 0 ETH | 0.00120395 | ||||
Approve | 16960895 | 921 days ago | IN | 0 ETH | 0.00076594 |
Latest 25 internal transactions (View All)
Advanced mode:
Parent Transaction Hash | Method | Block |
From
|
To
|
|||
---|---|---|---|---|---|---|---|
Transfer | 22022731 | 212 days ago | 0.01390724 ETH | ||||
Transfer | 22022731 | 212 days ago | 0.01390724 ETH | ||||
Transfer | 21028407 | 351 days ago | 0.06425922 ETH | ||||
Transfer | 21028407 | 351 days ago | 0.06425922 ETH | ||||
Transfer | 20990980 | 356 days ago | 0.1628593 ETH | ||||
Transfer | 20990980 | 356 days ago | 0.1628593 ETH | ||||
Transfer | 20191349 | 468 days ago | 4.60937635 ETH | ||||
Transfer | 20191349 | 468 days ago | 4.60937635 ETH | ||||
Transfer | 19159627 | 612 days ago | 0.01042968 ETH | ||||
Transfer | 19159627 | 612 days ago | 0.01042968 ETH | ||||
Transfer | 19159627 | 612 days ago | 0.01043073 ETH | ||||
Transfer | 19159627 | 612 days ago | 0.01043073 ETH | ||||
Transfer | 19152001 | 613 days ago | 0.04302302 ETH | ||||
Transfer | 19152001 | 613 days ago | 0.04302302 ETH | ||||
Deposit | 16921410 | 926 days ago | 29 ETH | ||||
Deposit | 16921410 | 926 days ago | 29 ETH | ||||
Deposit | 16919088 | 927 days ago | 50 ETH | ||||
Deposit | 16919088 | 927 days ago | 50 ETH | ||||
Transfer | 16883454 | 932 days ago | 13.87114337 ETH | ||||
Transfer | 16883454 | 932 days ago | 13.87114337 ETH | ||||
Transfer | 16883312 | 932 days ago | 13.87416961 ETH | ||||
Transfer | 16883312 | 932 days ago | 13.87416961 ETH | ||||
Deposit | 16872881 | 933 days ago | 35 ETH | ||||
Deposit | 16872881 | 933 days ago | 35 ETH | ||||
Deposit | 16824189 | 940 days ago | 10 ETH |
Cross-Chain Transactions
Loading...
Loading
Contract Name:
PendleAuraWethWstethSY
Compiler Version
v0.8.17+commit.8df45f5f
Optimization Enabled:
Yes with 24000 runs
Other Settings:
default evmVersion
Contract Source Code (Solidity Standard Json-Input format)
// SPDX-License-Identifier: GPL-3.0-or-later pragma solidity 0.8.17; import "@openzeppelin/contracts/token/ERC20/IERC20.sol"; import "./base/PendleAuraBalancerStableLPSY.sol"; import "../../StEthHelper.sol"; import "./base/MetaStable/MetaStablePreview.sol"; contract PendleAuraWethWstethSY is PendleAuraBalancerStableLPSY, StEthHelper { uint256 internal constant AURA_PID = 29; address internal constant LP = 0x32296969Ef14EB0c6d29669C550D4a0449130230; constructor( string memory _name, string memory _symbol, MetaStablePreview _previewHelper ) PendleAuraBalancerStableLPSY(_name, _symbol, LP, AURA_PID, _previewHelper) StEthHelper() {} function _deposit(address tokenIn, uint256 amount) internal virtual override returns (uint256 amountSharesOut) { if (tokenIn == NATIVE) { IWETH(WETH).deposit{ value: amount }(); amountSharesOut = super._deposit(WETH, amount); } else if (tokenIn == STETH) { uint256 amountWstETH = _depositWstETH(STETH, amount); amountSharesOut = super._deposit(WSTETH, amountWstETH); } else { amountSharesOut = super._deposit(tokenIn, amount); } } function _redeem( address receiver, address tokenOut, uint256 amountSharesToRedeem ) internal virtual override returns (uint256 amountTokenOut) { if (tokenOut == NATIVE) { amountTokenOut = super._redeem(address(this), WETH, amountSharesToRedeem); IWETH(WETH).withdraw(amountTokenOut); _transferOut(NATIVE, receiver, amountTokenOut); } else if (tokenOut == STETH) { uint256 amountWstETH = super._redeem(address(this), WSTETH, amountSharesToRedeem); amountTokenOut = _redeemWstETH(receiver, amountWstETH); } else { amountTokenOut = super._redeem(receiver, tokenOut, amountSharesToRedeem); } } function _previewDeposit(address tokenIn, uint256 amountTokenToDeposit) internal view virtual override returns (uint256 amountSharesOut) { if (tokenIn == NATIVE) { amountSharesOut = super._previewDeposit(WETH, amountTokenToDeposit); } else if (tokenIn == STETH) { uint256 amountWstETH = _previewDepositWstETH(STETH, amountTokenToDeposit); amountSharesOut = super._previewDeposit(WSTETH, amountWstETH); } else { amountSharesOut = super._previewDeposit(tokenIn, amountTokenToDeposit); } } function _previewRedeem(address tokenOut, uint256 amountSharesToRedeem) internal view virtual override returns (uint256 amountTokenOut) { if (tokenOut == NATIVE) { amountTokenOut = super._previewRedeem(WETH, amountSharesToRedeem); } else if (tokenOut == STETH) { uint256 amountWstETH = super._previewRedeem(WSTETH, amountSharesToRedeem); amountTokenOut = _previewRedeemWstETH(amountWstETH); } else { amountTokenOut = super._previewRedeem(tokenOut, amountSharesToRedeem); } } function _getPoolTokenAddresses() internal view virtual override returns (address[] memory res) { res = new address[](2); res[0] = WSTETH; res[1] = WETH; } function _getRateProviders() internal view virtual returns (address[] memory res) { res = new address[](2); res[0] = 0x72D07D7DcA67b8A406aD1Ec34ce969c90bFEE768; res[1] = 0x0000000000000000000000000000000000000000; } function _getRawScalingFactors() internal view virtual returns (uint256[] memory res) { res = new uint256[](2); res[0] = 1e18; res[1] = 1e18; } function _getImmutablePoolData() internal view virtual override returns (bytes memory) { MetaStablePreview.ImmutableData memory res; res.LP = LP; res.poolTokens = _getPoolTokenAddresses(); res.rateProviders = _getRateProviders(); res.rawScalingFactors = _getRawScalingFactors(); return abi.encode(res); } function getTokensIn() public view virtual override returns (address[] memory res) { res = new address[](5); res[0] = LP; res[1] = WSTETH; res[2] = WETH; res[3] = STETH; res[4] = NATIVE; } function getTokensOut() public view virtual override returns (address[] memory res) { res = new address[](5); res[0] = LP; res[1] = WSTETH; res[2] = WETH; res[3] = STETH; res[4] = NATIVE; } function isValidTokenIn(address token) public view virtual override returns (bool) { return (token == LP || token == WSTETH || token == WETH || token == STETH || token == NATIVE); } function isValidTokenOut(address token) public view virtual override returns (bool) { return (token == LP || token == WSTETH || token == WETH || token == STETH || token == NATIVE); } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.7.0) (proxy/utils/Initializable.sol) pragma solidity ^0.8.2; import "../../utils/AddressUpgradeable.sol"; /** * @dev This is a base contract to aid in writing upgradeable contracts, or any kind of contract that will be deployed * behind a proxy. Since proxied contracts do not make use of a constructor, it's common to move constructor logic to an * external initializer function, usually called `initialize`. It then becomes necessary to protect this initializer * function so it can only be called once. The {initializer} modifier provided by this contract will have this effect. * * The initialization functions use a version number. Once a version number is used, it is consumed and cannot be * reused. This mechanism prevents re-execution of each "step" but allows the creation of new initialization steps in * case an upgrade adds a module that needs to be initialized. * * For example: * * [.hljs-theme-light.nopadding] * ``` * contract MyToken is ERC20Upgradeable { * function initialize() initializer public { * __ERC20_init("MyToken", "MTK"); * } * } * contract MyTokenV2 is MyToken, ERC20PermitUpgradeable { * function initializeV2() reinitializer(2) public { * __ERC20Permit_init("MyToken"); * } * } * ``` * * TIP: To avoid leaving the proxy in an uninitialized state, the initializer function should be called as early as * possible by providing the encoded function call as the `_data` argument to {ERC1967Proxy-constructor}. * * CAUTION: When used with inheritance, manual care must be taken to not invoke a parent initializer twice, or to ensure * that all initializers are idempotent. This is not verified automatically as constructors are by Solidity. * * [CAUTION] * ==== * Avoid leaving a contract uninitialized. * * An uninitialized contract can be taken over by an attacker. This applies to both a proxy and its implementation * contract, which may impact the proxy. To prevent the implementation contract from being used, you should invoke * the {_disableInitializers} function in the constructor to automatically lock it when it is deployed: * * [.hljs-theme-light.nopadding] * ``` * /// @custom:oz-upgrades-unsafe-allow constructor * constructor() { * _disableInitializers(); * } * ``` * ==== */ abstract contract Initializable { /** * @dev Indicates that the contract has been initialized. * @custom:oz-retyped-from bool */ uint8 private _initialized; /** * @dev Indicates that the contract is in the process of being initialized. */ bool private _initializing; /** * @dev Triggered when the contract has been initialized or reinitialized. */ event Initialized(uint8 version); /** * @dev A modifier that defines a protected initializer function that can be invoked at most once. In its scope, * `onlyInitializing` functions can be used to initialize parent contracts. Equivalent to `reinitializer(1)`. */ modifier initializer() { bool isTopLevelCall = !_initializing; require( (isTopLevelCall && _initialized < 1) || (!AddressUpgradeable.isContract(address(this)) && _initialized == 1), "Initializable: contract is already initialized" ); _initialized = 1; if (isTopLevelCall) { _initializing = true; } _; if (isTopLevelCall) { _initializing = false; emit Initialized(1); } } /** * @dev A modifier that defines a protected reinitializer function that can be invoked at most once, and only if the * contract hasn't been initialized to a greater version before. In its scope, `onlyInitializing` functions can be * used to initialize parent contracts. * * `initializer` is equivalent to `reinitializer(1)`, so a reinitializer may be used after the original * initialization step. This is essential to configure modules that are added through upgrades and that require * initialization. * * Note that versions can jump in increments greater than 1; this implies that if multiple reinitializers coexist in * a contract, executing them in the right order is up to the developer or operator. */ modifier reinitializer(uint8 version) { require(!_initializing && _initialized < version, "Initializable: contract is already initialized"); _initialized = version; _initializing = true; _; _initializing = false; emit Initialized(version); } /** * @dev Modifier to protect an initialization function so that it can only be invoked by functions with the * {initializer} and {reinitializer} modifiers, directly or indirectly. */ modifier onlyInitializing() { require(_initializing, "Initializable: contract is not initializing"); _; } /** * @dev Locks the contract, preventing any future reinitialization. This cannot be part of an initializer call. * Calling this in the constructor of a contract will prevent that contract from being initialized or reinitialized * to any version. It is recommended to use this to lock implementation contracts that are designed to be called * through proxies. */ function _disableInitializers() internal virtual { require(!_initializing, "Initializable: contract is initializing"); if (_initialized < type(uint8).max) { _initialized = type(uint8).max; emit Initialized(type(uint8).max); } } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.7.0) (utils/Address.sol) pragma solidity ^0.8.1; /** * @dev Collection of functions related to the address type */ library AddressUpgradeable { /** * @dev Returns true if `account` is a contract. * * [IMPORTANT] * ==== * It is unsafe to assume that an address for which this function returns * false is an externally-owned account (EOA) and not a contract. * * Among others, `isContract` will return false for the following * types of addresses: * * - an externally-owned account * - a contract in construction * - an address where a contract will be created * - an address where a contract lived, but was destroyed * ==== * * [IMPORTANT] * ==== * You shouldn't rely on `isContract` to protect against flash loan attacks! * * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract * constructor. * ==== */ function isContract(address account) internal view returns (bool) { // This method relies on extcodesize/address.code.length, which returns 0 // for contracts in construction, since the code is only stored at the end // of the constructor execution. return account.code.length > 0; } /** * @dev Replacement for Solidity's `transfer`: sends `amount` wei to * `recipient`, forwarding all available gas and reverting on errors. * * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost * of certain opcodes, possibly making contracts go over the 2300 gas limit * imposed by `transfer`, making them unable to receive funds via * `transfer`. {sendValue} removes this limitation. * * https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more]. * * IMPORTANT: because control is transferred to `recipient`, care must be * taken to not create reentrancy vulnerabilities. Consider using * {ReentrancyGuard} or the * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern]. */ function sendValue(address payable recipient, uint256 amount) internal { require(address(this).balance >= amount, "Address: insufficient balance"); (bool success, ) = recipient.call{value: amount}(""); require(success, "Address: unable to send value, recipient may have reverted"); } /** * @dev Performs a Solidity function call using a low level `call`. A * plain `call` is an unsafe replacement for a function call: use this * function instead. * * If `target` reverts with a revert reason, it is bubbled up by this * function (like regular Solidity function calls). * * Returns the raw returned data. To convert to the expected return value, * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`]. * * Requirements: * * - `target` must be a contract. * - calling `target` with `data` must not revert. * * _Available since v3.1._ */ function functionCall(address target, bytes memory data) internal returns (bytes memory) { return functionCall(target, data, "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"); require(isContract(target), "Address: call to non-contract"); (bool success, bytes memory returndata) = target.call{value: value}(data); return verifyCallResult(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) { require(isContract(target), "Address: static call to non-contract"); (bool success, bytes memory returndata) = target.staticcall(data); return verifyCallResult(success, returndata, errorMessage); } /** * @dev Tool to verifies that a low level call was successful, and revert if it wasn't, either by bubbling the * revert reason 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 { // Look for revert reason and bubble it up if present if (returndata.length > 0) { // The easiest way to bubble the revert reason is using memory via assembly /// @solidity memory-safe-assembly assembly { let returndata_size := mload(returndata) revert(add(32, returndata), returndata_size) } } else { revert(errorMessage); } } } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.5.0) (interfaces/draft-IERC1822.sol) pragma solidity ^0.8.0; /** * @dev ERC1822: Universal Upgradeable Proxy Standard (UUPS) documents a method for upgradeability through a simplified * proxy whose upgrades are fully controlled by the current implementation. */ interface IERC1822Proxiable { /** * @dev Returns the storage slot that the proxiable contract assumes is being used to store the implementation * address. * * IMPORTANT: A proxy pointing at a proxiable contract should not be considered proxiable itself, because this risks * bricking a proxy that upgrades to it, by delegating to itself until out of gas. Thus it is critical that this * function revert if invoked through a proxy. */ function proxiableUUID() external view returns (bytes32); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (proxy/beacon/IBeacon.sol) pragma solidity ^0.8.0; /** * @dev This is the interface that {BeaconProxy} expects of its beacon. */ interface IBeacon { /** * @dev Must return an address that can be used as a delegate call target. * * {BeaconProxy} will check that this address is a contract. */ function implementation() external view returns (address); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.5.0) (proxy/ERC1967/ERC1967Upgrade.sol) pragma solidity ^0.8.2; import "../beacon/IBeacon.sol"; import "../../interfaces/draft-IERC1822.sol"; import "../../utils/Address.sol"; import "../../utils/StorageSlot.sol"; /** * @dev This abstract contract provides getters and event emitting update functions for * https://eips.ethereum.org/EIPS/eip-1967[EIP1967] slots. * * _Available since v4.1._ * * @custom:oz-upgrades-unsafe-allow delegatecall */ abstract contract ERC1967Upgrade { // This is the keccak-256 hash of "eip1967.proxy.rollback" subtracted by 1 bytes32 private constant _ROLLBACK_SLOT = 0x4910fdfa16fed3260ed0e7147f7cc6da11a60208b5b9406d12a635614ffd9143; /** * @dev Storage slot with the address of the current implementation. * This is the keccak-256 hash of "eip1967.proxy.implementation" subtracted by 1, and is * validated in the constructor. */ bytes32 internal constant _IMPLEMENTATION_SLOT = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc; /** * @dev Emitted when the implementation is upgraded. */ event Upgraded(address indexed implementation); /** * @dev Returns the current implementation address. */ function _getImplementation() internal view returns (address) { return StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value; } /** * @dev Stores a new address in the EIP1967 implementation slot. */ function _setImplementation(address newImplementation) private { require(Address.isContract(newImplementation), "ERC1967: new implementation is not a contract"); StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value = newImplementation; } /** * @dev Perform implementation upgrade * * Emits an {Upgraded} event. */ function _upgradeTo(address newImplementation) internal { _setImplementation(newImplementation); emit Upgraded(newImplementation); } /** * @dev Perform implementation upgrade with additional setup call. * * Emits an {Upgraded} event. */ function _upgradeToAndCall( address newImplementation, bytes memory data, bool forceCall ) internal { _upgradeTo(newImplementation); if (data.length > 0 || forceCall) { Address.functionDelegateCall(newImplementation, data); } } /** * @dev Perform implementation upgrade with security checks for UUPS proxies, and additional setup call. * * Emits an {Upgraded} event. */ function _upgradeToAndCallUUPS( address newImplementation, bytes memory data, bool forceCall ) internal { // Upgrades from old implementations will perform a rollback test. This test requires the new // implementation to upgrade back to the old, non-ERC1822 compliant, implementation. Removing // this special case will break upgrade paths from old UUPS implementation to new ones. if (StorageSlot.getBooleanSlot(_ROLLBACK_SLOT).value) { _setImplementation(newImplementation); } else { try IERC1822Proxiable(newImplementation).proxiableUUID() returns (bytes32 slot) { require(slot == _IMPLEMENTATION_SLOT, "ERC1967Upgrade: unsupported proxiableUUID"); } catch { revert("ERC1967Upgrade: new implementation is not UUPS"); } _upgradeToAndCall(newImplementation, data, forceCall); } } /** * @dev Storage slot with the admin of the contract. * This is the keccak-256 hash of "eip1967.proxy.admin" subtracted by 1, and is * validated in the constructor. */ bytes32 internal constant _ADMIN_SLOT = 0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103; /** * @dev Emitted when the admin account has changed. */ event AdminChanged(address previousAdmin, address newAdmin); /** * @dev Returns the current admin. */ function _getAdmin() internal view returns (address) { return StorageSlot.getAddressSlot(_ADMIN_SLOT).value; } /** * @dev Stores a new address in the EIP1967 admin slot. */ function _setAdmin(address newAdmin) private { require(newAdmin != address(0), "ERC1967: new admin is the zero address"); StorageSlot.getAddressSlot(_ADMIN_SLOT).value = newAdmin; } /** * @dev Changes the admin of the proxy. * * Emits an {AdminChanged} event. */ function _changeAdmin(address newAdmin) internal { emit AdminChanged(_getAdmin(), newAdmin); _setAdmin(newAdmin); } /** * @dev The storage slot of the UpgradeableBeacon contract which defines the implementation for this proxy. * This is bytes32(uint256(keccak256('eip1967.proxy.beacon')) - 1)) and is validated in the constructor. */ bytes32 internal constant _BEACON_SLOT = 0xa3f0ad74e5423aebfd80d3ef4346578335a9a72aeaee59ff6cb3582b35133d50; /** * @dev Emitted when the beacon is upgraded. */ event BeaconUpgraded(address indexed beacon); /** * @dev Returns the current beacon. */ function _getBeacon() internal view returns (address) { return StorageSlot.getAddressSlot(_BEACON_SLOT).value; } /** * @dev Stores a new beacon in the EIP1967 beacon slot. */ function _setBeacon(address newBeacon) private { require(Address.isContract(newBeacon), "ERC1967: new beacon is not a contract"); require( Address.isContract(IBeacon(newBeacon).implementation()), "ERC1967: beacon implementation is not a contract" ); StorageSlot.getAddressSlot(_BEACON_SLOT).value = newBeacon; } /** * @dev Perform beacon upgrade with additional setup call. Note: This upgrades the address of the beacon, it does * not upgrade the implementation contained in the beacon (see {UpgradeableBeacon-_setImplementation} for that). * * Emits a {BeaconUpgraded} event. */ function _upgradeBeaconToAndCall( address newBeacon, bytes memory data, bool forceCall ) internal { _setBeacon(newBeacon); emit BeaconUpgraded(newBeacon); if (data.length > 0 || forceCall) { Address.functionDelegateCall(IBeacon(newBeacon).implementation(), data); } } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.5.0) (proxy/utils/UUPSUpgradeable.sol) pragma solidity ^0.8.0; import "../../interfaces/draft-IERC1822.sol"; import "../ERC1967/ERC1967Upgrade.sol"; /** * @dev An upgradeability mechanism designed for UUPS proxies. The functions included here can perform an upgrade of an * {ERC1967Proxy}, when this contract is set as the implementation behind such a proxy. * * A security mechanism ensures that an upgrade does not turn off upgradeability accidentally, although this risk is * reinstated if the upgrade retains upgradeability but removes the security mechanism, e.g. by replacing * `UUPSUpgradeable` with a custom implementation of upgrades. * * The {_authorizeUpgrade} function must be overridden to include access restriction to the upgrade mechanism. * * _Available since v4.1._ */ abstract contract UUPSUpgradeable is IERC1822Proxiable, ERC1967Upgrade { /// @custom:oz-upgrades-unsafe-allow state-variable-immutable state-variable-assignment address private immutable __self = address(this); /** * @dev Check that the execution is being performed through a delegatecall call and that the execution context is * a proxy contract with an implementation (as defined in ERC1967) pointing to self. This should only be the case * for UUPS and transparent proxies that are using the current contract as their implementation. Execution of a * function through ERC1167 minimal proxies (clones) would not normally pass this test, but is not guaranteed to * fail. */ modifier onlyProxy() { require(address(this) != __self, "Function must be called through delegatecall"); require(_getImplementation() == __self, "Function must be called through active proxy"); _; } /** * @dev Check that the execution is not being performed through a delegate call. This allows a function to be * callable on the implementing contract but not through proxies. */ modifier notDelegated() { require(address(this) == __self, "UUPSUpgradeable: must not be called through delegatecall"); _; } /** * @dev Implementation of the ERC1822 {proxiableUUID} function. This returns the storage slot used by the * implementation. It is used to validate that the this implementation remains valid after an upgrade. * * IMPORTANT: A proxy pointing at a proxiable contract should not be considered proxiable itself, because this risks * bricking a proxy that upgrades to it, by delegating to itself until out of gas. Thus it is critical that this * function revert if invoked through a proxy. This is guaranteed by the `notDelegated` modifier. */ function proxiableUUID() external view virtual override notDelegated returns (bytes32) { return _IMPLEMENTATION_SLOT; } /** * @dev Upgrade the implementation of the proxy to `newImplementation`. * * Calls {_authorizeUpgrade}. * * Emits an {Upgraded} event. */ function upgradeTo(address newImplementation) external virtual onlyProxy { _authorizeUpgrade(newImplementation); _upgradeToAndCallUUPS(newImplementation, new bytes(0), false); } /** * @dev Upgrade the implementation of the proxy to `newImplementation`, and subsequently execute the function call * encoded in `data`. * * Calls {_authorizeUpgrade}. * * Emits an {Upgraded} event. */ function upgradeToAndCall(address newImplementation, bytes memory data) external payable virtual onlyProxy { _authorizeUpgrade(newImplementation); _upgradeToAndCallUUPS(newImplementation, data, true); } /** * @dev Function that should revert when `msg.sender` is not authorized to upgrade the contract. Called by * {upgradeTo} and {upgradeToAndCall}. * * Normally, this function will use an xref:access.adoc[access control] modifier such as {Ownable-onlyOwner}. * * ```solidity * function _authorizeUpgrade(address) internal override onlyOwner {} * ``` */ function _authorizeUpgrade(address newImplementation) internal virtual; }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.7.0) (security/Pausable.sol) pragma solidity ^0.8.0; import "../utils/Context.sol"; /** * @dev Contract module which allows children to implement an emergency stop * mechanism that can be triggered by an authorized account. * * This module is used through inheritance. It will make available the * modifiers `whenNotPaused` and `whenPaused`, which can be applied to * the functions of your contract. Note that they will not be pausable by * simply including this module, only once the modifiers are put in place. */ abstract contract Pausable is Context { /** * @dev Emitted when the pause is triggered by `account`. */ event Paused(address account); /** * @dev Emitted when the pause is lifted by `account`. */ event Unpaused(address account); bool private _paused; /** * @dev Initializes the contract in unpaused state. */ constructor() { _paused = false; } /** * @dev Modifier to make a function callable only when the contract is not paused. * * Requirements: * * - The contract must not be paused. */ modifier whenNotPaused() { _requireNotPaused(); _; } /** * @dev Modifier to make a function callable only when the contract is paused. * * Requirements: * * - The contract must be paused. */ modifier whenPaused() { _requirePaused(); _; } /** * @dev Returns true if the contract is paused, and false otherwise. */ function paused() public view virtual returns (bool) { return _paused; } /** * @dev Throws if the contract is paused. */ function _requireNotPaused() internal view virtual { require(!paused(), "Pausable: paused"); } /** * @dev Throws if the contract is not paused. */ function _requirePaused() internal view virtual { require(paused(), "Pausable: not paused"); } /** * @dev Triggers stopped state. * * Requirements: * * - The contract must not be paused. */ function _pause() internal virtual whenNotPaused { _paused = true; emit Paused(_msgSender()); } /** * @dev Returns to normal state. * * Requirements: * * - The contract must be paused. */ function _unpause() internal virtual whenPaused { _paused = false; emit Unpaused(_msgSender()); } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.7.0) (token/ERC20/ERC20.sol) pragma solidity ^0.8.0; import "./IERC20.sol"; import "./extensions/IERC20Metadata.sol"; import "../../utils/Context.sol"; /** * @dev Implementation of the {IERC20} interface. * * This implementation is agnostic to the way tokens are created. This means * that a supply mechanism has to be added in a derived contract using {_mint}. * For a generic mechanism see {ERC20PresetMinterPauser}. * * TIP: For a detailed writeup see our guide * https://forum.zeppelin.solutions/t/how-to-implement-erc20-supply-mechanisms/226[How * to implement supply mechanisms]. * * 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}. * * The default value of {decimals} is 18. To select a different value for * {decimals} you should overload it. * * 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 value {ERC20} uses, unless this function is * 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; } _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; _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; } _totalSupply -= amount; emit Transfer(account, address(0), amount); _afterTokenTransfer(account, address(0), amount); } /** * @dev Sets `amount` as the allowance of `spender` over the `owner` s tokens. * * This internal function is equivalent to `approve`, and can be used to * e.g. set automatic allowances for certain subsystems, etc. * * Emits an {Approval} event. * * Requirements: * * - `owner` cannot be the zero address. * - `spender` cannot be the zero address. */ function _approve( address owner, address spender, uint256 amount ) internal virtual { require(owner != address(0), "ERC20: approve from the zero address"); require(spender != address(0), "ERC20: approve to the zero address"); _allowances[owner][spender] = amount; emit Approval(owner, spender, amount); } /** * @dev Updates `owner` s allowance for `spender` based on spent `amount`. * * Does not update the allowance amount in case of infinite allowance. * Revert if not enough allowance is available. * * Might emit an {Approval} event. */ function _spendAllowance( address owner, address spender, uint256 amount ) internal virtual { uint256 currentAllowance = allowance(owner, spender); if (currentAllowance != type(uint256).max) { require(currentAllowance >= amount, "ERC20: insufficient allowance"); unchecked { _approve(owner, spender, currentAllowance - amount); } } } /** * @dev Hook that is called before any transfer of tokens. This includes * minting and burning. * * Calling conditions: * * - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens * will be transferred to `to`. * - when `from` is zero, `amount` tokens will be minted for `to`. * - when `to` is zero, `amount` of ``from``'s tokens will be burned. * - `from` and `to` are never both zero. * * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks]. */ function _beforeTokenTransfer( address from, address to, uint256 amount ) internal virtual {} /** * @dev Hook that is called after any transfer of tokens. This includes * minting and burning. * * Calling conditions: * * - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens * has been transferred to `to`. * - when `from` is zero, `amount` tokens have been minted for `to`. * - when `to` is zero, `amount` of ``from``'s tokens have been burned. * - `from` and `to` are never both zero. * * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks]. */ function _afterTokenTransfer( address from, address to, uint256 amount ) internal virtual {} }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.6.0) (token/ERC20/extensions/draft-ERC20Permit.sol) pragma solidity ^0.8.0; import "./draft-IERC20Permit.sol"; import "../ERC20.sol"; import "../../../utils/cryptography/draft-EIP712.sol"; import "../../../utils/cryptography/ECDSA.sol"; import "../../../utils/Counters.sol"; /** * @dev Implementation 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. * * _Available since v3.4._ */ abstract contract ERC20Permit is ERC20, IERC20Permit, EIP712 { using Counters for Counters.Counter; mapping(address => Counters.Counter) private _nonces; // solhint-disable-next-line var-name-mixedcase bytes32 private constant _PERMIT_TYPEHASH = keccak256("Permit(address owner,address spender,uint256 value,uint256 nonce,uint256 deadline)"); /** * @dev In previous versions `_PERMIT_TYPEHASH` was declared as `immutable`. * However, to ensure consistency with the upgradeable transpiler, we will continue * to reserve a slot. * @custom:oz-renamed-from _PERMIT_TYPEHASH */ // solhint-disable-next-line var-name-mixedcase bytes32 private _PERMIT_TYPEHASH_DEPRECATED_SLOT; /** * @dev Initializes the {EIP712} domain separator using the `name` parameter, and setting `version` to `"1"`. * * It's a good idea to use the same `name` that is defined as the ERC20 token name. */ constructor(string memory name) EIP712(name, "1") {} /** * @dev See {IERC20Permit-permit}. */ function permit( address owner, address spender, uint256 value, uint256 deadline, uint8 v, bytes32 r, bytes32 s ) public virtual override { require(block.timestamp <= deadline, "ERC20Permit: expired deadline"); bytes32 structHash = keccak256(abi.encode(_PERMIT_TYPEHASH, owner, spender, value, _useNonce(owner), deadline)); bytes32 hash = _hashTypedDataV4(structHash); address signer = ECDSA.recover(hash, v, r, s); require(signer == owner, "ERC20Permit: invalid signature"); _approve(owner, spender, value); } /** * @dev See {IERC20Permit-nonces}. */ function nonces(address owner) public view virtual override returns (uint256) { return _nonces[owner].current(); } /** * @dev See {IERC20Permit-DOMAIN_SEPARATOR}. */ // solhint-disable-next-line func-name-mixedcase function DOMAIN_SEPARATOR() external view override returns (bytes32) { return _domainSeparatorV4(); } /** * @dev "Consume a nonce": return the current value and increment. * * _Available since v4.1._ */ function _useNonce(address owner) internal virtual returns (uint256 current) { Counters.Counter storage nonce = _nonces[owner]; current = nonce.current(); nonce.increment(); } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (token/ERC20/extensions/draft-IERC20Permit.sol) pragma solidity ^0.8.0; /** * @dev Interface of the ERC20 Permit extension allowing approvals to be made via signatures, as defined in * https://eips.ethereum.org/EIPS/eip-2612[EIP-2612]. * * Adds the {permit} method, which can be used to change an account's ERC20 allowance (see {IERC20-allowance}) by * presenting a message signed by the account. By not relying on {IERC20-approve}, the token holder account doesn't * need to send a transaction, and thus is not required to hold Ether at all. */ interface IERC20Permit { /** * @dev Sets `value` as the allowance of `spender` over ``owner``'s tokens, * given ``owner``'s signed approval. * * IMPORTANT: The same issues {IERC20-approve} has related to transaction * ordering also apply here. * * Emits an {Approval} event. * * Requirements: * * - `spender` cannot be the zero address. * - `deadline` must be a timestamp in the future. * - `v`, `r` and `s` must be a valid `secp256k1` signature from `owner` * over the EIP712-formatted function arguments. * - the signature must use ``owner``'s current nonce (see {nonces}). * * For more information on the signature format, see the * https://eips.ethereum.org/EIPS/eip-2612#specification[relevant EIP * section]. */ function permit( address owner, address spender, uint256 value, uint256 deadline, uint8 v, bytes32 r, bytes32 s ) external; /** * @dev Returns the current nonce for `owner`. This value must be * included whenever a signature is generated for {permit}. * * Every successful call to {permit} increases ``owner``'s nonce by one. This * prevents a signature from being used multiple times. */ function nonces(address owner) external view returns (uint256); /** * @dev Returns the domain separator used in the encoding of the signature for {permit}, as defined by {EIP712}. */ // solhint-disable-next-line func-name-mixedcase function DOMAIN_SEPARATOR() external view returns (bytes32); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (token/ERC20/extensions/IERC20Metadata.sol) pragma solidity ^0.8.0; import "../IERC20.sol"; /** * @dev Interface for the optional metadata functions from the ERC20 standard. * * _Available since v4.1._ */ interface IERC20Metadata is IERC20 { /** * @dev Returns the name of the token. */ function name() external view returns (string memory); /** * @dev Returns the symbol of the token. */ function symbol() external view returns (string memory); /** * @dev Returns the decimals places of the token. */ function decimals() external view returns (uint8); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.6.0) (token/ERC20/IERC20.sol) pragma solidity ^0.8.0; /** * @dev Interface of the ERC20 standard as defined in the EIP. */ interface IERC20 { /** * @dev Emitted when `value` tokens are moved from one account (`from`) to * another (`to`). * * Note that `value` may be zero. */ event Transfer(address indexed from, address indexed to, uint256 value); /** * @dev Emitted when the allowance of a `spender` for an `owner` is set by * a call to {approve}. `value` is the new allowance. */ event Approval(address indexed owner, address indexed spender, uint256 value); /** * @dev Returns the amount of tokens in existence. */ function totalSupply() external view returns (uint256); /** * @dev Returns the amount of tokens owned by `account`. */ function balanceOf(address account) external view returns (uint256); /** * @dev Moves `amount` tokens from the caller's account to `to`. * * Returns a boolean value indicating whether the operation succeeded. * * Emits a {Transfer} event. */ function transfer(address to, uint256 amount) external returns (bool); /** * @dev Returns the remaining number of tokens that `spender` will be * allowed to spend on behalf of `owner` through {transferFrom}. This is * zero by default. * * This value changes when {approve} or {transferFrom} are called. */ function allowance(address owner, address spender) external view returns (uint256); /** * @dev Sets `amount` as the allowance of `spender` over the caller's tokens. * * Returns a boolean value indicating whether the operation succeeded. * * IMPORTANT: Beware that changing an allowance with this method brings the risk * that someone may use both the old and the new allowance by unfortunate * transaction ordering. One possible solution to mitigate this race * condition is to first reduce the spender's allowance to 0 and set the * desired value afterwards: * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729 * * Emits an {Approval} event. */ function approve(address spender, uint256 amount) external returns (bool); /** * @dev Moves `amount` tokens from `from` to `to` using the * allowance mechanism. `amount` is then deducted from the caller's * allowance. * * Returns a boolean value indicating whether the operation succeeded. * * Emits a {Transfer} event. */ function transferFrom( address from, address to, uint256 amount ) external returns (bool); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.7.0) (token/ERC20/utils/SafeERC20.sol) pragma solidity ^0.8.0; import "../IERC20.sol"; import "../extensions/draft-IERC20Permit.sol"; import "../../../utils/Address.sol"; /** * @title SafeERC20 * @dev Wrappers around ERC20 operations that throw on failure (when the token * contract returns false). Tokens that return no value (and instead revert or * throw on failure) are also supported, non-reverting calls are assumed to be * successful. * To use this library you can add a `using SafeERC20 for IERC20;` statement to your contract, * which allows you to call the safe operations as `token.safeTransfer(...)`, etc. */ library SafeERC20 { using Address for address; function safeTransfer( IERC20 token, address to, uint256 value ) internal { _callOptionalReturn(token, abi.encodeWithSelector(token.transfer.selector, to, value)); } function safeTransferFrom( IERC20 token, address from, address to, uint256 value ) internal { _callOptionalReturn(token, abi.encodeWithSelector(token.transferFrom.selector, from, to, value)); } /** * @dev Deprecated. This function has issues similar to the ones found in * {IERC20-approve}, and its usage is discouraged. * * Whenever possible, use {safeIncreaseAllowance} and * {safeDecreaseAllowance} instead. */ function safeApprove( IERC20 token, address spender, uint256 value ) internal { // safeApprove should only be called when setting an initial allowance, // or when resetting it to zero. To increase and decrease it, use // 'safeIncreaseAllowance' and 'safeDecreaseAllowance' require( (value == 0) || (token.allowance(address(this), spender) == 0), "SafeERC20: approve from non-zero to non-zero allowance" ); _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, value)); } function safeIncreaseAllowance( IERC20 token, address spender, uint256 value ) internal { uint256 newAllowance = token.allowance(address(this), spender) + value; _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance)); } function safeDecreaseAllowance( IERC20 token, address spender, uint256 value ) internal { unchecked { uint256 oldAllowance = token.allowance(address(this), spender); require(oldAllowance >= value, "SafeERC20: decreased allowance below zero"); uint256 newAllowance = oldAllowance - value; _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance)); } } function safePermit( IERC20Permit token, address owner, address spender, uint256 value, uint256 deadline, uint8 v, bytes32 r, bytes32 s ) internal { uint256 nonceBefore = token.nonces(owner); token.permit(owner, spender, value, deadline, v, r, s); uint256 nonceAfter = token.nonces(owner); require(nonceAfter == nonceBefore + 1, "SafeERC20: permit did not succeed"); } /** * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement * on the return value: the return value is optional (but if data is returned, it must not be false). * @param token The token targeted by the call. * @param data The call data (encoded using abi.encode or one of its variants). */ function _callOptionalReturn(IERC20 token, bytes memory data) private { // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since // we're implementing it ourselves. We use {Address.functionCall} to perform this call, which verifies that // the target address contains contract code and also asserts for success in the low-level call. bytes memory returndata = address(token).functionCall(data, "SafeERC20: low-level call failed"); if (returndata.length > 0) { // Return data is optional require(abi.decode(returndata, (bool)), "SafeERC20: ERC20 operation did not succeed"); } } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.7.0) (utils/Address.sol) pragma solidity ^0.8.1; /** * @dev Collection of functions related to the address type */ library Address { /** * @dev Returns true if `account` is a contract. * * [IMPORTANT] * ==== * It is unsafe to assume that an address for which this function returns * false is an externally-owned account (EOA) and not a contract. * * Among others, `isContract` will return false for the following * types of addresses: * * - an externally-owned account * - a contract in construction * - an address where a contract will be created * - an address where a contract lived, but was destroyed * ==== * * [IMPORTANT] * ==== * You shouldn't rely on `isContract` to protect against flash loan attacks! * * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract * constructor. * ==== */ function isContract(address account) internal view returns (bool) { // This method relies on extcodesize/address.code.length, which returns 0 // for contracts in construction, since the code is only stored at the end // of the constructor execution. return account.code.length > 0; } /** * @dev Replacement for Solidity's `transfer`: sends `amount` wei to * `recipient`, forwarding all available gas and reverting on errors. * * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost * of certain opcodes, possibly making contracts go over the 2300 gas limit * imposed by `transfer`, making them unable to receive funds via * `transfer`. {sendValue} removes this limitation. * * https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more]. * * IMPORTANT: because control is transferred to `recipient`, care must be * taken to not create reentrancy vulnerabilities. Consider using * {ReentrancyGuard} or the * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern]. */ function sendValue(address payable recipient, uint256 amount) internal { require(address(this).balance >= amount, "Address: insufficient balance"); (bool success, ) = recipient.call{value: amount}(""); require(success, "Address: unable to send value, recipient may have reverted"); } /** * @dev Performs a Solidity function call using a low level `call`. A * plain `call` is an unsafe replacement for a function call: use this * function instead. * * If `target` reverts with a revert reason, it is bubbled up by this * function (like regular Solidity function calls). * * Returns the raw returned data. To convert to the expected return value, * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`]. * * Requirements: * * - `target` must be a contract. * - calling `target` with `data` must not revert. * * _Available since v3.1._ */ function functionCall(address target, bytes memory data) internal returns (bytes memory) { return functionCall(target, data, "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"); require(isContract(target), "Address: call to non-contract"); (bool success, bytes memory returndata) = target.call{value: value}(data); return verifyCallResult(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) { require(isContract(target), "Address: static call to non-contract"); (bool success, bytes memory returndata) = target.staticcall(data); return verifyCallResult(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) { require(isContract(target), "Address: delegate call to non-contract"); (bool success, bytes memory returndata) = target.delegatecall(data); return verifyCallResult(success, returndata, errorMessage); } /** * @dev Tool to verifies that a low level call was successful, and revert if it wasn't, either by bubbling the * revert reason 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 { // Look for revert reason and bubble it up if present if (returndata.length > 0) { // The easiest way to bubble the revert reason is using memory via assembly /// @solidity memory-safe-assembly assembly { let returndata_size := mload(returndata) revert(add(32, returndata), returndata_size) } } else { revert(errorMessage); } } } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (utils/Context.sol) pragma solidity ^0.8.0; /** * @dev Provides information about the current execution context, including the * sender of the transaction and its data. While these are generally available * via msg.sender and msg.data, they should not be accessed in such a direct * manner, since when dealing with meta-transactions the account sending and * paying for execution may not be the actual sender (as far as an application * is concerned). * * This contract is only required for intermediate, library-like contracts. */ abstract contract Context { function _msgSender() internal view virtual returns (address) { return msg.sender; } function _msgData() internal view virtual returns (bytes calldata) { return msg.data; } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (utils/Counters.sol) pragma solidity ^0.8.0; /** * @title Counters * @author Matt Condon (@shrugs) * @dev Provides counters that can only be incremented, decremented or reset. This can be used e.g. to track the number * of elements in a mapping, issuing ERC721 ids, or counting request ids. * * Include with `using Counters for Counters.Counter;` */ library Counters { struct Counter { // This variable should never be directly accessed by users of the library: interactions must be restricted to // the library's function. As of Solidity v0.5.2, this cannot be enforced, though there is a proposal to add // this feature: see https://github.com/ethereum/solidity/issues/4637 uint256 _value; // default: 0 } function current(Counter storage counter) internal view returns (uint256) { return counter._value; } function increment(Counter storage counter) internal { unchecked { counter._value += 1; } } function decrement(Counter storage counter) internal { uint256 value = counter._value; require(value > 0, "Counter: decrement overflow"); unchecked { counter._value = value - 1; } } function reset(Counter storage counter) internal { counter._value = 0; } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (utils/cryptography/draft-EIP712.sol) pragma solidity ^0.8.0; import "./ECDSA.sol"; /** * @dev https://eips.ethereum.org/EIPS/eip-712[EIP 712] is a standard for hashing and signing of typed structured data. * * The encoding specified in the EIP is very generic, and such a generic implementation in Solidity is not feasible, * thus this contract does not implement the encoding itself. Protocols need to implement the type-specific encoding * they need in their contracts using a combination of `abi.encode` and `keccak256`. * * This contract implements the EIP 712 domain separator ({_domainSeparatorV4}) that is used as part of the encoding * scheme, and the final step of the encoding to obtain the message digest that is then signed via ECDSA * ({_hashTypedDataV4}). * * The implementation of the domain separator was designed to be as efficient as possible while still properly updating * the chain id to protect against replay attacks on an eventual fork of the chain. * * NOTE: This contract implements the version of the encoding known as "v4", as implemented by the JSON RPC method * https://docs.metamask.io/guide/signing-data.html[`eth_signTypedDataV4` in MetaMask]. * * _Available since v3.4._ */ abstract contract EIP712 { /* solhint-disable var-name-mixedcase */ // Cache the domain separator as an immutable value, but also store the chain id that it corresponds to, in order to // invalidate the cached domain separator if the chain id changes. bytes32 private immutable _CACHED_DOMAIN_SEPARATOR; uint256 private immutable _CACHED_CHAIN_ID; address private immutable _CACHED_THIS; bytes32 private immutable _HASHED_NAME; bytes32 private immutable _HASHED_VERSION; bytes32 private immutable _TYPE_HASH; /* solhint-enable var-name-mixedcase */ /** * @dev Initializes the domain separator and parameter caches. * * The meaning of `name` and `version` is specified in * https://eips.ethereum.org/EIPS/eip-712#definition-of-domainseparator[EIP 712]: * * - `name`: the user readable name of the signing domain, i.e. the name of the DApp or the protocol. * - `version`: the current major version of the signing domain. * * NOTE: These parameters cannot be changed except through a xref:learn::upgrading-smart-contracts.adoc[smart * contract upgrade]. */ constructor(string memory name, string memory version) { bytes32 hashedName = keccak256(bytes(name)); bytes32 hashedVersion = keccak256(bytes(version)); bytes32 typeHash = keccak256( "EIP712Domain(string name,string version,uint256 chainId,address verifyingContract)" ); _HASHED_NAME = hashedName; _HASHED_VERSION = hashedVersion; _CACHED_CHAIN_ID = block.chainid; _CACHED_DOMAIN_SEPARATOR = _buildDomainSeparator(typeHash, hashedName, hashedVersion); _CACHED_THIS = address(this); _TYPE_HASH = typeHash; } /** * @dev Returns the domain separator for the current chain. */ function _domainSeparatorV4() internal view returns (bytes32) { if (address(this) == _CACHED_THIS && block.chainid == _CACHED_CHAIN_ID) { return _CACHED_DOMAIN_SEPARATOR; } else { return _buildDomainSeparator(_TYPE_HASH, _HASHED_NAME, _HASHED_VERSION); } } function _buildDomainSeparator( bytes32 typeHash, bytes32 nameHash, bytes32 versionHash ) private view returns (bytes32) { return keccak256(abi.encode(typeHash, nameHash, versionHash, block.chainid, address(this))); } /** * @dev Given an already https://eips.ethereum.org/EIPS/eip-712#definition-of-hashstruct[hashed struct], this * function returns the hash of the fully encoded EIP712 message for this domain. * * This hash can be used together with {ECDSA-recover} to obtain the signer of a message. For example: * * ```solidity * bytes32 digest = _hashTypedDataV4(keccak256(abi.encode( * keccak256("Mail(address to,string contents)"), * mailTo, * keccak256(bytes(mailContents)) * ))); * address signer = ECDSA.recover(digest, signature); * ``` */ function _hashTypedDataV4(bytes32 structHash) internal view virtual returns (bytes32) { return ECDSA.toTypedDataHash(_domainSeparatorV4(), structHash); } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.7.3) (utils/cryptography/ECDSA.sol) pragma solidity ^0.8.0; import "../Strings.sol"; /** * @dev Elliptic Curve Digital Signature Algorithm (ECDSA) operations. * * These functions can be used to verify that a message was signed by the holder * of the private keys of a given address. */ library ECDSA { enum RecoverError { NoError, InvalidSignature, InvalidSignatureLength, InvalidSignatureS, InvalidSignatureV } function _throwError(RecoverError error) private pure { if (error == RecoverError.NoError) { return; // no error: do nothing } else if (error == RecoverError.InvalidSignature) { revert("ECDSA: invalid signature"); } else if (error == RecoverError.InvalidSignatureLength) { revert("ECDSA: invalid signature length"); } else if (error == RecoverError.InvalidSignatureS) { revert("ECDSA: invalid signature 's' value"); } else if (error == RecoverError.InvalidSignatureV) { revert("ECDSA: invalid signature 'v' value"); } } /** * @dev Returns the address that signed a hashed message (`hash`) with * `signature` or error string. This address can then be used for verification purposes. * * The `ecrecover` EVM opcode allows for malleable (non-unique) signatures: * this function rejects them by requiring the `s` value to be in the lower * half order, and the `v` value to be either 27 or 28. * * IMPORTANT: `hash` _must_ be the result of a hash operation for the * verification to be secure: it is possible to craft signatures that * recover to arbitrary addresses for non-hashed data. A safe way to ensure * this is by receiving a hash of the original message (which may otherwise * be too long), and then calling {toEthSignedMessageHash} on it. * * Documentation for signature generation: * - with https://web3js.readthedocs.io/en/v1.3.4/web3-eth-accounts.html#sign[Web3.js] * - with https://docs.ethers.io/v5/api/signer/#Signer-signMessage[ethers] * * _Available since v4.3._ */ function tryRecover(bytes32 hash, bytes memory signature) internal pure returns (address, RecoverError) { if (signature.length == 65) { bytes32 r; bytes32 s; uint8 v; // ecrecover takes the signature parameters, and the only way to get them // currently is to use assembly. /// @solidity memory-safe-assembly assembly { r := mload(add(signature, 0x20)) s := mload(add(signature, 0x40)) v := byte(0, mload(add(signature, 0x60))) } return tryRecover(hash, v, r, s); } else { return (address(0), RecoverError.InvalidSignatureLength); } } /** * @dev Returns the address that signed a hashed message (`hash`) with * `signature`. This address can then be used for verification purposes. * * The `ecrecover` EVM opcode allows for malleable (non-unique) signatures: * this function rejects them by requiring the `s` value to be in the lower * half order, and the `v` value to be either 27 or 28. * * IMPORTANT: `hash` _must_ be the result of a hash operation for the * verification to be secure: it is possible to craft signatures that * recover to arbitrary addresses for non-hashed data. A safe way to ensure * this is by receiving a hash of the original message (which may otherwise * be too long), and then calling {toEthSignedMessageHash} on it. */ function recover(bytes32 hash, bytes memory signature) internal pure returns (address) { (address recovered, RecoverError error) = tryRecover(hash, signature); _throwError(error); return recovered; } /** * @dev Overload of {ECDSA-tryRecover} that receives the `r` and `vs` short-signature fields separately. * * See https://eips.ethereum.org/EIPS/eip-2098[EIP-2098 short signatures] * * _Available since v4.3._ */ function tryRecover( bytes32 hash, bytes32 r, bytes32 vs ) internal pure returns (address, RecoverError) { bytes32 s = vs & bytes32(0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff); uint8 v = uint8((uint256(vs) >> 255) + 27); return tryRecover(hash, v, r, s); } /** * @dev Overload of {ECDSA-recover} that receives the `r and `vs` short-signature fields separately. * * _Available since v4.2._ */ function recover( bytes32 hash, bytes32 r, bytes32 vs ) internal pure returns (address) { (address recovered, RecoverError error) = tryRecover(hash, r, vs); _throwError(error); return recovered; } /** * @dev Overload of {ECDSA-tryRecover} that receives the `v`, * `r` and `s` signature fields separately. * * _Available since v4.3._ */ function tryRecover( bytes32 hash, uint8 v, bytes32 r, bytes32 s ) internal pure returns (address, RecoverError) { // EIP-2 still allows signature malleability for ecrecover(). Remove this possibility and make the signature // unique. Appendix F in the Ethereum Yellow paper (https://ethereum.github.io/yellowpaper/paper.pdf), defines // the valid range for s in (301): 0 < s < secp256k1n ÷ 2 + 1, and for v in (302): v ∈ {27, 28}. Most // signatures from current libraries generate a unique signature with an s-value in the lower half order. // // If your library generates malleable signatures, such as s-values in the upper range, calculate a new s-value // with 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEBAAEDCE6AF48A03BBFD25E8CD0364141 - s1 and flip v from 27 to 28 or // vice versa. If your library also generates signatures with 0/1 for v instead 27/28, add 27 to v to accept // these malleable signatures as well. if (uint256(s) > 0x7FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF5D576E7357A4501DDFE92F46681B20A0) { return (address(0), RecoverError.InvalidSignatureS); } if (v != 27 && v != 28) { return (address(0), RecoverError.InvalidSignatureV); } // If the signature is valid (and not malleable), return the signer address address signer = ecrecover(hash, v, r, s); if (signer == address(0)) { return (address(0), RecoverError.InvalidSignature); } return (signer, RecoverError.NoError); } /** * @dev Overload of {ECDSA-recover} that receives the `v`, * `r` and `s` signature fields separately. */ function recover( bytes32 hash, uint8 v, bytes32 r, bytes32 s ) internal pure returns (address) { (address recovered, RecoverError error) = tryRecover(hash, v, r, s); _throwError(error); return recovered; } /** * @dev Returns an Ethereum Signed Message, created from a `hash`. This * produces hash corresponding to the one signed with the * https://eth.wiki/json-rpc/API#eth_sign[`eth_sign`] * JSON-RPC method as part of EIP-191. * * See {recover}. */ function toEthSignedMessageHash(bytes32 hash) internal pure returns (bytes32) { // 32 is the length in bytes of hash, // enforced by the type signature above return keccak256(abi.encodePacked("\x19Ethereum Signed Message:\n32", hash)); } /** * @dev Returns an Ethereum Signed Message, created from `s`. This * produces hash corresponding to the one signed with the * https://eth.wiki/json-rpc/API#eth_sign[`eth_sign`] * JSON-RPC method as part of EIP-191. * * See {recover}. */ function toEthSignedMessageHash(bytes memory s) internal pure returns (bytes32) { return keccak256(abi.encodePacked("\x19Ethereum Signed Message:\n", Strings.toString(s.length), s)); } /** * @dev Returns an Ethereum Signed Typed Data, created from a * `domainSeparator` and a `structHash`. This produces hash corresponding * to the one signed with the * https://eips.ethereum.org/EIPS/eip-712[`eth_signTypedData`] * JSON-RPC method as part of EIP-712. * * See {recover}. */ function toTypedDataHash(bytes32 domainSeparator, bytes32 structHash) internal pure returns (bytes32) { return keccak256(abi.encodePacked("\x19\x01", domainSeparator, structHash)); } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.7.0) (utils/StorageSlot.sol) pragma solidity ^0.8.0; /** * @dev Library for reading and writing primitive types to specific storage slots. * * Storage slots are often used to avoid storage conflict when dealing with upgradeable contracts. * This library helps with reading and writing to such slots without the need for inline assembly. * * The functions in this library return Slot structs that contain a `value` member that can be used to read or write. * * Example usage to set ERC1967 implementation slot: * ``` * contract ERC1967 { * bytes32 internal constant _IMPLEMENTATION_SLOT = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc; * * function _getImplementation() internal view returns (address) { * return StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value; * } * * function _setImplementation(address newImplementation) internal { * require(Address.isContract(newImplementation), "ERC1967: new implementation is not a contract"); * StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value = newImplementation; * } * } * ``` * * _Available since v4.1 for `address`, `bool`, `bytes32`, and `uint256`._ */ library StorageSlot { struct AddressSlot { address value; } struct BooleanSlot { bool value; } struct Bytes32Slot { bytes32 value; } struct Uint256Slot { uint256 value; } /** * @dev Returns an `AddressSlot` with member `value` located at `slot`. */ function getAddressSlot(bytes32 slot) internal pure returns (AddressSlot storage r) { /// @solidity memory-safe-assembly assembly { r.slot := slot } } /** * @dev Returns an `BooleanSlot` with member `value` located at `slot`. */ function getBooleanSlot(bytes32 slot) internal pure returns (BooleanSlot storage r) { /// @solidity memory-safe-assembly assembly { r.slot := slot } } /** * @dev Returns an `Bytes32Slot` with member `value` located at `slot`. */ function getBytes32Slot(bytes32 slot) internal pure returns (Bytes32Slot storage r) { /// @solidity memory-safe-assembly assembly { r.slot := slot } } /** * @dev Returns an `Uint256Slot` with member `value` located at `slot`. */ function getUint256Slot(bytes32 slot) internal pure returns (Uint256Slot storage r) { /// @solidity memory-safe-assembly assembly { r.slot := slot } } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.7.0) (utils/Strings.sol) pragma solidity ^0.8.0; /** * @dev String operations. */ library Strings { bytes16 private constant _HEX_SYMBOLS = "0123456789abcdef"; uint8 private constant _ADDRESS_LENGTH = 20; /** * @dev Converts a `uint256` to its ASCII `string` decimal representation. */ function toString(uint256 value) internal pure returns (string memory) { // Inspired by OraclizeAPI's implementation - MIT licence // https://github.com/oraclize/ethereum-api/blob/b42146b063c7d6ee1358846c198246239e9360e8/oraclizeAPI_0.4.25.sol if (value == 0) { return "0"; } uint256 temp = value; uint256 digits; while (temp != 0) { digits++; temp /= 10; } bytes memory buffer = new bytes(digits); while (value != 0) { digits -= 1; buffer[digits] = bytes1(uint8(48 + uint256(value % 10))); value /= 10; } return string(buffer); } /** * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation. */ function toHexString(uint256 value) internal pure returns (string memory) { if (value == 0) { return "0x00"; } uint256 temp = value; uint256 length = 0; while (temp != 0) { length++; temp >>= 8; } return toHexString(value, length); } /** * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation with fixed length. */ function toHexString(uint256 value, uint256 length) internal pure returns (string memory) { bytes memory buffer = new bytes(2 * length + 2); buffer[0] = "0"; buffer[1] = "x"; for (uint256 i = 2 * length + 1; i > 1; --i) { buffer[i] = _HEX_SYMBOLS[value & 0xf]; value >>= 4; } require(value == 0, "Strings: hex length insufficient"); return string(buffer); } /** * @dev Converts an `address` with fixed length of 20 bytes to its not checksummed ASCII `string` hexadecimal representation. */ function toHexString(address addr) internal pure returns (string memory) { return toHexString(uint256(uint160(addr)), _ADDRESS_LENGTH); } }
// SPDX-License-Identifier: GPL-3.0-or-later // OpenZeppelin Contracts (last updated v4.6.0) (token/ERC20/ERC20.sol) pragma solidity ^0.8.0; import "@openzeppelin/contracts/token/ERC20/IERC20.sol"; import "@openzeppelin/contracts/token/ERC20/extensions/IERC20Metadata.sol"; import "@openzeppelin/contracts/utils/Context.sol"; /** * @dev Pendle's ERC20 implementation, modified from @openzeppelin implementation * Changes are: * - comes with built-in reentrancy protection, storage-packed with totalSupply variable * - delete increaseAllowance / decreaseAllowance * - add nonReentrancy protection to transfer / transferFrom functions * - allow decimals to be passed in * - block self-transfer by default */ // solhint-disable contract PendleERC20 is Context, IERC20, IERC20Metadata { uint8 private constant _NOT_ENTERED = 1; uint8 private constant _ENTERED = 2; mapping(address => uint256) private _balances; mapping(address => mapping(address => uint256)) private _allowances; uint248 private _totalSupply; uint8 private _status; string private _name; string private _symbol; uint8 public immutable decimals; /** * @dev Prevents a contract from calling itself, directly or indirectly. * Calling a `nonReentrant` function from another `nonReentrant` * function is not supported. It is possible to prevent this from happening * by making the `nonReentrant` function external, and making it call a * `private` function that does the actual work. */ modifier nonReentrant() { // On the first call to nonReentrant, _notEntered will be true require(_status != _ENTERED, "ReentrancyGuard: reentrant call"); // Any calls to nonReentrant after this point will fail _status = _ENTERED; _; // By storing the original value once again, a refund is triggered (see // https://eips.ethereum.org/EIPS/eip-2200) _status = _NOT_ENTERED; } /** * @dev Sets the values for {name}, {symbol} and {decimals}. * * All three of these values are immutable: they can only be set once during * construction. */ constructor( string memory name_, string memory symbol_, uint8 decimals_ ) { _name = name_; _symbol = symbol_; decimals = decimals_; _status = _NOT_ENTERED; } /** * @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 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) external virtual override nonReentrant 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) external 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 ) external virtual override nonReentrant returns (bool) { address spender = _msgSender(); _spendAllowance(from, spender, amount); _transfer(from, to, amount); return true; } /** * @dev Moves `amount` of tokens from `sender` to `recipient`. * * 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"); require(from != to, "ERC20: transfer to self"); _beforeTokenTransfer(from, to, amount); uint256 fromBalance = _balances[from]; require(fromBalance >= amount, "ERC20: transfer amount exceeds balance"); unchecked { _balances[from] = fromBalance - amount; } _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 += toUint248(amount); _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; } _totalSupply -= toUint248(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 {} function toUint248(uint256 x) internal virtual returns (uint248) { require(x <= type(uint248).max); // signed, lim = bit-1 return uint248(x); } }
// SPDX-License-Identifier: GPL-3.0-or-later // OpenZeppelin Contracts (last updated v4.6.0) (token/ERC20/ERC20.sol) pragma solidity ^0.8.0; import "./PendleERC20.sol"; import "@openzeppelin/contracts/token/ERC20/IERC20.sol"; import "@openzeppelin/contracts/token/ERC20/extensions/IERC20Metadata.sol"; import "@openzeppelin/contracts/utils/Context.sol"; import "@openzeppelin/contracts/token/ERC20/extensions/draft-ERC20Permit.sol"; import "@openzeppelin/contracts/utils/cryptography/draft-EIP712.sol"; import "@openzeppelin/contracts/utils/cryptography/ECDSA.sol"; import "@openzeppelin/contracts/utils/Counters.sol"; /// @dev forked from OZ's ERC20Permit contract PendleERC20Permit is PendleERC20, IERC20Permit, EIP712 { using Counters for Counters.Counter; mapping(address => Counters.Counter) private _nonces; // solhint-disable-next-line var-name-mixedcase bytes32 private constant _PERMIT_TYPEHASH = keccak256( "Permit(address owner,address spender,uint256 value,uint256 nonce,uint256 deadline)" ); constructor( string memory name_, string memory symbol_, uint8 decimals_ ) PendleERC20(name_, symbol_, decimals_) EIP712(name_, "1") {} /** * @dev See {IERC20Permit-permit}. */ function permit( address owner, address spender, uint256 value, uint256 deadline, uint8 v, bytes32 r, bytes32 s ) public virtual override { require(block.timestamp <= deadline, "ERC20Permit: expired deadline"); bytes32 structHash = keccak256( abi.encode(_PERMIT_TYPEHASH, owner, spender, value, _useNonce(owner), deadline) ); bytes32 hash = _hashTypedDataV4(structHash); address signer = ECDSA.recover(hash, v, r, s); require(signer == owner, "ERC20Permit: invalid signature"); _approve(owner, spender, value); } /** * @dev See {IERC20Permit-nonces}. */ function nonces(address owner) public view virtual override returns (uint256) { return _nonces[owner].current(); } /** * @dev See {IERC20Permit-DOMAIN_SEPARATOR}. */ // solhint-disable-next-line func-name-mixedcase function DOMAIN_SEPARATOR() external view override returns (bytes32) { return _domainSeparatorV4(); } /** * @dev "Consume a nonce": return the current value and increment. * * _Available since v4.1._ */ function _useNonce(address owner) internal virtual returns (uint256 current) { Counters.Counter storage nonce = _nonces[owner]; current = nonce.current(); nonce.increment(); } }
// SPDX-License-Identifier: GPL-3.0-or-later pragma solidity >=0.8.0; library ArrayLib { function sum(uint256[] memory input) internal pure returns (uint256) { uint256 value = 0; for (uint256 i = 0; i < input.length; ) { value += input[i]; unchecked { i++; } } return value; } /// @notice return index of the element if found, else return uint256.max function find(address[] memory array, address element) internal pure returns (uint256 index) { uint256 length = array.length; for (uint256 i = 0; i < length; ) { if (array[i] == element) return i; unchecked { i++; } } return type(uint256).max; } function contains(address[] memory array, address element) internal pure returns (bool) { uint256 length = array.length; for (uint256 i = 0; i < length; ) { if (array[i] == element) return true; unchecked { i++; } } return false; } function append(address[] memory inp, address element) internal pure returns (address[] memory out) { uint256 length = inp.length; out = new address[](length + 1); for (uint256 i = 0; i < length; ) { out[i] = inp[i]; unchecked { i++; } } out[length] = element; } }
// SPDX-License-Identifier: GPL-3.0-or-later pragma solidity 0.8.17; import "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol"; contract BoringOwnableUpgradeableData { address public owner; address public pendingOwner; } abstract contract BoringOwnableUpgradeable is BoringOwnableUpgradeableData, Initializable { event OwnershipTransferred(address indexed previousOwner, address indexed newOwner); function __BoringOwnable_init() internal onlyInitializing { owner = msg.sender; } /// @notice Transfers ownership to `newOwner`. Either directly or claimable by the new pending owner. /// Can only be invoked by the current `owner`. /// @param newOwner Address of the new owner. /// @param direct True if `newOwner` should be set immediately. False if `newOwner` needs to use `claimOwnership`. /// @param renounce Allows the `newOwner` to be `address(0)` if `direct` and `renounce` is True. Has no effect otherwise. function transferOwnership( address newOwner, bool direct, bool renounce ) public onlyOwner { if (direct) { // Checks require(newOwner != address(0) || renounce, "Ownable: zero address"); // Effects emit OwnershipTransferred(owner, newOwner); owner = newOwner; pendingOwner = address(0); } else { // Effects pendingOwner = newOwner; } } /// @notice Needs to be called by `pendingOwner` to claim ownership. function claimOwnership() public { address _pendingOwner = pendingOwner; // Checks require(msg.sender == _pendingOwner, "Ownable: caller != pending owner"); // Effects emit OwnershipTransferred(owner, _pendingOwner); owner = _pendingOwner; pendingOwner = address(0); } /// @notice Only allows the `owner` to execute the function. modifier onlyOwner() { require(msg.sender == owner, "Ownable: caller is not the owner"); _; } uint256[48] private __gap; }
// SPDX-License-Identifier: GPL-3.0-or-later pragma solidity 0.8.17; /// Adapted from UniswapV3's Oracle library Errors { // BulkSeller error BulkInsufficientSyForTrade(uint256 currentAmount, uint256 requiredAmount); error BulkInsufficientTokenForTrade(uint256 currentAmount, uint256 requiredAmount); error BulkInSufficientSyOut(uint256 actualSyOut, uint256 requiredSyOut); error BulkInSufficientTokenOut(uint256 actualTokenOut, uint256 requiredTokenOut); error BulkInsufficientSyReceived(uint256 actualBalance, uint256 requiredBalance); error BulkNotMaintainer(); error BulkNotAdmin(); error BulkSellerAlreadyExisted(address token, address SY, address bulk); error BulkSellerInvalidToken(address token, address SY); error BulkBadRateTokenToSy(uint256 actualRate, uint256 currentRate, uint256 eps); error BulkBadRateSyToToken(uint256 actualRate, uint256 currentRate, uint256 eps); // APPROX error ApproxFail(); error ApproxParamsInvalid(uint256 guessMin, uint256 guessMax, uint256 eps); error ApproxBinarySearchInputInvalid( uint256 approxGuessMin, uint256 approxGuessMax, uint256 minGuessMin, uint256 maxGuessMax ); // MARKET + MARKET MATH CORE error MarketExpired(); error MarketZeroAmountsInput(); error MarketZeroAmountsOutput(); error MarketZeroLnImpliedRate(); error MarketInsufficientPtForTrade(int256 currentAmount, int256 requiredAmount); error MarketInsufficientPtReceived(uint256 actualBalance, uint256 requiredBalance); error MarketInsufficientSyReceived(uint256 actualBalance, uint256 requiredBalance); error MarketZeroTotalPtOrTotalAsset(int256 totalPt, int256 totalAsset); error MarketExchangeRateBelowOne(int256 exchangeRate); error MarketProportionMustNotEqualOne(); error MarketRateScalarBelowZero(int256 rateScalar); error MarketScalarRootBelowZero(int256 scalarRoot); error MarketProportionTooHigh(int256 proportion, int256 maxProportion); error OracleUninitialized(); error OracleTargetTooOld(uint32 target, uint32 oldest); error OracleZeroCardinality(); error MarketFactoryExpiredPt(); error MarketFactoryInvalidPt(); error MarketFactoryMarketExists(); error MarketFactoryLnFeeRateRootTooHigh(uint80 lnFeeRateRoot, uint256 maxLnFeeRateRoot); error MarketFactoryReserveFeePercentTooHigh( uint8 reserveFeePercent, uint8 maxReserveFeePercent ); error MarketFactoryZeroTreasury(); error MarketFactoryInitialAnchorTooLow(int256 initialAnchor, int256 minInitialAnchor); // ROUTER error RouterInsufficientLpOut(uint256 actualLpOut, uint256 requiredLpOut); error RouterInsufficientSyOut(uint256 actualSyOut, uint256 requiredSyOut); error RouterInsufficientPtOut(uint256 actualPtOut, uint256 requiredPtOut); error RouterInsufficientYtOut(uint256 actualYtOut, uint256 requiredYtOut); error RouterInsufficientPYOut(uint256 actualPYOut, uint256 requiredPYOut); error RouterInsufficientTokenOut(uint256 actualTokenOut, uint256 requiredTokenOut); error RouterExceededLimitSyIn(uint256 actualSyIn, uint256 limitSyIn); error RouterExceededLimitPtIn(uint256 actualPtIn, uint256 limitPtIn); error RouterExceededLimitYtIn(uint256 actualYtIn, uint256 limitYtIn); error RouterInsufficientSyRepay(uint256 actualSyRepay, uint256 requiredSyRepay); error RouterInsufficientPtRepay(uint256 actualPtRepay, uint256 requiredPtRepay); error RouterNotAllSyUsed(uint256 netSyDesired, uint256 netSyUsed); error RouterTimeRangeZero(); error RouterCallbackNotPendleMarket(address caller); error RouterInvalidAction(bytes4 selector); error RouterKyberSwapDataZero(); // YIELD CONTRACT error YCExpired(); error YCNotExpired(); error YieldContractInsufficientSy(uint256 actualSy, uint256 requiredSy); error YCNothingToRedeem(); error YCPostExpiryDataNotSet(); error YCNoFloatingSy(); // YieldFactory error YCFactoryInvalidExpiry(); error YCFactoryYieldContractExisted(); error YCFactoryZeroExpiryDivisor(); error YCFactoryZeroTreasury(); error YCFactoryInterestFeeRateTooHigh(uint256 interestFeeRate, uint256 maxInterestFeeRate); error YCFactoryRewardFeeRateTooHigh(uint256 newRewardFeeRate, uint256 maxRewardFeeRate); // SY error SYInvalidTokenIn(address token); error SYInvalidTokenOut(address token); error SYZeroDeposit(); error SYZeroRedeem(); error SYInsufficientSharesOut(uint256 actualSharesOut, uint256 requiredSharesOut); error SYInsufficientTokenOut(uint256 actualTokenOut, uint256 requiredTokenOut); // SY-specific error SYQiTokenMintFailed(uint256 errCode); error SYQiTokenRedeemFailed(uint256 errCode); error SYQiTokenRedeemRewardsFailed(uint256 rewardAccruedType0, uint256 rewardAccruedType1); error SYQiTokenBorrowRateTooHigh(uint256 borrowRate, uint256 borrowRateMax); error SYCurveInvalidPid(); error SYCurve3crvPoolNotFound(); error SYApeDepositAmountTooSmall(uint256 amountDeposited); error SYBalancerInvalidPid(); error SYInvalidRewardToken(address token); // Liquidity Mining error VCInactivePool(address pool); error VCPoolAlreadyActive(address pool); error VCZeroVePendle(address user); error VCExceededMaxWeight(uint256 totalWeight, uint256 maxWeight); error VCEpochNotFinalized(uint256 wTime); error VCPoolAlreadyAddAndRemoved(address pool); error VEInvalidNewExpiry(uint256 newExpiry); error VEExceededMaxLockTime(); error VEInsufficientLockTime(); error VENotAllowedReduceExpiry(); error VEZeroAmountLocked(); error VEPositionNotExpired(); error VEZeroPosition(); error VEZeroSlope(uint128 bias, uint128 slope); error VEReceiveOldSupply(uint256 msgTime); error GCNotPendleMarket(address caller); error GCNotVotingController(address caller); error InvalidWTime(uint256 wTime); error ExpiryInThePast(uint256 expiry); error ChainNotSupported(uint256 chainId); error FDTotalAmountFundedNotMatch(uint256 actualTotalAmount, uint256 expectedTotalAmount); error FDEpochLengthMismatch(); error FDInvalidPool(address pool); error FDPoolAlreadyExists(address pool); error FDInvalidNewFinishedEpoch(uint256 oldFinishedEpoch, uint256 newFinishedEpoch); error FDInvalidStartEpoch(uint256 startEpoch); error FDInvalidWTimeFund(uint256 lastFunded, uint256 wTime); error FDFutureFunding(uint256 lastFunded, uint256 currentWTime); error BDInvalidEpoch(uint256 epoch, uint256 startTime); // Cross-Chain error MsgNotFromSendEndpoint(uint16 srcChainId, bytes path); error MsgNotFromReceiveEndpoint(address sender); error InsufficientFeeToSendMsg(uint256 currentFee, uint256 requiredFee); error ApproxDstExecutionGasNotSet(); error InvalidRetryData(); // GENERIC MSG error ArrayLengthMismatch(); error ArrayEmpty(); error ArrayOutOfBounds(); error ZeroAddress(); error FailedToSendEther(); error OnlyLayerZeroEndpoint(); error OnlyYT(); error OnlyYCFactory(); error OnlyWhitelisted(); }
// SPDX-License-Identifier: GPL-3.0-or-later // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // You should have received a copy of the GNU General Public License // along with this program. If not, see <http://www.gnu.org/licenses/>. pragma solidity 0.8.17; /* solhint-disable private-vars-leading-underscore, reason-string */ library Math { uint256 internal constant ONE = 1e18; // 18 decimal places int256 internal constant IONE = 1e18; // 18 decimal places function subMax0(uint256 a, uint256 b) internal pure returns (uint256) { unchecked { return (a >= b ? a - b : 0); } } function subNoNeg(int256 a, int256 b) internal pure returns (int256) { require(a >= b, "negative"); return a - b; // no unchecked since if b is very negative, a - b might overflow } function mulDown(uint256 a, uint256 b) internal pure returns (uint256) { uint256 product = a * b; unchecked { return product / ONE; } } function mulDown(int256 a, int256 b) internal pure returns (int256) { int256 product = a * b; unchecked { return product / IONE; } } function divDown(uint256 a, uint256 b) internal pure returns (uint256) { uint256 aInflated = a * ONE; unchecked { return aInflated / b; } } function divDown(int256 a, int256 b) internal pure returns (int256) { int256 aInflated = a * IONE; unchecked { return aInflated / b; } } function rawDivUp(uint256 a, uint256 b) internal pure returns (uint256) { return (a + b - 1) / b; } // @author Uniswap function sqrt(uint256 y) internal pure returns (uint256 z) { if (y > 3) { z = y; uint256 x = y / 2 + 1; while (x < z) { z = x; x = (y / x + x) / 2; } } else if (y != 0) { z = 1; } } function abs(int256 x) internal pure returns (uint256) { return uint256(x > 0 ? x : -x); } function neg(int256 x) internal pure returns (int256) { return x * (-1); } function neg(uint256 x) internal pure returns (int256) { return Int(x) * (-1); } function max(uint256 x, uint256 y) internal pure returns (uint256) { return (x > y ? x : y); } function max(int256 x, int256 y) internal pure returns (int256) { return (x > y ? x : y); } function min(uint256 x, uint256 y) internal pure returns (uint256) { return (x < y ? x : y); } function min(int256 x, int256 y) internal pure returns (int256) { return (x < y ? x : y); } /*/////////////////////////////////////////////////////////////// SIGNED CASTS //////////////////////////////////////////////////////////////*/ function Int(uint256 x) internal pure returns (int256) { require(x <= uint256(type(int256).max)); return int256(x); } function Int128(int256 x) internal pure returns (int128) { require(type(int128).min <= x && x <= type(int128).max); return int128(x); } function Int128(uint256 x) internal pure returns (int128) { return Int128(Int(x)); } /*/////////////////////////////////////////////////////////////// UNSIGNED CASTS //////////////////////////////////////////////////////////////*/ function Uint(int256 x) internal pure returns (uint256) { require(x >= 0); return uint256(x); } function Uint32(uint256 x) internal pure returns (uint32) { require(x <= type(uint32).max); return uint32(x); } function Uint112(uint256 x) internal pure returns (uint112) { require(x <= type(uint112).max); return uint112(x); } function Uint96(uint256 x) internal pure returns (uint96) { require(x <= type(uint96).max); return uint96(x); } function Uint128(uint256 x) internal pure returns (uint128) { require(x <= type(uint128).max); return uint128(x); } function isAApproxB( uint256 a, uint256 b, uint256 eps ) internal pure returns (bool) { return mulDown(b, ONE - eps) <= a && a <= mulDown(b, ONE + eps); } function isAGreaterApproxB( uint256 a, uint256 b, uint256 eps ) internal pure returns (bool) { return a >= b && a <= mulDown(b, ONE + eps); } function isASmallerApproxB( uint256 a, uint256 b, uint256 eps ) internal pure returns (bool) { return a <= b && a >= mulDown(b, ONE - eps); } }
// SPDX-License-Identifier: GPL-3.0-or-later pragma solidity 0.8.17; import "@openzeppelin/contracts/token/ERC20/extensions/IERC20Metadata.sol"; import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol"; abstract contract TokenHelper { using SafeERC20 for IERC20; address internal constant NATIVE = address(0); uint256 internal constant LOWER_BOUND_APPROVAL = type(uint96).max / 2; // some tokens use 96 bits for approval function _transferIn( address token, address from, uint256 amount ) internal { if (token == NATIVE) require(msg.value == amount, "eth mismatch"); else if (amount != 0) IERC20(token).safeTransferFrom(from, address(this), amount); } function _transferFrom( IERC20 token, address from, address to, uint256 amount ) internal { if (amount != 0) token.safeTransferFrom(from, to, amount); } function _transferOut( address token, address to, uint256 amount ) internal { if (amount == 0) return; if (token == NATIVE) { (bool success, ) = to.call{ value: amount }(""); require(success, "eth send failed"); } else { IERC20(token).safeTransfer(to, amount); } } function _transferOut( address[] memory tokens, address to, uint256[] memory amounts ) internal { uint256 numTokens = tokens.length; require(numTokens == amounts.length, "length mismatch"); for (uint256 i = 0; i < numTokens; ) { _transferOut(tokens[i], to, amounts[i]); unchecked { i++; } } } function _selfBalance(address token) internal view returns (uint256) { return (token == NATIVE) ? address(this).balance : IERC20(token).balanceOf(address(this)); } function _selfBalance(IERC20 token) internal view returns (uint256) { return token.balanceOf(address(this)); } /// @notice Approves the stipulated contract to spend the given allowance in the given token /// @dev PLS PAY ATTENTION to tokens that requires the approval to be set to 0 before changing it function _safeApprove( address token, address to, uint256 value ) internal { (bool success, bytes memory data) = token.call( abi.encodeWithSelector(IERC20.approve.selector, to, value) ); require(success && (data.length == 0 || abi.decode(data, (bool))), "Safe Approve"); } function _safeApproveInf(address token, address to) internal { if (token == NATIVE) return; if (IERC20(token).allowance(address(this), to) < LOWER_BOUND_APPROVAL) { _safeApprove(token, to, 0); _safeApprove(token, to, type(uint256).max); } } }
// SPDX-License-Identifier: GPL-3.0-or-later pragma solidity 0.8.17; import "./RewardManagerAbstract.sol"; /// NOTE: This RewardManager is used with PendleMarket & SY. For YT, it will use RewardManagerAbstract /// NOTE: RewardManager must not have duplicated rewardTokens abstract contract RewardManager is RewardManagerAbstract { using Math for uint256; using ArrayLib for uint256[]; uint256 public lastRewardBlock; mapping(address => RewardState) public rewardState; uint256 internal constant INITIAL_REWARD_INDEX = 1; function _updateRewardIndex() internal virtual override returns (address[] memory tokens, uint256[] memory indexes) { tokens = _getRewardTokens(); indexes = new uint256[](tokens.length); if (tokens.length == 0) return (tokens, indexes); if (lastRewardBlock != block.number) { // if we have not yet update the index for this block lastRewardBlock = block.number; uint256 totalShares = _rewardSharesTotal(); _redeemExternalReward(); for (uint256 i = 0; i < tokens.length; ++i) { address token = tokens[i]; // the entire token balance of the contract must be the rewards of the contract uint256 accrued = _selfBalance(tokens[i]) - rewardState[token].lastBalance; uint256 index = rewardState[token].index; if (index == 0) index = INITIAL_REWARD_INDEX; if (totalShares != 0) index += accrued.divDown(totalShares); rewardState[token].index = index.Uint128(); rewardState[token].lastBalance += accrued.Uint128(); } } for (uint256 i = 0; i < tokens.length; i++) indexes[i] = rewardState[tokens[i]].index; } /// @dev this function doesn't need redeemExternal since redeemExternal is bundled in updateRewardIndex /// @dev this function also has to update rewardState.lastBalance function _doTransferOutRewards(address user, address receiver) internal virtual override returns (uint256[] memory rewardAmounts) { address[] memory tokens = _getRewardTokens(); rewardAmounts = new uint256[](tokens.length); for (uint256 i = 0; i < tokens.length; i++) { rewardAmounts[i] = userReward[tokens[i]][user].accrued; if (rewardAmounts[i] != 0) { userReward[tokens[i]][user].accrued = 0; rewardState[tokens[i]].lastBalance -= rewardAmounts[i].Uint128(); _transferOut(tokens[i], receiver, rewardAmounts[i]); } } } function _getRewardTokens() internal view virtual returns (address[] memory); function _rewardSharesTotal() internal view virtual returns (uint256); }
// SPDX-License-Identifier: GPL-3.0-or-later pragma solidity 0.8.17; import "../../interfaces/IRewardManager.sol"; import "../libraries/ArrayLib.sol"; import "../libraries/TokenHelper.sol"; import "../libraries/math/Math.sol"; import "./RewardManagerAbstract.sol"; /// NOTE: RewardManager must not have duplicated rewardTokens abstract contract RewardManagerAbstract is IRewardManager, TokenHelper { using Math for uint256; struct RewardState { uint128 index; uint128 lastBalance; } struct UserReward { uint128 index; uint128 accrued; } // [token] => [user] => (index,accrued) mapping(address => mapping(address => UserReward)) public userReward; function _updateAndDistributeRewards(address user) internal virtual { _updateAndDistributeRewardsForTwo(user, address(0)); } function _updateAndDistributeRewardsForTwo(address user1, address user2) internal virtual { (address[] memory tokens, uint256[] memory indexes) = _updateRewardIndex(); if (tokens.length == 0) return; if (user1 != address(0) && user1 != address(this)) _distributeRewardsPrivate(user1, tokens, indexes); if (user2 != address(0) && user2 != address(this)) _distributeRewardsPrivate(user2, tokens, indexes); } // should only be callable from `_updateAndDistributeRewardsForTwo` to guarantee user != address(0) && user != address(this) function _distributeRewardsPrivate( address user, address[] memory tokens, uint256[] memory indexes ) private { assert(user != address(0) && user != address(this)); uint256 userShares = _rewardSharesUser(user); for (uint256 i = 0; i < tokens.length; ++i) { address token = tokens[i]; uint256 index = indexes[i]; uint256 userIndex = userReward[token][user].index; if (userIndex == 0) { userReward[token][user].index = index.Uint128(); continue; } if (userIndex == index) continue; uint256 deltaIndex = index - userIndex; uint256 rewardDelta = userShares.mulDown(deltaIndex); uint256 rewardAccrued = userReward[token][user].accrued + rewardDelta; userReward[token][user] = UserReward({ index: index.Uint128(), accrued: rewardAccrued.Uint128() }); } } function _updateRewardIndex() internal virtual returns (address[] memory tokens, uint256[] memory indexes); function _redeemExternalReward() internal virtual; function _doTransferOutRewards(address user, address receiver) internal virtual returns (uint256[] memory rewardAmounts); function _rewardSharesUser(address user) internal view virtual returns (uint256); }
// SPDX-License-Identifier: GPL-3.0-or-later pragma solidity ^0.8.17; /* solhint-disable private-vars-leading-underscore */ /** * @dev forked from https://etherscan.io/token/0x8e85e97ed19c0fa13b2549309965291fbbc0048b#code * with omitted overflow checks given solidity version */ library FixedPoint { uint256 internal constant ONE = 1e18; // 18 decimal places uint256 internal constant TWO = 2 * ONE; uint256 internal constant FOUR = 4 * ONE; function add(uint256 a, uint256 b) internal pure returns (uint256) { return a + b; } function sub(uint256 a, uint256 b) internal pure returns (uint256) { return a - b; } function mulDown(uint256 a, uint256 b) internal pure returns (uint256) { return (a * b) / ONE; } function mulUp(uint256 a, uint256 b) internal pure returns (uint256) { uint256 product = a * b; if (product == 0) { return 0; } else { unchecked { return ((product - 1) / ONE) + 1; } } } function divDown(uint256 a, uint256 b) internal pure returns (uint256) { require(b != 0, "Zero division"); if (a == 0) { return 0; } else { uint256 aInflated = a * ONE; return aInflated / b; } } function divUp(uint256 a, uint256 b) internal pure returns (uint256) { require(b != 0, "Zero division"); if (a == 0) { return 0; } else { uint256 aInflated = a * ONE; unchecked { return ((aInflated - 1) / b) + 1; } } } function complement(uint256 x) internal pure returns (uint256) { unchecked { return (x < ONE) ? (ONE - x) : 0; } } }
// SPDX-License-Identifier: GPL-3.0-or-later pragma solidity ^0.8.17; import "../FixedPoint.sol"; // almost copy-paste from https://etherscan.io/token/0x1e19cf2d73a72ef1332c882f20534b6519be0276#code library MetaStableMath { using FixedPoint for uint256; uint256 internal constant _MIN_AMP = 1; uint256 internal constant _MAX_AMP = 5000; uint256 internal constant _AMP_PRECISION = 1e3; function _calculateInvariant( uint256 amplificationParameter, uint256[] memory balances, bool roundUp ) public pure returns (uint256) { unchecked { /********************************************************************************************** // invariant // // D = invariant D^(n+1) // // A = amplification coefficient A n^n S + D = A D n^n + ----------- // // S = sum of balances n^n P // // P = product of balances // // n = number of tokens // **********************************************************************************************/ // We support rounding up or down. uint256 sum = 0; uint256 numTokens = balances.length; for (uint256 i = 0; i < numTokens; i++) { sum = sum.add(balances[i]); } if (sum == 0) { return 0; } uint256 prevInvariant = 0; uint256 invariant = sum; uint256 ampTimesTotal = amplificationParameter * numTokens; for (uint256 i = 0; i < 255; i++) { uint256 P_D = balances[0] * numTokens; for (uint256 j = 1; j < numTokens; j++) { P_D = div(mul(mul(P_D, balances[j]), numTokens), invariant, roundUp); } prevInvariant = invariant; invariant = div( mul(mul(numTokens, invariant), invariant).add( div(mul(mul(ampTimesTotal, sum), P_D), _AMP_PRECISION, roundUp) ), mul(numTokens + 1, invariant).add( // No need to use checked arithmetic for the amp precision, the amp is guaranteed to be at least 1 div(mul(ampTimesTotal - _AMP_PRECISION, P_D), _AMP_PRECISION, !roundUp) ), roundUp ); if (invariant > prevInvariant) { if (invariant - prevInvariant <= 1) { return invariant; } } else if (prevInvariant - invariant <= 1) { return invariant; } } revert("Stable Invariant did not converge"); } } function _calcBptOutGivenExactTokensIn( uint256 amp, uint256[] memory balances, uint256[] memory amountsIn, uint256 bptTotalSupply, uint256 swapFeePercentage ) internal pure returns (uint256) { unchecked { // BPT out, so we round down overall. // First loop calculates the sum of all token balances, which will be used to calculate // the current weights of each token, relative to this sum uint256 sumBalances = 0; for (uint256 i = 0; i < balances.length; i++) { sumBalances = sumBalances.add(balances[i]); } // Calculate the weighted balance ratio without considering fees uint256[] memory balanceRatiosWithFee = new uint256[](amountsIn.length); // The weighted sum of token balance ratios with fee uint256 invariantRatioWithFees = 0; for (uint256 i = 0; i < balances.length; i++) { uint256 currentWeight = balances[i].divDown(sumBalances); balanceRatiosWithFee[i] = balances[i].add(amountsIn[i]).divDown(balances[i]); invariantRatioWithFees = invariantRatioWithFees.add( balanceRatiosWithFee[i].mulDown(currentWeight) ); } // Second loop calculates new amounts in, taking into account the fee on the percentage excess uint256[] memory newBalances = new uint256[](balances.length); for (uint256 i = 0; i < balances.length; i++) { uint256 amountInWithoutFee; // Check if the balance ratio is greater than the ideal ratio to charge fees or not if (balanceRatiosWithFee[i] > invariantRatioWithFees) { uint256 nonTaxableAmount = balances[i].mulDown( invariantRatioWithFees.sub(FixedPoint.ONE) ); uint256 taxableAmount = amountsIn[i].sub(nonTaxableAmount); // No need to use checked arithmetic for the swap fee, it is guaranteed to be lower than 50% amountInWithoutFee = nonTaxableAmount.add( taxableAmount.mulDown(FixedPoint.ONE - swapFeePercentage) ); } else { amountInWithoutFee = amountsIn[i]; } newBalances[i] = balances[i].add(amountInWithoutFee); } // Get current and new invariants, taking swap fees into account uint256 currentInvariant = _calculateInvariant(amp, balances, true); uint256 newInvariant = _calculateInvariant(amp, newBalances, false); uint256 invariantRatio = newInvariant.divDown(currentInvariant); // If the invariant didn't increase for any reason, we simply don't mint BPT if (invariantRatio > FixedPoint.ONE) { return bptTotalSupply.mulDown(invariantRatio - FixedPoint.ONE); } else { return 0; } } } function _calcTokenOutGivenExactBptIn( uint256 amp, uint256[] memory balances, uint256 tokenIndex, uint256 bptAmountIn, uint256 bptTotalSupply, uint256 swapFeePercentage ) internal pure returns (uint256) { unchecked { // Token out, so we round down overall. // Get the current and new invariants. Since we need a bigger new invariant, we round the current one up. uint256 currentInvariant = _calculateInvariant(amp, balances, true); uint256 newInvariant = bptTotalSupply.sub(bptAmountIn).divUp(bptTotalSupply).mulUp( currentInvariant ); // Calculate amount out without fee uint256 newBalanceTokenIndex = _getTokenBalanceGivenInvariantAndAllOtherBalances( amp, balances, newInvariant, tokenIndex ); uint256 amountOutWithoutFee = balances[tokenIndex].sub(newBalanceTokenIndex); // First calculate the sum of all token balances, which will be used to calculate // the current weight of each token uint256 sumBalances = 0; for (uint256 i = 0; i < balances.length; i++) { sumBalances = sumBalances.add(balances[i]); } // We can now compute how much excess balance is being withdrawn as a result of the virtual swaps, which result // in swap fees. uint256 currentWeight = balances[tokenIndex].divDown(sumBalances); uint256 taxablePercentage = currentWeight.complement(); // Swap fees are typically charged on 'token in', but there is no 'token in' here, so we apply it // to 'token out'. This results in slightly larger price impact. Fees are rounded up. uint256 taxableAmount = amountOutWithoutFee.mulUp(taxablePercentage); uint256 nonTaxableAmount = amountOutWithoutFee.sub(taxableAmount); // No need to use checked arithmetic for the swap fee, it is guaranteed to be lower than 50% return nonTaxableAmount.add(taxableAmount.mulDown(FixedPoint.ONE - swapFeePercentage)); } } // The amplification parameter equals: A n^(n-1) function _calcDueTokenProtocolSwapFeeAmount( uint256 amplificationParameter, uint256[] memory balances, uint256 lastInvariant, uint256 tokenIndex, uint256 protocolSwapFeePercentage ) internal pure returns (uint256) { unchecked { /************************************************************************************************************** // oneTokenSwapFee - polynomial equation to solve // // af = fee amount to calculate in one token // // bf = balance of fee token // // f = bf - af (finalBalanceFeeToken) // // D = old invariant D D^(n+1) // // A = amplification coefficient f^2 + ( S - ---------- - D) * f - ------------- = 0 // // n = number of tokens (A * n^n) A * n^2n * P // // S = sum of final balances but f // // P = product of final balances but f // **************************************************************************************************************/ // Protocol swap fee amount, so we round down overall. uint256 finalBalanceFeeToken = _getTokenBalanceGivenInvariantAndAllOtherBalances( amplificationParameter, balances, lastInvariant, tokenIndex ); if (balances[tokenIndex] <= finalBalanceFeeToken) { // This shouldn't happen outside of rounding errors, but have this safeguard nonetheless to prevent the Pool // from entering a locked state in which joins and exits revert while computing accumulated swap fees. return 0; } // Result is rounded down uint256 accumulatedTokenSwapFees = balances[tokenIndex] - finalBalanceFeeToken; return accumulatedTokenSwapFees.mulDown(protocolSwapFeePercentage); } } // This function calculates the balance of a given token (tokenIndex) // given all the other balances and the invariant function _getTokenBalanceGivenInvariantAndAllOtherBalances( uint256 amplificationParameter, uint256[] memory balances, uint256 invariant, uint256 tokenIndex ) internal pure returns (uint256) { unchecked { // Rounds result up overall uint256 ampTimesTotal = amplificationParameter * balances.length; uint256 sum = balances[0]; uint256 P_D = balances[0] * balances.length; for (uint256 j = 1; j < balances.length; j++) { P_D = divDown(mul(mul(P_D, balances[j]), balances.length), invariant); sum = sum.add(balances[j]); } // No need to use safe math, based on the loop above `sum` is greater than or equal to `balances[tokenIndex]` sum = sum - balances[tokenIndex]; uint256 inv2 = mul(invariant, invariant); // We remove the balance from c by multiplying it uint256 c = mul( mul(divUp(inv2, mul(ampTimesTotal, P_D)), _AMP_PRECISION), balances[tokenIndex] ); uint256 b = sum.add(mul(divDown(invariant, ampTimesTotal), _AMP_PRECISION)); // We iterate to find the balance uint256 prevTokenBalance = 0; // We multiply the first iteration outside the loop with the invariant to set the value of the // initial approximation. uint256 tokenBalance = divUp(inv2.add(c), invariant.add(b)); for (uint256 i = 0; i < 255; i++) { prevTokenBalance = tokenBalance; tokenBalance = divUp( mul(tokenBalance, tokenBalance).add(c), mul(tokenBalance, 2).add(b).sub(invariant) ); if (tokenBalance > prevTokenBalance) { if (tokenBalance - prevTokenBalance <= 1) { return tokenBalance; } } else if (prevTokenBalance - tokenBalance <= 1) { return tokenBalance; } } revert("Stable get balance did not converge"); } } /*/////////////////////////////////////////////////////////////// LEGACY MATH FUNCTIONS //////////////////////////////////////////////////////////////*/ function mul(uint256 a, uint256 b) internal pure returns (uint256) { unchecked { uint256 c = a * b; require(a == 0 || c / a == b); return c; } } function div( uint256 a, uint256 b, bool roundUp ) internal pure returns (uint256) { return roundUp ? divUp(a, b) : divDown(a, b); } function divDown(uint256 a, uint256 b) internal pure returns (uint256) { unchecked { require(b != 0); return a / b; } } function divUp(uint256 a, uint256 b) internal pure returns (uint256) { unchecked { require(b != 0); if (a == 0) { return 0; } else { return 1 + (a - 1) / b; } } } }
// SPDX-License-Identifier: GPL-3.0-or-later pragma solidity 0.8.17; import "@openzeppelin/contracts/token/ERC20/IERC20.sol"; import "@openzeppelin/contracts/proxy/utils/UUPSUpgradeable.sol"; import "../../../../../../interfaces/Balancer/IMetaStablePool.sol"; import "../../../../../../interfaces/Balancer/IRateProvider.sol"; import "../FixedPoint.sol"; import "./MetaStableMath.sol"; import "../StablePoolUserData.sol"; import "../StablePreviewBase.sol"; import "../../../../../libraries/BoringOwnableUpgradeable.sol"; // this contract will be upgradable for the first 3-6 months, then its upgradeability will be relinquished contract MetaStablePreview is StablePreviewBase, BoringOwnableUpgradeable, UUPSUpgradeable { using FixedPoint for uint256; using MetaStableMath for uint256; using StablePoolUserData for bytes; struct ImmutableData { address LP; address[] poolTokens; address[] rateProviders; uint256[] rawScalingFactors; } constructor() initializer {} function initialize() external initializer { __BoringOwnable_init(); } function _authorizeUpgrade(address newImplementation) internal override onlyOwner {} function onJoinPool( bytes32 poolId, address sender, address recipient, uint256[] memory balances, uint256 lastChangeBlock, uint256 protocolSwapFeePercentage, bytes memory userData, bytes memory poolImmutableData ) internal view override returns (uint256 bptAmountOut) { ImmutableData memory imd = abi.decode(poolImmutableData, (ImmutableData)); uint256[] memory caches = _cachePriceRatesIfNecessary(imd); uint256[] memory scalingFactors = _scalingFactors(imd, caches); // skip totalSupply == 0 case _upscaleArray(balances, scalingFactors); (bptAmountOut, , ) = _onJoinPool( poolId, sender, recipient, balances, lastChangeBlock, protocolSwapFeePercentage, scalingFactors, userData, imd ); // skip _mintPoolTokens, _downscale } function onExitPool( bytes32 poolId, address sender, address recipient, uint256[] memory balances, uint256 lastChangeBlock, uint256 protocolSwapFeePercentage, bytes memory userData, bytes memory poolImmutableData ) internal view virtual override returns (uint256 amountTokenOut) { ImmutableData memory imd = abi.decode(poolImmutableData, (ImmutableData)); uint256[] memory caches = _cachePriceRatesIfNecessary(imd); uint256[] memory scalingFactors = _scalingFactors(imd, caches); _upscaleArray(balances, scalingFactors); (, uint256[] memory amountsOut, ) = _onExitPool( poolId, sender, recipient, balances, lastChangeBlock, protocolSwapFeePercentage, scalingFactors, userData, imd ); // skip burnPoolTokens _downscaleDownArray(amountsOut, scalingFactors); // skip _downscaleDownArray of dueProtocolFeeAmounts for (uint256 i = 0; i < amountsOut.length; i++) { if (amountsOut[i] > 0) { amountTokenOut = amountsOut[i]; } } } function _onJoinPool( bytes32, address, address, uint256[] memory balances, uint256, uint256 protocolSwapFeePercentage, uint256[] memory scalingFactors, bytes memory userData, ImmutableData memory imd ) internal view returns ( uint256, uint256[] memory, uint256[] memory ) { // skip _updateOracle uint256[] memory dueProtocolFeeAmounts = _getDueProtocolFeeAmounts( balances, protocolSwapFeePercentage, imd ); _mutateAmounts(balances, dueProtocolFeeAmounts, FixedPoint.sub); (uint256 bptAmountOut, uint256[] memory amountsIn) = _doJoin( balances, scalingFactors, userData, imd ); // skip _updateInvariantAfterJoin return (bptAmountOut, amountsIn, dueProtocolFeeAmounts); } function _onExitPool( bytes32, address, address, uint256[] memory balances, uint256, uint256 protocolSwapFeePercentage, uint256[] memory scalingFactors, bytes memory userData, ImmutableData memory imd ) internal view virtual returns ( uint256 bptAmountIn, uint256[] memory amountsOut, uint256[] memory dueProtocolFeeAmounts ) { // skip _updateOracle dueProtocolFeeAmounts = _getDueProtocolFeeAmounts( balances, protocolSwapFeePercentage, imd ); _mutateAmounts(balances, dueProtocolFeeAmounts, FixedPoint.sub); (bptAmountIn, amountsOut) = _doExit(balances, scalingFactors, userData, imd); // skip pause case // skip _updateInvariantAfterExit return (bptAmountIn, amountsOut, dueProtocolFeeAmounts); } function _getDueProtocolFeeAmounts( uint256[] memory balances, uint256 protocolSwapFeePercentage, ImmutableData memory imd ) private view returns (uint256[] memory) { uint256[] memory dueProtocolFeeAmounts = new uint256[](2); if (protocolSwapFeePercentage == 0) { return dueProtocolFeeAmounts; } uint256 chosenTokenIndex = 0; uint256 maxBalance = balances[0]; for (uint256 i = 1; i < 2; ++i) { uint256 currentBalance = balances[i]; if (currentBalance > maxBalance) { chosenTokenIndex = i; maxBalance = currentBalance; } } (uint256 _lastInvariant, uint256 _lastInvariantAmp) = IMetaStablePool(imd.LP) .getLastInvariant(); dueProtocolFeeAmounts[chosenTokenIndex] = MetaStableMath ._calcDueTokenProtocolSwapFeeAmount( _lastInvariantAmp, balances, _lastInvariant, chosenTokenIndex, protocolSwapFeePercentage ); return dueProtocolFeeAmounts; } function _doJoin( uint256[] memory balances, uint256[] memory scalingFactors, bytes memory userData, ImmutableData memory imd ) private view returns (uint256, uint256[] memory) { return _joinExactTokensInForBPTOut(balances, scalingFactors, userData, imd); } function _joinExactTokensInForBPTOut( uint256[] memory balances, uint256[] memory scalingFactors, bytes memory userData, ImmutableData memory imd ) private view returns (uint256, uint256[] memory) { (uint256[] memory amountsIn, ) = userData.exactTokensInForBptOut(); _upscaleArray(amountsIn, scalingFactors); (uint256 currentAmp, , ) = IMetaStablePool(imd.LP).getAmplificationParameter(); uint256 bptAmountOut = MetaStableMath._calcBptOutGivenExactTokensIn( currentAmp, balances, amountsIn, IMetaStablePool(imd.LP).totalSupply(), IMetaStablePool(imd.LP).getSwapFeePercentage() ); return (bptAmountOut, amountsIn); } function _doExit( uint256[] memory balances, uint256[] memory, bytes memory userData, ImmutableData memory imd ) private view returns (uint256, uint256[] memory) { return _exitExactBPTInForTokenOut(balances, userData, imd); } function _exitExactBPTInForTokenOut( uint256[] memory balances, bytes memory userData, ImmutableData memory imd ) private view returns (uint256, uint256[] memory) { // This exit function is disabled if the contract is paused. (uint256 bptAmountIn, uint256 tokenIndex) = userData.exactBptInForTokenOut(); // Note that there is no minimum amountOut parameter: this is handled by `IVault.exitPool`. // We exit in a single token, so initialize amountsOut with zeros uint256[] memory amountsOut = new uint256[](2); // And then assign the result to the selected token (uint256 currentAmp, , ) = IMetaStablePool(imd.LP).getAmplificationParameter(); amountsOut[tokenIndex] = MetaStableMath._calcTokenOutGivenExactBptIn( currentAmp, balances, tokenIndex, bptAmountIn, IMetaStablePool(imd.LP).totalSupply(), IMetaStablePool(imd.LP).getSwapFeePercentage() ); return (bptAmountIn, amountsOut); } function _scalingFactors(ImmutableData memory imd, uint256[] memory caches) internal view virtual returns (uint256[] memory) { uint256[] memory scalingFactors = new uint256[](2); for (uint256 i = 0; i < 2; ++i) { scalingFactors[i] = imd.rawScalingFactors[i].mulDown(_priceRate(caches, i)); } return scalingFactors; } function _priceRate(uint256[] memory caches, uint256 index) internal view virtual returns (uint256) { return caches[index] == 0 ? FixedPoint.ONE : caches[index]; } function _cachePriceRatesIfNecessary(ImmutableData memory imd) internal view returns (uint256[] memory res) { res = new uint256[](2); res[0] = _cachePriceRateIfNecessary(0, imd); res[1] = _cachePriceRateIfNecessary(1, imd); } function _cachePriceRateIfNecessary(uint256 index, ImmutableData memory imd) internal view returns (uint256 res) { if (!_hasRateProvider(imd, index)) return res; uint256 expires; (res, , expires) = IMetaStablePool(imd.LP).getPriceRateCache( IERC20(imd.poolTokens[index]) ); if (block.timestamp > expires) { res = IRateProvider(imd.rateProviders[index]).getRate(); } } /*/////////////////////////////////////////////////////////////// Helpers functions //////////////////////////////////////////////////////////////*/ function _upscaleArray(uint256[] memory amounts, uint256[] memory scalingFactors) internal pure { require(amounts.length == scalingFactors.length, "Array length mismatch"); uint256 length = amounts.length; for (uint256 i = 0; i < length; ++i) { amounts[i] = FixedPoint.mulDown(amounts[i], scalingFactors[i]); } } function _downscaleDownArray(uint256[] memory amounts, uint256[] memory scalingFactors) internal pure { require(amounts.length == scalingFactors.length, "Array length mismatch"); uint256 length = amounts.length; for (uint256 i = 0; i < length; ++i) { amounts[i] = FixedPoint.divDown(amounts[i], scalingFactors[i]); } } function _mutateAmounts( uint256[] memory toMutate, uint256[] memory arguments, function(uint256, uint256) pure returns (uint256) mutation ) private pure { for (uint256 i = 0; i < 2; ++i) { toMutate[i] = mutation(toMutate[i], arguments[i]); } } function _hasRateProvider(ImmutableData memory imd, uint256 index) internal pure returns (bool) { return address(imd.rateProviders[index]) != address(0); } }
// SPDX-License-Identifier: GPL-3.0-or-later pragma solidity 0.8.17; import "@openzeppelin/contracts/token/ERC20/IERC20.sol"; import "../../../../../interfaces/Balancer/IVault.sol"; import "../../../../../interfaces/Balancer/IRateProvider.sol"; import "../../../../../interfaces/Balancer/IBasePool.sol"; import "../../../../../interfaces/Balancer/IBalancerStablePreview.sol"; import "../../../../../interfaces/ConvexCurve/IBooster.sol"; import "../../../../../interfaces/ConvexCurve/IRewards.sol"; import "./StablePoolUserData.sol"; import "../../../../libraries/ArrayLib.sol"; import "../../../SYBaseWithRewards.sol"; abstract contract PendleAuraBalancerStableLPSY is SYBaseWithRewards { using ArrayLib for address[]; address public constant BAL_TOKEN = 0xba100000625a3754423978a60c9317c58a424e3D; address public constant AURA_TOKEN = 0xC0c293ce456fF0ED870ADd98a0828Dd4d2903DBF; address public constant AURA_BOOSTER = 0xA57b8d98dAE62B26Ec3bcC4a365338157060B234; address public constant BALANCER_VAULT = 0xBA12222222228d8Ba445958a75a0704d566BF2C8; address public immutable balLp; bytes32 public immutable balPoolId; uint256 public immutable auraPid; address public immutable auraRewardManager; IBalancerStablePreview public immutable previewHelper; address[] public extraRewards; constructor( string memory _name, string memory _symbol, address _balLp, uint256 _auraPid, IBalancerStablePreview _previewHelper ) SYBaseWithRewards(_name, _symbol, _balLp) { balPoolId = IBasePool(_balLp).getPoolId(); auraPid = _auraPid; (balLp, auraRewardManager) = _getPoolInfo(_auraPid); if (balLp != _balLp) revert Errors.SYBalancerInvalidPid(); _safeApproveInf(_balLp, AURA_BOOSTER); address[] memory tokens = _getPoolTokenAddresses(); for (uint256 i = 0; i < tokens.length; ++i) { _safeApproveInf(tokens[i], BALANCER_VAULT); } previewHelper = _previewHelper; } function _getPoolInfo(uint256 _auraPid) internal view returns (address _auraLp, address _auraRewardManager) { if (_auraPid > IBooster(AURA_BOOSTER).poolLength()) revert Errors.SYBalancerInvalidPid(); (_auraLp, , , _auraRewardManager, , ) = IBooster(AURA_BOOSTER).poolInfo(_auraPid); } /*/////////////////////////////////////////////////////////////// DEPOSIT/REDEEM USING BASE TOKENS //////////////////////////////////////////////////////////////*/ /** * @notice Either wraps LP, or also joins pool using exact tokenIn */ function _deposit(address tokenIn, uint256 amount) internal virtual override returns (uint256 amountSharesOut) { if (tokenIn == balLp) { amountSharesOut = amount; } else { amountSharesOut = _depositToBalancer(tokenIn, amount); } IBooster(AURA_BOOSTER).deposit(auraPid, amountSharesOut, true); } /** * @notice Either unwraps LP, or also exits pool using exact LP for only `tokenOut` */ function _redeem( address receiver, address tokenOut, uint256 amountSharesToRedeem ) internal virtual override returns (uint256 amountTokenOut) { IRewards(auraRewardManager).withdrawAndUnwrap(amountSharesToRedeem, false); if (tokenOut == balLp) { amountTokenOut = amountSharesToRedeem; _transferOut(tokenOut, receiver, amountTokenOut); } else { amountTokenOut = _redeemFromBalancer(receiver, tokenOut, amountSharesToRedeem); } } function exchangeRate() external view override returns (uint256) { return IRateProvider(balLp).getRate(); } /*/////////////////////////////////////////////////////////////// BALANCER-RELATED FUNCTIONS //////////////////////////////////////////////////////////////*/ function _depositToBalancer(address tokenIn, uint256 amountTokenToDeposit) internal virtual returns (uint256) { IVault.JoinPoolRequest memory request = _assembleJoinRequest( tokenIn, amountTokenToDeposit ); IVault(BALANCER_VAULT).joinPool(balPoolId, address(this), address(this), request); // amount shares out = amount LP received return _selfBalance(balLp); } function _assembleJoinRequest(address tokenIn, uint256 amountTokenToDeposit) internal view virtual returns (IVault.JoinPoolRequest memory request) { // max amounts in address[] memory assets = _getPoolTokenAddresses(); uint256 amountsLength = _getBPTIndex() < type(uint256).max ? assets.length - 1 : assets.length; uint256[] memory amountsIn = new uint256[](amountsLength); uint256[] memory maxAmountsIn = new uint256[](assets.length); uint256 index = assets.find(tokenIn); uint256 indexSkipBPT = index > _getBPTIndex() ? index - 1 : index; maxAmountsIn[index] = amountsIn[indexSkipBPT] = amountTokenToDeposit; // encode user data StablePoolUserData.JoinKind joinKind = StablePoolUserData .JoinKind .EXACT_TOKENS_IN_FOR_BPT_OUT; uint256 minimumBPT = 0; bytes memory userData = abi.encode(joinKind, amountsIn, minimumBPT); // assemble joinpoolrequest request = IVault.JoinPoolRequest(assets, maxAmountsIn, userData, false); } function _redeemFromBalancer( address receiver, address tokenOut, uint256 amountLpToRedeem ) internal virtual returns (uint256) { uint256 balanceBefore = IERC20(tokenOut).balanceOf(receiver); IVault.ExitPoolRequest memory request = _assembleExitRequest(tokenOut, amountLpToRedeem); IVault(BALANCER_VAULT).exitPool(balPoolId, address(this), payable(receiver), request); // calculate amount of tokens out uint256 balanceAfter = IERC20(tokenOut).balanceOf(receiver); return balanceAfter - balanceBefore; } function _assembleExitRequest(address tokenOut, uint256 amountLpToRedeem) internal view virtual returns (IVault.ExitPoolRequest memory request) { address[] memory assets = _getPoolTokenAddresses(); uint256[] memory minAmountsOut = new uint256[](assets.length); // encode user data StablePoolUserData.ExitKind exitKind = StablePoolUserData .ExitKind .EXACT_BPT_IN_FOR_ONE_TOKEN_OUT; uint256 bptAmountIn = amountLpToRedeem; uint256 exitTokenIndex = assets.find(tokenOut); // must drop BPT index as well exitTokenIndex = _getBPTIndex() < exitTokenIndex ? exitTokenIndex - 1 : exitTokenIndex; bytes memory userData = abi.encode(exitKind, bptAmountIn, exitTokenIndex); // assemble exitpoolrequest request = IVault.ExitPoolRequest(assets, minAmountsOut, userData, false); } /// @dev this should return tokens in the same order as `IVault.getPoolTokens()` function _getPoolTokenAddresses() internal view virtual returns (address[] memory res); /// @dev should be overriden if and only if BPT is one of the pool tokens function _getBPTIndex() internal view virtual returns (uint256) { return type(uint256).max; } /*/////////////////////////////////////////////////////////////// PREVIEW FUNCTIONS //////////////////////////////////////////////////////////////*/ function _previewDeposit(address tokenIn, uint256 amountTokenToDeposit) internal view virtual override returns (uint256 amountSharesOut) { if (tokenIn == balLp) { amountSharesOut = amountTokenToDeposit; } else { IVault.JoinPoolRequest memory request = _assembleJoinRequest( tokenIn, amountTokenToDeposit ); amountSharesOut = previewHelper.joinPoolPreview( balPoolId, address(this), address(this), request, _getImmutablePoolData() ); } } function _previewRedeem(address tokenOut, uint256 amountSharesToRedeem) internal view virtual override returns (uint256 amountTokenOut) { if (tokenOut == balLp) { amountTokenOut = amountSharesToRedeem; } else { IVault.ExitPoolRequest memory request = _assembleExitRequest( tokenOut, amountSharesToRedeem ); amountTokenOut = previewHelper.exitPoolPreview( balPoolId, address(this), address(this), request, _getImmutablePoolData() ); } } function _getImmutablePoolData() internal view virtual returns (bytes memory); /*/////////////////////////////////////////////////////////////// REWARDS-RELATED //////////////////////////////////////////////////////////////*/ /// @notice allows owner to add new reward tokens in in case Aura does so with their pools function addRewardTokens(address token) external virtual onlyOwner { if (token == BAL_TOKEN || token == AURA_TOKEN || extraRewards.contains(token)) revert Errors.SYInvalidRewardToken(token); uint256 nRewardsAura = IRewards(auraRewardManager).extraRewardsLength(); for (uint256 i = 0; i < nRewardsAura; i++) { if (token == IRewards(IRewards(auraRewardManager).extraRewards(i)).rewardToken()) { extraRewards.push(token); return; } } revert Errors.SYInvalidRewardToken(token); } function extraRewardsLength() external view virtual returns (uint256) { return extraRewards.length; } function _getRewardTokens() internal view virtual override returns (address[] memory res) { uint256 extraRewardsLen = extraRewards.length; res = new address[](2 + extraRewardsLen); res[0] = BAL_TOKEN; res[1] = AURA_TOKEN; for (uint256 i = 0; i < extraRewardsLen; i++) { res[2 + i] = extraRewards[i]; } } /// @dev if there is no extra rewards, we can call getReward with the 2nd arg (_claimExtra) to be false /// which helps save even more gas function _redeemExternalReward() internal virtual override { uint256 extraRewardsLen = extraRewards.length; if (extraRewardsLen == 0) IRewards(auraRewardManager).getReward(address(this), false); else IRewards(auraRewardManager).getReward(address(this), true); } /*/////////////////////////////////////////////////////////////// MISC FUNCTIONS FOR METADATA //////////////////////////////////////////////////////////////*/ function getTokensIn() public view virtual override returns (address[] memory res); function getTokensOut() public view virtual override returns (address[] memory res); function isValidTokenIn(address token) public view virtual override returns (bool); function isValidTokenOut(address token) public view virtual override returns (bool); function assetInfo() external view returns ( AssetType assetType, address assetAddress, uint8 assetDecimals ) { return (AssetType.LIQUIDITY, balLp, IERC20Metadata(balLp).decimals()); } }
// SPDX-License-Identifier: GPL-3.0-or-later pragma solidity ^0.8.17; library StablePoolUserData { enum JoinKind { INIT, EXACT_TOKENS_IN_FOR_BPT_OUT, TOKEN_IN_FOR_EXACT_BPT_OUT } enum ExitKind { EXACT_BPT_IN_FOR_ONE_TOKEN_OUT, BPT_IN_FOR_EXACT_TOKENS_OUT } function exactTokensInForBptOut(bytes memory self) internal pure returns (uint256[] memory amountsIn, uint256 minBPTAmountOut) { (, amountsIn, minBPTAmountOut) = abi.decode(self, (JoinKind, uint256[], uint256)); } function exactBptInForTokenOut(bytes memory self) internal pure returns (uint256 bptAmountIn, uint256 tokenIndex) { (, bptAmountIn, tokenIndex) = abi.decode(self, (ExitKind, uint256, uint256)); } }
// SPDX-License-Identifier: GPL-3.0-or-later pragma solidity 0.8.17; import "@openzeppelin/contracts/token/ERC20/IERC20.sol"; import "../../../../../interfaces/Balancer/IVault.sol"; import "../../../../../interfaces/Balancer/IBalancerFees.sol"; import "../../../../../interfaces/Balancer/IBalancerStablePreview.sol"; abstract contract StablePreviewBase is IBalancerStablePreview { address internal constant BALANCER_VAULT = 0xBA12222222228d8Ba445958a75a0704d566BF2C8; address internal constant WETH = 0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2; address internal constant FEE_COLLECTOR = 0xce88686553686DA562CE7Cea497CE749DA109f9F; enum PoolBalanceChangeKind { JOIN, EXIT } struct PoolBalanceChange { IAsset[] assets; uint256[] limits; bytes userData; bool useInternalBalance; } function joinPoolPreview( bytes32 poolId, address sender, address recipient, IVault.JoinPoolRequest memory request, bytes memory data ) external view returns (uint256 amountBptOut) { amountBptOut = _joinOrExit( PoolBalanceChangeKind.JOIN, poolId, sender, payable(recipient), _toPoolBalanceChange(request), data ); } function exitPoolPreview( bytes32 poolId, address sender, address recipient, IVault.ExitPoolRequest memory request, bytes memory data ) external view returns (uint256 amountTokenOut) { amountTokenOut = _joinOrExit( PoolBalanceChangeKind.EXIT, poolId, sender, recipient, _toPoolBalanceChange(request), data ); } function _joinOrExit( PoolBalanceChangeKind kind, bytes32 poolId, address sender, address recipient, PoolBalanceChange memory change, bytes memory data ) private view returns (uint256 amountBptOrTokensOut) { IERC20[] memory tokens = _translateToIERC20(change.assets); (uint256[] memory balances, uint256 lastChangeBlock) = _validateTokensAndGetBalances( poolId, tokens ); amountBptOrTokensOut = _callPoolBalanceChange( kind, poolId, sender, recipient, change, balances, lastChangeBlock, data ); } function _callPoolBalanceChange( PoolBalanceChangeKind kind, bytes32 poolId, address sender, address recipient, PoolBalanceChange memory change, uint256[] memory balances, uint256 lastChangeBlock, bytes memory data ) private view returns (uint256 amountsChanged) { if (kind == PoolBalanceChangeKind.JOIN) { amountsChanged = onJoinPool( poolId, sender, recipient, balances, lastChangeBlock, _getProtocolSwapFeePercentage(), change.userData, data ); } else { amountsChanged = onExitPool( poolId, sender, recipient, balances, lastChangeBlock, _getProtocolSwapFeePercentage(), change.userData, data ); } } function _getProtocolSwapFeePercentage() private view returns (uint256) { return IBalancerFees(FEE_COLLECTOR).getSwapFeePercentage(); } function _validateTokensAndGetBalances( bytes32 poolId, IERC20[] memory //expectedTokens ) private view returns (uint256[] memory, uint256) { (, uint256[] memory balances, uint256 lastChangeBlock) = IVault(BALANCER_VAULT) .getPoolTokens(poolId); return (balances, lastChangeBlock); } function _translateToIERC20(IAsset[] memory assets) internal pure returns (IERC20[] memory) { IERC20[] memory tokens = new IERC20[](assets.length); for (uint256 i = 0; i < assets.length; ++i) { tokens[i] = _translateToIERC20(assets[i]); } return tokens; } function _translateToIERC20(IAsset asset) internal pure returns (IERC20) { return address(asset) == address(0) ? IERC20(WETH) : IERC20(address(asset)); } function _toPoolBalanceChange(IVault.JoinPoolRequest memory request) private pure returns (PoolBalanceChange memory change) { // solhint-disable-next-line no-inline-assembly assembly { change := request } } function _toPoolBalanceChange(IVault.ExitPoolRequest memory request) private pure returns (PoolBalanceChange memory change) { // solhint-disable-next-line no-inline-assembly assembly { change := request } } function onJoinPool( bytes32 poolId, address sender, address recipient, uint256[] memory balances, uint256 lastChangeBlock, uint256 protocolSwapFeePercentage, bytes memory userData, bytes memory data ) internal view virtual returns (uint256 bptAmountOut); function onExitPool( bytes32 poolId, address sender, address recipient, uint256[] memory balances, uint256 lastChangeBlock, uint256 protocolSwapFeePercentage, bytes memory userData, bytes memory data ) internal view virtual returns (uint256 amountTokenOut); }
// SPDX-License-Identifier: GPL-3.0-or-later pragma solidity 0.8.17; import "../../interfaces/IWstETH.sol"; import "../../interfaces/IWETH.sol"; import "../../interfaces/IStETH.sol"; import "../libraries/TokenHelper.sol"; abstract contract StEthHelper is TokenHelper { address internal constant WETH = 0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2; address internal constant WSTETH = 0x7f39C581F595B53c5cb19bD0b3f8dA6c935E2Ca0; address internal constant STETH = 0xae7ab96520DE3A18E5e111B5EaAb095312D7fE84; constructor() { _safeApproveInf(STETH, WSTETH); } /// @dev tokenIn must be either ETH, WETH or STETH function _depositWstETH(address tokenIn, uint256 amountDep) internal virtual returns (uint256 amountOut) { uint256 amountStETH; if (tokenIn == STETH) { amountStETH = amountDep; } else { if (tokenIn == WETH) IWETH(WETH).withdraw(amountDep); uint256 amountStEthSharesOut = IStETH(STETH).submit{ value: amountDep }(address(0)); amountStETH = IStETH(STETH).getPooledEthByShares(amountStEthSharesOut); } amountOut = IWstETH(WSTETH).wrap(amountStETH); } function _redeemWstETH(address receiver, uint256 amountRedeem) internal virtual returns (uint256 amountTokenOut) { amountTokenOut = IWstETH(WSTETH).unwrap(amountRedeem); if (receiver != address(this)) _transferOut(STETH, receiver, amountTokenOut); } /// @dev tokenIn must be either ETH, WETH or STETH function _previewDepositWstETH(address tokenIn, uint256 amountDep) internal view virtual returns (uint256 amountOut) { if (tokenIn != STETH) { assert(tokenIn == WETH || tokenIn == NATIVE); uint256 totalShares = IStETH(STETH).getTotalShares(); uint256 totalPooledEth = IStETH(STETH).getTotalPooledEther(); uint256 amountStEthSharesOut = IStETH(STETH).getSharesByPooledEth(amountDep); totalShares += amountStEthSharesOut; totalPooledEth += amountDep; uint256 stEthBalance = (amountStEthSharesOut * totalPooledEth) / totalShares; amountOut = (stEthBalance * totalShares) / totalPooledEth; } else { amountOut = IStETH(STETH).getSharesByPooledEth(amountDep); } } function _previewRedeemWstETH(uint256 amountRedeem) internal view returns (uint256 amountOut) { amountOut = IStETH(STETH).getPooledEthByShares(amountRedeem); } }
// SPDX-License-Identifier: GPL-3.0-or-later pragma solidity 0.8.17; import "../../interfaces/IStandardizedYield.sol"; import "../erc20/PendleERC20Permit.sol"; import "../libraries/math/Math.sol"; import "../libraries/TokenHelper.sol"; import "../libraries/Errors.sol"; import "../libraries/BoringOwnableUpgradeable.sol"; import "@openzeppelin/contracts/security/Pausable.sol"; abstract contract SYBase is IStandardizedYield, PendleERC20Permit, TokenHelper, BoringOwnableUpgradeable, Pausable { using Math for uint256; address public immutable yieldToken; constructor( string memory _name, string memory _symbol, address _yieldToken ) PendleERC20Permit(_name, _symbol, IERC20Metadata(_yieldToken).decimals()) initializer { yieldToken = _yieldToken; __BoringOwnable_init(); } // solhint-disable no-empty-blocks receive() external payable {} /*/////////////////////////////////////////////////////////////// DEPOSIT/REDEEM USING BASE TOKENS //////////////////////////////////////////////////////////////*/ /** * @dev See {IStandardizedYield-deposit} */ function deposit( address receiver, address tokenIn, uint256 amountTokenToDeposit, uint256 minSharesOut ) external payable nonReentrant returns (uint256 amountSharesOut) { if (!isValidTokenIn(tokenIn)) revert Errors.SYInvalidTokenIn(tokenIn); if (amountTokenToDeposit == 0) revert Errors.SYZeroDeposit(); _transferIn(tokenIn, msg.sender, amountTokenToDeposit); amountSharesOut = _deposit(tokenIn, amountTokenToDeposit); if (amountSharesOut < minSharesOut) revert Errors.SYInsufficientSharesOut(amountSharesOut, minSharesOut); _mint(receiver, amountSharesOut); emit Deposit(msg.sender, receiver, tokenIn, amountTokenToDeposit, amountSharesOut); } /** * @dev See {IStandardizedYield-redeem} */ function redeem( address receiver, uint256 amountSharesToRedeem, address tokenOut, uint256 minTokenOut, bool burnFromInternalBalance ) external nonReentrant returns (uint256 amountTokenOut) { if (!isValidTokenOut(tokenOut)) revert Errors.SYInvalidTokenOut(tokenOut); if (amountSharesToRedeem == 0) revert Errors.SYZeroRedeem(); if (burnFromInternalBalance) { _burn(address(this), amountSharesToRedeem); } else { _burn(msg.sender, amountSharesToRedeem); } amountTokenOut = _redeem(receiver, tokenOut, amountSharesToRedeem); if (amountTokenOut < minTokenOut) revert Errors.SYInsufficientTokenOut(amountTokenOut, minTokenOut); emit Redeem(msg.sender, receiver, tokenOut, amountSharesToRedeem, amountTokenOut); } /** * @notice mint shares based on the deposited base tokens * @param tokenIn base token address used to mint shares * @param amountDeposited amount of base tokens deposited * @return amountSharesOut amount of shares minted */ function _deposit(address tokenIn, uint256 amountDeposited) internal virtual returns (uint256 amountSharesOut); /** * @notice redeems base tokens based on amount of shares to be burned * @param tokenOut address of the base token to be redeemed * @param amountSharesToRedeem amount of shares to be burned * @return amountTokenOut amount of base tokens redeemed */ function _redeem( address receiver, address tokenOut, uint256 amountSharesToRedeem ) internal virtual returns (uint256 amountTokenOut); /*/////////////////////////////////////////////////////////////// EXCHANGE-RATE //////////////////////////////////////////////////////////////*/ /** * @dev See {IStandardizedYield-exchangeRate} */ function exchangeRate() external view virtual override returns (uint256 res); /*/////////////////////////////////////////////////////////////// REWARDS-RELATED //////////////////////////////////////////////////////////////*/ /** * @dev See {IStandardizedYield-claimRewards} */ function claimRewards( address /*user*/ ) external virtual override returns (uint256[] memory rewardAmounts) { rewardAmounts = new uint256[](0); } /** * @dev See {IStandardizedYield-getRewardTokens} */ function getRewardTokens() external view virtual override returns (address[] memory rewardTokens) { rewardTokens = new address[](0); } /** * @dev See {IStandardizedYield-accruedRewards} */ function accruedRewards( address /*user*/ ) external view virtual override returns (uint256[] memory rewardAmounts) { rewardAmounts = new uint256[](0); } function rewardIndexesCurrent() external virtual override returns (uint256[] memory indexes) { indexes = new uint256[](0); } function rewardIndexesStored() external view virtual override returns (uint256[] memory indexes) { indexes = new uint256[](0); } /*/////////////////////////////////////////////////////////////// MISC METADATA FUNCTIONS //////////////////////////////////////////////////////////////*/ function previewDeposit(address tokenIn, uint256 amountTokenToDeposit) external view virtual returns (uint256 amountSharesOut) { if (!isValidTokenIn(tokenIn)) revert Errors.SYInvalidTokenIn(tokenIn); return _previewDeposit(tokenIn, amountTokenToDeposit); } function previewRedeem(address tokenOut, uint256 amountSharesToRedeem) external view virtual returns (uint256 amountTokenOut) { if (!isValidTokenOut(tokenOut)) revert Errors.SYInvalidTokenOut(tokenOut); return _previewRedeem(tokenOut, amountSharesToRedeem); } function pause() external onlyOwner { _pause(); } function unpause() external onlyOwner { _unpause(); } function _beforeTokenTransfer( address, address, uint256 ) internal virtual override whenNotPaused {} function _previewDeposit(address tokenIn, uint256 amountTokenToDeposit) internal view virtual returns (uint256 amountSharesOut); function _previewRedeem(address tokenOut, uint256 amountSharesToRedeem) internal view virtual returns (uint256 amountTokenOut); function getTokensIn() public view virtual returns (address[] memory res); function getTokensOut() public view virtual returns (address[] memory res); function isValidTokenIn(address token) public view virtual returns (bool); function isValidTokenOut(address token) public view virtual returns (bool); }
// SPDX-License-Identifier: GPL-3.0-or-later pragma solidity 0.8.17; import "../RewardManager/RewardManager.sol"; import "./SYBase.sol"; /// NOTE: yieldToken MUST NEVER BE a rewardToken, else the rewardManager will behave erroneously abstract contract SYBaseWithRewards is SYBase, RewardManager { using Math for uint256; using ArrayLib for address[]; constructor( string memory _name, string memory _symbol, address _yieldToken ) SYBase(_name, _symbol, _yieldToken) // solhint-disable-next-line no-empty-blocks {} /*/////////////////////////////////////////////////////////////// REWARDS-RELATED //////////////////////////////////////////////////////////////*/ /** * @dev See {IStandardizedYield-claimRewards} */ function claimRewards(address user) external virtual override nonReentrant returns (uint256[] memory rewardAmounts) { _updateAndDistributeRewards(user); rewardAmounts = _doTransferOutRewards(user, user); emit ClaimRewards(user, _getRewardTokens(), rewardAmounts); } /** * @dev See {IStandardizedYield-getRewardTokens} */ function getRewardTokens() external view virtual override returns (address[] memory rewardTokens) { rewardTokens = _getRewardTokens(); } /** * @dev See {IStandardizedYield-accruedRewards} */ function accruedRewards(address user) external view virtual override returns (uint256[] memory rewardAmounts) { address[] memory rewardTokens = _getRewardTokens(); rewardAmounts = new uint256[](rewardTokens.length); for (uint256 i = 0; i < rewardTokens.length; ) { rewardAmounts[i] = userReward[rewardTokens[i]][user].accrued; unchecked { i++; } } } function rewardIndexesCurrent() external override nonReentrant returns (uint256[] memory indexes) { _updateRewardIndex(); return rewardIndexesStored(); } function rewardIndexesStored() public view virtual override returns (uint256[] memory indexes) { address[] memory rewardTokens = _getRewardTokens(); indexes = new uint256[](rewardTokens.length); for (uint256 i = 0; i < rewardTokens.length; ) { indexes[i] = rewardState[rewardTokens[i]].index; unchecked { i++; } } } /** * @notice returns the total number of reward shares * @dev this is simply the total supply of shares, as rewards shares are equivalent to SY shares */ function _rewardSharesTotal() internal view virtual override returns (uint256) { return totalSupply(); } /** * @notice returns the reward shares of (`user`) * @dev this is simply the SY balance of (`user`), as rewards shares are equivalent to SY shares */ function _rewardSharesUser(address user) internal view virtual override returns (uint256) { return balanceOf(user); } /*/////////////////////////////////////////////////////////////// TRANSFER HOOKS //////////////////////////////////////////////////////////////*/ function _beforeTokenTransfer( address from, address to, uint256 ) internal virtual override { _updateAndDistributeRewardsForTwo(from, to); } }
// SPDX-License-Identifier: GPL-3.0-or-later pragma solidity 0.8.17; interface IAsset {}
// SPDX-License-Identifier: GPL-3.0-or-later pragma solidity 0.8.17; interface IBalancerFees { function getSwapFeePercentage() external view returns (uint256); }
// SPDX-License-Identifier: GPL-3.0-or-later pragma solidity 0.8.17; import "./IVault.sol"; interface IBalancerStablePreview { function joinPoolPreview( bytes32 poolId, address sender, address recipient, IVault.JoinPoolRequest memory request, bytes memory data ) external view returns (uint256 amountBptOut); function exitPoolPreview( bytes32 poolId, address sender, address recipient, IVault.ExitPoolRequest memory request, bytes memory data ) external view returns (uint256 amountTokenOut); }
// SPDX-License-Identifier: GPL-3.0-or-later pragma solidity 0.8.17; import "@openzeppelin/contracts/token/ERC20/IERC20.sol"; interface IBasePool is IERC20 { function onJoinPool( bytes32 poolId, address sender, address recipient, uint256[] memory balances, uint256 lastChangeBlock, uint256 protocolSwapFeePercentage, bytes memory userData ) external returns (uint256[] memory amountsIn, uint256[] memory dueProtocolFeeAmounts); function onExitPool( bytes32 poolId, address sender, address recipient, uint256[] memory balances, uint256 lastChangeBlock, uint256 protocolSwapFeePercentage, bytes memory userData ) external returns (uint256[] memory amountsOut, uint256[] memory dueProtocolFeeAmounts); function getPoolId() external view returns (bytes32); function getSwapFeePercentage() external view returns (uint256); }
// SPDX-License-Identifier: GPL-3.0-or-later pragma solidity 0.8.17; import "./IBasePool.sol"; interface IMetaStablePool is IBasePool { function getLastInvariant() external view returns (uint256 lastInvariant, uint256 lastInvariantAmp); function getAmplificationParameter() external view returns ( uint256 value, bool isUpdating, uint256 precision ); function getSwapFeePercentage() external view returns (uint256); function getPriceRateCache(IERC20 token) external view returns ( uint256 rate, uint256 duration, uint256 expires ); }
// SPDX-License-Identifier: GPL-3.0-or-later pragma solidity 0.8.17; interface IRateProvider { function getRate() external view returns (uint256); }
// SPDX-License-Identifier: GPL-3.0-or-later pragma solidity 0.8.17; import "@openzeppelin/contracts/token/ERC20/IERC20.sol"; import "./IAsset.sol"; interface IVault { struct JoinPoolRequest { address[] assets; uint256[] maxAmountsIn; bytes userData; bool fromInternalBalance; } function joinPool( bytes32 poolId, address sender, address recipient, JoinPoolRequest memory request ) external payable; struct ExitPoolRequest { address[] assets; uint256[] minAmountsOut; bytes userData; bool toInternalBalance; } function exitPool( bytes32 poolId, address sender, address payable recipient, ExitPoolRequest memory request ) external; enum SwapKind { GIVEN_IN, GIVEN_OUT } struct SingleSwap { bytes32 poolId; SwapKind kind; IAsset assetIn; IAsset assetOut; uint256 amount; bytes userData; } struct FundManagement { address sender; bool fromInternalBalance; address payable recipient; bool toInternalBalance; } function swap( SingleSwap memory singleSwap, FundManagement memory funds, uint256 limit, uint256 deadline ) external payable returns (uint256); function getPoolTokens(bytes32 poolId) external view returns ( IERC20[] memory tokens, uint256[] memory balances, uint256 lastChangeBlock ); function WETH() external view returns (IERC20); function getPool(bytes32 poolId) external view returns (address, uint8); function getProtocolFeesCollector() external view returns (address); }
// SPDX-License-Identifier: GPL-3.0-or-later pragma solidity 0.8.17; interface IBooster { function crv() external view returns (address); function poolLength() external view returns (uint256); function poolInfo(uint256) external view returns ( address lpToken, address, address, address, address, bool ); function deposit( uint256 _pid, uint256 _amount, bool _stake ) external returns (bool); function depositAll(uint256 _pid, bool _stake) external returns (bool); function withdraw(uint256 _pid, uint256 _amount) external returns (bool); function withdrawAll(uint256 _pid) external returns (bool); }
// SPDX-License-Identifier: GPL-3.0-or-later pragma solidity 0.8.17; interface IRewards { function operator() external view returns (address); function stake(address, uint256) external; function stakeFor(address, uint256) external; function withdraw(uint256, bool) external returns (bool); function withdrawAndUnwrap(uint256, bool) external returns (bool); function exit(address) external; function getReward( address, /*_account*/ bool /*_claimExtras*/ ) external; function getReward() external; function queueNewRewards(uint256) external; function notifyRewardAmount(uint256) external; function addExtraReward(address) external; function rewardToken() external returns (address); function rewardPerToken() external returns (uint256); function rewardPerTokenStored() external view returns (uint256); function extraRewardsLength() external view returns (uint256); function extraRewards(uint256) external returns (address); function stakingToken() external returns (address); function lastTimeRewardApplicable() external view returns (uint256); }
// SPDX-License-Identifier: GPL-3.0-or-later pragma solidity 0.8.17; interface IRewardManager { function userReward(address token, address user) external view returns (uint128 index, uint128 accrued); }
// SPDX-License-Identifier: GPL-3.0-or-later /* * MIT License * =========== * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in all * copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE */ pragma solidity 0.8.17; import "@openzeppelin/contracts/token/ERC20/extensions/IERC20Metadata.sol"; interface IStandardizedYield is IERC20Metadata { /// @dev Emitted when any base tokens is deposited to mint shares event Deposit( address indexed caller, address indexed receiver, address indexed tokenIn, uint256 amountDeposited, uint256 amountSyOut ); /// @dev Emitted when any shares are redeemed for base tokens event Redeem( address indexed caller, address indexed receiver, address indexed tokenOut, uint256 amountSyToRedeem, uint256 amountTokenOut ); /// @dev check `assetInfo()` for more information enum AssetType { TOKEN, LIQUIDITY } /// @dev Emitted when (`user`) claims their rewards event ClaimRewards(address indexed user, address[] rewardTokens, uint256[] rewardAmounts); /** * @notice mints an amount of shares by depositing a base token. * @param receiver shares recipient address * @param tokenIn address of the base tokens to mint shares * @param amountTokenToDeposit amount of base tokens to be transferred from (`msg.sender`) * @param minSharesOut reverts if amount of shares minted is lower than this * @return amountSharesOut amount of shares minted * @dev Emits a {Deposit} event * * Requirements: * - (`baseTokenIn`) must be a valid base token. */ function deposit( address receiver, address tokenIn, uint256 amountTokenToDeposit, uint256 minSharesOut ) external payable returns (uint256 amountSharesOut); /** * @notice redeems an amount of base tokens by burning some shares * @param receiver recipient address * @param amountSharesToRedeem amount of shares to be burned * @param tokenOut address of the base token to be redeemed * @param minTokenOut reverts if amount of base token redeemed is lower than this * @param burnFromInternalBalance if true, burns from balance of `address(this)`, otherwise burns from `msg.sender` * @return amountTokenOut amount of base tokens redeemed * @dev Emits a {Redeem} event * * Requirements: * - (`tokenOut`) must be a valid base token. */ function redeem( address receiver, uint256 amountSharesToRedeem, address tokenOut, uint256 minTokenOut, bool burnFromInternalBalance ) external returns (uint256 amountTokenOut); /** * @notice exchangeRate * syBalance / 1e18 must return the asset balance of the account * @notice vice-versa, if a user uses some amount of tokens equivalent to X asset, the amount of sy he can mint must be X * exchangeRate / 1e18 * @dev SYUtils's assetToSy & syToAsset should be used instead of raw multiplication & division */ function exchangeRate() external view returns (uint256 res); /** * @notice claims reward for (`user`) * @param user the user receiving their rewards * @return rewardAmounts an array of reward amounts in the same order as `getRewardTokens` * @dev * Emits a `ClaimRewards` event * See {getRewardTokens} for list of reward tokens */ function claimRewards(address user) external returns (uint256[] memory rewardAmounts); /** * @notice get the amount of unclaimed rewards for (`user`) * @param user the user to check for * @return rewardAmounts an array of reward amounts in the same order as `getRewardTokens` */ function accruedRewards(address user) external view returns (uint256[] memory rewardAmounts); function rewardIndexesCurrent() external returns (uint256[] memory indexes); function rewardIndexesStored() external view returns (uint256[] memory indexes); /** * @notice returns the list of reward token addresses */ function getRewardTokens() external view returns (address[] memory); /** * @notice returns the address of the underlying yield token */ function yieldToken() external view returns (address); /** * @notice returns all tokens that can mint this SY */ function getTokensIn() external view returns (address[] memory res); /** * @notice returns all tokens that can be redeemed by this SY */ function getTokensOut() external view returns (address[] memory res); function isValidTokenIn(address token) external view returns (bool); function isValidTokenOut(address token) external view returns (bool); function previewDeposit(address tokenIn, uint256 amountTokenToDeposit) external view returns (uint256 amountSharesOut); function previewRedeem(address tokenOut, uint256 amountSharesToRedeem) external view returns (uint256 amountTokenOut); /** * @notice This function contains information to interpret what the asset is * @return assetType the type of the asset (0 for ERC20 tokens, 1 for AMM liquidity tokens) * @return assetAddress the address of the asset * @return assetDecimals the decimals of the asset */ function assetInfo() external view returns ( AssetType assetType, address assetAddress, uint8 assetDecimals ); }
// SPDX-License-Identifier: GPL-3.0-or-later pragma solidity 0.8.17; interface IStETH { function getSharesByPooledEth(uint256 _ethAmount) external view returns (uint256); function getPooledEthByShares(uint256 _sharesAmount) external view returns (uint256); function submit(address referral) external payable returns (uint256 amount); function burnShares(address _account, uint256 _sharesAmount) external returns (uint256 newTotalShares); function sharesOf(address account) external view returns (uint256); function getTotalShares() external view returns (uint256); function getTotalPooledEther() external view returns (uint256); }
// SPDX-License-Identifier: GPL-3.0-or-later /* * MIT License * =========== * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in all * copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE */ pragma solidity 0.8.17; import "@openzeppelin/contracts/token/ERC20/IERC20.sol"; interface IWETH is IERC20 { event Deposit(address indexed dst, uint256 wad); event Withdrawal(address indexed src, uint256 wad); function deposit() external payable; function withdraw(uint256 wad) external; }
// SPDX-License-Identifier: GPL-3.0-or-later pragma solidity 0.8.17; interface IWstETH { function wrap(uint256 _stETHAmount) external returns (uint256); function unwrap(uint256 _wstETHAmount) external returns (uint256); function stETH() external view returns (address); function stEthPerToken() external view returns (uint256); }
{ "optimizer": { "enabled": true, "runs": 24000 }, "viaIR": true, "outputSelection": { "*": { "*": [ "evm.bytecode", "evm.deployedBytecode", "devdoc", "userdoc", "metadata", "abi" ] } }, "libraries": {} }
Contract Security Audit
- No Contract Security Audit Submitted- Submit Audit Here
Contract ABI
API[{"inputs":[{"internalType":"string","name":"_name","type":"string"},{"internalType":"string","name":"_symbol","type":"string"},{"internalType":"contract MetaStablePreview","name":"_previewHelper","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[],"name":"SYBalancerInvalidPid","type":"error"},{"inputs":[{"internalType":"uint256","name":"actualSharesOut","type":"uint256"},{"internalType":"uint256","name":"requiredSharesOut","type":"uint256"}],"name":"SYInsufficientSharesOut","type":"error"},{"inputs":[{"internalType":"uint256","name":"actualTokenOut","type":"uint256"},{"internalType":"uint256","name":"requiredTokenOut","type":"uint256"}],"name":"SYInsufficientTokenOut","type":"error"},{"inputs":[{"internalType":"address","name":"token","type":"address"}],"name":"SYInvalidRewardToken","type":"error"},{"inputs":[{"internalType":"address","name":"token","type":"address"}],"name":"SYInvalidTokenIn","type":"error"},{"inputs":[{"internalType":"address","name":"token","type":"address"}],"name":"SYInvalidTokenOut","type":"error"},{"inputs":[],"name":"SYZeroDeposit","type":"error"},{"inputs":[],"name":"SYZeroRedeem","type":"error"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"owner","type":"address"},{"indexed":true,"internalType":"address","name":"spender","type":"address"},{"indexed":false,"internalType":"uint256","name":"value","type":"uint256"}],"name":"Approval","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"user","type":"address"},{"indexed":false,"internalType":"address[]","name":"rewardTokens","type":"address[]"},{"indexed":false,"internalType":"uint256[]","name":"rewardAmounts","type":"uint256[]"}],"name":"ClaimRewards","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"caller","type":"address"},{"indexed":true,"internalType":"address","name":"receiver","type":"address"},{"indexed":true,"internalType":"address","name":"tokenIn","type":"address"},{"indexed":false,"internalType":"uint256","name":"amountDeposited","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"amountSyOut","type":"uint256"}],"name":"Deposit","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint8","name":"version","type":"uint8"}],"name":"Initialized","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"previousOwner","type":"address"},{"indexed":true,"internalType":"address","name":"newOwner","type":"address"}],"name":"OwnershipTransferred","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"account","type":"address"}],"name":"Paused","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"caller","type":"address"},{"indexed":true,"internalType":"address","name":"receiver","type":"address"},{"indexed":true,"internalType":"address","name":"tokenOut","type":"address"},{"indexed":false,"internalType":"uint256","name":"amountSyToRedeem","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"amountTokenOut","type":"uint256"}],"name":"Redeem","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"from","type":"address"},{"indexed":true,"internalType":"address","name":"to","type":"address"},{"indexed":false,"internalType":"uint256","name":"value","type":"uint256"}],"name":"Transfer","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"account","type":"address"}],"name":"Unpaused","type":"event"},{"inputs":[],"name":"AURA_BOOSTER","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"AURA_TOKEN","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"BALANCER_VAULT","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"BAL_TOKEN","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"DOMAIN_SEPARATOR","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"user","type":"address"}],"name":"accruedRewards","outputs":[{"internalType":"uint256[]","name":"rewardAmounts","type":"uint256[]"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"token","type":"address"}],"name":"addRewardTokens","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"owner","type":"address"},{"internalType":"address","name":"spender","type":"address"}],"name":"allowance","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"spender","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"approve","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"assetInfo","outputs":[{"internalType":"enum IStandardizedYield.AssetType","name":"assetType","type":"uint8"},{"internalType":"address","name":"assetAddress","type":"address"},{"internalType":"uint8","name":"assetDecimals","type":"uint8"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"auraPid","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"auraRewardManager","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"balLp","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"balPoolId","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"account","type":"address"}],"name":"balanceOf","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"claimOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"user","type":"address"}],"name":"claimRewards","outputs":[{"internalType":"uint256[]","name":"rewardAmounts","type":"uint256[]"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"decimals","outputs":[{"internalType":"uint8","name":"","type":"uint8"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"receiver","type":"address"},{"internalType":"address","name":"tokenIn","type":"address"},{"internalType":"uint256","name":"amountTokenToDeposit","type":"uint256"},{"internalType":"uint256","name":"minSharesOut","type":"uint256"}],"name":"deposit","outputs":[{"internalType":"uint256","name":"amountSharesOut","type":"uint256"}],"stateMutability":"payable","type":"function"},{"inputs":[],"name":"exchangeRate","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"extraRewards","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"extraRewardsLength","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getRewardTokens","outputs":[{"internalType":"address[]","name":"rewardTokens","type":"address[]"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getTokensIn","outputs":[{"internalType":"address[]","name":"res","type":"address[]"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getTokensOut","outputs":[{"internalType":"address[]","name":"res","type":"address[]"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"token","type":"address"}],"name":"isValidTokenIn","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"token","type":"address"}],"name":"isValidTokenOut","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"lastRewardBlock","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"name","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"owner","type":"address"}],"name":"nonces","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"pause","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"paused","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"pendingOwner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"owner","type":"address"},{"internalType":"address","name":"spender","type":"address"},{"internalType":"uint256","name":"value","type":"uint256"},{"internalType":"uint256","name":"deadline","type":"uint256"},{"internalType":"uint8","name":"v","type":"uint8"},{"internalType":"bytes32","name":"r","type":"bytes32"},{"internalType":"bytes32","name":"s","type":"bytes32"}],"name":"permit","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"tokenIn","type":"address"},{"internalType":"uint256","name":"amountTokenToDeposit","type":"uint256"}],"name":"previewDeposit","outputs":[{"internalType":"uint256","name":"amountSharesOut","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"previewHelper","outputs":[{"internalType":"contract IBalancerStablePreview","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"tokenOut","type":"address"},{"internalType":"uint256","name":"amountSharesToRedeem","type":"uint256"}],"name":"previewRedeem","outputs":[{"internalType":"uint256","name":"amountTokenOut","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"receiver","type":"address"},{"internalType":"uint256","name":"amountSharesToRedeem","type":"uint256"},{"internalType":"address","name":"tokenOut","type":"address"},{"internalType":"uint256","name":"minTokenOut","type":"uint256"},{"internalType":"bool","name":"burnFromInternalBalance","type":"bool"}],"name":"redeem","outputs":[{"internalType":"uint256","name":"amountTokenOut","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"rewardIndexesCurrent","outputs":[{"internalType":"uint256[]","name":"indexes","type":"uint256[]"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"rewardIndexesStored","outputs":[{"internalType":"uint256[]","name":"indexes","type":"uint256[]"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"rewardState","outputs":[{"internalType":"uint128","name":"index","type":"uint128"},{"internalType":"uint128","name":"lastBalance","type":"uint128"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"symbol","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"totalSupply","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"transfer","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"from","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"transferFrom","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"},{"internalType":"bool","name":"direct","type":"bool"},{"internalType":"bool","name":"renounce","type":"bool"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"unpause","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"},{"internalType":"address","name":"","type":"address"}],"name":"userReward","outputs":[{"internalType":"uint128","name":"index","type":"uint128"},{"internalType":"uint128","name":"accrued","type":"uint128"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"yieldToken","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"stateMutability":"payable","type":"receive"}]
Contract Creation Code
61022080604052346200087b5762007148803803809162000021828562001048565b83398101906060818303126200087b5780516001600160401b0381116200087b57826200005091830162001088565b60208201519092906001600160401b0381116200087b576040916200007791840162001088565b910151916001600160a01b03831683036200087b5760405163313ce56760e01b8152602081600481600080516020620070e88339815191525afa908115620009085760009162000fe5575b5060408051939084016001600160401b038111858210176200092a5760405260018452603160f81b602085015282516001600160401b0381116200092a57600354600181811c9116801562000fda575b602082101462000eb957601f811162000f70575b50806020601f821160011462000ee65760009162000eda575b508160011b916000199060031b1c1916176003555b8051906001600160401b0382116200092a5760045490600182811c9216801562000ecf575b602083101462000eb95781601f84931162000e47575b50602090601f831160011462000db85760009262000dac575b50508160011b916000199060031b1c1916176004555b608052600160f81b60018060f81b036002541617600255602081519101209060208151910120816101005280610120524660c05260405191600080516020620071288339815191526020840152604083015260608201524660808201523060a082015260a081528060c081011060018060401b0360c0830111176200092a5760c081016040528051602082012060a0523060e052600080516020620071288339815191526101405260ff196038541660385560075460ff8160a81c16159182809362000d9b575b801562000d7f575b1562000d1f575060ff60a01b198116600160a01b176007558162000d06575b50600080516020620070e8833981519152610160526007549060ff8260a81c161562000cad57600680546001600160a01b0319163317905562000c6f575b5060405163038fff2d60e41b8152602081600481600080516020620070e88339815191525afa908115620009085760009162000c37575b506101a052601d6101c05260405163040f1f6d60e11b8152602081600481600080516020620071088339815191525afa908115620009085760009162000bff575b50601d1162000b5057604051631526fe2760e01b8152601d600482015260c081602481600080516020620071088339815191525afa80156200090857600090819062000b62575b6101e0526101808190526001600160a01b03167332296969ef14eb0c6d29669c550d4a044913022f1901905062000b5057604051636eb1769f60e11b8152306004820152600080516020620071088339815191526024820152602081604481600080516020620070e88339815191525afa908115620009085760009162000b18575b5060016001605f1b031162000940575b604051606081016001600160401b038111828210176200092a57604052600281526020810160403682378151156200091457737f39c581f595b53c5cb19bd0b3f8da6c935e2ca09052805160011015620009145773c02aaa39b223fe8d0a0e5c4f27ead9083c756cc2604082015260005b8151811015620004fe57600581901b820160200151620004d5906001600160a01b031662001115565b6000198114620004e857600101620004ac565b634e487b7160e01b600052601160045260246000fd5b6001600160a01b03831661020052604051636eb1769f60e11b8152306004820152737f39c581f595b53c5cb19bd0b3f8da6c935e2ca0602482015273ae7ab96520de3a18e5e111b5eaab095312d7fe8490602081604481855afa9081156200090857600091620008cd575b5060016001605f1b0311620006fc575b604051615d4990816200139f8239608051816126b6015260a0518161546c015260c05181615527015260e0518161543d015261010051816154bb015261012051816154e10152610140518161549801526101605181611600015261018051818181610a1001528181610b7201528181610d2c01528181610e6601528181610fa40152818161109a0152818161121c01528181611457015281816117a801528181611bc401528181611f730152818161261701528181612a0501528181612df40152612fd001526101a051818181610aa401528181610c8501528181610ef9015281816119ca01528181611d76015281816120960152818161229b01528181612ce701528181612f2e015261310001526101c0518181816122d501528181612a5c01528181612e4e015261302601526101e05181818161070f0152818161176201528181611b7f01528181611f2e01528181613d0701528181613f8401526148b6015261020051818181610ad001528181610cb101528181610fe801526136140152f35b6040516000806020830163095ea7b360e01b93848252737f39c581f595b53c5cb19bd0b3f8da6c935e2ca060248201528260448201526044815262000741816200102c565b519082865af13d15620008c5573d6200075a816200106c565b906200076a604051928362001048565b81523d6000602083013e5b8162000888575b50156200080a5760009182918260405160208101928352737f39c581f595b53c5cb19bd0b3f8da6c935e2ca060248201528119604482015260448152620007c3816200102c565b51925af13d1562000880573d620007da816200106c565b90620007ea604051928362001048565b81523d6000602083013e5b816200083e575b50156200080a578062000579565b60405162461bcd60e51b815260206004820152600c60248201526b5361666520417070726f766560a01b6044820152606490fd5b805180159250821562000855575b505081620007fc565b81925090602091810103126200087b57602062000873910162001107565b81806200084c565b600080fd5b6060620007f5565b80518015925082156200089f575b5050836200077c565b81925090602091810103126200087b576020620008bd910162001107565b838062000896565b606062000775565b906020823d602011620008ff575b81620008ea6020938362001048565b81010312620008fc5750518262000569565b80fd5b3d9150620008db565b6040513d6000823e3d90fd5b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052604160045260246000fd5b6040516000806020830163095ea7b360e01b938482526000805160206200710883398151915260248201528260448201526044815262000980816200102c565b519082600080516020620070e88339815191525af13d1562000b10573d620009a8816200106c565b90620009b8604051928362001048565b81523d6000602083013e5b8162000ad3575b50156200080a576000809160405160208101918252600080516020620071088339815191526024820152821960448201526044815262000a0a816200102c565b519082600080516020620070e88339815191525af13d1562000acb573d62000a32816200106c565b9062000a42604051928362001048565b81523d6000602083013e5b8162000a8e575b506200043b5760405162461bcd60e51b815260206004820152600c60248201526b5361666520417070726f766560a01b6044820152606490fd5b805180159250821562000aa5575b50503862000a54565b81925090602091810103126200087b57602062000ac3910162001107565b388062000a9c565b606062000a4d565b805180159250821562000aea575b505038620009ca565b81925090602091810103126200087b57602062000b08910162001107565b388062000ae1565b6060620009c3565b906020823d60201162000b47575b8162000b356020938362001048565b81010312620008fc575051386200042b565b3d915062000b26565b604051636467ac9d60e11b8152600490fd5b5060c0823d60c01162000bf6575b8162000b7f60c0938362001048565b81010312620008fc57508062000ba5600080516020620070e883398151915292620010f2565b62000bb360208301620010f2565b5062000bc260408301620010f2565b5062000bee60a062000bd760608501620010f2565b9362000be660808201620010f2565b500162001107565b5090620003a9565b3d915062000b70565b906020823d60201162000c2e575b8162000c1c6020938362001048565b81010312620008fc5750513862000362565b3d915062000c0d565b906020823d60201162000c66575b8162000c546020938362001048565b81010312620008fc5750513862000321565b3d915062000c45565b60ff60a81b1916600755604051600181527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb384740249890602090a138620002ea565b60405162461bcd60e51b815260206004820152602b60248201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960448201526a6e697469616c697a696e6760a81b6064820152608490fd5b61ffff60a01b191661010160a01b1760075538620002ac565b60c060849162461bcd60e51b82820152602060c4820152602e60e48201527f496e697469616c697a61626c653a20636f6e747261637420697320616c7265616101048201526d191e481a5b9a5d1a585b1a5e995960921b61012482015201fd5b50303b1580156200028d5750600160ff8360a01c16146200028d565b50600160ff8360a01c161062000285565b015190503880620001a8565b6004600090815293507f8a35acfbc15ff81a39ae7d344fd709f28e8600b4aa8c65c6b64bfe7fe36bd19b91905b601f198416851062000e2b576001945083601f1981161062000e11575b505050811b01600455620001be565b015160001960f88460031b161c1916905538808062000e02565b8181015183556020948501946001909301929091019062000de5565b60046000529091507f8a35acfbc15ff81a39ae7d344fd709f28e8600b4aa8c65c6b64bfe7fe36bd19b601f840160051c81016020851062000eb1575b90849392915b601f830160051c8201811062000ea15750506200018f565b6000815585945060010162000e89565b508062000e83565b634e487b7160e01b600052602260045260246000fd5b91607f169162000179565b9050840151386200013f565b6003600090815292507fc2575a0e9e593c00f959f8c92f12db2869c3395a3b0502d05e2516446f71f85b905b601f198316841062000f57576001935082601f1981161062000f3d575b5050811b0160035562000154565b86015160001960f88460031b161c19169055388062000f2f565b8681015182556020938401936001909201910162000f12565b60036000527fc2575a0e9e593c00f959f8c92f12db2869c3395a3b0502d05e2516446f71f85b601f830160051c8101916020841062000fcf575b601f0160051c01905b81811062000fc2575062000126565b6000815560010162000fb3565b909150819062000faa565b90607f169062000112565b6020813d60201162001023575b81620010016020938362001048565b810103126200101f57519060ff82168203620008fc575038620000c2565b5080fd5b3d915062000ff2565b608081019081106001600160401b038211176200092a57604052565b601f909101601f19168101906001600160401b038211908210176200092a57604052565b6001600160401b0381116200092a57601f01601f191660200190565b919080601f840112156200087b57825190620010a4826200106c565b91620010b4604051938462001048565b8083526020918282870101116200087b5760005b818110620010de57508260009394955001015290565b8581018301518482018401528201620010c8565b51906001600160a01b03821682036200087b57565b519081151582036200087b57565b6001600160a01b03811680156200139a5760408051928392636eb1769f60e11b84523060048501528373ba12222222228d8ba445958a75a0704d566bf2c891826024830152602096879160449788915afa9081156200138f576000916200135c575b5060016001605f1b03116200118e575b5050505050565b82519060008087840163095ea7b360e01b948582528460248201528289820152888152620011bc816200102c565b519082875af13d1562001354573d620011d5816200106c565b90620011e48751928362001048565b81523d60008983013e5b8162001316575b5015620012e4579160009291838093865190898201938452602482015281198882015287815262001226816200102c565b51925af13d15620012dc573d6200123d816200106c565b906200124c8451928362001048565b81523d60008683013e5b816200129e575b50156200126c57808062001187565b5162461bcd60e51b81526004810192909252600c60248301526b5361666520417070726f766560a01b90820152606490fd5b80915051848115918215620012b9575b50509050386200125d565b83809293500103126200087b5783620012d3910162001107565b808438620012ae565b606062001256565b835162461bcd60e51b815260048101879052600c60248201526b5361666520417070726f766560a01b81870152606490fd5b8091505187811591821562001331575b5050905038620011f5565b83809293500103126200087b57866200134b910162001107565b80873862001326565b6060620011ee565b908682813d831162001387575b62001375818362001048565b81010312620008fc5750513862001177565b503d62001369565b84513d6000823e3d90fd5b505056fe608080604052600436101561001d575b50361561001b57600080fd5b005b6000803560e01c9182630390c839146135ea5750816306fdde0314613529578163071bc3c9146128d9578163078dfbe7146133df57816307cab83c146133b1578163095ea7b314613380578163128fced1146132e157816318160ddd146132a357816320e8c565146128e3578163213cae63146128d957816323b872dd1461274c5781632a5e141e146127085781632abc2a99146126da578163313ce5671461269d5781633644e515146126835781633ba0b9a9146125c35781633f4ba83a146124ee57816340c35446146124865781634e71e0c8146123b55781635c975abb146123935781635cbadbe4146122f8578163619002ce146122be578163655864521461228457816370a082311461223f578163769f8e5d1461162457816376d5de85146115d4578163784367d6146115ca5781637ecebe00146115865781638456cb59146114ae5781638da5cb5b1461147b5781638efabee01461142b57816395d89b41146112e7578163a40bee50146111f5578163a9059cbb1461113f578163a9f8d18114611122578163b8f82b2614610e13578163bc16384614610de5578163c4f59f9b14610db6578163cbe52ae3146109be578163d1e1a86714610990578163d505accf1461077f578163d55a23f414610762578163da88ecb414610733578163dc616e3e146106e3578163dd62ed3e14610687578163e30c397814610654578163ea64a820146105e4578163ef5cfb8c14610325578163f8b2f99114610260575063fa5a4f0614610253575b3861000f565b61025b6138c5565b61024d565b3461032257806003193601126103225761031e60025461028660028260f81c14156138f3565b7f02000000000000000000000000000000000000000000000000000000000000007effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff809216176002556102d6613c27565b50507f0100000000000000000000000000000000000000000000000000000000000000610301614283565b91600254161760025560405191829160208352602083019061382b565b0390f35b80fd5b34610322576020806003193601126105e057906103406137e5565b6002549161035460028460f81c14156138f3565b7f02000000000000000000000000000000000000000000000000000000000000007effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff809416176002556103a582613b42565b6103ad614b99565b6103b78151613a66565b94829073ffffffffffffffffffffffffffffffffffffffff93848616925b845181101561054c57856103e98287613b2e565b5116825260398084526040832085600052845260406000205490608091821c610412848d613b2e565b5261041d838c613b2e565b51610433575b505061042e90613ab5565b6103d5565b8761043e8489613b2e565b511684528452604083208560005284526040600020906fffffffffffffffffffffffffffffffff91828154169055610476838c613b2e565b5190828211610547578861048a858a613b2e565b51168552603b865282604086209216908254901c0391821161051a5761042e92916104f091906fffffffffffffffffffffffffffffffff7fffffffffffffffffffffffffffffffff0000000000000000000000000000000083549260801b169116179055565b6105138a8961050c848b610504828d613b2e565b511693613b2e565b5191615bf3565b908a610423565b6024847f4e487b710000000000000000000000000000000000000000000000000000000081526011600452fd5b600080fd5b88837f01000000000000000000000000000000000000000000000000000000000000008a877f2193aa20a3717f5f4ac79482f4f553e5f0afe8f4e6ec3e3d1aa2e138adc4763f6105b461059d614b99565b6105c1604051928392604084526040840190613696565b828103898401528961382b565b0390a2600254161760025561031e60405192828493845283019061382b565b5080fd5b3461032257602060031936011261032257604061031e9173ffffffffffffffffffffffffffffffffffffffff6106186137e5565b168152603b602090815291902054604080516fffffffffffffffffffffffffffffffff8316815260809290921c92820192909252918291820190565b34610322578060031936011261032257602073ffffffffffffffffffffffffffffffffffffffff60075416604051908152f35b34610322576040600319360112610322576106a06137e5565b60406106aa613808565b9273ffffffffffffffffffffffffffffffffffffffff809316815260016020522091166000526020526020604060002054604051908152f35b34610322578060031936011261032257602060405173ffffffffffffffffffffffffffffffffffffffff7f0000000000000000000000000000000000000000000000000000000000000000168152f35b3461032257806003193601126103225761031e61074e614283565b60405191829160208352602083019061382b565b346103225780600319360112610322576020603c54604051908152f35b346103225760e0600319360112610322576107986137e5565b6107a0613808565b6044359060843560643560ff8216820361098c578042116109485773ffffffffffffffffffffffffffffffffffffffff9081861692838852600560205260408820908154916001830190556040519260208401927f6e71edae12b1b97f4d1f60370fef10105fa2faae0126114a169c64845d6126c98452866040860152858816606086015288608086015260a085015260c084015260c0835260e083019183831067ffffffffffffffff841117610919576108c3936108bb93604052519020610867615426565b916040519160208301937f1901000000000000000000000000000000000000000000000000000000000000855260228401526042830152604282526108ab8261399d565b60c4359260a43592519020615371565b9190916151b4565b16036108d5576108d292615073565b80f35b606460405162461bcd60e51b815260206004820152601e60248201527f45524332305065726d69743a20696e76616c6964207369676e617475726500006044820152fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b606460405162461bcd60e51b815260206004820152601d60248201527f45524332305065726d69743a206578706972656420646561646c696e650000006044820152fd5b8580fd5b34610322578060031936011261032257602060405173c0c293ce456ff0ed870add98a0828dd4d2903dbf8152f35b34610322576040600319360112610322576109d76137e5565b602435906109e4816142f8565b15610d6f5773ffffffffffffffffffffffffffffffffffffffff9281841680610b4a57505050600091807f00000000000000000000000000000000000000000000000000000000000000001673c02aaa39b223fe8d0a0e5c4f27ead9083c756cc214600014610a5b5750602091505b604051908152f35b602090610a6a610acc93614602565b90610a736146a1565b916040518095819482937f6261173000000000000000000000000000000000000000000000000000000000845230307f00000000000000000000000000000000000000000000000000000000000000006004870161464e565b03917f0000000000000000000000000000000000000000000000000000000000000000165afa908115610b3f578291610b0a575b5060209150610a53565b90506020813d8211610b37575b81610b2460209383613a0d565b810103126105e057602091505182610b00565b3d9150610b17565b6040513d84823e3d90fd5b73ae7ab96520de3a18e5e111b5eaab095312d7fe8494919392818603610d20575050600090807f000000000000000000000000000000000000000000000000000000000000000016737f39c581f595b53c5cb19bd0b3f8da6c935e2ca014600014610c3c5750506020905b6024604051809581937f7a28fb8800000000000000000000000000000000000000000000000000000000835260048301525afa908115610c305790610bfe575b60209150610a53565b506020813d8211610c28575b81610c1760209383613a0d565b810103126105475760209051610bf5565b3d9150610c0a565b604051903d90823e3d90fd5b602090610c4b610cad946145bb565b90610c546146a1565b916040518096819482937f6261173000000000000000000000000000000000000000000000000000000000845230307f00000000000000000000000000000000000000000000000000000000000000006004870161464e565b03917f0000000000000000000000000000000000000000000000000000000000000000165afa908115610c30578091610ceb575b5060209150610bb5565b90506020823d8211610d18575b81610d0560209383613a0d565b8101031261032257506020905184610ce1565b3d9150610cf8565b919293509350600093827f00000000000000000000000000000000000000000000000000000000000000001614600014610d5f57505060209150610a53565b90610a6a610acc93602093614627565b60249073ffffffffffffffffffffffffffffffffffffffff604051917f88a50561000000000000000000000000000000000000000000000000000000008352166004820152fd5b3461032257806003193601126103225761031e610dd1614b99565b604051918291602083526020830190613696565b34610322578060031936011261032257602060405173ba12222222228d8ba445958a75a0704d566bf2c88152f35b3461032257604060031936011261032257610e2c6137e5565b9060243590610e3a836142f8565b156110db5773ffffffffffffffffffffffffffffffffffffffff9280841680610f2157505050600091807f00000000000000000000000000000000000000000000000000000000000000001673c02aaa39b223fe8d0a0e5c4f27ead9083c756cc214600014610eb0575060209150604051908152f35b602090610ebf610acc936144ee565b90610ec86146a1565b916040518095819482937f6669506000000000000000000000000000000000000000000000000000000000845230307f00000000000000000000000000000000000000000000000000000000000000006004870161464e565b919273ae7ab96520de3a18e5e111b5eaab095312d7fe8492909181840361108f5750506040519182917f19208451000000000000000000000000000000000000000000000000000000008352600483015281602460209485935afa928315610c305792611060575b50600092737f39c581f595b53c5cb19bd0b3f8da6c935e2ca07f0000000000000000000000000000000000000000000000000000000000000000821603610fd557505060209150610a53565b90610fe491610ebf829461442e565b03917f0000000000000000000000000000000000000000000000000000000000000000165afa918215611055578392611023575b505060209150610a53565b90809250813d831161104e575b61103a8183613a0d565b810103126105e05760209150518280611018565b503d611030565b6040513d85823e3d90fd5b9080925081813d8311611088575b6110788183613a0d565b8101031261054757519083610f89565b503d61106e565b6000959294509192507f00000000000000000000000000000000000000000000000000000000000000008316036110cb57505060209150610a53565b90610ebf610acc93602093614527565b60248373ffffffffffffffffffffffffffffffffffffffff604051917faeabe718000000000000000000000000000000000000000000000000000000008352166004820152fd5b346103225780600319360112610322576020603a54604051908152f35b34610322576040600319360112610322577f01000000000000000000000000000000000000000000000000000000000000006111796137e5565b6111e26002549161119060028460f81c14156138f3565b7f02000000000000000000000000000000000000000000000000000000000000007effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff809416176002556024359033614c75565b6002541617600255602060405160018152f35b3461032257806003193601126103225773ffffffffffffffffffffffffffffffffffffffff7f000000000000000000000000000000000000000000000000000000000000000016604051917f313ce567000000000000000000000000000000000000000000000000000000008352602083600481855afa9283156112da578193611295575b60608360ff8660405192600184526020840152166040820152f35b9092506020813d82116112d2575b816112b060209383613a0d565b810103126112ce57519160ff83168303610322575060ff606061127a565b8280fd5b3d91506112a3565b50604051903d90823e3d90fd5b34610322578060031936011261032257604051908060045491600183811c92818516948515611421575b60209586861081146113f4578588528794939291879082156113b3575050600114611359575b505061134592500383613a0d565b61031e604051928284938452830190613638565b90859250600482527f8a35acfbc15ff81a39ae7d344fd709f28e8600b4aa8c65c6b64bfe7fe36bd19b5b85831061139b57505061134593508201018580611337565b80548389018501528794508693909201918101611383565b915093506113459592507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0091501682840152151560051b8201018580611337565b6024837f4e487b710000000000000000000000000000000000000000000000000000000081526022600452fd5b93607f1693611311565b34610322578060031936011261032257602060405173ffffffffffffffffffffffffffffffffffffffff7f0000000000000000000000000000000000000000000000000000000000000000168152f35b34610322578060031936011261032257602073ffffffffffffffffffffffffffffffffffffffff60065416604051908152f35b346103225780600319360112610322576114e173ffffffffffffffffffffffffffffffffffffffff60065416331461393e565b60385460ff8116611542577fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0060019116176038557f62e78cea01bee320cd4e420270b5ea74000d11b0c9f74754ebdbfc544b05a2586020604051338152a180f35b606460405162461bcd60e51b815260206004820152601060248201527f5061757361626c653a20706175736564000000000000000000000000000000006044820152fd5b3461032257602060031936011261032257604060209173ffffffffffffffffffffffffffffffffffffffff6115b96137e5565b168152600583522054604051908152f35b505061025b6138c5565b34610322578060031936011261032257602060405173ffffffffffffffffffffffffffffffffffffffff7f0000000000000000000000000000000000000000000000000000000000000000168152f35b346103225760a06003193601126103225761163d6137e5565b906044359173ffffffffffffffffffffffffffffffffffffffff8316830361054757608435928315158403610547576002549361168060028660f81c14156138f3565b7f02000000000000000000000000000000000000000000000000000000000000007effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff809616176002556116d1826142f8565b156121f857602435156121ce57156121bd576116ef60243530614e95565b73ffffffffffffffffffffffffffffffffffffffff8116611af5576000926040517fc32e720200000000000000000000000000000000000000000000000000000000815284602435600483015280602483015260209182816044818573ffffffffffffffffffffffffffffffffffffffff7f0000000000000000000000000000000000000000000000000000000000000000165af18015610b3f57611ac8575b5073c02aaa39b223fe8d0a0e5c4f27ead9083c756cc2957f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff16870361192757505050602435906117f660243530615b2a565b8194803b156105e0578180916024604051809481937f2e1a7d4d0000000000000000000000000000000000000000000000000000000083528860048401525af18015610b3f57611913575b505061184d90836159fe565b6064358084106118dc5750927f01000000000000000000000000000000000000000000000000000000000000009160209473ffffffffffffffffffffffffffffffffffffffff806040519260243584528789850152169216907faee47cdf925cf525fdae94f9777ee5a06cac37e1c41220d0a8a89ed154f62d1c60403392a46002541617600255604051908152f35b83604491604051917fbfee4ca000000000000000000000000000000000000000000000000000000000835260048301526024820152fd5b61191d8291613989565b6103225780611841565b604051917f70a08231000000000000000000000000000000000000000000000000000000009081845230600485015284846024818c5afa9384156112da578194611a95575b50611978602435614602565b73ba12222222228d8ba445958a75a0704d566bf2c890813b156112ce57611a0b839283926040519485809481937f8bdb39130000000000000000000000000000000000000000000000000000000083527f000000000000000000000000000000000000000000000000000000000000000060048401523060248401523060448401526080606484015260848301906143bd565b03925af18015610b3f57611a83575b5060405191825230600483015284826024818c5afa928315610c305792611a4e575b5050611a489250613c0d565b906117f6565b9150919282813d8311611a7c575b611a668183613a0d565b81010312610322575090611a4891518880611a3c565b503d611a5c565b611a8e919350613989565b818a611a1a565b9093508481813d8311611ac1575b611aad8183613a0d565b81010312611abd5751928a61196c565b8380fd5b503d611aa3565b611ae790833d8511611aee575b611adf8183613a0d565b8101906143a5565b508761178f565b503d611ad5565b9173ffffffffffffffffffffffffffffffffffffffff831673ae7ab96520de3a18e5e111b5eaab095312d7fe8403611ed5576000604051907fc32e720200000000000000000000000000000000000000000000000000000000825280602435600484015281602484015260209283816044818673ffffffffffffffffffffffffffffffffffffffff7f0000000000000000000000000000000000000000000000000000000000000000165af1801561105557611eb8575b50737f39c581f595b53c5cb19bd0b3f8da6c935e2ca07f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff1603611cc757505060243590611c0e8230615a61565b604051917fde0e9a3e0000000000000000000000000000000000000000000000000000000083526004830152808260248186737f39c581f595b53c5cb19bd0b3f8da6c935e2ca05af1928315610c305792611c99575b50503073ffffffffffffffffffffffffffffffffffffffff831603611c8a575b9161184d565b611c9481836158ed565b611c84565b90809250813d8311611cc0575b611cb08183613a0d565b8101031261054757518480611c64565b503d611ca6565b604051917f70a082310000000000000000000000000000000000000000000000000000000083523060048401528383602481737f39c581f595b53c5cb19bd0b3f8da6c935e2ca05afa9283156112da578193611e89575b50611d2a6024356145bb565b73ba12222222228d8ba445958a75a0704d566bf2c83b156105e05781611db791604051809381927f8bdb39130000000000000000000000000000000000000000000000000000000083527f000000000000000000000000000000000000000000000000000000000000000060048401523060248401523060448401526080606484015260848301906143bd565b03818373ba12222222228d8ba445958a75a0704d566bf2c85af18015610b3f57611e77575b50604051907f70a082310000000000000000000000000000000000000000000000000000000082523060048301528482602481737f39c581f595b53c5cb19bd0b3f8da6c935e2ca05afa928315610c305792611e45575b505090611e3f91613c0d565b90611c0e565b9091508382813d8311611e70575b611e5d8183613a0d565b81010312610322575051611e3f88611e33565b503d611e53565b611e82919250613989565b8088611ddc565b9092508381813d8311611eb1575b611ea18183613a0d565b810103126112ce57519188611d1e565b503d611e97565b611ece90843d8611611aee57611adf8183613a0d565b5087611bac565b506000604051907fc32e720200000000000000000000000000000000000000000000000000000000825280602435600484015281602484015260209283816044818673ffffffffffffffffffffffffffffffffffffffff7f0000000000000000000000000000000000000000000000000000000000000000165af18015611055576121a0575b5073ffffffffffffffffffffffffffffffffffffffff7f00000000000000000000000000000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff861614600014611fc557505050602435611c846024358385615bf3565b604051917f70a08231000000000000000000000000000000000000000000000000000000009081845273ffffffffffffffffffffffffffffffffffffffff8616806004860152858560248173ffffffffffffffffffffffffffffffffffffffff8c165afa948515610b3f578295612171575b5061204460243589614627565b73ba12222222228d8ba445958a75a0704d566bf2c890813b15611abd576120d7849283926040519485809481937f8bdb39130000000000000000000000000000000000000000000000000000000083527f000000000000000000000000000000000000000000000000000000000000000060048401523060248401528960448401526080606484015260848301906143bd565b03925af180156110555761215e575b506040519283526004830152848260248173ffffffffffffffffffffffffffffffffffffffff8b165afa928315610c305792612129575b5050611c949250613c0d565b9150919282813d8311612157575b6121418183613a0d565b81010312610322575090611c949151868061211d565b503d612137565b612169919450613989565b8092896120e6565b9094508581813d8311612199575b6121898183613a0d565b810103126105e057519389612037565b503d61217f565b6121b690843d8611611aee57611adf8183613a0d565b5086611f5b565b6121c960243533614e95565b6116ef565b60046040517fc3d83b07000000000000000000000000000000000000000000000000000000008152fd5b60248273ffffffffffffffffffffffffffffffffffffffff604051917f88a50561000000000000000000000000000000000000000000000000000000008352166004820152fd5b34610322576020600319360112610322576020610a5361225d6137e5565b73ffffffffffffffffffffffffffffffffffffffff16600052600060205260406000205490565b3461032257806003193601126103225760206040517f00000000000000000000000000000000000000000000000000000000000000008152f35b3461032257806003193601126103225760206040517f00000000000000000000000000000000000000000000000000000000000000008152f35b34610322576040600319360112610322576123116137e5565b604061231b613808565b9273ffffffffffffffffffffffffffffffffffffffff8093168152603960205220911660005260205261031e60406000205460405191816fffffffffffffffffffffffffffffffff849360801c9116839060209093929360408301946fffffffffffffffffffffffffffffffff809216845216910152565b34610322578060031936011261032257602060ff603854166040519015158152f35b3461032257806003193601126103225760075473ffffffffffffffffffffffffffffffffffffffff9081811680330361244257806006549384167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e08680a37fffffffffffffffffffffffff0000000000000000000000000000000000000000809316176006551660075580f35b606460405162461bcd60e51b815260206004820152602060248201527f4f776e61626c653a2063616c6c657220213d2070656e64696e67206f776e65726044820152fd5b346103225760206003193601126103225760043590603c5482101561032257602073ffffffffffffffffffffffffffffffffffffffff83603c6000527fc6bb06cb7f92603de181bf256cd16846b93b752a170ff24824098b31aa008a7e015416604051908152f35b3461032257806003193601126103225761252173ffffffffffffffffffffffffffffffffffffffff60065416331461393e565b60385460ff81161561257f577fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00166038557f5db9ee0a495bf2e6ff9c91a7834c1ba4fdd244a5e8aa4e537bd38aeae4b073aa6020604051338152a180f35b606460405162461bcd60e51b815260206004820152601460248201527f5061757361626c653a206e6f74207061757365640000000000000000000000006044820152fd5b34610322578060031936011261032257604051907f679aefce00000000000000000000000000000000000000000000000000000000825260208260048173ffffffffffffffffffffffffffffffffffffffff7f0000000000000000000000000000000000000000000000000000000000000000165afa908115610c305790612651575b602090604051908152f35b506020813d821161267b575b8161266a60209383613a0d565b810103126105475760209051612646565b3d915061265d565b346103225780600319360112610322576020610a53615426565b34610322578060031936011261032257602060405160ff7f0000000000000000000000000000000000000000000000000000000000000000168152f35b34610322578060031936011261032257602060405173ba100000625a3754423978a60c9317c58a424e3d8152f35b34610322576020600319360112610322576108d26127246137e5565b61274773ffffffffffffffffffffffffffffffffffffffff60065416331461393e565b614843565b34610322576060600319360112610322576127656137e5565b9061276e613808565b6044359060406002549361278860028660f81c14156138f3565b7f02000000000000000000000000000000000000000000000000000000000000007effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8096161760025573ffffffffffffffffffffffffffffffffffffffff86168152600160205220336000526020526040600020547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8103612851575b50906111e2917f010000000000000000000000000000000000000000000000000000000000000094614c75565b9190818310612895577f01000000000000000000000000000000000000000000000000000000000000009461288c836111e295033383615073565b94509091612824565b606460405162461bcd60e51b815260206004820152601d60248201527f45524332303a20696e73756666696369656e7420616c6c6f77616e63650000006044820152fd5b505061025b6136e0565b6080600319360112610322576128f76137e5565b6128ff613808565b906044803592606491823594600294855494612920878760f81c14156138f3565b7f02000000000000000000000000000000000000000000000000000000000000007effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff809716178755612970856142f8565b1561325c5782156132325773ffffffffffffffffffffffffffffffffffffffff85811695861580156131a05785340361315d575b15612d79575073c02aaa39b223fe8d0a0e5c4f27ead9083c756cc2803b15612d75576040517fd0e30db00000000000000000000000000000000000000000000000000000000081528b8160048189865af18015612d6a57612d57575b5060007f00000000000000000000000000000000000000000000000000000000000000009183831614600014612c8b575050835b6040517f43a0d0660000000000000000000000000000000000000000000000000000000081527f000000000000000000000000000000000000000000000000000000000000000060048201528160248201526001878201526020818581600073a57b8d98dae62b26ec3bcc4a365338157060b2345af18015612c7f57612c61575b50985b808a10612c2b57508216938415612bea575050612ad490613b42565b83861161054757845484871685821601858111612bbd57926020988193927fff00000000000000000000000000000000000000000000000000000000000000887f0100000000000000000000000000000000000000000000000000000000000000999897169116178855818152808a5260408120612b538a8254613c1a565b90557fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8a6040518b8152a360405190815286888201527f5fe47ed6d4225326d3303476197d782ded5a4e9c14f479dc9ec4992af4e85d5960403392a4825416179055604051908152f35b6024897f4e487b710000000000000000000000000000000000000000000000000000000081526011600452fd5b7f45524332303a206d696e7420746f20746865207a65726f2061646472657373006040519162461bcd60e51b835260206004840152601f6024840152820152fd5b898691604051917fbc71f2ba00000000000000000000000000000000000000000000000000000000835260048301526024820152fd5b612c789060203d8111611aee57611adf8183613a0d565b508b612ab5565b6040513d6000823e3d90fd5b612c94866144ee565b73ba12222222228d8ba445958a75a0704d566bf2c8803b156112ce57918091612d26938a836040518097819582947fb95cac280000000000000000000000000000000000000000000000000000000084527f00000000000000000000000000000000000000000000000000000000000000006004850152306024850152309084015260808d84015260848301906143bd565b03925af1908115610c30575090612d439291612d48575b50615c76565b612a34565b612d5190613989565b8c612d3d565b612d63909b919b613989565b998b612a00565b6040513d8e823e3d90fd5b8a80fd5b73ae7ab96520de3a18e5e111b5eaab095312d7fe848703612fce57506040517fea598cb00000000000000000000000000000000000000000000000000000000081528460048201526020908b8282602481737f39c581f595b53c5cb19bd0b3f8da6c935e2ca094855af1918215612ec6578d92612f9b575b507f00000000000000000000000000000000000000000000000000000000000000009084821603612ed15750905b83818d604051928380927f43a0d0660000000000000000000000000000000000000000000000000000000082527f0000000000000000000000000000000000000000000000000000000000000000600483015287602483015260018d83015273a57b8d98dae62b26ec3bcc4a365338157060b2345af18015612ec657612ea8575b505098612ab8565b81612ebe92903d10611aee57611adf8183613a0d565b508b80612ea0565b6040513d8f823e3d90fd5b90612edb9061442e565b908c73ba12222222228d8ba445958a75a0704d566bf2c892833b156105e057612f6d938a836040518097819582947fb95cac280000000000000000000000000000000000000000000000000000000084527f00000000000000000000000000000000000000000000000000000000000000006004850152306024850152309084015260808d84015260848301906143bd565b03925af1918215612ec657612f8692612f8c5750615c76565b90612e1f565b612f9590613989565b8d612d3d565b9091508281813d8311612fc7575b612fb38183613a0d565b81010312612fc35751908d612df1565b8c80fd5b503d612fa9565b7f0000000000000000000000000000000000000000000000000000000000000000908583831689036130a4579150505b6040517f43a0d0660000000000000000000000000000000000000000000000000000000081527f000000000000000000000000000000000000000000000000000000000000000060048201526024810182905260018782015260208185818f73a57b8d98dae62b26ec3bcc4a365338157060b2345af18015612d6a57613086575b5098612ab8565b61309d9060203d8111611aee57611adf8183613a0d565b508b61307f565b6130ad91614527565b908b73ba12222222228d8ba445958a75a0704d566bf2c892833b156105e05761313f9389836040518097819582947fb95cac280000000000000000000000000000000000000000000000000000000084527f00000000000000000000000000000000000000000000000000000000000000006004850152306024850152309084015260808c84015260848301906143bd565b03925af1918215612d6a5761315892612d485750615c76565b612ffe565b83877f657468206d69736d6174636800000000000000000000000000000000000000006040519162461bcd60e51b835260206004840152600c6024840152820152fd5b6040517f23b872dd0000000000000000000000000000000000000000000000000000000060208201523360248201523088820152868582015284815260a0810181811067ffffffffffffffff821117613205576040526132009089615702565b6129a4565b60248e7f4e487b710000000000000000000000000000000000000000000000000000000081526041600452fd5b60046040517fa907f2f0000000000000000000000000000000000000000000000000000000008152fd5b60248573ffffffffffffffffffffffffffffffffffffffff604051917faeabe718000000000000000000000000000000000000000000000000000000008352166004820152fd5b3461032257806003193601126103225760207effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff60025416604051908152f35b346103225760209081600319360112610322576132fc6137e5565b90613305614b99565b916133108351613a66565b9373ffffffffffffffffffffffffffffffffffffffff91821691835b855181101561336d57808261334360019389613b2e565b5116865260398452604086208587528452604086205460801c613366828a613b2e565b520161332c565b6040518381528061031e8186018a61382b565b34610322576040600319360112610322576133a661339c6137e5565b6024359033615073565b602060405160018152f35b34610322578060031936011261032257602060405173a57b8d98dae62b26ec3bcc4a365338157060b2348152f35b34610322576060600319360112610322576133f86137e5565b60243580151581036112ce57604435908115158203611abd5773ffffffffffffffffffffffffffffffffffffffff9283916134388360065416331461393e565b156134f95716908115908115916134f1575b50156134ad57806006549283167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e08580a37fffffffffffffffffffffffff0000000000000000000000000000000000000000809216176006556007541660075580f35b606460405162461bcd60e51b815260206004820152601560248201527f4f776e61626c653a207a65726f206164647265737300000000000000000000006044820152fd5b90508461344a565b915050167fffffffffffffffffffffffff0000000000000000000000000000000000000000600754161760075580f35b34610322578060031936011261032257604051908060035491600183811c928185169485156135e0575b60209586861081146113f4578588528794939291879082156113b357505060011461358657505061134592500383613a0d565b90859250600382527fc2575a0e9e593c00f959f8c92f12db2869c3395a3b0502d05e2516446f71f85b5b8583106135c857505061134593508201018580611337565b805483890185015287945086939092019181016135b0565b93607f1693613553565b346105e057816003193601126105e05760209073ffffffffffffffffffffffffffffffffffffffff7f0000000000000000000000000000000000000000000000000000000000000000168152f35b919082519283825260005b8481106136825750507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0601f8460006020809697860101520116010190565b602081830181015184830182015201613643565b90815180825260208080930193019160005b8281106136b6575050505090565b835173ffffffffffffffffffffffffffffffffffffffff16855293810193928101926001016136a8565b503461054757600080600319360112610322576040516136ff816139b9565b6005815260a03660208301377332296969ef14eb0c6d29669c550d4a044913023061372982613b11565b52737f39c581f595b53c5cb19bd0b3f8da6c935e2ca061374882613b1e565b528051600210156137b85773c02aaa39b223fe8d0a0e5c4f27ead9083c756cc260608201528051600310156137b85773ae7ab96520de3a18e5e111b5eaab095312d7fe8460808201528051600410156137b85761031e9160a0820152604051918291602083526020830190613696565b6024827f4e487b710000000000000000000000000000000000000000000000000000000081526032600452fd5b6004359073ffffffffffffffffffffffffffffffffffffffff8216820361054757565b6024359073ffffffffffffffffffffffffffffffffffffffff8216820361054757565b90815180825260208080930193019160005b82811061384b575050505090565b83518552938101939281019260010161383d565b603c5481101561389657603c6000527fc6bb06cb7f92603de181bf256cd16846b93b752a170ff24824098b31aa008a7e0190600090565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b50346105475760206003193601126105475760206138e96138e46137e5565b6142f8565b6040519015158152f35b156138fa57565b606460405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c006044820152fd5b1561394557565b606460405162461bcd60e51b815260206004820152602060248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152fd5b67ffffffffffffffff811161091957604052565b6080810190811067ffffffffffffffff82111761091957604052565b60c0810190811067ffffffffffffffff82111761091957604052565b6060810190811067ffffffffffffffff82111761091957604052565b6040810190811067ffffffffffffffff82111761091957604052565b90601f7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0910116810190811067ffffffffffffffff82111761091957604052565b67ffffffffffffffff81116109195760051b60200190565b90613a7082613a4e565b613a7d6040519182613a0d565b8281527fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0613aab8294613a4e565b0190602036910137565b7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8114613ae25760010190565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b8051156138965760200190565b8051600110156138965760400190565b80518210156138965760209160051b010190565b613b4a613c27565b90805115613b935773ffffffffffffffffffffffffffffffffffffffff83168015159081613b88575b50613b7d57505050565b613b8692614010565b565b905030141538613b73565b505050565b613ba0613c27565b91815115613c075773ffffffffffffffffffffffffffffffffffffffff9083838383168015159081613bfc575b50613beb575b50505083168015159081613b885750613b7d57505050565b613bf492614010565b388383613bd3565b905030141538613bcd565b50505050565b91908203918211613ae257565b91908201809211613ae257565b613c2f614b99565b90613c3a8251613a66565b808351906000911561400a5750603a544303613cb9575b805b8451811015613cb4578073ffffffffffffffffffffffffffffffffffffffff613c7f613caf9388613b2e565b51168352603b6020526fffffffffffffffffffffffffffffffff604084205416613ca98286613b2e565b52613ab5565b613c53565b505090565b91909143603a557effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6002541693603c5415600014613f6c5773ffffffffffffffffffffffffffffffffffffffff7f000000000000000000000000000000000000000000000000000000000000000016803b156112ce578280916044604051809481937f7050ccd90000000000000000000000000000000000000000000000000000000083523060048401528160248401525af1801561105557908391613f58575b50505b818515938415915b8351811015613f4c5773ffffffffffffffffffffffffffffffffffffffff613dc481613db08488613b2e565b511691613dbd8488613b2e565b5116615c76565b818752603b90602092828452613de3604092838b205460801c90613c0d565b92818a528085526fffffffffffffffffffffffffffffffff9485848c20541692898415613f43575b613ee2575b868411610547578b525283828a2091167fffffffffffffffffffffffffffffffff0000000000000000000000000000000082541617905582821161054757829088209116815460801c01918211613eb557613eb09291613eab91906fffffffffffffffffffffffffffffffff7fffffffffffffffffffffffffffffffff0000000000000000000000000000000083549260801b169116179055565b613ab5565b613d84565b6024877f4e487b710000000000000000000000000000000000000000000000000000000081526011600452fd5b92670de0b6b3a764000090818702918783041487151715613ae2578d613f14578f613f0e920490613c1a565b92613e10565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b60019450613e0b565b50949350509350613c51565b613f6190613989565b6105e0578138613d79565b9073ffffffffffffffffffffffffffffffffffffffff7f000000000000000000000000000000000000000000000000000000000000000016803b156105e0578180916044604051809481937f7050ccd9000000000000000000000000000000000000000000000000000000008352306004840152600160248401525af18015610b3f57613ffb575b5090613d7c565b61400490613989565b38613ff4565b92915050565b90919273ffffffffffffffffffffffffffffffffffffffff908183169283151580614279575b1561424a576140699094919473ffffffffffffffffffffffffffffffffffffffff16600052600060205260406000205490565b9182159160005b815181101561424057826140848284613b2e565b511690614091818a613b2e565b5191806000526039926020908482526040806000208b60005283526fffffffffffffffffffffffffffffffff918282600020541680156141ee578181146141de576140dc9082613c0d565b808c02908c8204148b1715613ae257670de0b6b3a7640000614118918e886000528a88528560002090600052875204836000205460801c613c1a565b9183821161054757838311610547578051948186019086821067ffffffffffffffff831117610919576141d9998f9298878096613eab9b875216895285838a019716875260005281528260002091600052526000209351167fffffffffffffffffffffffffffffffff0000000000000000000000000000000084541617835551166fffffffffffffffffffffffffffffffff7fffffffffffffffffffffffffffffffff0000000000000000000000000000000083549260801b169116179055565b614070565b5050505050506141d99150613ab5565b50939582859492939411610547576141d996600052815281600020908b6000525260002091167fffffffffffffffffffffffffffffffff00000000000000000000000000000000825416179055613ab5565b5050505050509050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052600160045260246000fd5b5030841415614036565b61428b614b99565b906142968251613a66565b91600090815b8151811015613b93578073ffffffffffffffffffffffffffffffffffffffff6142c760019385613b2e565b51168452603b6020526fffffffffffffffffffffffffffffffff6040852054166142f18288613b2e565b520161429c565b73ffffffffffffffffffffffffffffffffffffffff167332296969ef14eb0c6d29669c550d4a04491302308114908115614387575b8115614369575b811561434b575b8115614345575090565b90501590565b73ae7ab96520de3a18e5e111b5eaab095312d7fe848114915061433b565b73c02aaa39b223fe8d0a0e5c4f27ead9083c756cc281149150614334565b737f39c581f595b53c5cb19bd0b3f8da6c935e2ca08114915061432d565b90816020910312610547575180151581036105475790565b906060806143fe6143ec6143da8651608087526080870190613696565b6020870151868203602088015261382b565b60408601518582036040870152613638565b930151151591015290565b604051906144168261399d565b60006060838181528160208201528160408201520152565b614436614409565b50614498614442614562565b916144cb6144508451613a66565b61445a8551613a66565b926144796144678761554d565b826144728286613b2e565b5285613b2e565b526040519384916001602084015260606040840152608083019061382b565b60006060830152037fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe08101845283613a0d565b604051926144d88461399d565b8352602083015260408201526000606082015290565b6144f6614409565b50614498614502614562565b916144cb6145108451613a66565b61451a8551613a66565b92614479614467876155ca565b61449890614533614409565b506144cb61453f614562565b9361454a8551613a66565b9061447961446761455b8851613a66565b9588615641565b6040519061456f826139d5565b60028252604036602084013773c02aaa39b223fe8d0a0e5c4f27ead9083c756cc26145b883737f39c581f595b53c5cb19bd0b3f8da6c935e2ca06145b282613b11565b52613b1e565b52565b6145c3614409565b506145cc614562565b906145d78251613a66565b6145e08361554d565b604051926000602085015260408401526060830152606082526144cb8261399d565b61460a614409565b50614613614562565b9061461e8251613a66565b6145e0836155ca565b90614630614409565b50614639614562565b916145e06146478451613a66565b9184615641565b93909161469e959361469093865273ffffffffffffffffffffffffffffffffffffffff809216602087015216604085015260a0606085015260a08401906143bd565b916080818403910152613638565b90565b73ffffffffffffffffffffffffffffffffffffffff61469e60406147eb8151916146ca8361399d565b60208301606081526147da6147a683860192606084526060870194606086527332296969ef14eb0c6d29669c550d4a04491302308852614708614562565b82528051614715816139d5565b60028152813660208301377372d07d7dca67b8a406ad1ec34ce969c90bfee76861473e82613b11565b52600061474a82613b1e565b5285528051614758816139d5565b6002815281366020830137670de0b6b3a76400008061477683613b11565b5261478082613b1e565b5286528051998a986020808b0152511690880152516080606088015260c0870190613696565b9151917fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc09283878303016080880152613696565b9151908483030160a085015261382b565b037fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe08101835282613a0d565b90816020910312610547575173ffffffffffffffffffffffffffffffffffffffff811681036105475790565b73ffffffffffffffffffffffffffffffffffffffff908181169073ba100000625a3754423978a60c9317c58a424e3d8214908115614b7b575b8115614afd575b50614acc57604080517fd55a23f400000000000000000000000000000000000000000000000000000000815260049360207f0000000000000000000000000000000000000000000000000000000000000000821681848881845afa938415614ac157600094614a92575b5060005b84811061492757602488888851917fd2dca630000000000000000000000000000000000000000000000000000000008352820152fd5b85517f40c354460000000000000000000000000000000000000000000000000000000081528189820152602490848183816000885af1908115614a6a57868b60009388938591614a75575b508b5194859384927ff7c618c1000000000000000000000000000000000000000000000000000000008452165af1908115614a6a57908691600091614a3d575b501688146149c957506149c490613ab5565b6148f1565b9450505050939150603c9081549268010000000000000000841015614a115750506001820190556149f99061385f565b909283549160031b90811b9283911b16911916179055565b6041907f4e487b7100000000000000000000000000000000000000000000000000000000600052526000fd5b614a5d9150863d8811614a63575b614a558183613a0d565b810190614817565b386149b2565b503d614a4b565b88513d6000823e3d90fd5b614a8c9150843d8611614a6357614a558183613a0d565b38614972565b90938282813d8311614aba575b614aa98183613a0d565b8101031261032257505192386148ed565b503d614a9f565b85513d6000823e3d90fd5b602490604051907fd2dca6300000000000000000000000000000000000000000000000000000000082526004820152fd5b905060405180603c5490818152602080910191603c6000527fc6bb06cb7f92603de181bf256cd16846b93b752a170ff24824098b31aa008a7e916000905b828210614b62575050505090614b5781614b5c94930382613a0d565b6156b0565b38614883565b8354891685529384019360019384019390910190614b3b565b73c0c293ce456ff0ed870add98a0828dd4d2903dbf8314915061487c565b603c54906002828101808211613ae257614bb290613a66565b9273ba100000625a3754423978a60c9317c58a424e3d614bd185613b11565b5273c0c293ce456ff0ed870add98a0828dd4d2903dbf614bf085613b1e565b526000805b828110614c025750505050565b614c0b8161385f565b905482860191828711614c485773ffffffffffffffffffffffffffffffffffffffff614c43949392613ca99260031b1c169189613b2e565b614bf5565b6024857f4e487b710000000000000000000000000000000000000000000000000000000081526011600452fd5b909173ffffffffffffffffffffffffffffffffffffffff91828116928315614e2b578416938415614dc157848414614d7d57614cb091613b98565b600082815280602052604081205491808310614d1357604082827fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef958760209652828652038282205586815220614d08828254613c1a565b9055604051908152a3565b608460405162461bcd60e51b815260206004820152602660248201527f45524332303a207472616e7366657220616d6f756e742065786365656473206260448201527f616c616e636500000000000000000000000000000000000000000000000000006064820152fd5b606460405162461bcd60e51b815260206004820152601760248201527f45524332303a207472616e7366657220746f2073656c660000000000000000006044820152fd5b608460405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201527f65737300000000000000000000000000000000000000000000000000000000006064820152fd5b608460405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f20616460448201527f64726573730000000000000000000000000000000000000000000000000000006064820152fd5b73ffffffffffffffffffffffffffffffffffffffff811690811561500957614ebc90613b42565b600091818352826020526040832054818110614f9f578190838552846020520360408420557effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff808211611abd576002549080831681831603818111614f7257917fff000000000000000000000000000000000000000000000000000000000000007fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef949260209416911617600255604051908152a3565b6024867f4e487b710000000000000000000000000000000000000000000000000000000081526011600452fd5b608460405162461bcd60e51b815260206004820152602260248201527f45524332303a206275726e20616d6f756e7420657863656564732062616c616e60448201527f63650000000000000000000000000000000000000000000000000000000000006064820152fd5b608460405162461bcd60e51b815260206004820152602160248201527f45524332303a206275726e2066726f6d20746865207a65726f2061646472657360448201527f73000000000000000000000000000000000000000000000000000000000000006064820152fd5b73ffffffffffffffffffffffffffffffffffffffff80911691821561514b57169182156150e15760207f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925918360005260018252604060002085600052825280604060002055604051908152a3565b608460405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f20616464726560448201527f73730000000000000000000000000000000000000000000000000000000000006064820152fd5b608460405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f2061646460448201527f72657373000000000000000000000000000000000000000000000000000000006064820152fd5b600581101561534257806151c55750565b6001810361521157606460405162461bcd60e51b815260206004820152601860248201527f45434453413a20696e76616c6964207369676e617475726500000000000000006044820152fd5b6002810361525d57606460405162461bcd60e51b815260206004820152601f60248201527f45434453413a20696e76616c6964207369676e6174757265206c656e677468006044820152fd5b600381036152cf57608460405162461bcd60e51b815260206004820152602260248201527f45434453413a20696e76616c6964207369676e6174757265202773272076616c60448201527f75650000000000000000000000000000000000000000000000000000000000006064820152fd5b6004146152d857565b608460405162461bcd60e51b815260206004820152602260248201527f45434453413a20696e76616c6964207369676e6174757265202776272076616c60448201527f75650000000000000000000000000000000000000000000000000000000000006064820152fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602160045260246000fd5b9291907f7fffffffffffffffffffffffffffffff5d576e7357a4501ddfe92f46681b20a0831161541a5760ff16601b8114158061540f575b615403579160809493916020936040519384528484015260408301526060820152600093849182805260015afa156112da57815173ffffffffffffffffffffffffffffffffffffffff8116156153fd579190565b50600190565b50505050600090600490565b50601c8114156153a9565b50505050600090600390565b73ffffffffffffffffffffffffffffffffffffffff7f000000000000000000000000000000000000000000000000000000000000000016301480615524575b1561548e577f000000000000000000000000000000000000000000000000000000000000000090565b60405160208101907f000000000000000000000000000000000000000000000000000000000000000082527f000000000000000000000000000000000000000000000000000000000000000060408201527f000000000000000000000000000000000000000000000000000000000000000060608201524660808201523060a082015260a0815261551e816139b9565b51902090565b507f00000000000000000000000000000000000000000000000000000000000000004614615465565b80519060005b828110615581575050507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff90565b737f39c581f595b53c5cb19bd0b3f8da6c935e2ca073ffffffffffffffffffffffffffffffffffffffff6155b58385613b2e565b5116146155c457600101615553565b91505090565b80519060005b8281106155fe575050507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff90565b73c02aaa39b223fe8d0a0e5c4f27ead9083c756cc273ffffffffffffffffffffffffffffffffffffffff6156328385613b2e565b5116146155c4576001016155d0565b9081519160005b83811061567757505050507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff90565b73ffffffffffffffffffffffffffffffffffffffff806156978385613b2e565b5116908416146156a957600101615648565b9250505090565b9081519160005b8381106156c75750505050600090565b73ffffffffffffffffffffffffffffffffffffffff806156e78385613b2e565b5116908416146156f9576001016156b7565b50505050600190565b73ffffffffffffffffffffffffffffffffffffffff169060405190615726826139f1565b6020928383527f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c656484840152803b1561580757600082819282876157789796519301915af161577261584b565b906158a9565b8051908161578557505050565b82806157959383010191016143a5565b1561579d5750565b6084906040519062461bcd60e51b82526004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e60448201527f6f742073756363656564000000000000000000000000000000000000000000006064820152fd5b6064846040519062461bcd60e51b82526004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e74726163740000006044820152fd5b3d156158a4573d9067ffffffffffffffff8211610919576040519161589860207fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0601f8401160184613a0d565b82523d6000602084013e565b606090565b909190156158b5575090565b8151156158c55750805190602001fd5b6158e99060405191829162461bcd60e51b8352602060048401526024830190613638565b0390fd5b81156159fa5760405160209273ffffffffffffffffffffffffffffffffffffffff848301937fa9059cbb00000000000000000000000000000000000000000000000000000000855216602483015260448201526044815261594d8161399d565b6040519161595a836139f1565b8383527f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c65648484015273ae7ab96520de3a18e5e111b5eaab095312d7fe8491823b156159b657615778939260009283809351925af161577261584b565b6064856040519062461bcd60e51b82526004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e74726163740000006044820152fd5b5050565b81156159fa57600080809381935af1615a1561584b565b5015615a1d57565b606460405162461bcd60e51b815260206004820152600f60248201527f6574682073656e64206661696c656400000000000000000000000000000000006044820152fd5b81156159fa5760405160209273ffffffffffffffffffffffffffffffffffffffff848301937fa9059cbb000000000000000000000000000000000000000000000000000000008552166024830152604482015260448152615ac18161399d565b60405191615ace836139f1565b8383527f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c656484840152737f39c581f595b53c5cb19bd0b3f8da6c935e2ca091823b156159b657615778939260009283809351925af161577261584b565b81156159fa5760405160209273ffffffffffffffffffffffffffffffffffffffff848301937fa9059cbb000000000000000000000000000000000000000000000000000000008552166024830152604482015260448152615b8a8161399d565b60405191615b97836139f1565b8383527f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c65648484015273c02aaa39b223fe8d0a0e5c4f27ead9083c756cc291823b156159b657615778939260009283809351925af161577261584b565b8215613b935773ffffffffffffffffffffffffffffffffffffffff9081169081615c2a575050600080809381935af1615a1561584b565b92613b8693604051937fa9059cbb000000000000000000000000000000000000000000000000000000006020860152166024840152604483015260448252615c718261399d565b615702565b60009073ffffffffffffffffffffffffffffffffffffffff1680615c9a5750504790565b6020602491604051928380927f70a082310000000000000000000000000000000000000000000000000000000082523060048301525afa918215610c30578092615ce357505090565b9091506020823d8211615d0b575b81615cfe60209383613a0d565b8101031261032257505190565b3d9150615cf156fea26469706673582212200c152966ddc028548bf5b28385c9661aea32dad77f60b569a28f759698a39e9b64736f6c6343000811003300000000000000000000000032296969ef14eb0c6d29669c550d4a0449130230000000000000000000000000a57b8d98dae62b26ec3bcc4a365338157060b2348b73c3c69bb8fe3d512ecc4cf759cc79239f7b179b0ffacaa9a75d522b39400f000000000000000000000000000000000000000000000000000000000000006000000000000000000000000000000000000000000000000000000000000000a000000000000000000000000021a9fd7212f37c35b030e9374510f99128d59cd3000000000000000000000000000000000000000000000000000000000000001e5359207773744554482d574554485f42616c616e6365724c5020417572610000000000000000000000000000000000000000000000000000000000000000001e53592d7773744554482d574554485f42616c616e6365724c5020417572610000
Deployed Bytecode
0x608080604052600436101561001d575b50361561001b57600080fd5b005b6000803560e01c9182630390c839146135ea5750816306fdde0314613529578163071bc3c9146128d9578163078dfbe7146133df57816307cab83c146133b1578163095ea7b314613380578163128fced1146132e157816318160ddd146132a357816320e8c565146128e3578163213cae63146128d957816323b872dd1461274c5781632a5e141e146127085781632abc2a99146126da578163313ce5671461269d5781633644e515146126835781633ba0b9a9146125c35781633f4ba83a146124ee57816340c35446146124865781634e71e0c8146123b55781635c975abb146123935781635cbadbe4146122f8578163619002ce146122be578163655864521461228457816370a082311461223f578163769f8e5d1461162457816376d5de85146115d4578163784367d6146115ca5781637ecebe00146115865781638456cb59146114ae5781638da5cb5b1461147b5781638efabee01461142b57816395d89b41146112e7578163a40bee50146111f5578163a9059cbb1461113f578163a9f8d18114611122578163b8f82b2614610e13578163bc16384614610de5578163c4f59f9b14610db6578163cbe52ae3146109be578163d1e1a86714610990578163d505accf1461077f578163d55a23f414610762578163da88ecb414610733578163dc616e3e146106e3578163dd62ed3e14610687578163e30c397814610654578163ea64a820146105e4578163ef5cfb8c14610325578163f8b2f99114610260575063fa5a4f0614610253575b3861000f565b61025b6138c5565b61024d565b3461032257806003193601126103225761031e60025461028660028260f81c14156138f3565b7f02000000000000000000000000000000000000000000000000000000000000007effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff809216176002556102d6613c27565b50507f0100000000000000000000000000000000000000000000000000000000000000610301614283565b91600254161760025560405191829160208352602083019061382b565b0390f35b80fd5b34610322576020806003193601126105e057906103406137e5565b6002549161035460028460f81c14156138f3565b7f02000000000000000000000000000000000000000000000000000000000000007effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff809416176002556103a582613b42565b6103ad614b99565b6103b78151613a66565b94829073ffffffffffffffffffffffffffffffffffffffff93848616925b845181101561054c57856103e98287613b2e565b5116825260398084526040832085600052845260406000205490608091821c610412848d613b2e565b5261041d838c613b2e565b51610433575b505061042e90613ab5565b6103d5565b8761043e8489613b2e565b511684528452604083208560005284526040600020906fffffffffffffffffffffffffffffffff91828154169055610476838c613b2e565b5190828211610547578861048a858a613b2e565b51168552603b865282604086209216908254901c0391821161051a5761042e92916104f091906fffffffffffffffffffffffffffffffff7fffffffffffffffffffffffffffffffff0000000000000000000000000000000083549260801b169116179055565b6105138a8961050c848b610504828d613b2e565b511693613b2e565b5191615bf3565b908a610423565b6024847f4e487b710000000000000000000000000000000000000000000000000000000081526011600452fd5b600080fd5b88837f01000000000000000000000000000000000000000000000000000000000000008a877f2193aa20a3717f5f4ac79482f4f553e5f0afe8f4e6ec3e3d1aa2e138adc4763f6105b461059d614b99565b6105c1604051928392604084526040840190613696565b828103898401528961382b565b0390a2600254161760025561031e60405192828493845283019061382b565b5080fd5b3461032257602060031936011261032257604061031e9173ffffffffffffffffffffffffffffffffffffffff6106186137e5565b168152603b602090815291902054604080516fffffffffffffffffffffffffffffffff8316815260809290921c92820192909252918291820190565b34610322578060031936011261032257602073ffffffffffffffffffffffffffffffffffffffff60075416604051908152f35b34610322576040600319360112610322576106a06137e5565b60406106aa613808565b9273ffffffffffffffffffffffffffffffffffffffff809316815260016020522091166000526020526020604060002054604051908152f35b34610322578060031936011261032257602060405173ffffffffffffffffffffffffffffffffffffffff7f000000000000000000000000e4683fe8f53da14ca5dac4251eadfb3aa614d528168152f35b3461032257806003193601126103225761031e61074e614283565b60405191829160208352602083019061382b565b346103225780600319360112610322576020603c54604051908152f35b346103225760e0600319360112610322576107986137e5565b6107a0613808565b6044359060843560643560ff8216820361098c578042116109485773ffffffffffffffffffffffffffffffffffffffff9081861692838852600560205260408820908154916001830190556040519260208401927f6e71edae12b1b97f4d1f60370fef10105fa2faae0126114a169c64845d6126c98452866040860152858816606086015288608086015260a085015260c084015260c0835260e083019183831067ffffffffffffffff841117610919576108c3936108bb93604052519020610867615426565b916040519160208301937f1901000000000000000000000000000000000000000000000000000000000000855260228401526042830152604282526108ab8261399d565b60c4359260a43592519020615371565b9190916151b4565b16036108d5576108d292615073565b80f35b606460405162461bcd60e51b815260206004820152601e60248201527f45524332305065726d69743a20696e76616c6964207369676e617475726500006044820152fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b606460405162461bcd60e51b815260206004820152601d60248201527f45524332305065726d69743a206578706972656420646561646c696e650000006044820152fd5b8580fd5b34610322578060031936011261032257602060405173c0c293ce456ff0ed870add98a0828dd4d2903dbf8152f35b34610322576040600319360112610322576109d76137e5565b602435906109e4816142f8565b15610d6f5773ffffffffffffffffffffffffffffffffffffffff9281841680610b4a57505050600091807f00000000000000000000000032296969ef14eb0c6d29669c550d4a04491302301673c02aaa39b223fe8d0a0e5c4f27ead9083c756cc214600014610a5b5750602091505b604051908152f35b602090610a6a610acc93614602565b90610a736146a1565b916040518095819482937f6261173000000000000000000000000000000000000000000000000000000000845230307f32296969ef14eb0c6d29669c550d4a04491302300002000000000000000000806004870161464e565b03917f00000000000000000000000021a9fd7212f37c35b030e9374510f99128d59cd3165afa908115610b3f578291610b0a575b5060209150610a53565b90506020813d8211610b37575b81610b2460209383613a0d565b810103126105e057602091505182610b00565b3d9150610b17565b6040513d84823e3d90fd5b73ae7ab96520de3a18e5e111b5eaab095312d7fe8494919392818603610d20575050600090807f00000000000000000000000032296969ef14eb0c6d29669c550d4a044913023016737f39c581f595b53c5cb19bd0b3f8da6c935e2ca014600014610c3c5750506020905b6024604051809581937f7a28fb8800000000000000000000000000000000000000000000000000000000835260048301525afa908115610c305790610bfe575b60209150610a53565b506020813d8211610c28575b81610c1760209383613a0d565b810103126105475760209051610bf5565b3d9150610c0a565b604051903d90823e3d90fd5b602090610c4b610cad946145bb565b90610c546146a1565b916040518096819482937f6261173000000000000000000000000000000000000000000000000000000000845230307f32296969ef14eb0c6d29669c550d4a04491302300002000000000000000000806004870161464e565b03917f00000000000000000000000021a9fd7212f37c35b030e9374510f99128d59cd3165afa908115610c30578091610ceb575b5060209150610bb5565b90506020823d8211610d18575b81610d0560209383613a0d565b8101031261032257506020905184610ce1565b3d9150610cf8565b919293509350600093827f00000000000000000000000032296969ef14eb0c6d29669c550d4a04491302301614600014610d5f57505060209150610a53565b90610a6a610acc93602093614627565b60249073ffffffffffffffffffffffffffffffffffffffff604051917f88a50561000000000000000000000000000000000000000000000000000000008352166004820152fd5b3461032257806003193601126103225761031e610dd1614b99565b604051918291602083526020830190613696565b34610322578060031936011261032257602060405173ba12222222228d8ba445958a75a0704d566bf2c88152f35b3461032257604060031936011261032257610e2c6137e5565b9060243590610e3a836142f8565b156110db5773ffffffffffffffffffffffffffffffffffffffff9280841680610f2157505050600091807f00000000000000000000000032296969ef14eb0c6d29669c550d4a04491302301673c02aaa39b223fe8d0a0e5c4f27ead9083c756cc214600014610eb0575060209150604051908152f35b602090610ebf610acc936144ee565b90610ec86146a1565b916040518095819482937f6669506000000000000000000000000000000000000000000000000000000000845230307f32296969ef14eb0c6d29669c550d4a04491302300002000000000000000000806004870161464e565b919273ae7ab96520de3a18e5e111b5eaab095312d7fe8492909181840361108f5750506040519182917f19208451000000000000000000000000000000000000000000000000000000008352600483015281602460209485935afa928315610c305792611060575b50600092737f39c581f595b53c5cb19bd0b3f8da6c935e2ca07f00000000000000000000000032296969ef14eb0c6d29669c550d4a0449130230821603610fd557505060209150610a53565b90610fe491610ebf829461442e565b03917f00000000000000000000000021a9fd7212f37c35b030e9374510f99128d59cd3165afa918215611055578392611023575b505060209150610a53565b90809250813d831161104e575b61103a8183613a0d565b810103126105e05760209150518280611018565b503d611030565b6040513d85823e3d90fd5b9080925081813d8311611088575b6110788183613a0d565b8101031261054757519083610f89565b503d61106e565b6000959294509192507f00000000000000000000000032296969ef14eb0c6d29669c550d4a04491302308316036110cb57505060209150610a53565b90610ebf610acc93602093614527565b60248373ffffffffffffffffffffffffffffffffffffffff604051917faeabe718000000000000000000000000000000000000000000000000000000008352166004820152fd5b346103225780600319360112610322576020603a54604051908152f35b34610322576040600319360112610322577f01000000000000000000000000000000000000000000000000000000000000006111796137e5565b6111e26002549161119060028460f81c14156138f3565b7f02000000000000000000000000000000000000000000000000000000000000007effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff809416176002556024359033614c75565b6002541617600255602060405160018152f35b3461032257806003193601126103225773ffffffffffffffffffffffffffffffffffffffff7f00000000000000000000000032296969ef14eb0c6d29669c550d4a044913023016604051917f313ce567000000000000000000000000000000000000000000000000000000008352602083600481855afa9283156112da578193611295575b60608360ff8660405192600184526020840152166040820152f35b9092506020813d82116112d2575b816112b060209383613a0d565b810103126112ce57519160ff83168303610322575060ff606061127a565b8280fd5b3d91506112a3565b50604051903d90823e3d90fd5b34610322578060031936011261032257604051908060045491600183811c92818516948515611421575b60209586861081146113f4578588528794939291879082156113b3575050600114611359575b505061134592500383613a0d565b61031e604051928284938452830190613638565b90859250600482527f8a35acfbc15ff81a39ae7d344fd709f28e8600b4aa8c65c6b64bfe7fe36bd19b5b85831061139b57505061134593508201018580611337565b80548389018501528794508693909201918101611383565b915093506113459592507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0091501682840152151560051b8201018580611337565b6024837f4e487b710000000000000000000000000000000000000000000000000000000081526022600452fd5b93607f1693611311565b34610322578060031936011261032257602060405173ffffffffffffffffffffffffffffffffffffffff7f00000000000000000000000032296969ef14eb0c6d29669c550d4a0449130230168152f35b34610322578060031936011261032257602073ffffffffffffffffffffffffffffffffffffffff60065416604051908152f35b346103225780600319360112610322576114e173ffffffffffffffffffffffffffffffffffffffff60065416331461393e565b60385460ff8116611542577fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0060019116176038557f62e78cea01bee320cd4e420270b5ea74000d11b0c9f74754ebdbfc544b05a2586020604051338152a180f35b606460405162461bcd60e51b815260206004820152601060248201527f5061757361626c653a20706175736564000000000000000000000000000000006044820152fd5b3461032257602060031936011261032257604060209173ffffffffffffffffffffffffffffffffffffffff6115b96137e5565b168152600583522054604051908152f35b505061025b6138c5565b34610322578060031936011261032257602060405173ffffffffffffffffffffffffffffffffffffffff7f00000000000000000000000032296969ef14eb0c6d29669c550d4a0449130230168152f35b346103225760a06003193601126103225761163d6137e5565b906044359173ffffffffffffffffffffffffffffffffffffffff8316830361054757608435928315158403610547576002549361168060028660f81c14156138f3565b7f02000000000000000000000000000000000000000000000000000000000000007effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff809616176002556116d1826142f8565b156121f857602435156121ce57156121bd576116ef60243530614e95565b73ffffffffffffffffffffffffffffffffffffffff8116611af5576000926040517fc32e720200000000000000000000000000000000000000000000000000000000815284602435600483015280602483015260209182816044818573ffffffffffffffffffffffffffffffffffffffff7f000000000000000000000000e4683fe8f53da14ca5dac4251eadfb3aa614d528165af18015610b3f57611ac8575b5073c02aaa39b223fe8d0a0e5c4f27ead9083c756cc2957f00000000000000000000000032296969ef14eb0c6d29669c550d4a044913023073ffffffffffffffffffffffffffffffffffffffff16870361192757505050602435906117f660243530615b2a565b8194803b156105e0578180916024604051809481937f2e1a7d4d0000000000000000000000000000000000000000000000000000000083528860048401525af18015610b3f57611913575b505061184d90836159fe565b6064358084106118dc5750927f01000000000000000000000000000000000000000000000000000000000000009160209473ffffffffffffffffffffffffffffffffffffffff806040519260243584528789850152169216907faee47cdf925cf525fdae94f9777ee5a06cac37e1c41220d0a8a89ed154f62d1c60403392a46002541617600255604051908152f35b83604491604051917fbfee4ca000000000000000000000000000000000000000000000000000000000835260048301526024820152fd5b61191d8291613989565b6103225780611841565b604051917f70a08231000000000000000000000000000000000000000000000000000000009081845230600485015284846024818c5afa9384156112da578194611a95575b50611978602435614602565b73ba12222222228d8ba445958a75a0704d566bf2c890813b156112ce57611a0b839283926040519485809481937f8bdb39130000000000000000000000000000000000000000000000000000000083527f32296969ef14eb0c6d29669c550d4a044913023000020000000000000000008060048401523060248401523060448401526080606484015260848301906143bd565b03925af18015610b3f57611a83575b5060405191825230600483015284826024818c5afa928315610c305792611a4e575b5050611a489250613c0d565b906117f6565b9150919282813d8311611a7c575b611a668183613a0d565b81010312610322575090611a4891518880611a3c565b503d611a5c565b611a8e919350613989565b818a611a1a565b9093508481813d8311611ac1575b611aad8183613a0d565b81010312611abd5751928a61196c565b8380fd5b503d611aa3565b611ae790833d8511611aee575b611adf8183613a0d565b8101906143a5565b508761178f565b503d611ad5565b9173ffffffffffffffffffffffffffffffffffffffff831673ae7ab96520de3a18e5e111b5eaab095312d7fe8403611ed5576000604051907fc32e720200000000000000000000000000000000000000000000000000000000825280602435600484015281602484015260209283816044818673ffffffffffffffffffffffffffffffffffffffff7f000000000000000000000000e4683fe8f53da14ca5dac4251eadfb3aa614d528165af1801561105557611eb8575b50737f39c581f595b53c5cb19bd0b3f8da6c935e2ca07f00000000000000000000000032296969ef14eb0c6d29669c550d4a044913023073ffffffffffffffffffffffffffffffffffffffff1603611cc757505060243590611c0e8230615a61565b604051917fde0e9a3e0000000000000000000000000000000000000000000000000000000083526004830152808260248186737f39c581f595b53c5cb19bd0b3f8da6c935e2ca05af1928315610c305792611c99575b50503073ffffffffffffffffffffffffffffffffffffffff831603611c8a575b9161184d565b611c9481836158ed565b611c84565b90809250813d8311611cc0575b611cb08183613a0d565b8101031261054757518480611c64565b503d611ca6565b604051917f70a082310000000000000000000000000000000000000000000000000000000083523060048401528383602481737f39c581f595b53c5cb19bd0b3f8da6c935e2ca05afa9283156112da578193611e89575b50611d2a6024356145bb565b73ba12222222228d8ba445958a75a0704d566bf2c83b156105e05781611db791604051809381927f8bdb39130000000000000000000000000000000000000000000000000000000083527f32296969ef14eb0c6d29669c550d4a044913023000020000000000000000008060048401523060248401523060448401526080606484015260848301906143bd565b03818373ba12222222228d8ba445958a75a0704d566bf2c85af18015610b3f57611e77575b50604051907f70a082310000000000000000000000000000000000000000000000000000000082523060048301528482602481737f39c581f595b53c5cb19bd0b3f8da6c935e2ca05afa928315610c305792611e45575b505090611e3f91613c0d565b90611c0e565b9091508382813d8311611e70575b611e5d8183613a0d565b81010312610322575051611e3f88611e33565b503d611e53565b611e82919250613989565b8088611ddc565b9092508381813d8311611eb1575b611ea18183613a0d565b810103126112ce57519188611d1e565b503d611e97565b611ece90843d8611611aee57611adf8183613a0d565b5087611bac565b506000604051907fc32e720200000000000000000000000000000000000000000000000000000000825280602435600484015281602484015260209283816044818673ffffffffffffffffffffffffffffffffffffffff7f000000000000000000000000e4683fe8f53da14ca5dac4251eadfb3aa614d528165af18015611055576121a0575b5073ffffffffffffffffffffffffffffffffffffffff7f00000000000000000000000032296969ef14eb0c6d29669c550d4a04491302301673ffffffffffffffffffffffffffffffffffffffff861614600014611fc557505050602435611c846024358385615bf3565b604051917f70a08231000000000000000000000000000000000000000000000000000000009081845273ffffffffffffffffffffffffffffffffffffffff8616806004860152858560248173ffffffffffffffffffffffffffffffffffffffff8c165afa948515610b3f578295612171575b5061204460243589614627565b73ba12222222228d8ba445958a75a0704d566bf2c890813b15611abd576120d7849283926040519485809481937f8bdb39130000000000000000000000000000000000000000000000000000000083527f32296969ef14eb0c6d29669c550d4a044913023000020000000000000000008060048401523060248401528960448401526080606484015260848301906143bd565b03925af180156110555761215e575b506040519283526004830152848260248173ffffffffffffffffffffffffffffffffffffffff8b165afa928315610c305792612129575b5050611c949250613c0d565b9150919282813d8311612157575b6121418183613a0d565b81010312610322575090611c949151868061211d565b503d612137565b612169919450613989565b8092896120e6565b9094508581813d8311612199575b6121898183613a0d565b810103126105e057519389612037565b503d61217f565b6121b690843d8611611aee57611adf8183613a0d565b5086611f5b565b6121c960243533614e95565b6116ef565b60046040517fc3d83b07000000000000000000000000000000000000000000000000000000008152fd5b60248273ffffffffffffffffffffffffffffffffffffffff604051917f88a50561000000000000000000000000000000000000000000000000000000008352166004820152fd5b34610322576020600319360112610322576020610a5361225d6137e5565b73ffffffffffffffffffffffffffffffffffffffff16600052600060205260406000205490565b3461032257806003193601126103225760206040517f32296969ef14eb0c6d29669c550d4a04491302300002000000000000000000808152f35b3461032257806003193601126103225760206040517f000000000000000000000000000000000000000000000000000000000000001d8152f35b34610322576040600319360112610322576123116137e5565b604061231b613808565b9273ffffffffffffffffffffffffffffffffffffffff8093168152603960205220911660005260205261031e60406000205460405191816fffffffffffffffffffffffffffffffff849360801c9116839060209093929360408301946fffffffffffffffffffffffffffffffff809216845216910152565b34610322578060031936011261032257602060ff603854166040519015158152f35b3461032257806003193601126103225760075473ffffffffffffffffffffffffffffffffffffffff9081811680330361244257806006549384167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e08680a37fffffffffffffffffffffffff0000000000000000000000000000000000000000809316176006551660075580f35b606460405162461bcd60e51b815260206004820152602060248201527f4f776e61626c653a2063616c6c657220213d2070656e64696e67206f776e65726044820152fd5b346103225760206003193601126103225760043590603c5482101561032257602073ffffffffffffffffffffffffffffffffffffffff83603c6000527fc6bb06cb7f92603de181bf256cd16846b93b752a170ff24824098b31aa008a7e015416604051908152f35b3461032257806003193601126103225761252173ffffffffffffffffffffffffffffffffffffffff60065416331461393e565b60385460ff81161561257f577fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00166038557f5db9ee0a495bf2e6ff9c91a7834c1ba4fdd244a5e8aa4e537bd38aeae4b073aa6020604051338152a180f35b606460405162461bcd60e51b815260206004820152601460248201527f5061757361626c653a206e6f74207061757365640000000000000000000000006044820152fd5b34610322578060031936011261032257604051907f679aefce00000000000000000000000000000000000000000000000000000000825260208260048173ffffffffffffffffffffffffffffffffffffffff7f00000000000000000000000032296969ef14eb0c6d29669c550d4a0449130230165afa908115610c305790612651575b602090604051908152f35b506020813d821161267b575b8161266a60209383613a0d565b810103126105475760209051612646565b3d915061265d565b346103225780600319360112610322576020610a53615426565b34610322578060031936011261032257602060405160ff7f0000000000000000000000000000000000000000000000000000000000000012168152f35b34610322578060031936011261032257602060405173ba100000625a3754423978a60c9317c58a424e3d8152f35b34610322576020600319360112610322576108d26127246137e5565b61274773ffffffffffffffffffffffffffffffffffffffff60065416331461393e565b614843565b34610322576060600319360112610322576127656137e5565b9061276e613808565b6044359060406002549361278860028660f81c14156138f3565b7f02000000000000000000000000000000000000000000000000000000000000007effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8096161760025573ffffffffffffffffffffffffffffffffffffffff86168152600160205220336000526020526040600020547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8103612851575b50906111e2917f010000000000000000000000000000000000000000000000000000000000000094614c75565b9190818310612895577f01000000000000000000000000000000000000000000000000000000000000009461288c836111e295033383615073565b94509091612824565b606460405162461bcd60e51b815260206004820152601d60248201527f45524332303a20696e73756666696369656e7420616c6c6f77616e63650000006044820152fd5b505061025b6136e0565b6080600319360112610322576128f76137e5565b6128ff613808565b906044803592606491823594600294855494612920878760f81c14156138f3565b7f02000000000000000000000000000000000000000000000000000000000000007effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff809716178755612970856142f8565b1561325c5782156132325773ffffffffffffffffffffffffffffffffffffffff85811695861580156131a05785340361315d575b15612d79575073c02aaa39b223fe8d0a0e5c4f27ead9083c756cc2803b15612d75576040517fd0e30db00000000000000000000000000000000000000000000000000000000081528b8160048189865af18015612d6a57612d57575b5060007f00000000000000000000000032296969ef14eb0c6d29669c550d4a04491302309183831614600014612c8b575050835b6040517f43a0d0660000000000000000000000000000000000000000000000000000000081527f000000000000000000000000000000000000000000000000000000000000001d60048201528160248201526001878201526020818581600073a57b8d98dae62b26ec3bcc4a365338157060b2345af18015612c7f57612c61575b50985b808a10612c2b57508216938415612bea575050612ad490613b42565b83861161054757845484871685821601858111612bbd57926020988193927fff00000000000000000000000000000000000000000000000000000000000000887f0100000000000000000000000000000000000000000000000000000000000000999897169116178855818152808a5260408120612b538a8254613c1a565b90557fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8a6040518b8152a360405190815286888201527f5fe47ed6d4225326d3303476197d782ded5a4e9c14f479dc9ec4992af4e85d5960403392a4825416179055604051908152f35b6024897f4e487b710000000000000000000000000000000000000000000000000000000081526011600452fd5b7f45524332303a206d696e7420746f20746865207a65726f2061646472657373006040519162461bcd60e51b835260206004840152601f6024840152820152fd5b898691604051917fbc71f2ba00000000000000000000000000000000000000000000000000000000835260048301526024820152fd5b612c789060203d8111611aee57611adf8183613a0d565b508b612ab5565b6040513d6000823e3d90fd5b612c94866144ee565b73ba12222222228d8ba445958a75a0704d566bf2c8803b156112ce57918091612d26938a836040518097819582947fb95cac280000000000000000000000000000000000000000000000000000000084527f32296969ef14eb0c6d29669c550d4a04491302300002000000000000000000806004850152306024850152309084015260808d84015260848301906143bd565b03925af1908115610c30575090612d439291612d48575b50615c76565b612a34565b612d5190613989565b8c612d3d565b612d63909b919b613989565b998b612a00565b6040513d8e823e3d90fd5b8a80fd5b73ae7ab96520de3a18e5e111b5eaab095312d7fe848703612fce57506040517fea598cb00000000000000000000000000000000000000000000000000000000081528460048201526020908b8282602481737f39c581f595b53c5cb19bd0b3f8da6c935e2ca094855af1918215612ec6578d92612f9b575b507f00000000000000000000000032296969ef14eb0c6d29669c550d4a04491302309084821603612ed15750905b83818d604051928380927f43a0d0660000000000000000000000000000000000000000000000000000000082527f000000000000000000000000000000000000000000000000000000000000001d600483015287602483015260018d83015273a57b8d98dae62b26ec3bcc4a365338157060b2345af18015612ec657612ea8575b505098612ab8565b81612ebe92903d10611aee57611adf8183613a0d565b508b80612ea0565b6040513d8f823e3d90fd5b90612edb9061442e565b908c73ba12222222228d8ba445958a75a0704d566bf2c892833b156105e057612f6d938a836040518097819582947fb95cac280000000000000000000000000000000000000000000000000000000084527f32296969ef14eb0c6d29669c550d4a04491302300002000000000000000000806004850152306024850152309084015260808d84015260848301906143bd565b03925af1918215612ec657612f8692612f8c5750615c76565b90612e1f565b612f9590613989565b8d612d3d565b9091508281813d8311612fc7575b612fb38183613a0d565b81010312612fc35751908d612df1565b8c80fd5b503d612fa9565b7f00000000000000000000000032296969ef14eb0c6d29669c550d4a0449130230908583831689036130a4579150505b6040517f43a0d0660000000000000000000000000000000000000000000000000000000081527f000000000000000000000000000000000000000000000000000000000000001d60048201526024810182905260018782015260208185818f73a57b8d98dae62b26ec3bcc4a365338157060b2345af18015612d6a57613086575b5098612ab8565b61309d9060203d8111611aee57611adf8183613a0d565b508b61307f565b6130ad91614527565b908b73ba12222222228d8ba445958a75a0704d566bf2c892833b156105e05761313f9389836040518097819582947fb95cac280000000000000000000000000000000000000000000000000000000084527f32296969ef14eb0c6d29669c550d4a04491302300002000000000000000000806004850152306024850152309084015260808c84015260848301906143bd565b03925af1918215612d6a5761315892612d485750615c76565b612ffe565b83877f657468206d69736d6174636800000000000000000000000000000000000000006040519162461bcd60e51b835260206004840152600c6024840152820152fd5b6040517f23b872dd0000000000000000000000000000000000000000000000000000000060208201523360248201523088820152868582015284815260a0810181811067ffffffffffffffff821117613205576040526132009089615702565b6129a4565b60248e7f4e487b710000000000000000000000000000000000000000000000000000000081526041600452fd5b60046040517fa907f2f0000000000000000000000000000000000000000000000000000000008152fd5b60248573ffffffffffffffffffffffffffffffffffffffff604051917faeabe718000000000000000000000000000000000000000000000000000000008352166004820152fd5b3461032257806003193601126103225760207effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff60025416604051908152f35b346103225760209081600319360112610322576132fc6137e5565b90613305614b99565b916133108351613a66565b9373ffffffffffffffffffffffffffffffffffffffff91821691835b855181101561336d57808261334360019389613b2e565b5116865260398452604086208587528452604086205460801c613366828a613b2e565b520161332c565b6040518381528061031e8186018a61382b565b34610322576040600319360112610322576133a661339c6137e5565b6024359033615073565b602060405160018152f35b34610322578060031936011261032257602060405173a57b8d98dae62b26ec3bcc4a365338157060b2348152f35b34610322576060600319360112610322576133f86137e5565b60243580151581036112ce57604435908115158203611abd5773ffffffffffffffffffffffffffffffffffffffff9283916134388360065416331461393e565b156134f95716908115908115916134f1575b50156134ad57806006549283167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e08580a37fffffffffffffffffffffffff0000000000000000000000000000000000000000809216176006556007541660075580f35b606460405162461bcd60e51b815260206004820152601560248201527f4f776e61626c653a207a65726f206164647265737300000000000000000000006044820152fd5b90508461344a565b915050167fffffffffffffffffffffffff0000000000000000000000000000000000000000600754161760075580f35b34610322578060031936011261032257604051908060035491600183811c928185169485156135e0575b60209586861081146113f4578588528794939291879082156113b357505060011461358657505061134592500383613a0d565b90859250600382527fc2575a0e9e593c00f959f8c92f12db2869c3395a3b0502d05e2516446f71f85b5b8583106135c857505061134593508201018580611337565b805483890185015287945086939092019181016135b0565b93607f1693613553565b346105e057816003193601126105e05760209073ffffffffffffffffffffffffffffffffffffffff7f00000000000000000000000021a9fd7212f37c35b030e9374510f99128d59cd3168152f35b919082519283825260005b8481106136825750507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0601f8460006020809697860101520116010190565b602081830181015184830182015201613643565b90815180825260208080930193019160005b8281106136b6575050505090565b835173ffffffffffffffffffffffffffffffffffffffff16855293810193928101926001016136a8565b503461054757600080600319360112610322576040516136ff816139b9565b6005815260a03660208301377332296969ef14eb0c6d29669c550d4a044913023061372982613b11565b52737f39c581f595b53c5cb19bd0b3f8da6c935e2ca061374882613b1e565b528051600210156137b85773c02aaa39b223fe8d0a0e5c4f27ead9083c756cc260608201528051600310156137b85773ae7ab96520de3a18e5e111b5eaab095312d7fe8460808201528051600410156137b85761031e9160a0820152604051918291602083526020830190613696565b6024827f4e487b710000000000000000000000000000000000000000000000000000000081526032600452fd5b6004359073ffffffffffffffffffffffffffffffffffffffff8216820361054757565b6024359073ffffffffffffffffffffffffffffffffffffffff8216820361054757565b90815180825260208080930193019160005b82811061384b575050505090565b83518552938101939281019260010161383d565b603c5481101561389657603c6000527fc6bb06cb7f92603de181bf256cd16846b93b752a170ff24824098b31aa008a7e0190600090565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b50346105475760206003193601126105475760206138e96138e46137e5565b6142f8565b6040519015158152f35b156138fa57565b606460405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c006044820152fd5b1561394557565b606460405162461bcd60e51b815260206004820152602060248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152fd5b67ffffffffffffffff811161091957604052565b6080810190811067ffffffffffffffff82111761091957604052565b60c0810190811067ffffffffffffffff82111761091957604052565b6060810190811067ffffffffffffffff82111761091957604052565b6040810190811067ffffffffffffffff82111761091957604052565b90601f7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0910116810190811067ffffffffffffffff82111761091957604052565b67ffffffffffffffff81116109195760051b60200190565b90613a7082613a4e565b613a7d6040519182613a0d565b8281527fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0613aab8294613a4e565b0190602036910137565b7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8114613ae25760010190565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b8051156138965760200190565b8051600110156138965760400190565b80518210156138965760209160051b010190565b613b4a613c27565b90805115613b935773ffffffffffffffffffffffffffffffffffffffff83168015159081613b88575b50613b7d57505050565b613b8692614010565b565b905030141538613b73565b505050565b613ba0613c27565b91815115613c075773ffffffffffffffffffffffffffffffffffffffff9083838383168015159081613bfc575b50613beb575b50505083168015159081613b885750613b7d57505050565b613bf492614010565b388383613bd3565b905030141538613bcd565b50505050565b91908203918211613ae257565b91908201809211613ae257565b613c2f614b99565b90613c3a8251613a66565b808351906000911561400a5750603a544303613cb9575b805b8451811015613cb4578073ffffffffffffffffffffffffffffffffffffffff613c7f613caf9388613b2e565b51168352603b6020526fffffffffffffffffffffffffffffffff604084205416613ca98286613b2e565b52613ab5565b613c53565b505090565b91909143603a557effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6002541693603c5415600014613f6c5773ffffffffffffffffffffffffffffffffffffffff7f000000000000000000000000e4683fe8f53da14ca5dac4251eadfb3aa614d52816803b156112ce578280916044604051809481937f7050ccd90000000000000000000000000000000000000000000000000000000083523060048401528160248401525af1801561105557908391613f58575b50505b818515938415915b8351811015613f4c5773ffffffffffffffffffffffffffffffffffffffff613dc481613db08488613b2e565b511691613dbd8488613b2e565b5116615c76565b818752603b90602092828452613de3604092838b205460801c90613c0d565b92818a528085526fffffffffffffffffffffffffffffffff9485848c20541692898415613f43575b613ee2575b868411610547578b525283828a2091167fffffffffffffffffffffffffffffffff0000000000000000000000000000000082541617905582821161054757829088209116815460801c01918211613eb557613eb09291613eab91906fffffffffffffffffffffffffffffffff7fffffffffffffffffffffffffffffffff0000000000000000000000000000000083549260801b169116179055565b613ab5565b613d84565b6024877f4e487b710000000000000000000000000000000000000000000000000000000081526011600452fd5b92670de0b6b3a764000090818702918783041487151715613ae2578d613f14578f613f0e920490613c1a565b92613e10565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b60019450613e0b565b50949350509350613c51565b613f6190613989565b6105e0578138613d79565b9073ffffffffffffffffffffffffffffffffffffffff7f000000000000000000000000e4683fe8f53da14ca5dac4251eadfb3aa614d52816803b156105e0578180916044604051809481937f7050ccd9000000000000000000000000000000000000000000000000000000008352306004840152600160248401525af18015610b3f57613ffb575b5090613d7c565b61400490613989565b38613ff4565b92915050565b90919273ffffffffffffffffffffffffffffffffffffffff908183169283151580614279575b1561424a576140699094919473ffffffffffffffffffffffffffffffffffffffff16600052600060205260406000205490565b9182159160005b815181101561424057826140848284613b2e565b511690614091818a613b2e565b5191806000526039926020908482526040806000208b60005283526fffffffffffffffffffffffffffffffff918282600020541680156141ee578181146141de576140dc9082613c0d565b808c02908c8204148b1715613ae257670de0b6b3a7640000614118918e886000528a88528560002090600052875204836000205460801c613c1a565b9183821161054757838311610547578051948186019086821067ffffffffffffffff831117610919576141d9998f9298878096613eab9b875216895285838a019716875260005281528260002091600052526000209351167fffffffffffffffffffffffffffffffff0000000000000000000000000000000084541617835551166fffffffffffffffffffffffffffffffff7fffffffffffffffffffffffffffffffff0000000000000000000000000000000083549260801b169116179055565b614070565b5050505050506141d99150613ab5565b50939582859492939411610547576141d996600052815281600020908b6000525260002091167fffffffffffffffffffffffffffffffff00000000000000000000000000000000825416179055613ab5565b5050505050509050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052600160045260246000fd5b5030841415614036565b61428b614b99565b906142968251613a66565b91600090815b8151811015613b93578073ffffffffffffffffffffffffffffffffffffffff6142c760019385613b2e565b51168452603b6020526fffffffffffffffffffffffffffffffff6040852054166142f18288613b2e565b520161429c565b73ffffffffffffffffffffffffffffffffffffffff167332296969ef14eb0c6d29669c550d4a04491302308114908115614387575b8115614369575b811561434b575b8115614345575090565b90501590565b73ae7ab96520de3a18e5e111b5eaab095312d7fe848114915061433b565b73c02aaa39b223fe8d0a0e5c4f27ead9083c756cc281149150614334565b737f39c581f595b53c5cb19bd0b3f8da6c935e2ca08114915061432d565b90816020910312610547575180151581036105475790565b906060806143fe6143ec6143da8651608087526080870190613696565b6020870151868203602088015261382b565b60408601518582036040870152613638565b930151151591015290565b604051906144168261399d565b60006060838181528160208201528160408201520152565b614436614409565b50614498614442614562565b916144cb6144508451613a66565b61445a8551613a66565b926144796144678761554d565b826144728286613b2e565b5285613b2e565b526040519384916001602084015260606040840152608083019061382b565b60006060830152037fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe08101845283613a0d565b604051926144d88461399d565b8352602083015260408201526000606082015290565b6144f6614409565b50614498614502614562565b916144cb6145108451613a66565b61451a8551613a66565b92614479614467876155ca565b61449890614533614409565b506144cb61453f614562565b9361454a8551613a66565b9061447961446761455b8851613a66565b9588615641565b6040519061456f826139d5565b60028252604036602084013773c02aaa39b223fe8d0a0e5c4f27ead9083c756cc26145b883737f39c581f595b53c5cb19bd0b3f8da6c935e2ca06145b282613b11565b52613b1e565b52565b6145c3614409565b506145cc614562565b906145d78251613a66565b6145e08361554d565b604051926000602085015260408401526060830152606082526144cb8261399d565b61460a614409565b50614613614562565b9061461e8251613a66565b6145e0836155ca565b90614630614409565b50614639614562565b916145e06146478451613a66565b9184615641565b93909161469e959361469093865273ffffffffffffffffffffffffffffffffffffffff809216602087015216604085015260a0606085015260a08401906143bd565b916080818403910152613638565b90565b73ffffffffffffffffffffffffffffffffffffffff61469e60406147eb8151916146ca8361399d565b60208301606081526147da6147a683860192606084526060870194606086527332296969ef14eb0c6d29669c550d4a04491302308852614708614562565b82528051614715816139d5565b60028152813660208301377372d07d7dca67b8a406ad1ec34ce969c90bfee76861473e82613b11565b52600061474a82613b1e565b5285528051614758816139d5565b6002815281366020830137670de0b6b3a76400008061477683613b11565b5261478082613b1e565b5286528051998a986020808b0152511690880152516080606088015260c0870190613696565b9151917fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc09283878303016080880152613696565b9151908483030160a085015261382b565b037fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe08101835282613a0d565b90816020910312610547575173ffffffffffffffffffffffffffffffffffffffff811681036105475790565b73ffffffffffffffffffffffffffffffffffffffff908181169073ba100000625a3754423978a60c9317c58a424e3d8214908115614b7b575b8115614afd575b50614acc57604080517fd55a23f400000000000000000000000000000000000000000000000000000000815260049360207f000000000000000000000000e4683fe8f53da14ca5dac4251eadfb3aa614d528821681848881845afa938415614ac157600094614a92575b5060005b84811061492757602488888851917fd2dca630000000000000000000000000000000000000000000000000000000008352820152fd5b85517f40c354460000000000000000000000000000000000000000000000000000000081528189820152602490848183816000885af1908115614a6a57868b60009388938591614a75575b508b5194859384927ff7c618c1000000000000000000000000000000000000000000000000000000008452165af1908115614a6a57908691600091614a3d575b501688146149c957506149c490613ab5565b6148f1565b9450505050939150603c9081549268010000000000000000841015614a115750506001820190556149f99061385f565b909283549160031b90811b9283911b16911916179055565b6041907f4e487b7100000000000000000000000000000000000000000000000000000000600052526000fd5b614a5d9150863d8811614a63575b614a558183613a0d565b810190614817565b386149b2565b503d614a4b565b88513d6000823e3d90fd5b614a8c9150843d8611614a6357614a558183613a0d565b38614972565b90938282813d8311614aba575b614aa98183613a0d565b8101031261032257505192386148ed565b503d614a9f565b85513d6000823e3d90fd5b602490604051907fd2dca6300000000000000000000000000000000000000000000000000000000082526004820152fd5b905060405180603c5490818152602080910191603c6000527fc6bb06cb7f92603de181bf256cd16846b93b752a170ff24824098b31aa008a7e916000905b828210614b62575050505090614b5781614b5c94930382613a0d565b6156b0565b38614883565b8354891685529384019360019384019390910190614b3b565b73c0c293ce456ff0ed870add98a0828dd4d2903dbf8314915061487c565b603c54906002828101808211613ae257614bb290613a66565b9273ba100000625a3754423978a60c9317c58a424e3d614bd185613b11565b5273c0c293ce456ff0ed870add98a0828dd4d2903dbf614bf085613b1e565b526000805b828110614c025750505050565b614c0b8161385f565b905482860191828711614c485773ffffffffffffffffffffffffffffffffffffffff614c43949392613ca99260031b1c169189613b2e565b614bf5565b6024857f4e487b710000000000000000000000000000000000000000000000000000000081526011600452fd5b909173ffffffffffffffffffffffffffffffffffffffff91828116928315614e2b578416938415614dc157848414614d7d57614cb091613b98565b600082815280602052604081205491808310614d1357604082827fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef958760209652828652038282205586815220614d08828254613c1a565b9055604051908152a3565b608460405162461bcd60e51b815260206004820152602660248201527f45524332303a207472616e7366657220616d6f756e742065786365656473206260448201527f616c616e636500000000000000000000000000000000000000000000000000006064820152fd5b606460405162461bcd60e51b815260206004820152601760248201527f45524332303a207472616e7366657220746f2073656c660000000000000000006044820152fd5b608460405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201527f65737300000000000000000000000000000000000000000000000000000000006064820152fd5b608460405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f20616460448201527f64726573730000000000000000000000000000000000000000000000000000006064820152fd5b73ffffffffffffffffffffffffffffffffffffffff811690811561500957614ebc90613b42565b600091818352826020526040832054818110614f9f578190838552846020520360408420557effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff808211611abd576002549080831681831603818111614f7257917fff000000000000000000000000000000000000000000000000000000000000007fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef949260209416911617600255604051908152a3565b6024867f4e487b710000000000000000000000000000000000000000000000000000000081526011600452fd5b608460405162461bcd60e51b815260206004820152602260248201527f45524332303a206275726e20616d6f756e7420657863656564732062616c616e60448201527f63650000000000000000000000000000000000000000000000000000000000006064820152fd5b608460405162461bcd60e51b815260206004820152602160248201527f45524332303a206275726e2066726f6d20746865207a65726f2061646472657360448201527f73000000000000000000000000000000000000000000000000000000000000006064820152fd5b73ffffffffffffffffffffffffffffffffffffffff80911691821561514b57169182156150e15760207f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925918360005260018252604060002085600052825280604060002055604051908152a3565b608460405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f20616464726560448201527f73730000000000000000000000000000000000000000000000000000000000006064820152fd5b608460405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f2061646460448201527f72657373000000000000000000000000000000000000000000000000000000006064820152fd5b600581101561534257806151c55750565b6001810361521157606460405162461bcd60e51b815260206004820152601860248201527f45434453413a20696e76616c6964207369676e617475726500000000000000006044820152fd5b6002810361525d57606460405162461bcd60e51b815260206004820152601f60248201527f45434453413a20696e76616c6964207369676e6174757265206c656e677468006044820152fd5b600381036152cf57608460405162461bcd60e51b815260206004820152602260248201527f45434453413a20696e76616c6964207369676e6174757265202773272076616c60448201527f75650000000000000000000000000000000000000000000000000000000000006064820152fd5b6004146152d857565b608460405162461bcd60e51b815260206004820152602260248201527f45434453413a20696e76616c6964207369676e6174757265202776272076616c60448201527f75650000000000000000000000000000000000000000000000000000000000006064820152fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602160045260246000fd5b9291907f7fffffffffffffffffffffffffffffff5d576e7357a4501ddfe92f46681b20a0831161541a5760ff16601b8114158061540f575b615403579160809493916020936040519384528484015260408301526060820152600093849182805260015afa156112da57815173ffffffffffffffffffffffffffffffffffffffff8116156153fd579190565b50600190565b50505050600090600490565b50601c8114156153a9565b50505050600090600390565b73ffffffffffffffffffffffffffffffffffffffff7f0000000000000000000000008267fdabd1b8c8645138f2de5b0fe24988dc982016301480615524575b1561548e577fd94c950392bfa6cc0861911fdeccdfa1bd92f5059f47a63a016dbd1a4d2d98b590565b60405160208101907f8b73c3c69bb8fe3d512ecc4cf759cc79239f7b179b0ffacaa9a75d522b39400f82527f9f6eb204e48ababe6515aac444d72db6d39a53aa12ca4ea45d245afe82a61d1e60408201527fc89efdaa54c0f20c7adf612882df0950f5a951637e0307cdcb4c672f298b8bc660608201524660808201523060a082015260a0815261551e816139b9565b51902090565b507f00000000000000000000000000000000000000000000000000000000000000014614615465565b80519060005b828110615581575050507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff90565b737f39c581f595b53c5cb19bd0b3f8da6c935e2ca073ffffffffffffffffffffffffffffffffffffffff6155b58385613b2e565b5116146155c457600101615553565b91505090565b80519060005b8281106155fe575050507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff90565b73c02aaa39b223fe8d0a0e5c4f27ead9083c756cc273ffffffffffffffffffffffffffffffffffffffff6156328385613b2e565b5116146155c4576001016155d0565b9081519160005b83811061567757505050507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff90565b73ffffffffffffffffffffffffffffffffffffffff806156978385613b2e565b5116908416146156a957600101615648565b9250505090565b9081519160005b8381106156c75750505050600090565b73ffffffffffffffffffffffffffffffffffffffff806156e78385613b2e565b5116908416146156f9576001016156b7565b50505050600190565b73ffffffffffffffffffffffffffffffffffffffff169060405190615726826139f1565b6020928383527f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c656484840152803b1561580757600082819282876157789796519301915af161577261584b565b906158a9565b8051908161578557505050565b82806157959383010191016143a5565b1561579d5750565b6084906040519062461bcd60e51b82526004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e60448201527f6f742073756363656564000000000000000000000000000000000000000000006064820152fd5b6064846040519062461bcd60e51b82526004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e74726163740000006044820152fd5b3d156158a4573d9067ffffffffffffffff8211610919576040519161589860207fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0601f8401160184613a0d565b82523d6000602084013e565b606090565b909190156158b5575090565b8151156158c55750805190602001fd5b6158e99060405191829162461bcd60e51b8352602060048401526024830190613638565b0390fd5b81156159fa5760405160209273ffffffffffffffffffffffffffffffffffffffff848301937fa9059cbb00000000000000000000000000000000000000000000000000000000855216602483015260448201526044815261594d8161399d565b6040519161595a836139f1565b8383527f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c65648484015273ae7ab96520de3a18e5e111b5eaab095312d7fe8491823b156159b657615778939260009283809351925af161577261584b565b6064856040519062461bcd60e51b82526004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e74726163740000006044820152fd5b5050565b81156159fa57600080809381935af1615a1561584b565b5015615a1d57565b606460405162461bcd60e51b815260206004820152600f60248201527f6574682073656e64206661696c656400000000000000000000000000000000006044820152fd5b81156159fa5760405160209273ffffffffffffffffffffffffffffffffffffffff848301937fa9059cbb000000000000000000000000000000000000000000000000000000008552166024830152604482015260448152615ac18161399d565b60405191615ace836139f1565b8383527f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c656484840152737f39c581f595b53c5cb19bd0b3f8da6c935e2ca091823b156159b657615778939260009283809351925af161577261584b565b81156159fa5760405160209273ffffffffffffffffffffffffffffffffffffffff848301937fa9059cbb000000000000000000000000000000000000000000000000000000008552166024830152604482015260448152615b8a8161399d565b60405191615b97836139f1565b8383527f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c65648484015273c02aaa39b223fe8d0a0e5c4f27ead9083c756cc291823b156159b657615778939260009283809351925af161577261584b565b8215613b935773ffffffffffffffffffffffffffffffffffffffff9081169081615c2a575050600080809381935af1615a1561584b565b92613b8693604051937fa9059cbb000000000000000000000000000000000000000000000000000000006020860152166024840152604483015260448252615c718261399d565b615702565b60009073ffffffffffffffffffffffffffffffffffffffff1680615c9a5750504790565b6020602491604051928380927f70a082310000000000000000000000000000000000000000000000000000000082523060048301525afa918215610c30578092615ce357505090565b9091506020823d8211615d0b575b81615cfe60209383613a0d565b8101031261032257505190565b3d9150615cf156fea26469706673582212200c152966ddc028548bf5b28385c9661aea32dad77f60b569a28f759698a39e9b64736f6c63430008110033
Constructor Arguments (ABI-Encoded and is the last bytes of the Contract Creation Code above)
000000000000000000000000000000000000000000000000000000000000006000000000000000000000000000000000000000000000000000000000000000a000000000000000000000000021a9fd7212f37c35b030e9374510f99128d59cd3000000000000000000000000000000000000000000000000000000000000001e5359207773744554482d574554485f42616c616e6365724c5020417572610000000000000000000000000000000000000000000000000000000000000000001e53592d7773744554482d574554485f42616c616e6365724c5020417572610000
-----Decoded View---------------
Arg [0] : _name (string): SY wstETH-WETH_BalancerLP Aura
Arg [1] : _symbol (string): SY-wstETH-WETH_BalancerLP Aura
Arg [2] : _previewHelper (address): 0x21a9fd7212F37c35B030e9374510F99128d59CD3
-----Encoded View---------------
7 Constructor Arguments found :
Arg [0] : 0000000000000000000000000000000000000000000000000000000000000060
Arg [1] : 00000000000000000000000000000000000000000000000000000000000000a0
Arg [2] : 00000000000000000000000021a9fd7212f37c35b030e9374510f99128d59cd3
Arg [3] : 000000000000000000000000000000000000000000000000000000000000001e
Arg [4] : 5359207773744554482d574554485f42616c616e6365724c5020417572610000
Arg [5] : 000000000000000000000000000000000000000000000000000000000000001e
Arg [6] : 53592d7773744554482d574554485f42616c616e6365724c5020417572610000
Loading...
Loading
Loading...
Loading
Loading...
Loading
[ Download: CSV Export ]
[ 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.