Feature Tip: Add private address tag to any address under My Name Tag !
ERC-20
Stablecoin
Overview
Max Total Supply
7,649,610.141473287090526993 sUSDz
Holders
496 (0.00%)
Market
Onchain Market Cap
$0.00
Circulating Supply Market Cap
-
Other Info
Token Contract (WITH 18 Decimals)
Balance
0.000083782258071473 sUSDzValue
$0.00Loading...
Loading
Loading...
Loading
Loading...
Loading
# | Exchange | Pair | Price | 24H Volume | % Volume |
---|
Contract Source Code Verified (Exact Match)
Contract Name:
SUSDz
Compiler Version
v0.8.24+commit.e11b9ed9
Optimization Enabled:
Yes with 200 runs
Other Settings:
cancun EvmVersion
Contract Source Code (Solidity Standard Json-Input format)
// SPDX-License-Identifier: MIT pragma solidity ^0.8.21; import "@openzeppelin/contracts/access/AccessControl.sol"; import "@openzeppelin/contracts/token/ERC20/extensions/ERC4626.sol"; import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol"; import "@openzeppelin/contracts/token/ERC20/extensions/ERC20Permit.sol"; import "@openzeppelin/contracts/utils/ReentrancyGuard.sol"; import "./utils/SafeMath.sol"; import "./USDzFlat.sol"; /** * @title Staked USDz for getting yield. */ contract SUSDz is AccessControl, ReentrancyGuard, ERC20Permit, ERC4626 { using SafeERC20 for IERC20; using SafeMath for uint256; bytes32 public constant POOL_MANAGER_ROLE = keccak256("POOL_MANAGER_ROLE"); bytes32 public constant YIELD_MANAGER_ROLE = keccak256("YIELD_MANAGER_ROLE"); // Max withdraw cd time. uint24 public constant MAX_CD_PERIOD = 90 days; uint24 public CDPeriod; // It depends on how long we get the yield from off-chain. (Default is 30 days) uint256 public vestingPeriod = 30 days; uint256 public pooledUSDz; uint256 public vestingAmount; uint256 public lastDistributionTime; USDzFlat public immutable flat; struct UserCD { uint256 time; uint256 amount; } mapping(address => UserCD) public CD; // Blacklist mapping(address => bool) private _blacklist; event YieldReceived(uint256 indexed amount); event CDPeriodChanged(uint256 indexed newCDPeriod); event VestingPeriodChanged(uint256 indexed newCDPeriod); constructor(address _admin, IERC20 _asset, uint24 _CDPeriod) ERC20("Staked USDz", "sUSDz") ERC4626(_asset) ERC20Permit("sUSDz") { require(_CDPeriod < MAX_CD_PERIOD, "CDPERIOD_SHOULD_BE_LESS_THAN_90_DAYS"); _grantRole(DEFAULT_ADMIN_ROLE, _admin); CDPeriod = _CDPeriod; flat = new USDzFlat(address(this), _asset); } /** * @notice Add Yield(USDz) to this contract. * Emits a `YieldReceived` event. */ function addYield(uint256 _amount) external onlyRole(YIELD_MANAGER_ROLE) { require(_amount > 0, "TRANSFER_AMOUNT_IS_ZERO"); require(totalSupply() > 1 ether, "NOT_ENOUGH_TOTAL_STAKED_USDZ"); _updateVestingAmount(_amount); pooledUSDz = pooledUSDz.add(_amount); IERC20(asset()).safeTransferFrom(msg.sender, address(this), _amount); emit YieldReceived(_amount); } /** * @notice set new CD period. * * @param newCDPeriod new CD period. */ function setNewCDPeriod(uint24 newCDPeriod) external onlyRole(POOL_MANAGER_ROLE) { require(newCDPeriod < MAX_CD_PERIOD, "SHOULD_BE_LESS_THAN_MAX_CD_PERIOD"); CDPeriod = newCDPeriod; emit CDPeriodChanged(newCDPeriod); } /** * @notice set new vesting period. * * @param newPeriod new vesting period. */ function setNewVestingPeriod(uint256 newPeriod) external onlyRole(POOL_MANAGER_ROLE) { require(newPeriod > 0 && newPeriod < type(uint256).max, "SHOULD_BE_LESS_THAN_UINT256_MAX_AND_GREATER_THAN_ZERO"); vestingPeriod = newPeriod; emit VestingPeriodChanged(newPeriod); } /** * @return true if user in list. */ function isBlacklist(address _user) external view returns (bool) { return _blacklist[_user]; } function addToBlacklist(address _user) external onlyRole(POOL_MANAGER_ROLE) { _blacklist[_user] = true; } function addBatchToBlacklist(address[] calldata _users) external onlyRole(POOL_MANAGER_ROLE) { uint256 numUsers = _users.length; for (uint256 i; i < numUsers; ++i) { _blacklist[_users[i]] = true; } } function removeFromBlacklist(address _user) external onlyRole(POOL_MANAGER_ROLE) { _blacklist[_user] = false; } function removeBatchFromBlacklist(address[] calldata _users) external onlyRole(POOL_MANAGER_ROLE) { uint256 numUsers = _users.length; for (uint256 i; i < numUsers; ++i) { _blacklist[_users[i]] = false; } } /** * @notice Total vested USDz in this contract. * @dev To prevent ERC4626 Inflation Attacks. We use pooledUSDz to calculate totalAssets instead of balanceOf(). * * https://blog.openzeppelin.com/a-novel-defense-against-erc4626-inflation-attacks * */ function totalAssets() public view override returns (uint256) { uint256 unvested = getUnvestedAmount(); return pooledUSDz.sub(unvested); } /** * @dev Add mode check to {IERC4626-withdraw}. */ function withdraw(uint256 assets, address receiver, address _owner) public virtual override returns (uint256) { require(CDPeriod == 0, "ERC4626_MODE_ON"); return super.withdraw(assets, receiver, _owner); } /** * @dev Add mode check to {IERC4626-redeem}. */ function redeem(uint256 shares, address receiver, address _owner) public virtual override returns (uint256) { require(CDPeriod == 0, "ERC4626_MODE_ON"); return super.redeem(shares, receiver, _owner); } /** * @notice Used to claim USDz after CD has finished. * @dev Works on both mode. */ function unstake() external { UserCD storage userCD = CD[msg.sender]; require(block.timestamp >= userCD.time || CDPeriod == 0, "UNSTAKE_FAILED"); uint256 amountToWithdraw = userCD.amount; userCD.time = 0; userCD.amount = 0; flat.withdraw(msg.sender, amountToWithdraw); } /** * @notice Starts withdraw CD with assets. */ function CDAssets(uint256 _assets) external returns (uint256 _shares) { require(CDPeriod > 0, "CD_MODE_ON"); require(_assets <= maxWithdraw(msg.sender), "WITHDRAW_AMOUNT_EXCEEDED"); _shares = previewWithdraw(_assets); CD[msg.sender].time = block.timestamp + CDPeriod; CD[msg.sender].amount += _assets; _withdraw(msg.sender, address(flat), msg.sender, _assets, _shares); } /** * @notice Starts withdraw CD with shares. */ function CDShares(uint256 _shares) external returns (uint256 _assets) { require(CDPeriod > 0, "CD_MODE_ON"); require(_shares <= maxRedeem(msg.sender), "WITHDRAW_AMOUNT_EXCEEDED"); _assets = previewRedeem(_shares); CD[msg.sender].time = block.timestamp + CDPeriod; CD[msg.sender].amount += _assets; _withdraw(msg.sender, address(flat), msg.sender, _assets, _shares); } function getUnvestedAmount() public view returns (uint256) { uint256 timeGap = block.timestamp.sub(lastDistributionTime); // If all vested if (timeGap >= vestingPeriod) { return 0; } else { uint256 unvestedAmount = ((vestingPeriod.sub(timeGap)).mul(vestingAmount)).div(vestingPeriod); return unvestedAmount; } } /** * @dev ERC4626 and ERC20 define function with same name and parameter types. */ function decimals() public pure override(ERC4626, ERC20) returns (uint8) { return 18; } /** * @dev Add nonReetrant and pooledUSDz calculation. */ function _deposit(address _caller, address _receiver, uint256 _assets, uint256 _shares) internal override nonReentrant { require(_assets > 0, "ASSETS_IS_ZERO"); require(_shares > 0, "SHARES_IS_ZERO"); require(!_blacklist[_receiver], "RECIPIENT_IN_BLACKLIST"); super._deposit(_caller, _receiver, _assets, _shares); pooledUSDz = pooledUSDz.add(_assets); } function _withdraw(address _caller, address _receiver, address _owner, uint256 _assets, uint256 _shares) internal override nonReentrant { require(_assets > 0, "ASSETS_IS_ZERO"); require(_shares > 0, "SHARES_IS_ZERO"); pooledUSDz = pooledUSDz.sub(_assets); super._withdraw(_caller, _receiver, _owner, _assets, _shares); } function _updateVestingAmount(uint256 _amount) internal { require(getUnvestedAmount() == 0, "UNVESTING_IS_NOT_ZERO"); vestingAmount = _amount; lastDistributionTime = block.timestamp; } function _update(address from, address to, uint256 amount) internal virtual override { require(!_blacklist[from], "SENDER_IN_BLACKLIST"); require(!_blacklist[to], "RECIPIENT_IN_BLACKLIST"); super._update(from, to, amount); } function rescueERC20(IERC20 token, address to, uint256 amount) external onlyRole(POOL_MANAGER_ROLE) { // If is USDz, check pooled amount first. if (address(token) == asset()) { require(amount <= token.balanceOf(address(this)).sub(pooledUSDz), "USDZ_RESCUE_AMOUNT_EXCEED_DEBIT"); } token.safeTransfer(to, amount); } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.0) (access/AccessControl.sol) pragma solidity ^0.8.20; import {IAccessControl} from "./IAccessControl.sol"; import {Context} from "../utils/Context.sol"; import {ERC165} from "../utils/introspection/ERC165.sol"; /** * @dev Contract module that allows children to implement role-based access * control mechanisms. This is a lightweight version that doesn't allow enumerating role * members except through off-chain means by accessing the contract event logs. Some * applications may benefit from on-chain enumerability, for those cases see * {AccessControlEnumerable}. * * Roles are referred to by their `bytes32` identifier. These should be exposed * in the external API and be unique. The best way to achieve this is by * using `public constant` hash digests: * * ```solidity * bytes32 public constant MY_ROLE = keccak256("MY_ROLE"); * ``` * * Roles can be used to represent a set of permissions. To restrict access to a * function call, use {hasRole}: * * ```solidity * function foo() public { * require(hasRole(MY_ROLE, msg.sender)); * ... * } * ``` * * Roles can be granted and revoked dynamically via the {grantRole} and * {revokeRole} functions. Each role has an associated admin role, and only * accounts that have a role's admin role can call {grantRole} and {revokeRole}. * * By default, the admin role for all roles is `DEFAULT_ADMIN_ROLE`, which means * that only accounts with this role will be able to grant or revoke other * roles. More complex role relationships can be created by using * {_setRoleAdmin}. * * WARNING: The `DEFAULT_ADMIN_ROLE` is also its own admin: it has permission to * grant and revoke this role. Extra precautions should be taken to secure * accounts that have been granted it. We recommend using {AccessControlDefaultAdminRules} * to enforce additional security measures for this role. */ abstract contract AccessControl is Context, IAccessControl, ERC165 { struct RoleData { mapping(address account => bool) hasRole; bytes32 adminRole; } mapping(bytes32 role => RoleData) private _roles; bytes32 public constant DEFAULT_ADMIN_ROLE = 0x00; /** * @dev Modifier that checks that an account has a specific role. Reverts * with an {AccessControlUnauthorizedAccount} error including the required role. */ modifier onlyRole(bytes32 role) { _checkRole(role); _; } /** * @dev See {IERC165-supportsInterface}. */ function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) { return interfaceId == type(IAccessControl).interfaceId || super.supportsInterface(interfaceId); } /** * @dev Returns `true` if `account` has been granted `role`. */ function hasRole(bytes32 role, address account) public view virtual returns (bool) { return _roles[role].hasRole[account]; } /** * @dev Reverts with an {AccessControlUnauthorizedAccount} error if `_msgSender()` * is missing `role`. Overriding this function changes the behavior of the {onlyRole} modifier. */ function _checkRole(bytes32 role) internal view virtual { _checkRole(role, _msgSender()); } /** * @dev Reverts with an {AccessControlUnauthorizedAccount} error if `account` * is missing `role`. */ function _checkRole(bytes32 role, address account) internal view virtual { if (!hasRole(role, account)) { revert AccessControlUnauthorizedAccount(account, role); } } /** * @dev Returns the admin role that controls `role`. See {grantRole} and * {revokeRole}. * * To change a role's admin, use {_setRoleAdmin}. */ function getRoleAdmin(bytes32 role) public view virtual returns (bytes32) { return _roles[role].adminRole; } /** * @dev Grants `role` to `account`. * * If `account` had not been already granted `role`, emits a {RoleGranted} * event. * * Requirements: * * - the caller must have ``role``'s admin role. * * May emit a {RoleGranted} event. */ function grantRole(bytes32 role, address account) public virtual onlyRole(getRoleAdmin(role)) { _grantRole(role, account); } /** * @dev Revokes `role` from `account`. * * If `account` had been granted `role`, emits a {RoleRevoked} event. * * Requirements: * * - the caller must have ``role``'s admin role. * * May emit a {RoleRevoked} event. */ function revokeRole(bytes32 role, address account) public virtual onlyRole(getRoleAdmin(role)) { _revokeRole(role, account); } /** * @dev Revokes `role` from the calling account. * * Roles are often managed via {grantRole} and {revokeRole}: this function's * purpose is to provide a mechanism for accounts to lose their privileges * if they are compromised (such as when a trusted device is misplaced). * * If the calling account had been revoked `role`, emits a {RoleRevoked} * event. * * Requirements: * * - the caller must be `callerConfirmation`. * * May emit a {RoleRevoked} event. */ function renounceRole(bytes32 role, address callerConfirmation) public virtual { if (callerConfirmation != _msgSender()) { revert AccessControlBadConfirmation(); } _revokeRole(role, callerConfirmation); } /** * @dev Sets `adminRole` as ``role``'s admin role. * * Emits a {RoleAdminChanged} event. */ function _setRoleAdmin(bytes32 role, bytes32 adminRole) internal virtual { bytes32 previousAdminRole = getRoleAdmin(role); _roles[role].adminRole = adminRole; emit RoleAdminChanged(role, previousAdminRole, adminRole); } /** * @dev Attempts to grant `role` to `account` and returns a boolean indicating if `role` was granted. * * Internal function without access restriction. * * May emit a {RoleGranted} event. */ function _grantRole(bytes32 role, address account) internal virtual returns (bool) { if (!hasRole(role, account)) { _roles[role].hasRole[account] = true; emit RoleGranted(role, account, _msgSender()); return true; } else { return false; } } /** * @dev Attempts to revoke `role` to `account` and returns a boolean indicating if `role` was revoked. * * Internal function without access restriction. * * May emit a {RoleRevoked} event. */ function _revokeRole(bytes32 role, address account) internal virtual returns (bool) { if (hasRole(role, account)) { _roles[role].hasRole[account] = false; emit RoleRevoked(role, account, _msgSender()); return true; } else { return false; } } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.0) (token/ERC20/extensions/ERC4626.sol) pragma solidity ^0.8.20; import {IERC20, IERC20Metadata, ERC20} from "../ERC20.sol"; import {SafeERC20} from "../utils/SafeERC20.sol"; import {IERC4626} from "../../../interfaces/IERC4626.sol"; import {Math} from "../../../utils/math/Math.sol"; /** * @dev Implementation of the ERC4626 "Tokenized Vault Standard" as defined in * https://eips.ethereum.org/EIPS/eip-4626[EIP-4626]. * * This extension allows the minting and burning of "shares" (represented using the ERC20 inheritance) in exchange for * underlying "assets" through standardized {deposit}, {mint}, {redeem} and {burn} workflows. This contract extends * the ERC20 standard. Any additional extensions included along it would affect the "shares" token represented by this * contract and not the "assets" token which is an independent contract. * * [CAUTION] * ==== * In empty (or nearly empty) ERC-4626 vaults, deposits are at high risk of being stolen through frontrunning * with a "donation" to the vault that inflates the price of a share. This is variously known as a donation or inflation * attack and is essentially a problem of slippage. Vault deployers can protect against this attack by making an initial * deposit of a non-trivial amount of the asset, such that price manipulation becomes infeasible. Withdrawals may * similarly be affected by slippage. Users can protect against this attack as well as unexpected slippage in general by * verifying the amount received is as expected, using a wrapper that performs these checks such as * https://github.com/fei-protocol/ERC4626#erc4626router-and-base[ERC4626Router]. * * Since v4.9, this implementation uses virtual assets and shares to mitigate that risk. The `_decimalsOffset()` * corresponds to an offset in the decimal representation between the underlying asset's decimals and the vault * decimals. This offset also determines the rate of virtual shares to virtual assets in the vault, which itself * determines the initial exchange rate. While not fully preventing the attack, analysis shows that the default offset * (0) makes it non-profitable, as a result of the value being captured by the virtual shares (out of the attacker's * donation) matching the attacker's expected gains. With a larger offset, the attack becomes orders of magnitude more * expensive than it is profitable. More details about the underlying math can be found * xref:erc4626.adoc#inflation-attack[here]. * * The drawback of this approach is that the virtual shares do capture (a very small) part of the value being accrued * to the vault. Also, if the vault experiences losses, the users try to exit the vault, the virtual shares and assets * will cause the first user to exit to experience reduced losses in detriment to the last users that will experience * bigger losses. Developers willing to revert back to the pre-v4.9 behavior just need to override the * `_convertToShares` and `_convertToAssets` functions. * * To learn more, check out our xref:ROOT:erc4626.adoc[ERC-4626 guide]. * ==== */ abstract contract ERC4626 is ERC20, IERC4626 { using Math for uint256; IERC20 private immutable _asset; uint8 private immutable _underlyingDecimals; /** * @dev Attempted to deposit more assets than the max amount for `receiver`. */ error ERC4626ExceededMaxDeposit(address receiver, uint256 assets, uint256 max); /** * @dev Attempted to mint more shares than the max amount for `receiver`. */ error ERC4626ExceededMaxMint(address receiver, uint256 shares, uint256 max); /** * @dev Attempted to withdraw more assets than the max amount for `receiver`. */ error ERC4626ExceededMaxWithdraw(address owner, uint256 assets, uint256 max); /** * @dev Attempted to redeem more shares than the max amount for `receiver`. */ error ERC4626ExceededMaxRedeem(address owner, uint256 shares, uint256 max); /** * @dev Set the underlying asset contract. This must be an ERC20-compatible contract (ERC20 or ERC777). */ constructor(IERC20 asset_) { (bool success, uint8 assetDecimals) = _tryGetAssetDecimals(asset_); _underlyingDecimals = success ? assetDecimals : 18; _asset = asset_; } /** * @dev Attempts to fetch the asset decimals. A return value of false indicates that the attempt failed in some way. */ function _tryGetAssetDecimals(IERC20 asset_) private view returns (bool, uint8) { (bool success, bytes memory encodedDecimals) = address(asset_).staticcall( abi.encodeCall(IERC20Metadata.decimals, ()) ); if (success && encodedDecimals.length >= 32) { uint256 returnedDecimals = abi.decode(encodedDecimals, (uint256)); if (returnedDecimals <= type(uint8).max) { return (true, uint8(returnedDecimals)); } } return (false, 0); } /** * @dev Decimals are computed by adding the decimal offset on top of the underlying asset's decimals. This * "original" value is cached during construction of the vault contract. If this read operation fails (e.g., the * asset has not been created yet), a default of 18 is used to represent the underlying asset's decimals. * * See {IERC20Metadata-decimals}. */ function decimals() public view virtual override(IERC20Metadata, ERC20) returns (uint8) { return _underlyingDecimals + _decimalsOffset(); } /** @dev See {IERC4626-asset}. */ function asset() public view virtual returns (address) { return address(_asset); } /** @dev See {IERC4626-totalAssets}. */ function totalAssets() public view virtual returns (uint256) { return _asset.balanceOf(address(this)); } /** @dev See {IERC4626-convertToShares}. */ function convertToShares(uint256 assets) public view virtual returns (uint256) { return _convertToShares(assets, Math.Rounding.Floor); } /** @dev See {IERC4626-convertToAssets}. */ function convertToAssets(uint256 shares) public view virtual returns (uint256) { return _convertToAssets(shares, Math.Rounding.Floor); } /** @dev See {IERC4626-maxDeposit}. */ function maxDeposit(address) public view virtual returns (uint256) { return type(uint256).max; } /** @dev See {IERC4626-maxMint}. */ function maxMint(address) public view virtual returns (uint256) { return type(uint256).max; } /** @dev See {IERC4626-maxWithdraw}. */ function maxWithdraw(address owner) public view virtual returns (uint256) { return _convertToAssets(balanceOf(owner), Math.Rounding.Floor); } /** @dev See {IERC4626-maxRedeem}. */ function maxRedeem(address owner) public view virtual returns (uint256) { return balanceOf(owner); } /** @dev See {IERC4626-previewDeposit}. */ function previewDeposit(uint256 assets) public view virtual returns (uint256) { return _convertToShares(assets, Math.Rounding.Floor); } /** @dev See {IERC4626-previewMint}. */ function previewMint(uint256 shares) public view virtual returns (uint256) { return _convertToAssets(shares, Math.Rounding.Ceil); } /** @dev See {IERC4626-previewWithdraw}. */ function previewWithdraw(uint256 assets) public view virtual returns (uint256) { return _convertToShares(assets, Math.Rounding.Ceil); } /** @dev See {IERC4626-previewRedeem}. */ function previewRedeem(uint256 shares) public view virtual returns (uint256) { return _convertToAssets(shares, Math.Rounding.Floor); } /** @dev See {IERC4626-deposit}. */ function deposit(uint256 assets, address receiver) public virtual returns (uint256) { uint256 maxAssets = maxDeposit(receiver); if (assets > maxAssets) { revert ERC4626ExceededMaxDeposit(receiver, assets, maxAssets); } uint256 shares = previewDeposit(assets); _deposit(_msgSender(), receiver, assets, shares); return shares; } /** @dev See {IERC4626-mint}. * * As opposed to {deposit}, minting is allowed even if the vault is in a state where the price of a share is zero. * In this case, the shares will be minted without requiring any assets to be deposited. */ function mint(uint256 shares, address receiver) public virtual returns (uint256) { uint256 maxShares = maxMint(receiver); if (shares > maxShares) { revert ERC4626ExceededMaxMint(receiver, shares, maxShares); } uint256 assets = previewMint(shares); _deposit(_msgSender(), receiver, assets, shares); return assets; } /** @dev See {IERC4626-withdraw}. */ function withdraw(uint256 assets, address receiver, address owner) public virtual returns (uint256) { uint256 maxAssets = maxWithdraw(owner); if (assets > maxAssets) { revert ERC4626ExceededMaxWithdraw(owner, assets, maxAssets); } uint256 shares = previewWithdraw(assets); _withdraw(_msgSender(), receiver, owner, assets, shares); return shares; } /** @dev See {IERC4626-redeem}. */ function redeem(uint256 shares, address receiver, address owner) public virtual returns (uint256) { uint256 maxShares = maxRedeem(owner); if (shares > maxShares) { revert ERC4626ExceededMaxRedeem(owner, shares, maxShares); } uint256 assets = previewRedeem(shares); _withdraw(_msgSender(), receiver, owner, assets, shares); return assets; } /** * @dev Internal conversion function (from assets to shares) with support for rounding direction. */ function _convertToShares(uint256 assets, Math.Rounding rounding) internal view virtual returns (uint256) { return assets.mulDiv(totalSupply() + 10 ** _decimalsOffset(), totalAssets() + 1, rounding); } /** * @dev Internal conversion function (from shares to assets) with support for rounding direction. */ function _convertToAssets(uint256 shares, Math.Rounding rounding) internal view virtual returns (uint256) { return shares.mulDiv(totalAssets() + 1, totalSupply() + 10 ** _decimalsOffset(), rounding); } /** * @dev Deposit/mint common workflow. */ function _deposit(address caller, address receiver, uint256 assets, uint256 shares) internal virtual { // If _asset is ERC777, `transferFrom` can trigger a reentrancy BEFORE the transfer happens through the // `tokensToSend` hook. On the other hand, the `tokenReceived` hook, that is triggered after the transfer, // calls the vault, which is assumed not malicious. // // Conclusion: we need to do the transfer before we mint so that any reentrancy would happen before the // assets are transferred and before the shares are minted, which is a valid state. // slither-disable-next-line reentrancy-no-eth SafeERC20.safeTransferFrom(_asset, caller, address(this), assets); _mint(receiver, shares); emit Deposit(caller, receiver, assets, shares); } /** * @dev Withdraw/redeem common workflow. */ function _withdraw( address caller, address receiver, address owner, uint256 assets, uint256 shares ) internal virtual { if (caller != owner) { _spendAllowance(owner, caller, shares); } // If _asset is ERC777, `transfer` can trigger a reentrancy AFTER the transfer happens through the // `tokensReceived` hook. On the other hand, the `tokensToSend` hook, that is triggered before the transfer, // calls the vault, which is assumed not malicious. // // Conclusion: we need to do the transfer after the burn so that any reentrancy would happen after the // shares are burned and after the assets are transferred, which is a valid state. _burn(owner, shares); SafeERC20.safeTransfer(_asset, receiver, assets); emit Withdraw(caller, receiver, owner, assets, shares); } function _decimalsOffset() internal view virtual returns (uint8) { return 0; } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.0) (token/ERC20/utils/SafeERC20.sol) pragma solidity ^0.8.20; import {IERC20} from "../IERC20.sol"; import {IERC20Permit} from "../extensions/IERC20Permit.sol"; import {Address} from "../../../utils/Address.sol"; /** * @title SafeERC20 * @dev Wrappers around ERC20 operations that throw on failure (when the token * contract returns false). Tokens that return no value (and instead revert or * throw on failure) are also supported, non-reverting calls are assumed to be * successful. * To use this library you can add a `using SafeERC20 for IERC20;` statement to your contract, * which allows you to call the safe operations as `token.safeTransfer(...)`, etc. */ library SafeERC20 { using Address for address; /** * @dev An operation with an ERC20 token failed. */ error SafeERC20FailedOperation(address token); /** * @dev Indicates a failed `decreaseAllowance` request. */ error SafeERC20FailedDecreaseAllowance(address spender, uint256 currentAllowance, uint256 requestedDecrease); /** * @dev Transfer `value` amount of `token` from the calling contract to `to`. If `token` returns no value, * non-reverting calls are assumed to be successful. */ function safeTransfer(IERC20 token, address to, uint256 value) internal { _callOptionalReturn(token, abi.encodeCall(token.transfer, (to, value))); } /** * @dev Transfer `value` amount of `token` from `from` to `to`, spending the approval given by `from` to the * calling contract. If `token` returns no value, non-reverting calls are assumed to be successful. */ function safeTransferFrom(IERC20 token, address from, address to, uint256 value) internal { _callOptionalReturn(token, abi.encodeCall(token.transferFrom, (from, to, value))); } /** * @dev Increase the calling contract's allowance toward `spender` by `value`. If `token` returns no value, * non-reverting calls are assumed to be successful. */ function safeIncreaseAllowance(IERC20 token, address spender, uint256 value) internal { uint256 oldAllowance = token.allowance(address(this), spender); forceApprove(token, spender, oldAllowance + value); } /** * @dev Decrease the calling contract's allowance toward `spender` by `requestedDecrease`. If `token` returns no * value, non-reverting calls are assumed to be successful. */ function safeDecreaseAllowance(IERC20 token, address spender, uint256 requestedDecrease) internal { unchecked { uint256 currentAllowance = token.allowance(address(this), spender); if (currentAllowance < requestedDecrease) { revert SafeERC20FailedDecreaseAllowance(spender, currentAllowance, requestedDecrease); } forceApprove(token, spender, currentAllowance - requestedDecrease); } } /** * @dev Set the calling contract's allowance toward `spender` to `value`. If `token` returns no value, * non-reverting calls are assumed to be successful. Meant to be used with tokens that require the approval * to be set to zero before setting it to a non-zero value, such as USDT. */ function forceApprove(IERC20 token, address spender, uint256 value) internal { bytes memory approvalCall = abi.encodeCall(token.approve, (spender, value)); if (!_callOptionalReturnBool(token, approvalCall)) { _callOptionalReturn(token, abi.encodeCall(token.approve, (spender, 0))); _callOptionalReturn(token, approvalCall); } } /** * @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); if (returndata.length != 0 && !abi.decode(returndata, (bool))) { revert SafeERC20FailedOperation(address(token)); } } /** * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement * on the return value: the return value is optional (but if data is returned, it must not be false). * @param token The token targeted by the call. * @param data The call data (encoded using abi.encode or one of its variants). * * This is a variant of {_callOptionalReturn} that silents catches all reverts and returns a bool instead. */ function _callOptionalReturnBool(IERC20 token, bytes memory data) private returns (bool) { // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since // we're implementing it ourselves. We cannot use {Address-functionCall} here since this should return false // and not revert is the subcall reverts. (bool success, bytes memory returndata) = address(token).call(data); return success && (returndata.length == 0 || abi.decode(returndata, (bool))) && address(token).code.length > 0; } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.0) (token/ERC20/extensions/ERC20Permit.sol) pragma solidity ^0.8.20; import {IERC20Permit} from "./IERC20Permit.sol"; import {ERC20} from "../ERC20.sol"; import {ECDSA} from "../../../utils/cryptography/ECDSA.sol"; import {EIP712} from "../../../utils/cryptography/EIP712.sol"; import {Nonces} from "../../../utils/Nonces.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. */ abstract contract ERC20Permit is ERC20, IERC20Permit, EIP712, Nonces { bytes32 private constant PERMIT_TYPEHASH = keccak256("Permit(address owner,address spender,uint256 value,uint256 nonce,uint256 deadline)"); /** * @dev Permit deadline has expired. */ error ERC2612ExpiredSignature(uint256 deadline); /** * @dev Mismatched signature. */ error ERC2612InvalidSigner(address signer, address owner); /** * @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") {} /** * @inheritdoc IERC20Permit */ function permit( address owner, address spender, uint256 value, uint256 deadline, uint8 v, bytes32 r, bytes32 s ) public virtual { if (block.timestamp > deadline) { revert ERC2612ExpiredSignature(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); if (signer != owner) { revert ERC2612InvalidSigner(signer, owner); } _approve(owner, spender, value); } /** * @inheritdoc IERC20Permit */ function nonces(address owner) public view virtual override(IERC20Permit, Nonces) returns (uint256) { return super.nonces(owner); } /** * @inheritdoc IERC20Permit */ // solhint-disable-next-line func-name-mixedcase function DOMAIN_SEPARATOR() external view virtual returns (bytes32) { return _domainSeparatorV4(); } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.0) (utils/ReentrancyGuard.sol) pragma solidity ^0.8.20; /** * @dev Contract module that helps prevent reentrant calls to a function. * * Inheriting from `ReentrancyGuard` will make the {nonReentrant} modifier * available, which can be applied to functions to make sure there are no nested * (reentrant) calls to them. * * Note that because there is a single `nonReentrant` guard, functions marked as * `nonReentrant` may not call one another. This can be worked around by making * those functions `private`, and then adding `external` `nonReentrant` entry * points to them. * * TIP: If you would like to learn more about reentrancy and alternative ways * to protect against it, check out our blog post * https://blog.openzeppelin.com/reentrancy-after-istanbul/[Reentrancy After Istanbul]. */ abstract contract ReentrancyGuard { // Booleans are more expensive than uint256 or any type that takes up a full // word because each write operation emits an extra SLOAD to first read the // slot's contents, replace the bits taken up by the boolean, and then write // back. This is the compiler's defense against contract upgrades and // pointer aliasing, and it cannot be disabled. // The values being non-zero value makes deployment a bit more expensive, // but in exchange the refund on every call to nonReentrant will be lower in // amount. Since refunds are capped to a percentage of the total // transaction's gas, it is best to keep them low in cases like this one, to // increase the likelihood of the full refund coming into effect. uint256 private constant NOT_ENTERED = 1; uint256 private constant ENTERED = 2; uint256 private _status; /** * @dev Unauthorized reentrant call. */ error ReentrancyGuardReentrantCall(); constructor() { _status = NOT_ENTERED; } /** * @dev Prevents a contract from calling itself, directly or indirectly. * Calling a `nonReentrant` function from another `nonReentrant` * function is not supported. It is possible to prevent this from happening * by making the `nonReentrant` function external, and making it call a * `private` function that does the actual work. */ modifier nonReentrant() { _nonReentrantBefore(); _; _nonReentrantAfter(); } function _nonReentrantBefore() private { // On the first call to nonReentrant, _status will be NOT_ENTERED if (_status == ENTERED) { revert ReentrancyGuardReentrantCall(); } // Any calls to nonReentrant after this point will fail _status = ENTERED; } function _nonReentrantAfter() private { // By storing the original value once again, a refund is triggered (see // https://eips.ethereum.org/EIPS/eip-2200) _status = NOT_ENTERED; } /** * @dev Returns true if the reentrancy guard is currently set to "entered", which indicates there is a * `nonReentrant` function in the call stack. */ function _reentrancyGuardEntered() internal view returns (bool) { return _status == ENTERED; } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.9.0) (utils/math/SafeMath.sol) pragma solidity ^0.8.0; // CAUTION // This version of SafeMath should only be used with Solidity 0.8 or later, // because it relies on the compiler's built in overflow checks. /** * @dev Wrappers over Solidity's arithmetic operations. * * NOTE: `SafeMath` is generally not needed starting with Solidity 0.8, since the compiler * now has built in overflow checking. */ library SafeMath { /** * @dev Returns the addition of two unsigned integers, with an overflow flag. * * _Available since v3.4._ */ function tryAdd(uint256 a, uint256 b) internal pure returns (bool, uint256) { unchecked { uint256 c = a + b; if (c < a) return (false, 0); return (true, c); } } /** * @dev Returns the subtraction of two unsigned integers, with an overflow flag. * * _Available since v3.4._ */ function trySub(uint256 a, uint256 b) internal pure returns (bool, uint256) { unchecked { if (b > a) return (false, 0); return (true, a - b); } } /** * @dev Returns the multiplication of two unsigned integers, with an overflow flag. * * _Available since v3.4._ */ function tryMul(uint256 a, uint256 b) internal pure returns (bool, uint256) { unchecked { // Gas optimization: this is cheaper than requiring 'a' not being zero, but the // benefit is lost if 'b' is also tested. // See: https://github.com/OpenZeppelin/openzeppelin-contracts/pull/522 if (a == 0) return (true, 0); uint256 c = a * b; if (c / a != b) return (false, 0); return (true, c); } } /** * @dev Returns the division of two unsigned integers, with a division by zero flag. * * _Available since v3.4._ */ function tryDiv(uint256 a, uint256 b) internal pure returns (bool, uint256) { unchecked { if (b == 0) return (false, 0); return (true, a / b); } } /** * @dev Returns the remainder of dividing two unsigned integers, with a division by zero flag. * * _Available since v3.4._ */ function tryMod(uint256 a, uint256 b) internal pure returns (bool, uint256) { unchecked { if (b == 0) return (false, 0); return (true, a % b); } } /** * @dev Returns the addition of two unsigned integers, reverting on * overflow. * * Counterpart to Solidity's `+` operator. * * Requirements: * * - Addition cannot overflow. */ function add(uint256 a, uint256 b) internal pure returns (uint256) { return a + b; } /** * @dev Returns the subtraction of two unsigned integers, reverting on * overflow (when the result is negative). * * Counterpart to Solidity's `-` operator. * * Requirements: * * - Subtraction cannot overflow. */ function sub(uint256 a, uint256 b) internal pure returns (uint256) { return a - b; } /** * @dev Returns the multiplication of two unsigned integers, reverting on * overflow. * * Counterpart to Solidity's `*` operator. * * Requirements: * * - Multiplication cannot overflow. */ function mul(uint256 a, uint256 b) internal pure returns (uint256) { return a * b; } /** * @dev Returns the integer division of two unsigned integers, reverting on * division by zero. The result is rounded towards zero. * * Counterpart to Solidity's `/` operator. * * Requirements: * * - The divisor cannot be zero. */ function div(uint256 a, uint256 b) internal pure returns (uint256) { return a / b; } /** * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo), * reverting when dividing by zero. * * Counterpart to Solidity's `%` operator. This function uses a `revert` * opcode (which leaves remaining gas untouched) while Solidity uses an * invalid opcode to revert (consuming all remaining gas). * * Requirements: * * - The divisor cannot be zero. */ function mod(uint256 a, uint256 b) internal pure returns (uint256) { return a % b; } /** * @dev Returns the subtraction of two unsigned integers, reverting with custom message on * overflow (when the result is negative). * * CAUTION: This function is deprecated because it requires allocating memory for the error * message unnecessarily. For custom revert reasons use {trySub}. * * Counterpart to Solidity's `-` operator. * * Requirements: * * - Subtraction cannot overflow. */ function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) { unchecked { require(b <= a, errorMessage); return a - b; } } /** * @dev Returns the integer division of two unsigned integers, reverting with custom message on * division by zero. The result is rounded towards zero. * * Counterpart to Solidity's `/` operator. Note: this function uses a * `revert` opcode (which leaves remaining gas untouched) while Solidity * uses an invalid opcode to revert (consuming all remaining gas). * * Requirements: * * - The divisor cannot be zero. */ function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) { unchecked { require(b > 0, errorMessage); return a / b; } } /** * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo), * reverting with custom message when dividing by zero. * * CAUTION: This function is deprecated because it requires allocating memory for the error * message unnecessarily. For custom revert reasons use {tryMod}. * * Counterpart to Solidity's `%` operator. This function uses a `revert` * opcode (which leaves remaining gas untouched) while Solidity uses an * invalid opcode to revert (consuming all remaining gas). * * Requirements: * * - The divisor cannot be zero. */ function mod(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) { unchecked { require(b > 0, errorMessage); return a % b; } } }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.21; import "@openzeppelin/contracts/token/ERC20/IERC20.sol"; /** * @title Used to put cooldown USDz from sUSDz contract. */ contract USDzFlat { address public immutable susdz; IERC20 public immutable usdz; constructor(address _susdz, IERC20 _usdz) { susdz = _susdz; usdz = _usdz; } modifier onlysUSDz() { require(msg.sender == susdz, "CAN_ONLY_CALLED_BY_SUSDZ"); _; } function withdraw(address _to, uint256 _amount) external onlysUSDz { usdz.transfer(_to, _amount); } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.0) (access/IAccessControl.sol) pragma solidity ^0.8.20; /** * @dev External interface of AccessControl declared to support ERC165 detection. */ interface IAccessControl { /** * @dev The `account` is missing a role. */ error AccessControlUnauthorizedAccount(address account, bytes32 neededRole); /** * @dev The caller of a function is not the expected one. * * NOTE: Don't confuse with {AccessControlUnauthorizedAccount}. */ error AccessControlBadConfirmation(); /** * @dev Emitted when `newAdminRole` is set as ``role``'s admin role, replacing `previousAdminRole` * * `DEFAULT_ADMIN_ROLE` is the starting admin for all roles, despite * {RoleAdminChanged} not being emitted signaling this. */ event RoleAdminChanged(bytes32 indexed role, bytes32 indexed previousAdminRole, bytes32 indexed newAdminRole); /** * @dev Emitted when `account` is granted `role`. * * `sender` is the account that originated the contract call, an admin role * bearer except when using {AccessControl-_setupRole}. */ event RoleGranted(bytes32 indexed role, address indexed account, address indexed sender); /** * @dev Emitted when `account` is revoked `role`. * * `sender` is the account that originated the contract call: * - if using `revokeRole`, it is the admin role bearer * - if using `renounceRole`, it is the role bearer (i.e. `account`) */ event RoleRevoked(bytes32 indexed role, address indexed account, address indexed sender); /** * @dev Returns `true` if `account` has been granted `role`. */ function hasRole(bytes32 role, address account) external view returns (bool); /** * @dev Returns the admin role that controls `role`. See {grantRole} and * {revokeRole}. * * To change a role's admin, use {AccessControl-_setRoleAdmin}. */ function getRoleAdmin(bytes32 role) external view returns (bytes32); /** * @dev Grants `role` to `account`. * * If `account` had not been already granted `role`, emits a {RoleGranted} * event. * * Requirements: * * - the caller must have ``role``'s admin role. */ function grantRole(bytes32 role, address account) external; /** * @dev Revokes `role` from `account`. * * If `account` had been granted `role`, emits a {RoleRevoked} event. * * Requirements: * * - the caller must have ``role``'s admin role. */ function revokeRole(bytes32 role, address account) external; /** * @dev Revokes `role` from the calling account. * * Roles are often managed via {grantRole} and {revokeRole}: this function's * purpose is to provide a mechanism for accounts to lose their privileges * if they are compromised (such as when a trusted device is misplaced). * * If the calling account had been granted `role`, emits a {RoleRevoked} * event. * * Requirements: * * - the caller must be `callerConfirmation`. */ function renounceRole(bytes32 role, address callerConfirmation) external; }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.1) (utils/Context.sol) pragma solidity ^0.8.20; /** * @dev Provides information about the current execution context, including the * sender of the transaction and its data. While these are generally available * via msg.sender and msg.data, they should not be accessed in such a direct * manner, since when dealing with meta-transactions the account sending and * paying for execution may not be the actual sender (as far as an application * is concerned). * * This contract is only required for intermediate, library-like contracts. */ abstract contract Context { function _msgSender() internal view virtual returns (address) { return msg.sender; } function _msgData() internal view virtual returns (bytes calldata) { return msg.data; } function _contextSuffixLength() internal view virtual returns (uint256) { return 0; } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.0) (utils/introspection/ERC165.sol) pragma solidity ^0.8.20; import {IERC165} from "./IERC165.sol"; /** * @dev Implementation of the {IERC165} interface. * * Contracts that want to implement ERC165 should inherit from this contract and override {supportsInterface} to check * for the additional interface id that will be supported. For example: * * ```solidity * function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) { * return interfaceId == type(MyInterface).interfaceId || super.supportsInterface(interfaceId); * } * ``` */ abstract contract ERC165 is IERC165 { /** * @dev See {IERC165-supportsInterface}. */ function supportsInterface(bytes4 interfaceId) public view virtual returns (bool) { return interfaceId == type(IERC165).interfaceId; } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.0) (token/ERC20/ERC20.sol) pragma solidity ^0.8.20; import {IERC20} from "./IERC20.sol"; import {IERC20Metadata} from "./extensions/IERC20Metadata.sol"; import {Context} from "../../utils/Context.sol"; import {IERC20Errors} from "../../interfaces/draft-IERC6093.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}. * * TIP: For a detailed writeup see our guide * https://forum.openzeppelin.com/t/how-to-implement-erc20-supply-mechanisms/226[How * to implement supply mechanisms]. * * The default value of {decimals} is 18. To change this, you should override * this function so it returns a different value. * * We have followed general OpenZeppelin Contracts guidelines: functions revert * instead returning `false` on failure. This behavior is nonetheless * conventional and does not conflict with the expectations of ERC20 * applications. * * Additionally, an {Approval} event is emitted on calls to {transferFrom}. * This allows applications to reconstruct the allowance for all accounts just * by listening to said events. Other implementations of the EIP may not emit * these events, as it isn't required by the specification. */ abstract contract ERC20 is Context, IERC20, IERC20Metadata, IERC20Errors { mapping(address account => uint256) private _balances; mapping(address account => mapping(address spender => uint256)) private _allowances; uint256 private _totalSupply; string private _name; string private _symbol; /** * @dev Sets the values for {name} and {symbol}. * * All two of these values are immutable: they can only be set once during * construction. */ constructor(string memory name_, string memory symbol_) { _name = name_; _symbol = symbol_; } /** * @dev Returns the name of the token. */ function name() public view virtual returns (string memory) { return _name; } /** * @dev Returns the symbol of the token, usually a shorter version of the * name. */ function symbol() public view virtual returns (string memory) { return _symbol; } /** * @dev Returns the number of decimals used to get its user representation. * For example, if `decimals` equals `2`, a balance of `505` tokens should * be displayed to a user as `5.05` (`505 / 10 ** 2`). * * Tokens usually opt for a value of 18, imitating the relationship between * Ether and Wei. This is the default value returned by this function, unless * it's overridden. * * NOTE: This information is only used for _display_ purposes: it in * no way affects any of the arithmetic of the contract, including * {IERC20-balanceOf} and {IERC20-transfer}. */ function decimals() public view virtual returns (uint8) { return 18; } /** * @dev See {IERC20-totalSupply}. */ function totalSupply() public view virtual returns (uint256) { return _totalSupply; } /** * @dev See {IERC20-balanceOf}. */ function balanceOf(address account) public view virtual 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 `value`. */ function transfer(address to, uint256 value) public virtual returns (bool) { address owner = _msgSender(); _transfer(owner, to, value); return true; } /** * @dev See {IERC20-allowance}. */ function allowance(address owner, address spender) public view virtual returns (uint256) { return _allowances[owner][spender]; } /** * @dev See {IERC20-approve}. * * NOTE: If `value` 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 value) public virtual returns (bool) { address owner = _msgSender(); _approve(owner, spender, value); 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 `value`. * - the caller must have allowance for ``from``'s tokens of at least * `value`. */ function transferFrom(address from, address to, uint256 value) public virtual returns (bool) { address spender = _msgSender(); _spendAllowance(from, spender, value); _transfer(from, to, value); return true; } /** * @dev Moves a `value` 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. * * NOTE: This function is not virtual, {_update} should be overridden instead. */ function _transfer(address from, address to, uint256 value) internal { if (from == address(0)) { revert ERC20InvalidSender(address(0)); } if (to == address(0)) { revert ERC20InvalidReceiver(address(0)); } _update(from, to, value); } /** * @dev Transfers a `value` amount of tokens from `from` to `to`, or alternatively mints (or burns) if `from` * (or `to`) is the zero address. All customizations to transfers, mints, and burns should be done by overriding * this function. * * Emits a {Transfer} event. */ function _update(address from, address to, uint256 value) internal virtual { if (from == address(0)) { // Overflow check required: The rest of the code assumes that totalSupply never overflows _totalSupply += value; } else { uint256 fromBalance = _balances[from]; if (fromBalance < value) { revert ERC20InsufficientBalance(from, fromBalance, value); } unchecked { // Overflow not possible: value <= fromBalance <= totalSupply. _balances[from] = fromBalance - value; } } if (to == address(0)) { unchecked { // Overflow not possible: value <= totalSupply or value <= fromBalance <= totalSupply. _totalSupply -= value; } } else { unchecked { // Overflow not possible: balance + value is at most totalSupply, which we know fits into a uint256. _balances[to] += value; } } emit Transfer(from, to, value); } /** * @dev Creates a `value` amount of tokens and assigns them to `account`, by transferring it from address(0). * Relies on the `_update` mechanism * * Emits a {Transfer} event with `from` set to the zero address. * * NOTE: This function is not virtual, {_update} should be overridden instead. */ function _mint(address account, uint256 value) internal { if (account == address(0)) { revert ERC20InvalidReceiver(address(0)); } _update(address(0), account, value); } /** * @dev Destroys a `value` amount of tokens from `account`, lowering the total supply. * Relies on the `_update` mechanism. * * Emits a {Transfer} event with `to` set to the zero address. * * NOTE: This function is not virtual, {_update} should be overridden instead */ function _burn(address account, uint256 value) internal { if (account == address(0)) { revert ERC20InvalidSender(address(0)); } _update(account, address(0), value); } /** * @dev Sets `value` 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. * * Overrides to this logic should be done to the variant with an additional `bool emitEvent` argument. */ function _approve(address owner, address spender, uint256 value) internal { _approve(owner, spender, value, true); } /** * @dev Variant of {_approve} with an optional flag to enable or disable the {Approval} event. * * By default (when calling {_approve}) the flag is set to true. On the other hand, approval changes made by * `_spendAllowance` during the `transferFrom` operation set the flag to false. This saves gas by not emitting any * `Approval` event during `transferFrom` operations. * * Anyone who wishes to continue emitting `Approval` events on the`transferFrom` operation can force the flag to * true using the following override: * ``` * function _approve(address owner, address spender, uint256 value, bool) internal virtual override { * super._approve(owner, spender, value, true); * } * ``` * * Requirements are the same as {_approve}. */ function _approve(address owner, address spender, uint256 value, bool emitEvent) internal virtual { if (owner == address(0)) { revert ERC20InvalidApprover(address(0)); } if (spender == address(0)) { revert ERC20InvalidSpender(address(0)); } _allowances[owner][spender] = value; if (emitEvent) { emit Approval(owner, spender, value); } } /** * @dev Updates `owner` s allowance for `spender` based on spent `value`. * * Does not update the allowance value in case of infinite allowance. * Revert if not enough allowance is available. * * Does not emit an {Approval} event. */ function _spendAllowance(address owner, address spender, uint256 value) internal virtual { uint256 currentAllowance = allowance(owner, spender); if (currentAllowance != type(uint256).max) { if (currentAllowance < value) { revert ERC20InsufficientAllowance(spender, currentAllowance, value); } unchecked { _approve(owner, spender, currentAllowance - value, false); } } } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.0) (interfaces/IERC4626.sol) pragma solidity ^0.8.20; import {IERC20} from "../token/ERC20/IERC20.sol"; import {IERC20Metadata} from "../token/ERC20/extensions/IERC20Metadata.sol"; /** * @dev Interface of the ERC4626 "Tokenized Vault Standard", as defined in * https://eips.ethereum.org/EIPS/eip-4626[ERC-4626]. */ interface IERC4626 is IERC20, IERC20Metadata { event Deposit(address indexed sender, address indexed owner, uint256 assets, uint256 shares); event Withdraw( address indexed sender, address indexed receiver, address indexed owner, uint256 assets, uint256 shares ); /** * @dev Returns the address of the underlying token used for the Vault for accounting, depositing, and withdrawing. * * - MUST be an ERC-20 token contract. * - MUST NOT revert. */ function asset() external view returns (address assetTokenAddress); /** * @dev Returns the total amount of the underlying asset that is “managed” by Vault. * * - SHOULD include any compounding that occurs from yield. * - MUST be inclusive of any fees that are charged against assets in the Vault. * - MUST NOT revert. */ function totalAssets() external view returns (uint256 totalManagedAssets); /** * @dev Returns the amount of shares that the Vault would exchange for the amount of assets provided, in an ideal * scenario where all the conditions are met. * * - MUST NOT be inclusive of any fees that are charged against assets in the Vault. * - MUST NOT show any variations depending on the caller. * - MUST NOT reflect slippage or other on-chain conditions, when performing the actual exchange. * - MUST NOT revert. * * NOTE: This calculation MAY NOT reflect the “per-user” price-per-share, and instead should reflect the * “average-user’s” price-per-share, meaning what the average user should expect to see when exchanging to and * from. */ function convertToShares(uint256 assets) external view returns (uint256 shares); /** * @dev Returns the amount of assets that the Vault would exchange for the amount of shares provided, in an ideal * scenario where all the conditions are met. * * - MUST NOT be inclusive of any fees that are charged against assets in the Vault. * - MUST NOT show any variations depending on the caller. * - MUST NOT reflect slippage or other on-chain conditions, when performing the actual exchange. * - MUST NOT revert. * * NOTE: This calculation MAY NOT reflect the “per-user” price-per-share, and instead should reflect the * “average-user’s” price-per-share, meaning what the average user should expect to see when exchanging to and * from. */ function convertToAssets(uint256 shares) external view returns (uint256 assets); /** * @dev Returns the maximum amount of the underlying asset that can be deposited into the Vault for the receiver, * through a deposit call. * * - MUST return a limited value if receiver is subject to some deposit limit. * - MUST return 2 ** 256 - 1 if there is no limit on the maximum amount of assets that may be deposited. * - MUST NOT revert. */ function maxDeposit(address receiver) external view returns (uint256 maxAssets); /** * @dev Allows an on-chain or off-chain user to simulate the effects of their deposit at the current block, given * current on-chain conditions. * * - MUST return as close to and no more than the exact amount of Vault shares that would be minted in a deposit * call in the same transaction. I.e. deposit should return the same or more shares as previewDeposit if called * in the same transaction. * - MUST NOT account for deposit limits like those returned from maxDeposit and should always act as though the * deposit would be accepted, regardless if the user has enough tokens approved, etc. * - MUST be inclusive of deposit fees. Integrators should be aware of the existence of deposit fees. * - MUST NOT revert. * * NOTE: any unfavorable discrepancy between convertToShares and previewDeposit SHOULD be considered slippage in * share price or some other type of condition, meaning the depositor will lose assets by depositing. */ function previewDeposit(uint256 assets) external view returns (uint256 shares); /** * @dev Mints shares Vault shares to receiver by depositing exactly amount of underlying tokens. * * - MUST emit the Deposit event. * - MAY support an additional flow in which the underlying tokens are owned by the Vault contract before the * deposit execution, and are accounted for during deposit. * - MUST revert if all of assets cannot be deposited (due to deposit limit being reached, slippage, the user not * approving enough underlying tokens to the Vault contract, etc). * * NOTE: most implementations will require pre-approval of the Vault with the Vault’s underlying asset token. */ function deposit(uint256 assets, address receiver) external returns (uint256 shares); /** * @dev Returns the maximum amount of the Vault shares that can be minted for the receiver, through a mint call. * - MUST return a limited value if receiver is subject to some mint limit. * - MUST return 2 ** 256 - 1 if there is no limit on the maximum amount of shares that may be minted. * - MUST NOT revert. */ function maxMint(address receiver) external view returns (uint256 maxShares); /** * @dev Allows an on-chain or off-chain user to simulate the effects of their mint at the current block, given * current on-chain conditions. * * - MUST return as close to and no fewer than the exact amount of assets that would be deposited in a mint call * in the same transaction. I.e. mint should return the same or fewer assets as previewMint if called in the * same transaction. * - MUST NOT account for mint limits like those returned from maxMint and should always act as though the mint * would be accepted, regardless if the user has enough tokens approved, etc. * - MUST be inclusive of deposit fees. Integrators should be aware of the existence of deposit fees. * - MUST NOT revert. * * NOTE: any unfavorable discrepancy between convertToAssets and previewMint SHOULD be considered slippage in * share price or some other type of condition, meaning the depositor will lose assets by minting. */ function previewMint(uint256 shares) external view returns (uint256 assets); /** * @dev Mints exactly shares Vault shares to receiver by depositing amount of underlying tokens. * * - MUST emit the Deposit event. * - MAY support an additional flow in which the underlying tokens are owned by the Vault contract before the mint * execution, and are accounted for during mint. * - MUST revert if all of shares cannot be minted (due to deposit limit being reached, slippage, the user not * approving enough underlying tokens to the Vault contract, etc). * * NOTE: most implementations will require pre-approval of the Vault with the Vault’s underlying asset token. */ function mint(uint256 shares, address receiver) external returns (uint256 assets); /** * @dev Returns the maximum amount of the underlying asset that can be withdrawn from the owner balance in the * Vault, through a withdraw call. * * - MUST return a limited value if owner is subject to some withdrawal limit or timelock. * - MUST NOT revert. */ function maxWithdraw(address owner) external view returns (uint256 maxAssets); /** * @dev Allows an on-chain or off-chain user to simulate the effects of their withdrawal at the current block, * given current on-chain conditions. * * - MUST return as close to and no fewer than the exact amount of Vault shares that would be burned in a withdraw * call in the same transaction. I.e. withdraw should return the same or fewer shares as previewWithdraw if * called * in the same transaction. * - MUST NOT account for withdrawal limits like those returned from maxWithdraw and should always act as though * the withdrawal would be accepted, regardless if the user has enough shares, etc. * - MUST be inclusive of withdrawal fees. Integrators should be aware of the existence of withdrawal fees. * - MUST NOT revert. * * NOTE: any unfavorable discrepancy between convertToShares and previewWithdraw SHOULD be considered slippage in * share price or some other type of condition, meaning the depositor will lose assets by depositing. */ function previewWithdraw(uint256 assets) external view returns (uint256 shares); /** * @dev Burns shares from owner and sends exactly assets of underlying tokens to receiver. * * - MUST emit the Withdraw event. * - MAY support an additional flow in which the underlying tokens are owned by the Vault contract before the * withdraw execution, and are accounted for during withdraw. * - MUST revert if all of assets cannot be withdrawn (due to withdrawal limit being reached, slippage, the owner * not having enough shares, etc). * * Note that some implementations will require pre-requesting to the Vault before a withdrawal may be performed. * Those methods should be performed separately. */ function withdraw(uint256 assets, address receiver, address owner) external returns (uint256 shares); /** * @dev Returns the maximum amount of Vault shares that can be redeemed from the owner balance in the Vault, * through a redeem call. * * - MUST return a limited value if owner is subject to some withdrawal limit or timelock. * - MUST return balanceOf(owner) if owner is not subject to any withdrawal limit or timelock. * - MUST NOT revert. */ function maxRedeem(address owner) external view returns (uint256 maxShares); /** * @dev Allows an on-chain or off-chain user to simulate the effects of their redeemption at the current block, * given current on-chain conditions. * * - MUST return as close to and no more than the exact amount of assets that would be withdrawn in a redeem call * in the same transaction. I.e. redeem should return the same or more assets as previewRedeem if called in the * same transaction. * - MUST NOT account for redemption limits like those returned from maxRedeem and should always act as though the * redemption would be accepted, regardless if the user has enough shares, etc. * - MUST be inclusive of withdrawal fees. Integrators should be aware of the existence of withdrawal fees. * - MUST NOT revert. * * NOTE: any unfavorable discrepancy between convertToAssets and previewRedeem SHOULD be considered slippage in * share price or some other type of condition, meaning the depositor will lose assets by redeeming. */ function previewRedeem(uint256 shares) external view returns (uint256 assets); /** * @dev Burns exactly shares from owner and sends assets of underlying tokens to receiver. * * - MUST emit the Withdraw event. * - MAY support an additional flow in which the underlying tokens are owned by the Vault contract before the * redeem execution, and are accounted for during redeem. * - MUST revert if all of shares cannot be redeemed (due to withdrawal limit being reached, slippage, the owner * not having enough shares, etc). * * NOTE: some implementations will require pre-requesting to the Vault before a withdrawal may be performed. * Those methods should be performed separately. */ function redeem(uint256 shares, address receiver, address owner) external returns (uint256 assets); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.0) (utils/math/Math.sol) pragma solidity ^0.8.20; /** * @dev Standard math utilities missing in the Solidity language. */ library Math { /** * @dev Muldiv operation overflow. */ error MathOverflowedMulDiv(); enum Rounding { Floor, // Toward negative infinity Ceil, // Toward positive infinity Trunc, // Toward zero Expand // Away from zero } /** * @dev Returns the addition of two unsigned integers, with an overflow flag. */ function tryAdd(uint256 a, uint256 b) internal pure returns (bool, uint256) { unchecked { uint256 c = a + b; if (c < a) return (false, 0); return (true, c); } } /** * @dev Returns the subtraction of two unsigned integers, with an overflow flag. */ function trySub(uint256 a, uint256 b) internal pure returns (bool, uint256) { unchecked { if (b > a) return (false, 0); return (true, a - b); } } /** * @dev Returns the multiplication of two unsigned integers, with an overflow flag. */ function tryMul(uint256 a, uint256 b) internal pure returns (bool, uint256) { unchecked { // Gas optimization: this is cheaper than requiring 'a' not being zero, but the // benefit is lost if 'b' is also tested. // See: https://github.com/OpenZeppelin/openzeppelin-contracts/pull/522 if (a == 0) return (true, 0); uint256 c = a * b; if (c / a != b) return (false, 0); return (true, c); } } /** * @dev Returns the division of two unsigned integers, with a division by zero flag. */ function tryDiv(uint256 a, uint256 b) internal pure returns (bool, uint256) { unchecked { if (b == 0) return (false, 0); return (true, a / b); } } /** * @dev Returns the remainder of dividing two unsigned integers, with a division by zero flag. */ function tryMod(uint256 a, uint256 b) internal pure returns (bool, uint256) { unchecked { if (b == 0) return (false, 0); return (true, a % b); } } /** * @dev Returns the largest of two numbers. */ function max(uint256 a, uint256 b) internal pure returns (uint256) { return a > b ? a : b; } /** * @dev Returns the smallest of two numbers. */ function min(uint256 a, uint256 b) internal pure returns (uint256) { return a < b ? a : b; } /** * @dev Returns the average of two numbers. The result is rounded towards * zero. */ function average(uint256 a, uint256 b) internal pure returns (uint256) { // (a + b) / 2 can overflow. return (a & b) + (a ^ b) / 2; } /** * @dev Returns the ceiling of the division of two numbers. * * This differs from standard division with `/` in that it rounds towards infinity instead * of rounding towards zero. */ function ceilDiv(uint256 a, uint256 b) internal pure returns (uint256) { if (b == 0) { // Guarantee the same behavior as in a regular Solidity division. return a / b; } // (a + b - 1) / b can overflow on addition, so we distribute. return a == 0 ? 0 : (a - 1) / b + 1; } /** * @notice Calculates floor(x * y / denominator) with full precision. Throws if result overflows a uint256 or * denominator == 0. * @dev Original credit to Remco Bloemen under MIT license (https://xn--2-umb.com/21/muldiv) with further edits by * Uniswap Labs also under MIT license. */ function mulDiv(uint256 x, uint256 y, uint256 denominator) internal pure returns (uint256 result) { unchecked { // 512-bit multiply [prod1 prod0] = x * y. Compute the product mod 2^256 and mod 2^256 - 1, then use // use the Chinese Remainder Theorem to reconstruct the 512 bit result. The result is stored in two 256 // variables such that product = prod1 * 2^256 + prod0. uint256 prod0 = x * y; // Least significant 256 bits of the product uint256 prod1; // Most significant 256 bits of the product assembly { let mm := mulmod(x, y, not(0)) prod1 := sub(sub(mm, prod0), lt(mm, prod0)) } // Handle non-overflow cases, 256 by 256 division. if (prod1 == 0) { // Solidity will revert if denominator == 0, unlike the div opcode on its own. // The surrounding unchecked block does not change this fact. // See https://docs.soliditylang.org/en/latest/control-structures.html#checked-or-unchecked-arithmetic. return prod0 / denominator; } // Make sure the result is less than 2^256. Also prevents denominator == 0. if (denominator <= prod1) { revert MathOverflowedMulDiv(); } /////////////////////////////////////////////// // 512 by 256 division. /////////////////////////////////////////////// // Make division exact by subtracting the remainder from [prod1 prod0]. uint256 remainder; assembly { // Compute remainder using mulmod. remainder := mulmod(x, y, denominator) // Subtract 256 bit number from 512 bit number. prod1 := sub(prod1, gt(remainder, prod0)) prod0 := sub(prod0, remainder) } // Factor powers of two out of denominator and compute largest power of two divisor of denominator. // Always >= 1. See https://cs.stackexchange.com/q/138556/92363. uint256 twos = denominator & (0 - denominator); assembly { // Divide denominator by twos. denominator := div(denominator, twos) // Divide [prod1 prod0] by twos. prod0 := div(prod0, twos) // Flip twos such that it is 2^256 / twos. If twos is zero, then it becomes one. twos := add(div(sub(0, twos), twos), 1) } // Shift in bits from prod1 into prod0. prod0 |= prod1 * twos; // Invert denominator mod 2^256. Now that denominator is an odd number, it has an inverse modulo 2^256 such // that denominator * inv = 1 mod 2^256. Compute the inverse by starting with a seed that is correct for // four bits. That is, denominator * inv = 1 mod 2^4. uint256 inverse = (3 * denominator) ^ 2; // Use the Newton-Raphson iteration to improve the precision. Thanks to Hensel's lifting lemma, this also // works in modular arithmetic, doubling the correct bits in each step. inverse *= 2 - denominator * inverse; // inverse mod 2^8 inverse *= 2 - denominator * inverse; // inverse mod 2^16 inverse *= 2 - denominator * inverse; // inverse mod 2^32 inverse *= 2 - denominator * inverse; // inverse mod 2^64 inverse *= 2 - denominator * inverse; // inverse mod 2^128 inverse *= 2 - denominator * inverse; // inverse mod 2^256 // Because the division is now exact we can divide by multiplying with the modular inverse of denominator. // This will give us the correct result modulo 2^256. Since the preconditions guarantee that the outcome is // less than 2^256, this is the final result. We don't need to compute the high bits of the result and prod1 // is no longer required. result = prod0 * inverse; return result; } } /** * @notice Calculates x * y / denominator with full precision, following the selected rounding direction. */ function mulDiv(uint256 x, uint256 y, uint256 denominator, Rounding rounding) internal pure returns (uint256) { uint256 result = mulDiv(x, y, denominator); if (unsignedRoundsUp(rounding) && mulmod(x, y, denominator) > 0) { result += 1; } return result; } /** * @dev Returns the square root of a number. If the number is not a perfect square, the value is rounded * towards zero. * * Inspired by Henry S. Warren, Jr.'s "Hacker's Delight" (Chapter 11). */ function sqrt(uint256 a) internal pure returns (uint256) { if (a == 0) { return 0; } // For our first guess, we get the biggest power of 2 which is smaller than the square root of the target. // // We know that the "msb" (most significant bit) of our target number `a` is a power of 2 such that we have // `msb(a) <= a < 2*msb(a)`. This value can be written `msb(a)=2**k` with `k=log2(a)`. // // This can be rewritten `2**log2(a) <= a < 2**(log2(a) + 1)` // → `sqrt(2**k) <= sqrt(a) < sqrt(2**(k+1))` // → `2**(k/2) <= sqrt(a) < 2**((k+1)/2) <= 2**(k/2 + 1)` // // Consequently, `2**(log2(a) / 2)` is a good first approximation of `sqrt(a)` with at least 1 correct bit. uint256 result = 1 << (log2(a) >> 1); // At this point `result` is an estimation with one bit of precision. We know the true value is a uint128, // since it is the square root of a uint256. Newton's method converges quadratically (precision doubles at // every iteration). We thus need at most 7 iteration to turn our partial result with one bit of precision // into the expected uint128 result. unchecked { result = (result + a / result) >> 1; result = (result + a / result) >> 1; result = (result + a / result) >> 1; result = (result + a / result) >> 1; result = (result + a / result) >> 1; result = (result + a / result) >> 1; result = (result + a / result) >> 1; return min(result, a / result); } } /** * @notice Calculates sqrt(a), following the selected rounding direction. */ function sqrt(uint256 a, Rounding rounding) internal pure returns (uint256) { unchecked { uint256 result = sqrt(a); return result + (unsignedRoundsUp(rounding) && result * result < a ? 1 : 0); } } /** * @dev Return the log in base 2 of a positive value rounded towards zero. * Returns 0 if given 0. */ function log2(uint256 value) internal pure returns (uint256) { uint256 result = 0; unchecked { if (value >> 128 > 0) { value >>= 128; result += 128; } if (value >> 64 > 0) { value >>= 64; result += 64; } if (value >> 32 > 0) { value >>= 32; result += 32; } if (value >> 16 > 0) { value >>= 16; result += 16; } if (value >> 8 > 0) { value >>= 8; result += 8; } if (value >> 4 > 0) { value >>= 4; result += 4; } if (value >> 2 > 0) { value >>= 2; result += 2; } if (value >> 1 > 0) { result += 1; } } return result; } /** * @dev Return the log in base 2, following the selected rounding direction, of a positive value. * Returns 0 if given 0. */ function log2(uint256 value, Rounding rounding) internal pure returns (uint256) { unchecked { uint256 result = log2(value); return result + (unsignedRoundsUp(rounding) && 1 << result < value ? 1 : 0); } } /** * @dev Return the log in base 10 of a positive value rounded towards zero. * Returns 0 if given 0. */ function log10(uint256 value) internal pure returns (uint256) { uint256 result = 0; unchecked { if (value >= 10 ** 64) { value /= 10 ** 64; result += 64; } if (value >= 10 ** 32) { value /= 10 ** 32; result += 32; } if (value >= 10 ** 16) { value /= 10 ** 16; result += 16; } if (value >= 10 ** 8) { value /= 10 ** 8; result += 8; } if (value >= 10 ** 4) { value /= 10 ** 4; result += 4; } if (value >= 10 ** 2) { value /= 10 ** 2; result += 2; } if (value >= 10 ** 1) { result += 1; } } return result; } /** * @dev Return the log in base 10, following the selected rounding direction, of a positive value. * Returns 0 if given 0. */ function log10(uint256 value, Rounding rounding) internal pure returns (uint256) { unchecked { uint256 result = log10(value); return result + (unsignedRoundsUp(rounding) && 10 ** result < value ? 1 : 0); } } /** * @dev Return the log in base 256 of a positive value rounded towards zero. * Returns 0 if given 0. * * Adding one to the result gives the number of pairs of hex symbols needed to represent `value` as a hex string. */ function log256(uint256 value) internal pure returns (uint256) { uint256 result = 0; unchecked { if (value >> 128 > 0) { value >>= 128; result += 16; } if (value >> 64 > 0) { value >>= 64; result += 8; } if (value >> 32 > 0) { value >>= 32; result += 4; } if (value >> 16 > 0) { value >>= 16; result += 2; } if (value >> 8 > 0) { result += 1; } } return result; } /** * @dev Return the log in base 256, following the selected rounding direction, of a positive value. * Returns 0 if given 0. */ function log256(uint256 value, Rounding rounding) internal pure returns (uint256) { unchecked { uint256 result = log256(value); return result + (unsignedRoundsUp(rounding) && 1 << (result << 3) < value ? 1 : 0); } } /** * @dev Returns whether a provided rounding mode is considered rounding up for unsigned integers. */ function unsignedRoundsUp(Rounding rounding) internal pure returns (bool) { return uint8(rounding) % 2 == 1; } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.0) (token/ERC20/IERC20.sol) pragma solidity ^0.8.20; /** * @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 value of tokens in existence. */ function totalSupply() external view returns (uint256); /** * @dev Returns the value of tokens owned by `account`. */ function balanceOf(address account) external view returns (uint256); /** * @dev Moves a `value` amount of 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 value) 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 a `value` amount of tokens 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 value) external returns (bool); /** * @dev Moves a `value` amount of tokens from `from` to `to` using the * allowance mechanism. `value` 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 value) external returns (bool); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.0) (token/ERC20/extensions/IERC20Permit.sol) pragma solidity ^0.8.20; /** * @dev Interface of the ERC20 Permit extension allowing approvals to be made via signatures, as defined in * https://eips.ethereum.org/EIPS/eip-2612[EIP-2612]. * * Adds the {permit} method, which can be used to change an account's ERC20 allowance (see {IERC20-allowance}) by * presenting a message signed by the account. By not relying on {IERC20-approve}, the token holder account doesn't * need to send a transaction, and thus is not required to hold Ether at all. * * ==== Security Considerations * * There are two important considerations concerning the use of `permit`. The first is that a valid permit signature * expresses an allowance, and it should not be assumed to convey additional meaning. In particular, it should not be * considered as an intention to spend the allowance in any specific way. The second is that because permits have * built-in replay protection and can be submitted by anyone, they can be frontrun. A protocol that uses permits should * take this into consideration and allow a `permit` call to fail. Combining these two aspects, a pattern that may be * generally recommended is: * * ```solidity * function doThingWithPermit(..., uint256 value, uint256 deadline, uint8 v, bytes32 r, bytes32 s) public { * try token.permit(msg.sender, address(this), value, deadline, v, r, s) {} catch {} * doThing(..., value); * } * * function doThing(..., uint256 value) public { * token.safeTransferFrom(msg.sender, address(this), value); * ... * } * ``` * * Observe that: 1) `msg.sender` is used as the owner, leaving no ambiguity as to the signer intent, and 2) the use of * `try/catch` allows the permit to fail and makes the code tolerant to frontrunning. (See also * {SafeERC20-safeTransferFrom}). * * Additionally, note that smart contract wallets (such as Argent or Safe) are not able to produce permit signatures, so * contracts should have entry points that don't rely on permit. */ interface IERC20Permit { /** * @dev Sets `value` as the allowance of `spender` over ``owner``'s tokens, * given ``owner``'s signed approval. * * IMPORTANT: The same issues {IERC20-approve} has related to transaction * ordering also apply here. * * Emits an {Approval} event. * * Requirements: * * - `spender` cannot be the zero address. * - `deadline` must be a timestamp in the future. * - `v`, `r` and `s` must be a valid `secp256k1` signature from `owner` * over the EIP712-formatted function arguments. * - the signature must use ``owner``'s current nonce (see {nonces}). * * For more information on the signature format, see the * https://eips.ethereum.org/EIPS/eip-2612#specification[relevant EIP * section]. * * CAUTION: See Security Considerations above. */ function permit( address owner, address spender, uint256 value, uint256 deadline, uint8 v, bytes32 r, bytes32 s ) external; /** * @dev Returns the current nonce for `owner`. This value must be * included whenever a signature is generated for {permit}. * * Every successful call to {permit} increases ``owner``'s nonce by one. This * prevents a signature from being used multiple times. */ function nonces(address owner) external view returns (uint256); /** * @dev Returns the domain separator used in the encoding of the signature for {permit}, as defined by {EIP712}. */ // solhint-disable-next-line func-name-mixedcase function DOMAIN_SEPARATOR() external view returns (bytes32); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.0) (utils/Address.sol) pragma solidity ^0.8.20; /** * @dev Collection of functions related to the address type */ library Address { /** * @dev The ETH balance of the account is not enough to perform the operation. */ error AddressInsufficientBalance(address account); /** * @dev There's no code at `target` (it is not a contract). */ error AddressEmptyCode(address target); /** * @dev A call to an address target failed. The target may have reverted. */ error FailedInnerCall(); /** * @dev Replacement for Solidity's `transfer`: sends `amount` wei to * `recipient`, forwarding all available gas and reverting on errors. * * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost * of certain opcodes, possibly making contracts go over the 2300 gas limit * imposed by `transfer`, making them unable to receive funds via * `transfer`. {sendValue} removes this limitation. * * https://consensys.net/diligence/blog/2019/09/stop-using-soliditys-transfer-now/[Learn more]. * * IMPORTANT: because control is transferred to `recipient`, care must be * taken to not create reentrancy vulnerabilities. Consider using * {ReentrancyGuard} or the * https://solidity.readthedocs.io/en/v0.8.20/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern]. */ function sendValue(address payable recipient, uint256 amount) internal { if (address(this).balance < amount) { revert AddressInsufficientBalance(address(this)); } (bool success, ) = recipient.call{value: amount}(""); if (!success) { revert FailedInnerCall(); } } /** * @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 or custom error, it is bubbled * up by this function (like regular Solidity function calls). However, if * the call reverted with no returned reason, this function reverts with a * {FailedInnerCall} error. * * 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. */ function functionCall(address target, bytes memory data) internal returns (bytes memory) { return functionCallWithValue(target, data, 0); } /** * @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`. */ function functionCallWithValue(address target, bytes memory data, uint256 value) internal returns (bytes memory) { if (address(this).balance < value) { revert AddressInsufficientBalance(address(this)); } (bool success, bytes memory returndata) = target.call{value: value}(data); return verifyCallResultFromTarget(target, success, returndata); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but performing a static call. */ function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) { (bool success, bytes memory returndata) = target.staticcall(data); return verifyCallResultFromTarget(target, success, returndata); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but performing a delegate call. */ function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) { (bool success, bytes memory returndata) = target.delegatecall(data); return verifyCallResultFromTarget(target, success, returndata); } /** * @dev Tool to verify that a low level call to smart-contract was successful, and reverts if the target * was not a contract or bubbling up the revert reason (falling back to {FailedInnerCall}) in case of an * unsuccessful call. */ function verifyCallResultFromTarget( address target, bool success, bytes memory returndata ) internal view returns (bytes memory) { if (!success) { _revert(returndata); } else { // only check if target is a contract if the call was successful and the return data is empty // otherwise we already know that it was a contract if (returndata.length == 0 && target.code.length == 0) { revert AddressEmptyCode(target); } return returndata; } } /** * @dev Tool to verify that a low level call was successful, and reverts if it wasn't, either by bubbling the * revert reason or with a default {FailedInnerCall} error. */ function verifyCallResult(bool success, bytes memory returndata) internal pure returns (bytes memory) { if (!success) { _revert(returndata); } else { return returndata; } } /** * @dev Reverts with returndata if present. Otherwise reverts with {FailedInnerCall}. */ function _revert(bytes memory returndata) private pure { // Look for revert reason and bubble it up if present if (returndata.length > 0) { // The easiest way to bubble the revert reason is using memory via assembly /// @solidity memory-safe-assembly assembly { let returndata_size := mload(returndata) revert(add(32, returndata), returndata_size) } } else { revert FailedInnerCall(); } } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.0) (utils/cryptography/ECDSA.sol) pragma solidity ^0.8.20; /** * @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 } /** * @dev The signature derives the `address(0)`. */ error ECDSAInvalidSignature(); /** * @dev The signature has an invalid length. */ error ECDSAInvalidSignatureLength(uint256 length); /** * @dev The signature has an S value that is in the upper half order. */ error ECDSAInvalidSignatureS(bytes32 s); /** * @dev Returns the address that signed a hashed message (`hash`) with `signature` or an error. This will not * return address(0) without also returning an error description. Errors are documented using an enum (error type) * and a bytes32 providing additional information about the error. * * If no error is returned, then the address can be used for verification purposes. * * The `ecrecover` EVM precompile 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 {MessageHashUtils-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] */ function tryRecover(bytes32 hash, bytes memory signature) internal pure returns (address, RecoverError, bytes32) { 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, bytes32(signature.length)); } } /** * @dev Returns the address that signed a hashed message (`hash`) with * `signature`. This address can then be used for verification purposes. * * The `ecrecover` EVM precompile 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 {MessageHashUtils-toEthSignedMessageHash} on it. */ function recover(bytes32 hash, bytes memory signature) internal pure returns (address) { (address recovered, RecoverError error, bytes32 errorArg) = tryRecover(hash, signature); _throwError(error, errorArg); 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] */ function tryRecover(bytes32 hash, bytes32 r, bytes32 vs) internal pure returns (address, RecoverError, bytes32) { unchecked { bytes32 s = vs & bytes32(0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff); // We do not check for an overflow here since the shift operation results in 0 or 1. 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. */ function recover(bytes32 hash, bytes32 r, bytes32 vs) internal pure returns (address) { (address recovered, RecoverError error, bytes32 errorArg) = tryRecover(hash, r, vs); _throwError(error, errorArg); return recovered; } /** * @dev Overload of {ECDSA-tryRecover} that receives the `v`, * `r` and `s` signature fields separately. */ function tryRecover( bytes32 hash, uint8 v, bytes32 r, bytes32 s ) internal pure returns (address, RecoverError, bytes32) { // 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, s); } // 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, bytes32(0)); } return (signer, RecoverError.NoError, bytes32(0)); } /** * @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, bytes32 errorArg) = tryRecover(hash, v, r, s); _throwError(error, errorArg); return recovered; } /** * @dev Optionally reverts with the corresponding custom error according to the `error` argument provided. */ function _throwError(RecoverError error, bytes32 errorArg) private pure { if (error == RecoverError.NoError) { return; // no error: do nothing } else if (error == RecoverError.InvalidSignature) { revert ECDSAInvalidSignature(); } else if (error == RecoverError.InvalidSignatureLength) { revert ECDSAInvalidSignatureLength(uint256(errorArg)); } else if (error == RecoverError.InvalidSignatureS) { revert ECDSAInvalidSignatureS(errorArg); } } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.0) (utils/cryptography/EIP712.sol) pragma solidity ^0.8.20; import {MessageHashUtils} from "./MessageHashUtils.sol"; import {ShortStrings, ShortString} from "../ShortStrings.sol"; import {IERC5267} from "../../interfaces/IERC5267.sol"; /** * @dev https://eips.ethereum.org/EIPS/eip-712[EIP 712] is a standard for hashing and signing of typed structured data. * * The encoding scheme specified in the EIP requires a domain separator and a hash of the typed structured data, whose * encoding is very generic and therefore its 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 order to * produce the hash of their typed data 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]. * * NOTE: In the upgradeable version of this contract, the cached values will correspond to the address, and the domain * separator of the implementation contract. This will cause the {_domainSeparatorV4} function to always rebuild the * separator from the immutable values, which is cheaper than accessing a cached version in cold storage. * * @custom:oz-upgrades-unsafe-allow state-variable-immutable */ abstract contract EIP712 is IERC5267 { using ShortStrings for *; bytes32 private constant TYPE_HASH = keccak256("EIP712Domain(string name,string version,uint256 chainId,address verifyingContract)"); // 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 _cachedDomainSeparator; uint256 private immutable _cachedChainId; address private immutable _cachedThis; bytes32 private immutable _hashedName; bytes32 private immutable _hashedVersion; ShortString private immutable _name; ShortString private immutable _version; string private _nameFallback; string private _versionFallback; /** * @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) { _name = name.toShortStringWithFallback(_nameFallback); _version = version.toShortStringWithFallback(_versionFallback); _hashedName = keccak256(bytes(name)); _hashedVersion = keccak256(bytes(version)); _cachedChainId = block.chainid; _cachedDomainSeparator = _buildDomainSeparator(); _cachedThis = address(this); } /** * @dev Returns the domain separator for the current chain. */ function _domainSeparatorV4() internal view returns (bytes32) { if (address(this) == _cachedThis && block.chainid == _cachedChainId) { return _cachedDomainSeparator; } else { return _buildDomainSeparator(); } } function _buildDomainSeparator() private view returns (bytes32) { return keccak256(abi.encode(TYPE_HASH, _hashedName, _hashedVersion, 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 MessageHashUtils.toTypedDataHash(_domainSeparatorV4(), structHash); } /** * @dev See {IERC-5267}. */ function eip712Domain() public view virtual returns ( bytes1 fields, string memory name, string memory version, uint256 chainId, address verifyingContract, bytes32 salt, uint256[] memory extensions ) { return ( hex"0f", // 01111 _EIP712Name(), _EIP712Version(), block.chainid, address(this), bytes32(0), new uint256[](0) ); } /** * @dev The name parameter for the EIP712 domain. * * NOTE: By default this function reads _name which is an immutable value. * It only reads from storage if necessary (in case the value is too large to fit in a ShortString). */ // solhint-disable-next-line func-name-mixedcase function _EIP712Name() internal view returns (string memory) { return _name.toStringWithFallback(_nameFallback); } /** * @dev The version parameter for the EIP712 domain. * * NOTE: By default this function reads _version which is an immutable value. * It only reads from storage if necessary (in case the value is too large to fit in a ShortString). */ // solhint-disable-next-line func-name-mixedcase function _EIP712Version() internal view returns (string memory) { return _version.toStringWithFallback(_versionFallback); } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.0) (utils/Nonces.sol) pragma solidity ^0.8.20; /** * @dev Provides tracking nonces for addresses. Nonces will only increment. */ abstract contract Nonces { /** * @dev The nonce used for an `account` is not the expected current nonce. */ error InvalidAccountNonce(address account, uint256 currentNonce); mapping(address account => uint256) private _nonces; /** * @dev Returns the next unused nonce for an address. */ function nonces(address owner) public view virtual returns (uint256) { return _nonces[owner]; } /** * @dev Consumes a nonce. * * Returns the current value and increments nonce. */ function _useNonce(address owner) internal virtual returns (uint256) { // For each account, the nonce has an initial value of 0, can only be incremented by one, and cannot be // decremented or reset. This guarantees that the nonce never overflows. unchecked { // It is important to do x++ and not ++x here. return _nonces[owner]++; } } /** * @dev Same as {_useNonce} but checking that `nonce` is the next valid for `owner`. */ function _useCheckedNonce(address owner, uint256 nonce) internal virtual { uint256 current = _useNonce(owner); if (nonce != current) { revert InvalidAccountNonce(owner, current); } } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.0) (utils/introspection/IERC165.sol) pragma solidity ^0.8.20; /** * @dev Interface of the ERC165 standard, as defined in the * https://eips.ethereum.org/EIPS/eip-165[EIP]. * * Implementers can declare support of contract interfaces, which can then be * queried by others ({ERC165Checker}). * * For an implementation, see {ERC165}. */ interface IERC165 { /** * @dev Returns true if this contract implements the interface defined by * `interfaceId`. See the corresponding * https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section] * to learn more about how these ids are created. * * This function call must use less than 30 000 gas. */ function supportsInterface(bytes4 interfaceId) external view returns (bool); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.0) (token/ERC20/extensions/IERC20Metadata.sol) pragma solidity ^0.8.20; import {IERC20} from "../IERC20.sol"; /** * @dev Interface for the optional metadata functions from the ERC20 standard. */ 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 v5.0.0) (interfaces/draft-IERC6093.sol) pragma solidity ^0.8.20; /** * @dev Standard ERC20 Errors * Interface of the https://eips.ethereum.org/EIPS/eip-6093[ERC-6093] custom errors for ERC20 tokens. */ interface IERC20Errors { /** * @dev Indicates an error related to the current `balance` of a `sender`. Used in transfers. * @param sender Address whose tokens are being transferred. * @param balance Current balance for the interacting account. * @param needed Minimum amount required to perform a transfer. */ error ERC20InsufficientBalance(address sender, uint256 balance, uint256 needed); /** * @dev Indicates a failure with the token `sender`. Used in transfers. * @param sender Address whose tokens are being transferred. */ error ERC20InvalidSender(address sender); /** * @dev Indicates a failure with the token `receiver`. Used in transfers. * @param receiver Address to which tokens are being transferred. */ error ERC20InvalidReceiver(address receiver); /** * @dev Indicates a failure with the `spender`’s `allowance`. Used in transfers. * @param spender Address that may be allowed to operate on tokens without being their owner. * @param allowance Amount of tokens a `spender` is allowed to operate with. * @param needed Minimum amount required to perform a transfer. */ error ERC20InsufficientAllowance(address spender, uint256 allowance, uint256 needed); /** * @dev Indicates a failure with the `approver` of a token to be approved. Used in approvals. * @param approver Address initiating an approval operation. */ error ERC20InvalidApprover(address approver); /** * @dev Indicates a failure with the `spender` to be approved. Used in approvals. * @param spender Address that may be allowed to operate on tokens without being their owner. */ error ERC20InvalidSpender(address spender); } /** * @dev Standard ERC721 Errors * Interface of the https://eips.ethereum.org/EIPS/eip-6093[ERC-6093] custom errors for ERC721 tokens. */ interface IERC721Errors { /** * @dev Indicates that an address can't be an owner. For example, `address(0)` is a forbidden owner in EIP-20. * Used in balance queries. * @param owner Address of the current owner of a token. */ error ERC721InvalidOwner(address owner); /** * @dev Indicates a `tokenId` whose `owner` is the zero address. * @param tokenId Identifier number of a token. */ error ERC721NonexistentToken(uint256 tokenId); /** * @dev Indicates an error related to the ownership over a particular token. Used in transfers. * @param sender Address whose tokens are being transferred. * @param tokenId Identifier number of a token. * @param owner Address of the current owner of a token. */ error ERC721IncorrectOwner(address sender, uint256 tokenId, address owner); /** * @dev Indicates a failure with the token `sender`. Used in transfers. * @param sender Address whose tokens are being transferred. */ error ERC721InvalidSender(address sender); /** * @dev Indicates a failure with the token `receiver`. Used in transfers. * @param receiver Address to which tokens are being transferred. */ error ERC721InvalidReceiver(address receiver); /** * @dev Indicates a failure with the `operator`’s approval. Used in transfers. * @param operator Address that may be allowed to operate on tokens without being their owner. * @param tokenId Identifier number of a token. */ error ERC721InsufficientApproval(address operator, uint256 tokenId); /** * @dev Indicates a failure with the `approver` of a token to be approved. Used in approvals. * @param approver Address initiating an approval operation. */ error ERC721InvalidApprover(address approver); /** * @dev Indicates a failure with the `operator` to be approved. Used in approvals. * @param operator Address that may be allowed to operate on tokens without being their owner. */ error ERC721InvalidOperator(address operator); } /** * @dev Standard ERC1155 Errors * Interface of the https://eips.ethereum.org/EIPS/eip-6093[ERC-6093] custom errors for ERC1155 tokens. */ interface IERC1155Errors { /** * @dev Indicates an error related to the current `balance` of a `sender`. Used in transfers. * @param sender Address whose tokens are being transferred. * @param balance Current balance for the interacting account. * @param needed Minimum amount required to perform a transfer. * @param tokenId Identifier number of a token. */ error ERC1155InsufficientBalance(address sender, uint256 balance, uint256 needed, uint256 tokenId); /** * @dev Indicates a failure with the token `sender`. Used in transfers. * @param sender Address whose tokens are being transferred. */ error ERC1155InvalidSender(address sender); /** * @dev Indicates a failure with the token `receiver`. Used in transfers. * @param receiver Address to which tokens are being transferred. */ error ERC1155InvalidReceiver(address receiver); /** * @dev Indicates a failure with the `operator`’s approval. Used in transfers. * @param operator Address that may be allowed to operate on tokens without being their owner. * @param owner Address of the current owner of a token. */ error ERC1155MissingApprovalForAll(address operator, address owner); /** * @dev Indicates a failure with the `approver` of a token to be approved. Used in approvals. * @param approver Address initiating an approval operation. */ error ERC1155InvalidApprover(address approver); /** * @dev Indicates a failure with the `operator` to be approved. Used in approvals. * @param operator Address that may be allowed to operate on tokens without being their owner. */ error ERC1155InvalidOperator(address operator); /** * @dev Indicates an array length mismatch between ids and values in a safeBatchTransferFrom operation. * Used in batch transfers. * @param idsLength Length of the array of token identifiers * @param valuesLength Length of the array of token amounts */ error ERC1155InvalidArrayLength(uint256 idsLength, uint256 valuesLength); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.0) (utils/cryptography/MessageHashUtils.sol) pragma solidity ^0.8.20; import {Strings} from "../Strings.sol"; /** * @dev Signature message hash utilities for producing digests to be consumed by {ECDSA} recovery or signing. * * The library provides methods for generating a hash of a message that conforms to the * https://eips.ethereum.org/EIPS/eip-191[EIP 191] and https://eips.ethereum.org/EIPS/eip-712[EIP 712] * specifications. */ library MessageHashUtils { /** * @dev Returns the keccak256 digest of an EIP-191 signed data with version * `0x45` (`personal_sign` messages). * * The digest is calculated by prefixing a bytes32 `messageHash` with * `"\x19Ethereum Signed Message:\n32"` and hashing the result. It corresponds with the * hash signed when using the https://eth.wiki/json-rpc/API#eth_sign[`eth_sign`] JSON-RPC method. * * NOTE: The `messageHash` parameter is intended to be the result of hashing a raw message with * keccak256, although any bytes32 value can be safely used because the final digest will * be re-hashed. * * See {ECDSA-recover}. */ function toEthSignedMessageHash(bytes32 messageHash) internal pure returns (bytes32 digest) { /// @solidity memory-safe-assembly assembly { mstore(0x00, "\x19Ethereum Signed Message:\n32") // 32 is the bytes-length of messageHash mstore(0x1c, messageHash) // 0x1c (28) is the length of the prefix digest := keccak256(0x00, 0x3c) // 0x3c is the length of the prefix (0x1c) + messageHash (0x20) } } /** * @dev Returns the keccak256 digest of an EIP-191 signed data with version * `0x45` (`personal_sign` messages). * * The digest is calculated by prefixing an arbitrary `message` with * `"\x19Ethereum Signed Message:\n" + len(message)` and hashing the result. It corresponds with the * hash signed when using the https://eth.wiki/json-rpc/API#eth_sign[`eth_sign`] JSON-RPC method. * * See {ECDSA-recover}. */ function toEthSignedMessageHash(bytes memory message) internal pure returns (bytes32) { return keccak256(bytes.concat("\x19Ethereum Signed Message:\n", bytes(Strings.toString(message.length)), message)); } /** * @dev Returns the keccak256 digest of an EIP-191 signed data with version * `0x00` (data with intended validator). * * The digest is calculated by prefixing an arbitrary `data` with `"\x19\x00"` and the intended * `validator` address. Then hashing the result. * * See {ECDSA-recover}. */ function toDataWithIntendedValidatorHash(address validator, bytes memory data) internal pure returns (bytes32) { return keccak256(abi.encodePacked(hex"19_00", validator, data)); } /** * @dev Returns the keccak256 digest of an EIP-712 typed data (EIP-191 version `0x01`). * * The digest is calculated from a `domainSeparator` and a `structHash`, by prefixing them with * `\x19\x01` and hashing the result. It corresponds to the hash signed by the * https://eips.ethereum.org/EIPS/eip-712[`eth_signTypedData`] JSON-RPC method as part of EIP-712. * * See {ECDSA-recover}. */ function toTypedDataHash(bytes32 domainSeparator, bytes32 structHash) internal pure returns (bytes32 digest) { /// @solidity memory-safe-assembly assembly { let ptr := mload(0x40) mstore(ptr, hex"19_01") mstore(add(ptr, 0x02), domainSeparator) mstore(add(ptr, 0x22), structHash) digest := keccak256(ptr, 0x42) } } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.0) (utils/ShortStrings.sol) pragma solidity ^0.8.20; import {StorageSlot} from "./StorageSlot.sol"; // | string | 0xAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA | // | length | 0x BB | type ShortString is bytes32; /** * @dev This library provides functions to convert short memory strings * into a `ShortString` type that can be used as an immutable variable. * * Strings of arbitrary length can be optimized using this library if * they are short enough (up to 31 bytes) by packing them with their * length (1 byte) in a single EVM word (32 bytes). Additionally, a * fallback mechanism can be used for every other case. * * Usage example: * * ```solidity * contract Named { * using ShortStrings for *; * * ShortString private immutable _name; * string private _nameFallback; * * constructor(string memory contractName) { * _name = contractName.toShortStringWithFallback(_nameFallback); * } * * function name() external view returns (string memory) { * return _name.toStringWithFallback(_nameFallback); * } * } * ``` */ library ShortStrings { // Used as an identifier for strings longer than 31 bytes. bytes32 private constant FALLBACK_SENTINEL = 0x00000000000000000000000000000000000000000000000000000000000000FF; error StringTooLong(string str); error InvalidShortString(); /** * @dev Encode a string of at most 31 chars into a `ShortString`. * * This will trigger a `StringTooLong` error is the input string is too long. */ function toShortString(string memory str) internal pure returns (ShortString) { bytes memory bstr = bytes(str); if (bstr.length > 31) { revert StringTooLong(str); } return ShortString.wrap(bytes32(uint256(bytes32(bstr)) | bstr.length)); } /** * @dev Decode a `ShortString` back to a "normal" string. */ function toString(ShortString sstr) internal pure returns (string memory) { uint256 len = byteLength(sstr); // using `new string(len)` would work locally but is not memory safe. string memory str = new string(32); /// @solidity memory-safe-assembly assembly { mstore(str, len) mstore(add(str, 0x20), sstr) } return str; } /** * @dev Return the length of a `ShortString`. */ function byteLength(ShortString sstr) internal pure returns (uint256) { uint256 result = uint256(ShortString.unwrap(sstr)) & 0xFF; if (result > 31) { revert InvalidShortString(); } return result; } /** * @dev Encode a string into a `ShortString`, or write it to storage if it is too long. */ function toShortStringWithFallback(string memory value, string storage store) internal returns (ShortString) { if (bytes(value).length < 32) { return toShortString(value); } else { StorageSlot.getStringSlot(store).value = value; return ShortString.wrap(FALLBACK_SENTINEL); } } /** * @dev Decode a string that was encoded to `ShortString` or written to storage using {setWithFallback}. */ function toStringWithFallback(ShortString value, string storage store) internal pure returns (string memory) { if (ShortString.unwrap(value) != FALLBACK_SENTINEL) { return toString(value); } else { return store; } } /** * @dev Return the length of a string that was encoded to `ShortString` or written to storage using * {setWithFallback}. * * WARNING: This will return the "byte length" of the string. This may not reflect the actual length in terms of * actual characters as the UTF-8 encoding of a single character can span over multiple bytes. */ function byteLengthWithFallback(ShortString value, string storage store) internal view returns (uint256) { if (ShortString.unwrap(value) != FALLBACK_SENTINEL) { return byteLength(value); } else { return bytes(store).length; } } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.0) (interfaces/IERC5267.sol) pragma solidity ^0.8.20; interface IERC5267 { /** * @dev MAY be emitted to signal that the domain could have changed. */ event EIP712DomainChanged(); /** * @dev returns the fields and values that describe the domain separator used by this contract for EIP-712 * signature. */ function eip712Domain() external view returns ( bytes1 fields, string memory name, string memory version, uint256 chainId, address verifyingContract, bytes32 salt, uint256[] memory extensions ); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.0) (utils/Strings.sol) pragma solidity ^0.8.20; import {Math} from "./math/Math.sol"; import {SignedMath} from "./math/SignedMath.sol"; /** * @dev String operations. */ library Strings { bytes16 private constant HEX_DIGITS = "0123456789abcdef"; uint8 private constant ADDRESS_LENGTH = 20; /** * @dev The `value` string doesn't fit in the specified `length`. */ error StringsInsufficientHexLength(uint256 value, uint256 length); /** * @dev Converts a `uint256` to its ASCII `string` decimal representation. */ function toString(uint256 value) internal pure returns (string memory) { unchecked { uint256 length = Math.log10(value) + 1; string memory buffer = new string(length); uint256 ptr; /// @solidity memory-safe-assembly assembly { ptr := add(buffer, add(32, length)) } while (true) { ptr--; /// @solidity memory-safe-assembly assembly { mstore8(ptr, byte(mod(value, 10), HEX_DIGITS)) } value /= 10; if (value == 0) break; } return buffer; } } /** * @dev Converts a `int256` to its ASCII `string` decimal representation. */ function toStringSigned(int256 value) internal pure returns (string memory) { return string.concat(value < 0 ? "-" : "", toString(SignedMath.abs(value))); } /** * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation. */ function toHexString(uint256 value) internal pure returns (string memory) { unchecked { return toHexString(value, Math.log256(value) + 1); } } /** * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation with fixed length. */ function toHexString(uint256 value, uint256 length) internal pure returns (string memory) { uint256 localValue = value; 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_DIGITS[localValue & 0xf]; localValue >>= 4; } if (localValue != 0) { revert StringsInsufficientHexLength(value, length); } 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); } /** * @dev Returns true if the two strings are equal. */ function equal(string memory a, string memory b) internal pure returns (bool) { return bytes(a).length == bytes(b).length && keccak256(bytes(a)) == keccak256(bytes(b)); } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.0) (utils/StorageSlot.sol) // This file was procedurally generated from scripts/generate/templates/StorageSlot.js. pragma solidity ^0.8.20; /** * @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: * ```solidity * 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(newImplementation.code.length > 0); * StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value = newImplementation; * } * } * ``` */ library StorageSlot { struct AddressSlot { address value; } struct BooleanSlot { bool value; } struct Bytes32Slot { bytes32 value; } struct Uint256Slot { uint256 value; } struct StringSlot { string value; } struct BytesSlot { bytes 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 } } /** * @dev Returns an `StringSlot` with member `value` located at `slot`. */ function getStringSlot(bytes32 slot) internal pure returns (StringSlot storage r) { /// @solidity memory-safe-assembly assembly { r.slot := slot } } /** * @dev Returns an `StringSlot` representation of the string storage pointer `store`. */ function getStringSlot(string storage store) internal pure returns (StringSlot storage r) { /// @solidity memory-safe-assembly assembly { r.slot := store.slot } } /** * @dev Returns an `BytesSlot` with member `value` located at `slot`. */ function getBytesSlot(bytes32 slot) internal pure returns (BytesSlot storage r) { /// @solidity memory-safe-assembly assembly { r.slot := slot } } /** * @dev Returns an `BytesSlot` representation of the bytes storage pointer `store`. */ function getBytesSlot(bytes storage store) internal pure returns (BytesSlot storage r) { /// @solidity memory-safe-assembly assembly { r.slot := store.slot } } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.0) (utils/math/SignedMath.sol) pragma solidity ^0.8.20; /** * @dev Standard signed math utilities missing in the Solidity language. */ library SignedMath { /** * @dev Returns the largest of two signed numbers. */ function max(int256 a, int256 b) internal pure returns (int256) { return a > b ? a : b; } /** * @dev Returns the smallest of two signed numbers. */ function min(int256 a, int256 b) internal pure returns (int256) { return a < b ? a : b; } /** * @dev Returns the average of two signed numbers without overflow. * The result is rounded towards zero. */ function average(int256 a, int256 b) internal pure returns (int256) { // Formula from the book "Hacker's Delight" int256 x = (a & b) + ((a ^ b) >> 1); return x + (int256(uint256(x) >> 255) & (a ^ b)); } /** * @dev Returns the absolute unsigned value of a signed value. */ function abs(int256 n) internal pure returns (uint256) { unchecked { // must be unchecked in order to support `n = type(int256).min` return uint256(n >= 0 ? n : -n); } } }
{ "remappings": [ "@openzeppelin/contracts/=lib/openzeppelin-contracts/contracts/", "@openzeppelin/contracts-upgradeable/=lib/openzeppelin-contracts-upgradeable/contracts/", "@chainlink/contracts/=lib/chainlink/contracts/", "forge-std/=lib/forge-std/src/", "@layerzerolabs/lz-evm-protocol-v2/=lib/LayerZero-v2/protocol/", "@layerzerolabs/lz-evm-oapp-v2/=lib/LayerZero-v2/oapp/", "@createx/=lib/createx/src/", "LayerZero-v2/=lib/LayerZero-v2/", "chainlink/=lib/chainlink/contracts/", "createx/=lib/createx/src/", "ds-test/=lib/createx/lib/forge-std/lib/ds-test/src/", "erc4626-tests/=lib/openzeppelin-contracts/lib/erc4626-tests/", "forge-std/=lib/forge-std/src/", "openzeppelin-contracts/=lib/openzeppelin-contracts/", "openzeppelin/=lib/createx/lib/openzeppelin-contracts/contracts/", "solady/=lib/createx/lib/solady/" ], "optimizer": { "enabled": true, "runs": 200 }, "metadata": { "useLiteralContent": false, "bytecodeHash": "ipfs", "appendCBOR": true }, "outputSelection": { "*": { "*": [ "evm.bytecode", "evm.deployedBytecode", "devdoc", "userdoc", "metadata", "abi" ] } }, "evmVersion": "cancun", "viaIR": true, "libraries": {} }
Contract Security Audit
- No Contract Security Audit Submitted- Submit Audit Here
[{"inputs":[{"internalType":"address","name":"_admin","type":"address"},{"internalType":"contract IERC20","name":"_asset","type":"address"},{"internalType":"uint24","name":"_CDPeriod","type":"uint24"}],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[],"name":"AccessControlBadConfirmation","type":"error"},{"inputs":[{"internalType":"address","name":"account","type":"address"},{"internalType":"bytes32","name":"neededRole","type":"bytes32"}],"name":"AccessControlUnauthorizedAccount","type":"error"},{"inputs":[{"internalType":"address","name":"target","type":"address"}],"name":"AddressEmptyCode","type":"error"},{"inputs":[{"internalType":"address","name":"account","type":"address"}],"name":"AddressInsufficientBalance","type":"error"},{"inputs":[],"name":"ECDSAInvalidSignature","type":"error"},{"inputs":[{"internalType":"uint256","name":"length","type":"uint256"}],"name":"ECDSAInvalidSignatureLength","type":"error"},{"inputs":[{"internalType":"bytes32","name":"s","type":"bytes32"}],"name":"ECDSAInvalidSignatureS","type":"error"},{"inputs":[{"internalType":"address","name":"spender","type":"address"},{"internalType":"uint256","name":"allowance","type":"uint256"},{"internalType":"uint256","name":"needed","type":"uint256"}],"name":"ERC20InsufficientAllowance","type":"error"},{"inputs":[{"internalType":"address","name":"sender","type":"address"},{"internalType":"uint256","name":"balance","type":"uint256"},{"internalType":"uint256","name":"needed","type":"uint256"}],"name":"ERC20InsufficientBalance","type":"error"},{"inputs":[{"internalType":"address","name":"approver","type":"address"}],"name":"ERC20InvalidApprover","type":"error"},{"inputs":[{"internalType":"address","name":"receiver","type":"address"}],"name":"ERC20InvalidReceiver","type":"error"},{"inputs":[{"internalType":"address","name":"sender","type":"address"}],"name":"ERC20InvalidSender","type":"error"},{"inputs":[{"internalType":"address","name":"spender","type":"address"}],"name":"ERC20InvalidSpender","type":"error"},{"inputs":[{"internalType":"uint256","name":"deadline","type":"uint256"}],"name":"ERC2612ExpiredSignature","type":"error"},{"inputs":[{"internalType":"address","name":"signer","type":"address"},{"internalType":"address","name":"owner","type":"address"}],"name":"ERC2612InvalidSigner","type":"error"},{"inputs":[{"internalType":"address","name":"receiver","type":"address"},{"internalType":"uint256","name":"assets","type":"uint256"},{"internalType":"uint256","name":"max","type":"uint256"}],"name":"ERC4626ExceededMaxDeposit","type":"error"},{"inputs":[{"internalType":"address","name":"receiver","type":"address"},{"internalType":"uint256","name":"shares","type":"uint256"},{"internalType":"uint256","name":"max","type":"uint256"}],"name":"ERC4626ExceededMaxMint","type":"error"},{"inputs":[{"internalType":"address","name":"owner","type":"address"},{"internalType":"uint256","name":"shares","type":"uint256"},{"internalType":"uint256","name":"max","type":"uint256"}],"name":"ERC4626ExceededMaxRedeem","type":"error"},{"inputs":[{"internalType":"address","name":"owner","type":"address"},{"internalType":"uint256","name":"assets","type":"uint256"},{"internalType":"uint256","name":"max","type":"uint256"}],"name":"ERC4626ExceededMaxWithdraw","type":"error"},{"inputs":[],"name":"FailedInnerCall","type":"error"},{"inputs":[{"internalType":"address","name":"account","type":"address"},{"internalType":"uint256","name":"currentNonce","type":"uint256"}],"name":"InvalidAccountNonce","type":"error"},{"inputs":[],"name":"InvalidShortString","type":"error"},{"inputs":[],"name":"MathOverflowedMulDiv","type":"error"},{"inputs":[],"name":"ReentrancyGuardReentrantCall","type":"error"},{"inputs":[{"internalType":"address","name":"token","type":"address"}],"name":"SafeERC20FailedOperation","type":"error"},{"inputs":[{"internalType":"string","name":"str","type":"string"}],"name":"StringTooLong","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":"uint256","name":"newCDPeriod","type":"uint256"}],"name":"CDPeriodChanged","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"sender","type":"address"},{"indexed":true,"internalType":"address","name":"owner","type":"address"},{"indexed":false,"internalType":"uint256","name":"assets","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"shares","type":"uint256"}],"name":"Deposit","type":"event"},{"anonymous":false,"inputs":[],"name":"EIP712DomainChanged","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"role","type":"bytes32"},{"indexed":true,"internalType":"bytes32","name":"previousAdminRole","type":"bytes32"},{"indexed":true,"internalType":"bytes32","name":"newAdminRole","type":"bytes32"}],"name":"RoleAdminChanged","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"role","type":"bytes32"},{"indexed":true,"internalType":"address","name":"account","type":"address"},{"indexed":true,"internalType":"address","name":"sender","type":"address"}],"name":"RoleGranted","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"role","type":"bytes32"},{"indexed":true,"internalType":"address","name":"account","type":"address"},{"indexed":true,"internalType":"address","name":"sender","type":"address"}],"name":"RoleRevoked","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":true,"internalType":"uint256","name":"newCDPeriod","type":"uint256"}],"name":"VestingPeriodChanged","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"sender","type":"address"},{"indexed":true,"internalType":"address","name":"receiver","type":"address"},{"indexed":true,"internalType":"address","name":"owner","type":"address"},{"indexed":false,"internalType":"uint256","name":"assets","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"shares","type":"uint256"}],"name":"Withdraw","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"YieldReceived","type":"event"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"CD","outputs":[{"internalType":"uint256","name":"time","type":"uint256"},{"internalType":"uint256","name":"amount","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_assets","type":"uint256"}],"name":"CDAssets","outputs":[{"internalType":"uint256","name":"_shares","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"CDPeriod","outputs":[{"internalType":"uint24","name":"","type":"uint24"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_shares","type":"uint256"}],"name":"CDShares","outputs":[{"internalType":"uint256","name":"_assets","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"DEFAULT_ADMIN_ROLE","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"DOMAIN_SEPARATOR","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"MAX_CD_PERIOD","outputs":[{"internalType":"uint24","name":"","type":"uint24"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"POOL_MANAGER_ROLE","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"YIELD_MANAGER_ROLE","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address[]","name":"_users","type":"address[]"}],"name":"addBatchToBlacklist","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_user","type":"address"}],"name":"addToBlacklist","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_amount","type":"uint256"}],"name":"addYield","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":"value","type":"uint256"}],"name":"approve","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"asset","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"account","type":"address"}],"name":"balanceOf","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"shares","type":"uint256"}],"name":"convertToAssets","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"assets","type":"uint256"}],"name":"convertToShares","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"decimals","outputs":[{"internalType":"uint8","name":"","type":"uint8"}],"stateMutability":"pure","type":"function"},{"inputs":[{"internalType":"uint256","name":"assets","type":"uint256"},{"internalType":"address","name":"receiver","type":"address"}],"name":"deposit","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"eip712Domain","outputs":[{"internalType":"bytes1","name":"fields","type":"bytes1"},{"internalType":"string","name":"name","type":"string"},{"internalType":"string","name":"version","type":"string"},{"internalType":"uint256","name":"chainId","type":"uint256"},{"internalType":"address","name":"verifyingContract","type":"address"},{"internalType":"bytes32","name":"salt","type":"bytes32"},{"internalType":"uint256[]","name":"extensions","type":"uint256[]"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"flat","outputs":[{"internalType":"contract USDzFlat","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"}],"name":"getRoleAdmin","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getUnvestedAmount","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"grantRole","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"hasRole","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_user","type":"address"}],"name":"isBlacklist","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"lastDistributionTime","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"maxDeposit","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"maxMint","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"owner","type":"address"}],"name":"maxRedeem","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"owner","type":"address"}],"name":"maxWithdraw","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"shares","type":"uint256"},{"internalType":"address","name":"receiver","type":"address"}],"name":"mint","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"nonpayable","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":[{"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":[],"name":"pooledUSDz","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"assets","type":"uint256"}],"name":"previewDeposit","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"shares","type":"uint256"}],"name":"previewMint","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"shares","type":"uint256"}],"name":"previewRedeem","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"assets","type":"uint256"}],"name":"previewWithdraw","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"shares","type":"uint256"},{"internalType":"address","name":"receiver","type":"address"},{"internalType":"address","name":"_owner","type":"address"}],"name":"redeem","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address[]","name":"_users","type":"address[]"}],"name":"removeBatchFromBlacklist","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_user","type":"address"}],"name":"removeFromBlacklist","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"callerConfirmation","type":"address"}],"name":"renounceRole","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"contract IERC20","name":"token","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"rescueERC20","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"revokeRole","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint24","name":"newCDPeriod","type":"uint24"}],"name":"setNewCDPeriod","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"newPeriod","type":"uint256"}],"name":"setNewVestingPeriod","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes4","name":"interfaceId","type":"bytes4"}],"name":"supportsInterface","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"symbol","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"totalAssets","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"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":"value","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":"value","type":"uint256"}],"name":"transferFrom","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"unstake","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"vestingAmount","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"vestingPeriod","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"assets","type":"uint256"},{"internalType":"address","name":"receiver","type":"address"},{"internalType":"address","name":"_owner","type":"address"}],"name":"withdraw","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"nonpayable","type":"function"}]
Contract Creation Code
6101c0604081815234620005725760608262003b2f803803809162000025828562000592565b833981010312620005725781516001600160a01b03919082811681036200057257602092838501519081169485820362000572578301519462ffffff8616809603620005725762000075620005b6565b90845195620000848762000576565b600b87526a29ba30b5b2b2102aa9a23d60a91b81880152620000a5620005b6565b91865198620000b48a62000576565b6001808b52603160f81b848c019081528180558a51909a6001600160401b039687831162000360576005928354928584811c9416801562000567575b8985101462000487578190601f9485811162000516575b508990858311600114620004b2575f92620004a6575b50505f19600383901b1c191690851b1783555b8051928884116200036057600654908582811c921680156200049b575b89831014620004875783821162000440575b505086918311600114620003da579282939183925f94620003ce575b50501b915f199060031b1c1916176006555b62000198856200071c565b98610120998a52620001aa8b620008d7565b956101409687528481519101209a8b60e052519020996101009a808c524660a052895190858201927f8b73c3c69bb8fe3d512ecc4cf759cc79239f7b179b0ffacaa9a75d522b39400f84528b83015260608201524660808201523060a082015260a0815260c081018181108782111762000360578a525190206080523060c05262000235866200065b565b9015620003c457965b61018097885261016096875262278d00600b556276a70082101562000374576200026890620005d9565b5062ffffff19600a541617600a558651926102f99182850191858310908311176200036057889385936200381685393083528201520301905ff093841562000357576101a09485525194612d91968762000a8588396080518761234b015260a05187612417015260c05187612315015260e0518761239a015251866123c0015251856110c9015251846110f30152518381816103fe015281816107dc015281816109b101528181610b1201528181610c0701528181610fd80152818161133a015281816114fc0152611a440152518250505181818161038b015281816106db0152818161165201526119d20152f35b513d5f823e3d90fd5b634e487b7160e01b5f52604160045260245ffd5b885162461bcd60e51b8152600481018590526024808201527f4344504552494f445f53484f554c445f42455f4c4553535f5448414e5f39305f6044820152634441595360e01b6064820152608490fd5b506012966200023e565b015192505f806200017b565b90601f1983169160065f5283885f20935f5b8a888383106200042857505050106200040f575b505050811b016006556200018d565b01515f1960f88460031b161c191690555f808062000400565b868601518855909601959485019487935001620003ec565b60065f52885f209084808701821c8301938b88106200047d575b01901c019085905b8281106200047157506200015f565b5f815501859062000462565b935082936200045a565b634e487b7160e01b5f52602260045260245ffd5b91607f16916200014d565b015190505f806200011d565b90879350601f19831691875f528b5f20925f5b8d828210620004ff5750508411620004e6575b505050811b01835562000130565b01515f1960f88460031b161c191690555f8080620004d8565b8385015186558b97909501949384019301620004c5565b909150855f52895f2085808501881c8201928c86106200055d575b9189918695949301891c01915b8281106200054e57505062000107565b5f81558594508991016200053e565b9250819262000531565b93607f1693620000f0565b5f80fd5b604081019081106001600160401b038211176200036057604052565b601f909101601f19168101906001600160401b038211908210176200036057604052565b60405190620005c58262000576565b600582526439aaa9a23d60d91b6020830152565b6001600160a01b03165f8181525f8051602062003b0f833981519152602052604090205460ff1662000656575f8181525f8051602062003b0f83398151915260205260408120805460ff191660011790553391907f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d8180a4600190565b505f90565b5f80604051926020938481019063313ce56760e01b825260048152620006818162000576565b51916001600160a01b03165afa3d1562000713573d906001600160401b038211620003605760405191620006bf601f8201601f191685018462000592565b82523d5f8484013e5b8062000707575b620006dd575b50505f905f90565b81818051810103126200057257015160ff811115620006fd5780620006d5565b9060ff6001921690565b508181511015620006cf565b606090620006c8565b805160209081811015620007b65750601f8251116200075757808251920151908083106200074957501790565b825f19910360031b1b161790565b90604051809263305a27a960e01b82528060048301528251908160248401525f935b8285106200079c575050604492505f838284010152601f80199101168101030190fd5b848101820151868601604401529381019385935062000779565b906001600160401b0382116200036057600754926001938481811c91168015620008cc575b838210146200048757601f811162000895575b5081601f84116001146200082d57509282939183925f9462000821575b50501b915f199060031b1c19161760075560ff90565b015192505f806200080b565b919083601f19811660075f52845f20945f905b888383106200087a575050501062000861575b505050811b0160075560ff90565b01515f1960f88460031b161c191690555f808062000853565b85870151885590960195948501948793509081019062000840565b60075f5284601f845f20920160051c820191601f860160051c015b828110620008c0575050620007ee565b5f8155018590620008b0565b90607f1690620007db565b805160209081811015620009635750601f8251116200090457808251920151908083106200074957501790565b90604051809263305a27a960e01b82528060048301528251908160248401525f935b82851062000949575050604492505f838284010152601f80199101168101030190fd5b848101820151868601604401529381019385935062000926565b906001600160401b0382116200036057600854926001938481811c9116801562000a79575b838210146200048757601f811162000a42575b5081601f8411600114620009da57509282939183925f94620009ce575b50501b915f199060031b1c19161760085560ff90565b015192505f80620009b8565b919083601f19811660085f52845f20945f905b8883831062000a27575050501062000a0e575b505050811b0160085560ff90565b01515f1960f88460031b161c191690555f808062000a00565b858701518855909601959485019487935090810190620009ed565b60085f5284601f845f20920160051c820191601f860160051c015b82811062000a6d5750506200099b565b5f815501859062000a5d565b90607f16906200098856fe6080604081815260049182361015610015575f80fd5b5f925f3560e01c918262728f7614611b515750816301e1d11414611b0d57816301ffc9a714611ab9578163022176461461195c57816306fdde03146118ad57816307a2d13a1461145d578163095ea7b3146118845781630a28a477146118665781630ba595c4146117a457816318160ddd1461178857816323b872dd1461174c578163248a9ca3146117235781632def6620146116125781632f2ff15d146115e8578163313ce567146115cc578163333e99db1461158e5781633644e5151461157157816336568abe1461152b57816338d52e0f146114e7578163402d267d1461090d57816344337ea1146114a457816345d9aece146114625781634cdad5061461145d578163537df3b61461141d57816356d73568146113e257816362190852146113c45781636e553f65146112c657816370a08231146104e45781637313ee5a146112a757816375b17350146112885781637cfb384d1461122d5781637ea5032d146112095781637ecebe00146111d157816384b0196e146110b157816391d148541461106e57816394bf804d14610f6357816395d89b4114610e7c578163a217fddf14610e61578163a9059cbb14610e30578163aaa070ca14610dd2578163aca3b71114610d18578163b2118a8d14610bc6578163b3d7f6b914610ba3578163b460af9414610a6b578163ba08765214610912578163c63d75b61461090d578163c6e6f592146102e7578163c8b2b54614610744578163ce96cb771461070a578163d0fda779146106c6578163d505accf1461055e578163d547741f1461051f578163d905777e146104e4578163dd04bb2e146104c5578163dd62ed3e14610478578163e41bd7011461030f57508063e7c2a608146102ec578063ef8b30f7146102e75763fe9e9640146102aa575f80fd5b346102e357816003193601126102e357602090517f470f4f1717679395b6a9e0700797bfeeaa970f1643e72f5684d687c0be10fe278152f35b5080fd5b611ca2565b50346102e357816003193601126102e357602090610308611e66565b9051908152f35b9190503461047457602036600319011261047457813562ffffff600a541692610339841515611cc0565b338552600260205261035861035084872054611f26565b831115611cf9565b600161036d61036684611f96565b9542611d45565b338752600f60205284872090815501610387838254611d45565b90557f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316906103bc6125ae565b6103c7831515611eac565b6103d2851515611ee9565b600c5483810390811161046157600c55331561044a5750602094506103f78433612688565b61042282827f00000000000000000000000000000000000000000000000000000000000000006124f4565b8251918252838583015233915f80516020612d1c833981519152843392a46001805551908152f35b8351634b637e8f60e11b8152908101869052602490fd5b634e487b7160e01b875260118252602487fd5b8280fd5b5050346102e357806003193601126102e357602091610495611bcf565b8261049e611be5565b6001600160a01b03928316845260038652922091165f908152908352819020549051908152f35b5050346102e357816003193601126102e357602090600c549051908152f35b5050346102e35760203660031901126102e357602090610308610505611bcf565b6001600160a01b03165f9081526002602052604090205490565b9190503461047457806003193601126104745761055a91356105556001610544611be5565b93838752866020528620015461207f565b61243d565b5080f35b839150346102e35760e03660031901126102e35761057a611bcf565b610582611be5565b906044359260643560843560ff811681036106c2578142116106ab5760018060a01b0390818516928389526009602052898920908154916001830190558a519060208201927f6e71edae12b1b97f4d1f60370fef10105fa2faae0126114a169c64845d6126c98452868d840152858a1660608401528a608084015260a083015260c082015260c0815260e0810181811067ffffffffffffffff821117610698578b525190206106669161065d91610637612312565b908c519161190160f01b83526002830152602282015260c43591604260a4359220612af0565b90929192612b9b565b1681810361067d578661067a8787876125fb565b80f35b87516325c0072360e11b815292830152602482015260449150fd5b604187634e487b7160e01b5f525260245ffd5b875163313c898160e11b8152808401839052602490fd5b8680fd5b5050346102e357816003193601126102e357517f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03168152602090f35b5050346102e35760203660031901126102e3576020916103089082906001600160a01b03610736611bcf565b168152600285522054611f26565b90503461047457602080600319360112610909578135927f470f4f1717679395b6a9e0700797bfeeaa970f1643e72f5684d687c0be10fe27805f525f8352815f20335f52835260ff825f205416156108eb575083156108aa57670de0b6b3a764000083541115610869576107b6611e66565b6108305750505080600d5542600e556107d181600c54611d45565b600c556108098130337f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316612537565b7fd0e841f234010ad7f57b7c09faffb2245cd240429c6e8fa3cd934a0a8bf58eb08280a280f35b5162461bcd60e51b8152918201526015602482015274554e56455354494e475f49535f4e4f545f5a45524f60581b604482015260649150fd5b5162461bcd60e51b815291820152601c60248201527f4e4f545f454e4f5547485f544f54414c5f5354414b45445f5553445a00000000604482015260649150fd5b5162461bcd60e51b815291820152601760248201527f5452414e534645525f414d4f554e545f49535f5a45524f000000000000000000604482015260649150fd5b905163e2517d3f60e01b815233818501526024810191909152604490fd5b8380fd5b611bfb565b8383346102e35761092236611c6d565b94919061093662ffffff600a541615611e28565b60018060a01b039081871693848752600260205285872054808511610a36575061095f84611f26565b966109686125ae565b610973881515611eac565b61097e851515611ee9565b600c54888103908111610a2357600c55853303610a13575b85156109fd5750506109aa83602098612688565b6109d586827f00000000000000000000000000000000000000000000000000000000000000006124f4565b8451928684528784015216905f80516020612d1c833981519152843392a46001805551908152f35b8651634b637e8f60e11b81529182015260249150fd5b610a1e85338b6120a0565b610996565b506011602492634e487b7160e01b835252fd5b8651632e52afbb60e21b81526001600160a01b038a169281019283526020830186905260408301919091529081906060010390fd5b8383346102e357610a7b36611c6d565b949190610a8f62ffffff600a541615611e28565b60018060a01b0390818716938487526002602052610aaf86882054611f26565b808511610b6e5750610ac084611f96565b96610ac96125ae565b610ad4851515611eac565b610adf881515611ee9565b600c54858103908111610a2357600c55853303610b5e575b85156109fd575050610b0b86602098612688565b610b3683827f00000000000000000000000000000000000000000000000000000000000000006124f4565b8451928352858784015216905f80516020612d1c833981519152843392a46001805551908152f35b610b6988338b6120a0565b610af7565b8651633fa733bb60e21b81526001600160a01b038a169281019283526020830186905260408301919091529081906060010390fd5b828434610bc3576020366003190112610bc3575061030860209235611f5e565b80fd5b839150346102e35760603660031901126102e3576001600160a01b0390803582811691828203610d1457610bf8611be5565b9260443594610c05612006565b7f0000000000000000000000000000000000000000000000000000000000000000168114610c3b575b505061067a9394506124f4565b60206024918851928380926370a0823160e01b825230878301525afa908115610d0a578691610cd4575b50600c548103908111610cc1578411610c7e5780610c2e565b606490602087519162461bcd60e51b8352820152601f60248201527f5553445a5f5245534355455f414d4f554e545f4558434545445f4445424954006044820152fd5b634e487b7160e01b865260118252602486fd5b90506020813d602011610d02575b81610cef60209383611dce565b81010312610cfe575187610c65565b8580fd5b3d9150610ce2565b87513d88823e3d90fd5b8480fd5b9050346104745760203660031901126104745780359162ffffff831680930361090957610d43612006565b6276a700831015610d855750508062ffffff19600a541617600a557fba527850cebcf4242dd68f21779c47243e6d13eea42a0271d5e1e2f9cfb67cdf8280a280f35b906020608492519162461bcd60e51b8352820152602160248201527f53484f554c445f42455f4c4553535f5448414e5f4d41585f43445f504552494f6044820152601160fa1b6064820152fd5b5050346102e357610de236611c20565b9190610dec612006565b835b838110610df9578480f35b6001906001600160a01b03610e17610e12838887611df0565b611e14565b1686526010602052838620805460ff1916905501610dee565b5050346102e357806003193601126102e357602090610e5a610e50611bcf565b602435903361216d565b5160018152f35b5050346102e357816003193601126102e35751908152602090f35b828434610bc35780600319360112610bc3575080516006549091825f610ea184611d66565b808352602094600190866001821691825f14610f41575050600114610ee6575b5050610ee29291610ed3910385611dce565b51928284938452830190611b6b565b0390f35b9085925060065f527ff652222313e28459528d920b65115c16c04f3efc82aaedc97be59f3f377c0d3f915f925b828410610f295750505082010181610ed3610ec1565b8054848a018601528895508794909301928101610f13565b60ff19168682015292151560051b85019092019250839150610ed39050610ec1565b91905034610474578060031936011261047457813592610f81611be5565b93610f8b81611f5e565b93610f946125ae565b610f9f851515611eac565b610faa821515611ee9565b6001600160a01b038616808452601060205284842054909390610fd09060ff16156124af565b610ffc8630337f0000000000000000000000000000000000000000000000000000000000000000612537565b83156110585750506110108160209661279e565b825190848252858201527fdcbc1c05240f31ff3ad067ef1ee35ce4997762752e3a095284754544f4c709d7833392a361104b82600c54611d45565b600c556001805551908152f35b845163ec442f0560e01b81529182015260249150fd5b9050346104745781600319360112610474578160209361108c611be5565b92358152808552209060018060a01b03165f52825260ff815f20541690519015158152f35b919050346104745782600319360112610474576110ed7f000000000000000000000000000000000000000000000000000000000000000061287c565b926111177f000000000000000000000000000000000000000000000000000000000000000061297a565b90825192602092602085019585871067ffffffffffffffff8811176111be5750926020611174838896611167998b9996528686528151998a99600f60f81b8b5260e0868c015260e08b0190611b6b565b91898303908a0152611b6b565b924660608801523060808801528460a088015286840360c088015251928381520193925b8281106111a757505050500390f35b835185528695509381019392810192600101611198565b604190634e487b7160e01b5f525260245ffd5b5050346102e35760203660031901126102e35760209181906001600160a01b036111f9611bcf565b1681526009845220549051908152f35b5050346102e357816003193601126102e35760209062ffffff600a54169051908152f35b5050346102e35761123d36611c20565b9190611247612006565b835b838110611254578480f35b6001906001600160a01b0361126d610e12838887611df0565b1686526010602052838620805460ff19168317905501611249565b5050346102e357816003193601126102e357602090600e549051908152f35b5050346102e357816003193601126102e357602090600b549051908152f35b90508234610bc35782600319360112610bc3578135906112e4611be5565b6112ed83611fce565b936112f66125ae565b611301841515611eac565b61130c851515611ee9565b6001600160a01b0382168084526010602052868420549093906113329060ff16156124af565b61135e8530337f0000000000000000000000000000000000000000000000000000000000000000612537565b83156113ae576020868861104b8888611377858a61279e565b835182815285878201527fdcbc1c05240f31ff3ad067ef1ee35ce4997762752e3a095284754544f4c709d7853392a3600c54611d45565b865163ec442f0560e01b81529182015260249150fd5b5050346102e357816003193601126102e357602090516276a7008152f35b5050346102e357816003193601126102e357602090517f6077685936c8169d09204a1d97db12e41713588c38e1d29a61867d3dcee98aff8152f35b5050346102e35760203660031901126102e357611438611bcf565b611440612006565b6001600160a01b0316825260106020528120805460ff1916905580f35b611ba9565b5050346102e35760203660031901126102e3579081906001600160a01b03611488611bcf565b168152600f602052206001815491015482519182526020820152f35b5050346102e35760203660031901126102e3576114bf611bcf565b6114c7612006565b6001600160a01b0316825260106020528120805460ff1916600117905580f35b5050346102e357816003193601126102e357517f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03168152602090f35b8383346102e357806003193601126102e357611545611be5565b90336001600160a01b03831603611562575061055a91923561243d565b5163334bd91960e11b81528390fd5b5050346102e357816003193601126102e357602090610308612312565b5050346102e35760203660031901126102e35760209160ff9082906001600160a01b036115b9611bcf565b1681526010855220541690519015158152f35b5050346102e357816003193601126102e3576020905160128152f35b9190503461047457806003193601126104745761055a913561160d6001610544611be5565b612296565b919050346116dd575f3660031901126116dd57335f52600f602052805f209182544210801590611714575b156116e1576001830180545f948590559390557f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316803b156116dd57825163f3fef3a360e01b8152338382019081526020810195909552935f91859182908490829060400103925af180156116d3576116bc578380f35b9091925067ffffffffffffffff83116111be575052005b82513d5f823e3d90fd5b5f80fd5b6020606492519162461bcd60e51b8352820152600e60248201526d155394d51052d157d1905253115160921b6044820152fd5b5062ffffff600a54161561163d565b82346116dd5760203660031901126116dd57602091355f525f82526001815f2001549051908152f35b82346116dd5760603660031901126116dd57602090610e5a61176c611bcf565b611774611be5565b604435916117838333836120a0565b61216d565b82346116dd575f3660031901126116dd57602091549051908152f35b9050346116dd5760203660031901126116dd578035916117c2612006565b8215158061185c575b156117fb578280600b557f2f847163bc3888f61ddc9b405dc655d9cc509f5518194a06263f0ad3c090df965f80a2005b906020608492519162461bcd60e51b8352820152603560248201527f53484f554c445f42455f4c4553535f5448414e5f55494e543235365f4d41585f604482015274414e445f475245415445525f5448414e5f5a45524f60581b6064820152fd5b505f1983106117cb565b82346116dd5760203660031901126116dd5761030860209235611f96565b82346116dd57806003193601126116dd57602090610e5a6118a3611bcf565b60243590336125fb565b82346116dd575f3660031901126116dd5780516005549091825f6118d084611d66565b808352602094600190866001821691825f14610f41575050600114611901575050610ee29291610ed3910385611dce565b9085925060055f527f036b6384b5eca791c62761152d0c79bb0604c104a5fb6f4eb0703f3154bb3db0915f925b8284106119445750505082010181610ed3610ec1565b8054848a01860152889550879490930192810161192e565b82346116dd5760203660031901126116dd57600a5462ffffff16908235611984831515611cc0565b335f9081526002602052604090205461199f90821115611cf9565b60016119b46119ad83611f26565b9442611d45565b335f52600f602052835f20908155016119ce848254611d45565b90557f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031693611a036125ae565b611a0e841515611eac565b611a19821515611ee9565b600c54848103908111611aa657600c553315611a905750602093611a3d8233612688565b611a6884827f00000000000000000000000000000000000000000000000000000000000000006124f4565b8251918483528583015233915f80516020612d1c833981519152843392a46001805551908152f35b6024905f845191634b637e8f60e11b8352820152fd5b601182634e487b7160e01b5f525260245ffd5b9050346116dd5760203660031901126116dd573563ffffffff60e01b81168091036116dd57602091637965db0b60e01b8214918215611afc575b50519015158152f35b6301ffc9a760e01b14915083611af3565b82346116dd575f3660031901126116dd57611b26611e66565b90600c54918203918211611b3e576020925051908152f35b601183634e487b7160e01b5f525260245ffd5b346116dd575f3660031901126116dd57602090600d548152f35b91908251928382525f5b848110611b95575050825f602080949584010152601f8019910116010190565b602081830181015184830182015201611b75565b346116dd5760203660031901126116dd576020611bc7600435611f26565b604051908152f35b600435906001600160a01b03821682036116dd57565b602435906001600160a01b03821682036116dd57565b346116dd5760203660031901126116dd57611c14611bcf565b5060206040515f198152f35b9060206003198301126116dd5760043567ffffffffffffffff928382116116dd57806023830112156116dd5781600401359384116116dd5760248460051b830101116116dd576024019190565b60609060031901126116dd57600435906001600160a01b039060243582811681036116dd579160443590811681036116dd5790565b346116dd5760203660031901126116dd576020611bc7600435611fce565b15611cc757565b60405162461bcd60e51b815260206004820152600a60248201526921a22fa6a7a222afa7a760b11b6044820152606490fd5b15611d0057565b60405162461bcd60e51b815260206004820152601860248201527f57495448445241575f414d4f554e545f455843454544454400000000000000006044820152606490fd5b91908201809211611d5257565b634e487b7160e01b5f52601160045260245ffd5b90600182811c92168015611d94575b6020831014611d8057565b634e487b7160e01b5f52602260045260245ffd5b91607f1691611d75565b6040810190811067ffffffffffffffff821117611dba57604052565b634e487b7160e01b5f52604160045260245ffd5b90601f8019910116810190811067ffffffffffffffff821117611dba57604052565b9190811015611e005760051b0190565b634e487b7160e01b5f52603260045260245ffd5b356001600160a01b03811681036116dd5790565b15611e2f57565b60405162461bcd60e51b815260206004820152600f60248201526e22a9219a1b191b2fa6a7a222afa7a760891b6044820152606490fd5b600e544203428111611d5257600b54808210611e825750505f90565b81810391818311611d5257600d54808402938404149082141715611d5257611ea991612590565b90565b15611eb357565b60405162461bcd60e51b815260206004820152600e60248201526d4153534554535f49535f5a45524f60901b6044820152606490fd5b15611ef057565b60405162461bcd60e51b815260206004820152600e60248201526d5348415245535f49535f5a45524f60901b6044820152606490fd5b611f2e611e66565b600c54908103908111611d525760018101809111611d52576004549060018201809211611d5257611ea992612c26565b611f66611e66565b600c54908103908111611d525760018101809111611d52576004549060018201809211611d5257611ea9926125d1565b60045460018101809111611d5257611fac611e66565b90600c54918203918211611d525760018201809211611d5257611ea9926125d1565b60045460018101809111611d5257611fe4611e66565b90600c54918203918211611d525760018201809211611d5257611ea992612c26565b335f9081527f729ef9451dd492832bd2a98139702ced95dfa0cec7e99526dbbcb957abcbc47660205260409020547f6077685936c8169d09204a1d97db12e41713588c38e1d29a61867d3dcee98aff9060ff16156120615750565b6044906040519063e2517d3f60e01b82523360048301526024820152fd5b805f525f60205260405f20335f5260205260ff60405f205416156120615750565b919060018060a01b0380931692835f526003602052604093845f2091831691825f52602052845f2054925f1984036120db575b505050505050565b84841061213d5750801561212657811561210f575f526003602052835f20905f5260205203905f20555f80808080806120d3565b8451634a1406b160e11b81525f6004820152602490fd5b845163e602df0560e01b81525f6004820152602490fd5b8551637dc7a0d960e11b81526001600160a01b039190911660048201526024810184905260448101859052606490fd5b9291906001600160a01b0380851691821561227e571691821561226657815f5260209060108252604060ff815f20541661222d57845f52601083526121b860ff825f205416156124af565b835f5260028352805f2054968288106121fe575081849596975f80516020612d3c833981519152955f526002855203815f2055855f52805f2082815401905551908152a3565b905163391434e360e21b81526001600160a01b0390911660048201526024810187905260448101829052606490fd5b5162461bcd60e51b815260048101839052601360248201527214d15391115497d25397d0931050d2d31254d5606a1b6044820152606490fd5b60405163ec442f0560e01b81525f6004820152602490fd5b604051634b637e8f60e11b81525f6004820152602490fd5b90815f525f60205260405f209060018060a01b031690815f5260205260ff60405f205416155f1461230c57815f525f60205260405f20815f5260205260405f20600160ff1982541617905533917f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d5f80a4600190565b50505f90565b307f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03161480612414575b1561236d577f000000000000000000000000000000000000000000000000000000000000000090565b60405160208101907f8b73c3c69bb8fe3d512ecc4cf759cc79239f7b179b0ffacaa9a75d522b39400f82527f000000000000000000000000000000000000000000000000000000000000000060408201527f000000000000000000000000000000000000000000000000000000000000000060608201524660808201523060a082015260a0815260c0810181811067ffffffffffffffff821117611dba5760405251902090565b507f00000000000000000000000000000000000000000000000000000000000000004614612344565b90815f525f60205260405f209060018060a01b031690815f5260205260ff60405f2054165f1461230c57815f525f60205260405f20815f5260205260405f2060ff19815416905533917ff6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b5f80a4600190565b156124b657565b60405162461bcd60e51b8152602060048201526016602482015275149150d2541251539517d25397d0931050d2d31254d560521b6044820152606490fd5b60405163a9059cbb60e01b60208201526001600160a01b0392909216602483015260448083019390935291815261253591612530606483611dce565b612a37565b565b6040516323b872dd60e01b60208201526001600160a01b03928316602482015292909116604483015260648083019390935291815260a081019181831067ffffffffffffffff841117611dba5761253592604052612a37565b811561259a570490565b634e487b7160e01b5f52601260045260245ffd5b6002600154146125bf576002600155565b604051633ee5aeb560e01b8152600490fd5b91906125de828285612c26565b92821561259a57096125ed5790565b60018101809111611d525790565b6001600160a01b0390811691821561267057169182156126585760207f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92591835f526003825260405f20855f5282528060405f2055604051908152a3565b604051634a1406b160e11b81525f6004820152602490fd5b60405163e602df0560e01b81525f6004820152602490fd5b60018060a01b03811691825f526020916010835260409060ff825f205416612764575f8052601084526126c160ff835f205416156124af565b846126f9575091815f94936126e65f80516020612d3c83398151915294600454611d45565b6004555b816004540360045551908152a3565b845f5260028452815f205490838210612733575091849391815f80516020612d3c833981519152945f9788526002855203818720556126ea565b825163391434e360e21b81526001600160a01b03919091166004820152602481019190915260448101839052606490fd5b815162461bcd60e51b815260048101859052601360248201527214d15391115497d25397d0931050d2d31254d5606a1b6044820152606490fd5b5f805260106020527f6e0956cda88cad152e89927e53611735b61a5c762d1428573c6931b0a5efcb015460ff16612841575f80516020612d3c83398151915260205f9260018060a01b0316938484526010825261280260ff604086205416156124af565b61280e81600454611d45565b6004558415841461282b5780600454036004555b604051908152a3565b8484526002825260408420818154019055612822565b60405162461bcd60e51b815260206004820152601360248201527214d15391115497d25397d0931050d2d31254d5606a1b6044820152606490fd5b60ff81146128ba5760ff811690601f82116128a8576040519161289e83611d9e565b8252602082015290565b604051632cd44ac360e21b8152600490fd5b50604051600754815f6128cc83611d66565b8083529260209060019081811690811561295657506001146128f7575b5050611ea992500382611dce565b91509260075f527fa66cc928b5edb82af9bd49922954155ab7b0942694bea4ce44661d9a8736c688935f925b82841061293e5750611ea99450505081016020015f806128e9565b85548785018301529485019486945092810192612923565b91505060209250611ea994915060ff191682840152151560051b8201015f806128e9565b60ff811461299c5760ff811690601f82116128a8576040519161289e83611d9e565b50604051600854815f6129ae83611d66565b8083529260209060019081811690811561295657506001146129d8575050611ea992500382611dce565b91509260085f527ff3f7a9fe364faab93b216da50a3214154f22a0a2b415b23a84c8169e8b636ee3935f925b828410612a1f5750611ea99450505081016020015f806128e9565b85548785018301529485019486945092810192612a04565b81516001600160a01b03909116915f91829160200182855af13d15612ae4573d67ffffffffffffffff8111611dba57612a929160405191612a826020601f19601f8401160184611dce565b82523d5f602084013e5b83612cb8565b8051908115159182612ac0575b5050612aa85750565b60249060405190635274afe760e01b82526004820152fd5b81925090602091810103126116dd57602001518015908115036116dd575f80612a9f565b612a9290606090612a8c565b91907f7fffffffffffffffffffffffffffffff5d576e7357a4501ddfe92f46681b20a08411612b72579160209360809260ff5f9560405194855216868401526040830152606082015282805260015afa15612b67575f516001600160a01b03811615612b5d57905f905f90565b505f906001905f90565b6040513d5f823e3d90fd5b5050505f9160039190565b60041115612b8757565b634e487b7160e01b5f52602160045260245ffd5b612ba481612b7d565b80612bad575050565b612bb681612b7d565b60018103612bd05760405163f645eedf60e01b8152600490fd5b612bd981612b7d565b60028103612bfa5760405163fce698f760e01b815260048101839052602490fd5b80612c06600392612b7d565b14612c0e5750565b602490604051906335e2f38360e21b82526004820152fd5b9091828202915f1984820993838086109503948086039514612cab5784831115612c9957829109815f038216809204600280826003021880830282030280830282030280830282030280830282030280830282030280920290030293600183805f03040190848311900302920304170290565b60405163227bc15360e01b8152600490fd5b505090611ea99250612590565b90612cdf5750805115612ccd57805190602001fd5b604051630a12f52160e11b8152600490fd5b81511580612d12575b612cf0575090565b604051639996b31560e01b81526001600160a01b039091166004820152602490fd5b50803b15612ce856fefbde797d201c681b91056529119e0b02407c7bb96a4a2c75c01fc9667232c8dbddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3efa2646970667358221220d37ec05dfd1df6d59ba72ba186b8759d635794cb296990adf90df7170027b32164736f6c6343000818003360c03461009157601f6102f938819003918201601f19168301916001600160401b038311848410176100955780849260409485528339810103126100915780516001600160a01b03918282168203610091576020015191821682036100915760805260a05260405161024f90816100aa8239608051818181606901526101ea015260a05181818160b601526101a90152f35b5f80fd5b634e487b7160e01b5f52604160045260245ffdfe60806040908082526004361015610014575f80fd5b5f3560e01c908163021770d5146101d8575080636c92d200146101955763f3fef3a31461003f575f80fd5b346101275780600319360112610127576001600160a01b03906004358281169081900361012757827f0000000000000000000000000000000000000000000000000000000000000000163303610151575f9260446020928451958693849263a9059cbb60e01b8452600484015260243560248401527f0000000000000000000000000000000000000000000000000000000000000000165af18015610147576100e457005b6020903d60201161013f575b601f8201601f191683019167ffffffffffffffff83118484101761012b576020928492528101031261012757518015150361012757005b5f80fd5b634e487b7160e01b5f52604160045260245ffd5b3d91506100f0565b50513d5f823e3d90fd5b815162461bcd60e51b815260206004820152601860248201527f43414e5f4f4e4c595f43414c4c45445f42595f535553445a00000000000000006044820152606490fd5b5034610127575f36600319011261012757517f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03168152602090f35b34610127575f366003190112610127577f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03168152602090f3fea2646970667358221220688b3387957a63503e35c37a30df3505fb5192d5ed5685dc9e918742b9e07c5a64736f6c63430008180033ad3228b676f7d3cd4284a5443f17f1962b36e491b30a40b2405849e597ba5fb50000000000000000000000003def017cd003f44aa7b49bdfcf95fd61cf5294cb000000000000000000000000a469b7ee9ee773642b3e93e842e5d9b5baa100670000000000000000000000000000000000000000000000000000000000278d00
Deployed Bytecode
0x6080604081815260049182361015610015575f80fd5b5f925f3560e01c918262728f7614611b515750816301e1d11414611b0d57816301ffc9a714611ab9578163022176461461195c57816306fdde03146118ad57816307a2d13a1461145d578163095ea7b3146118845781630a28a477146118665781630ba595c4146117a457816318160ddd1461178857816323b872dd1461174c578163248a9ca3146117235781632def6620146116125781632f2ff15d146115e8578163313ce567146115cc578163333e99db1461158e5781633644e5151461157157816336568abe1461152b57816338d52e0f146114e7578163402d267d1461090d57816344337ea1146114a457816345d9aece146114625781634cdad5061461145d578163537df3b61461141d57816356d73568146113e257816362190852146113c45781636e553f65146112c657816370a08231146104e45781637313ee5a146112a757816375b17350146112885781637cfb384d1461122d5781637ea5032d146112095781637ecebe00146111d157816384b0196e146110b157816391d148541461106e57816394bf804d14610f6357816395d89b4114610e7c578163a217fddf14610e61578163a9059cbb14610e30578163aaa070ca14610dd2578163aca3b71114610d18578163b2118a8d14610bc6578163b3d7f6b914610ba3578163b460af9414610a6b578163ba08765214610912578163c63d75b61461090d578163c6e6f592146102e7578163c8b2b54614610744578163ce96cb771461070a578163d0fda779146106c6578163d505accf1461055e578163d547741f1461051f578163d905777e146104e4578163dd04bb2e146104c5578163dd62ed3e14610478578163e41bd7011461030f57508063e7c2a608146102ec578063ef8b30f7146102e75763fe9e9640146102aa575f80fd5b346102e357816003193601126102e357602090517f470f4f1717679395b6a9e0700797bfeeaa970f1643e72f5684d687c0be10fe278152f35b5080fd5b611ca2565b50346102e357816003193601126102e357602090610308611e66565b9051908152f35b9190503461047457602036600319011261047457813562ffffff600a541692610339841515611cc0565b338552600260205261035861035084872054611f26565b831115611cf9565b600161036d61036684611f96565b9542611d45565b338752600f60205284872090815501610387838254611d45565b90557f0000000000000000000000005d74abb95e85cba124fb27df08994ef072b5d49b6001600160a01b0316906103bc6125ae565b6103c7831515611eac565b6103d2851515611ee9565b600c5483810390811161046157600c55331561044a5750602094506103f78433612688565b61042282827f000000000000000000000000a469b7ee9ee773642b3e93e842e5d9b5baa100676124f4565b8251918252838583015233915f80516020612d1c833981519152843392a46001805551908152f35b8351634b637e8f60e11b8152908101869052602490fd5b634e487b7160e01b875260118252602487fd5b8280fd5b5050346102e357806003193601126102e357602091610495611bcf565b8261049e611be5565b6001600160a01b03928316845260038652922091165f908152908352819020549051908152f35b5050346102e357816003193601126102e357602090600c549051908152f35b5050346102e35760203660031901126102e357602090610308610505611bcf565b6001600160a01b03165f9081526002602052604090205490565b9190503461047457806003193601126104745761055a91356105556001610544611be5565b93838752866020528620015461207f565b61243d565b5080f35b839150346102e35760e03660031901126102e35761057a611bcf565b610582611be5565b906044359260643560843560ff811681036106c2578142116106ab5760018060a01b0390818516928389526009602052898920908154916001830190558a519060208201927f6e71edae12b1b97f4d1f60370fef10105fa2faae0126114a169c64845d6126c98452868d840152858a1660608401528a608084015260a083015260c082015260c0815260e0810181811067ffffffffffffffff821117610698578b525190206106669161065d91610637612312565b908c519161190160f01b83526002830152602282015260c43591604260a4359220612af0565b90929192612b9b565b1681810361067d578661067a8787876125fb565b80f35b87516325c0072360e11b815292830152602482015260449150fd5b604187634e487b7160e01b5f525260245ffd5b875163313c898160e11b8152808401839052602490fd5b8680fd5b5050346102e357816003193601126102e357517f0000000000000000000000005d74abb95e85cba124fb27df08994ef072b5d49b6001600160a01b03168152602090f35b5050346102e35760203660031901126102e3576020916103089082906001600160a01b03610736611bcf565b168152600285522054611f26565b90503461047457602080600319360112610909578135927f470f4f1717679395b6a9e0700797bfeeaa970f1643e72f5684d687c0be10fe27805f525f8352815f20335f52835260ff825f205416156108eb575083156108aa57670de0b6b3a764000083541115610869576107b6611e66565b6108305750505080600d5542600e556107d181600c54611d45565b600c556108098130337f000000000000000000000000a469b7ee9ee773642b3e93e842e5d9b5baa100676001600160a01b0316612537565b7fd0e841f234010ad7f57b7c09faffb2245cd240429c6e8fa3cd934a0a8bf58eb08280a280f35b5162461bcd60e51b8152918201526015602482015274554e56455354494e475f49535f4e4f545f5a45524f60581b604482015260649150fd5b5162461bcd60e51b815291820152601c60248201527f4e4f545f454e4f5547485f544f54414c5f5354414b45445f5553445a00000000604482015260649150fd5b5162461bcd60e51b815291820152601760248201527f5452414e534645525f414d4f554e545f49535f5a45524f000000000000000000604482015260649150fd5b905163e2517d3f60e01b815233818501526024810191909152604490fd5b8380fd5b611bfb565b8383346102e35761092236611c6d565b94919061093662ffffff600a541615611e28565b60018060a01b039081871693848752600260205285872054808511610a36575061095f84611f26565b966109686125ae565b610973881515611eac565b61097e851515611ee9565b600c54888103908111610a2357600c55853303610a13575b85156109fd5750506109aa83602098612688565b6109d586827f000000000000000000000000a469b7ee9ee773642b3e93e842e5d9b5baa100676124f4565b8451928684528784015216905f80516020612d1c833981519152843392a46001805551908152f35b8651634b637e8f60e11b81529182015260249150fd5b610a1e85338b6120a0565b610996565b506011602492634e487b7160e01b835252fd5b8651632e52afbb60e21b81526001600160a01b038a169281019283526020830186905260408301919091529081906060010390fd5b8383346102e357610a7b36611c6d565b949190610a8f62ffffff600a541615611e28565b60018060a01b0390818716938487526002602052610aaf86882054611f26565b808511610b6e5750610ac084611f96565b96610ac96125ae565b610ad4851515611eac565b610adf881515611ee9565b600c54858103908111610a2357600c55853303610b5e575b85156109fd575050610b0b86602098612688565b610b3683827f000000000000000000000000a469b7ee9ee773642b3e93e842e5d9b5baa100676124f4565b8451928352858784015216905f80516020612d1c833981519152843392a46001805551908152f35b610b6988338b6120a0565b610af7565b8651633fa733bb60e21b81526001600160a01b038a169281019283526020830186905260408301919091529081906060010390fd5b828434610bc3576020366003190112610bc3575061030860209235611f5e565b80fd5b839150346102e35760603660031901126102e3576001600160a01b0390803582811691828203610d1457610bf8611be5565b9260443594610c05612006565b7f000000000000000000000000a469b7ee9ee773642b3e93e842e5d9b5baa10067168114610c3b575b505061067a9394506124f4565b60206024918851928380926370a0823160e01b825230878301525afa908115610d0a578691610cd4575b50600c548103908111610cc1578411610c7e5780610c2e565b606490602087519162461bcd60e51b8352820152601f60248201527f5553445a5f5245534355455f414d4f554e545f4558434545445f4445424954006044820152fd5b634e487b7160e01b865260118252602486fd5b90506020813d602011610d02575b81610cef60209383611dce565b81010312610cfe575187610c65565b8580fd5b3d9150610ce2565b87513d88823e3d90fd5b8480fd5b9050346104745760203660031901126104745780359162ffffff831680930361090957610d43612006565b6276a700831015610d855750508062ffffff19600a541617600a557fba527850cebcf4242dd68f21779c47243e6d13eea42a0271d5e1e2f9cfb67cdf8280a280f35b906020608492519162461bcd60e51b8352820152602160248201527f53484f554c445f42455f4c4553535f5448414e5f4d41585f43445f504552494f6044820152601160fa1b6064820152fd5b5050346102e357610de236611c20565b9190610dec612006565b835b838110610df9578480f35b6001906001600160a01b03610e17610e12838887611df0565b611e14565b1686526010602052838620805460ff1916905501610dee565b5050346102e357806003193601126102e357602090610e5a610e50611bcf565b602435903361216d565b5160018152f35b5050346102e357816003193601126102e35751908152602090f35b828434610bc35780600319360112610bc3575080516006549091825f610ea184611d66565b808352602094600190866001821691825f14610f41575050600114610ee6575b5050610ee29291610ed3910385611dce565b51928284938452830190611b6b565b0390f35b9085925060065f527ff652222313e28459528d920b65115c16c04f3efc82aaedc97be59f3f377c0d3f915f925b828410610f295750505082010181610ed3610ec1565b8054848a018601528895508794909301928101610f13565b60ff19168682015292151560051b85019092019250839150610ed39050610ec1565b91905034610474578060031936011261047457813592610f81611be5565b93610f8b81611f5e565b93610f946125ae565b610f9f851515611eac565b610faa821515611ee9565b6001600160a01b038616808452601060205284842054909390610fd09060ff16156124af565b610ffc8630337f000000000000000000000000a469b7ee9ee773642b3e93e842e5d9b5baa10067612537565b83156110585750506110108160209661279e565b825190848252858201527fdcbc1c05240f31ff3ad067ef1ee35ce4997762752e3a095284754544f4c709d7833392a361104b82600c54611d45565b600c556001805551908152f35b845163ec442f0560e01b81529182015260249150fd5b9050346104745781600319360112610474578160209361108c611be5565b92358152808552209060018060a01b03165f52825260ff815f20541690519015158152f35b919050346104745782600319360112610474576110ed7f735553447a00000000000000000000000000000000000000000000000000000561287c565b926111177f310000000000000000000000000000000000000000000000000000000000000161297a565b90825192602092602085019585871067ffffffffffffffff8811176111be5750926020611174838896611167998b9996528686528151998a99600f60f81b8b5260e0868c015260e08b0190611b6b565b91898303908a0152611b6b565b924660608801523060808801528460a088015286840360c088015251928381520193925b8281106111a757505050500390f35b835185528695509381019392810192600101611198565b604190634e487b7160e01b5f525260245ffd5b5050346102e35760203660031901126102e35760209181906001600160a01b036111f9611bcf565b1681526009845220549051908152f35b5050346102e357816003193601126102e35760209062ffffff600a54169051908152f35b5050346102e35761123d36611c20565b9190611247612006565b835b838110611254578480f35b6001906001600160a01b0361126d610e12838887611df0565b1686526010602052838620805460ff19168317905501611249565b5050346102e357816003193601126102e357602090600e549051908152f35b5050346102e357816003193601126102e357602090600b549051908152f35b90508234610bc35782600319360112610bc3578135906112e4611be5565b6112ed83611fce565b936112f66125ae565b611301841515611eac565b61130c851515611ee9565b6001600160a01b0382168084526010602052868420549093906113329060ff16156124af565b61135e8530337f000000000000000000000000a469b7ee9ee773642b3e93e842e5d9b5baa10067612537565b83156113ae576020868861104b8888611377858a61279e565b835182815285878201527fdcbc1c05240f31ff3ad067ef1ee35ce4997762752e3a095284754544f4c709d7853392a3600c54611d45565b865163ec442f0560e01b81529182015260249150fd5b5050346102e357816003193601126102e357602090516276a7008152f35b5050346102e357816003193601126102e357602090517f6077685936c8169d09204a1d97db12e41713588c38e1d29a61867d3dcee98aff8152f35b5050346102e35760203660031901126102e357611438611bcf565b611440612006565b6001600160a01b0316825260106020528120805460ff1916905580f35b611ba9565b5050346102e35760203660031901126102e3579081906001600160a01b03611488611bcf565b168152600f602052206001815491015482519182526020820152f35b5050346102e35760203660031901126102e3576114bf611bcf565b6114c7612006565b6001600160a01b0316825260106020528120805460ff1916600117905580f35b5050346102e357816003193601126102e357517f000000000000000000000000a469b7ee9ee773642b3e93e842e5d9b5baa100676001600160a01b03168152602090f35b8383346102e357806003193601126102e357611545611be5565b90336001600160a01b03831603611562575061055a91923561243d565b5163334bd91960e11b81528390fd5b5050346102e357816003193601126102e357602090610308612312565b5050346102e35760203660031901126102e35760209160ff9082906001600160a01b036115b9611bcf565b1681526010855220541690519015158152f35b5050346102e357816003193601126102e3576020905160128152f35b9190503461047457806003193601126104745761055a913561160d6001610544611be5565b612296565b919050346116dd575f3660031901126116dd57335f52600f602052805f209182544210801590611714575b156116e1576001830180545f948590559390557f0000000000000000000000005d74abb95e85cba124fb27df08994ef072b5d49b6001600160a01b0316803b156116dd57825163f3fef3a360e01b8152338382019081526020810195909552935f91859182908490829060400103925af180156116d3576116bc578380f35b9091925067ffffffffffffffff83116111be575052005b82513d5f823e3d90fd5b5f80fd5b6020606492519162461bcd60e51b8352820152600e60248201526d155394d51052d157d1905253115160921b6044820152fd5b5062ffffff600a54161561163d565b82346116dd5760203660031901126116dd57602091355f525f82526001815f2001549051908152f35b82346116dd5760603660031901126116dd57602090610e5a61176c611bcf565b611774611be5565b604435916117838333836120a0565b61216d565b82346116dd575f3660031901126116dd57602091549051908152f35b9050346116dd5760203660031901126116dd578035916117c2612006565b8215158061185c575b156117fb578280600b557f2f847163bc3888f61ddc9b405dc655d9cc509f5518194a06263f0ad3c090df965f80a2005b906020608492519162461bcd60e51b8352820152603560248201527f53484f554c445f42455f4c4553535f5448414e5f55494e543235365f4d41585f604482015274414e445f475245415445525f5448414e5f5a45524f60581b6064820152fd5b505f1983106117cb565b82346116dd5760203660031901126116dd5761030860209235611f96565b82346116dd57806003193601126116dd57602090610e5a6118a3611bcf565b60243590336125fb565b82346116dd575f3660031901126116dd5780516005549091825f6118d084611d66565b808352602094600190866001821691825f14610f41575050600114611901575050610ee29291610ed3910385611dce565b9085925060055f527f036b6384b5eca791c62761152d0c79bb0604c104a5fb6f4eb0703f3154bb3db0915f925b8284106119445750505082010181610ed3610ec1565b8054848a01860152889550879490930192810161192e565b82346116dd5760203660031901126116dd57600a5462ffffff16908235611984831515611cc0565b335f9081526002602052604090205461199f90821115611cf9565b60016119b46119ad83611f26565b9442611d45565b335f52600f602052835f20908155016119ce848254611d45565b90557f0000000000000000000000005d74abb95e85cba124fb27df08994ef072b5d49b6001600160a01b031693611a036125ae565b611a0e841515611eac565b611a19821515611ee9565b600c54848103908111611aa657600c553315611a905750602093611a3d8233612688565b611a6884827f000000000000000000000000a469b7ee9ee773642b3e93e842e5d9b5baa100676124f4565b8251918483528583015233915f80516020612d1c833981519152843392a46001805551908152f35b6024905f845191634b637e8f60e11b8352820152fd5b601182634e487b7160e01b5f525260245ffd5b9050346116dd5760203660031901126116dd573563ffffffff60e01b81168091036116dd57602091637965db0b60e01b8214918215611afc575b50519015158152f35b6301ffc9a760e01b14915083611af3565b82346116dd575f3660031901126116dd57611b26611e66565b90600c54918203918211611b3e576020925051908152f35b601183634e487b7160e01b5f525260245ffd5b346116dd575f3660031901126116dd57602090600d548152f35b91908251928382525f5b848110611b95575050825f602080949584010152601f8019910116010190565b602081830181015184830182015201611b75565b346116dd5760203660031901126116dd576020611bc7600435611f26565b604051908152f35b600435906001600160a01b03821682036116dd57565b602435906001600160a01b03821682036116dd57565b346116dd5760203660031901126116dd57611c14611bcf565b5060206040515f198152f35b9060206003198301126116dd5760043567ffffffffffffffff928382116116dd57806023830112156116dd5781600401359384116116dd5760248460051b830101116116dd576024019190565b60609060031901126116dd57600435906001600160a01b039060243582811681036116dd579160443590811681036116dd5790565b346116dd5760203660031901126116dd576020611bc7600435611fce565b15611cc757565b60405162461bcd60e51b815260206004820152600a60248201526921a22fa6a7a222afa7a760b11b6044820152606490fd5b15611d0057565b60405162461bcd60e51b815260206004820152601860248201527f57495448445241575f414d4f554e545f455843454544454400000000000000006044820152606490fd5b91908201809211611d5257565b634e487b7160e01b5f52601160045260245ffd5b90600182811c92168015611d94575b6020831014611d8057565b634e487b7160e01b5f52602260045260245ffd5b91607f1691611d75565b6040810190811067ffffffffffffffff821117611dba57604052565b634e487b7160e01b5f52604160045260245ffd5b90601f8019910116810190811067ffffffffffffffff821117611dba57604052565b9190811015611e005760051b0190565b634e487b7160e01b5f52603260045260245ffd5b356001600160a01b03811681036116dd5790565b15611e2f57565b60405162461bcd60e51b815260206004820152600f60248201526e22a9219a1b191b2fa6a7a222afa7a760891b6044820152606490fd5b600e544203428111611d5257600b54808210611e825750505f90565b81810391818311611d5257600d54808402938404149082141715611d5257611ea991612590565b90565b15611eb357565b60405162461bcd60e51b815260206004820152600e60248201526d4153534554535f49535f5a45524f60901b6044820152606490fd5b15611ef057565b60405162461bcd60e51b815260206004820152600e60248201526d5348415245535f49535f5a45524f60901b6044820152606490fd5b611f2e611e66565b600c54908103908111611d525760018101809111611d52576004549060018201809211611d5257611ea992612c26565b611f66611e66565b600c54908103908111611d525760018101809111611d52576004549060018201809211611d5257611ea9926125d1565b60045460018101809111611d5257611fac611e66565b90600c54918203918211611d525760018201809211611d5257611ea9926125d1565b60045460018101809111611d5257611fe4611e66565b90600c54918203918211611d525760018201809211611d5257611ea992612c26565b335f9081527f729ef9451dd492832bd2a98139702ced95dfa0cec7e99526dbbcb957abcbc47660205260409020547f6077685936c8169d09204a1d97db12e41713588c38e1d29a61867d3dcee98aff9060ff16156120615750565b6044906040519063e2517d3f60e01b82523360048301526024820152fd5b805f525f60205260405f20335f5260205260ff60405f205416156120615750565b919060018060a01b0380931692835f526003602052604093845f2091831691825f52602052845f2054925f1984036120db575b505050505050565b84841061213d5750801561212657811561210f575f526003602052835f20905f5260205203905f20555f80808080806120d3565b8451634a1406b160e11b81525f6004820152602490fd5b845163e602df0560e01b81525f6004820152602490fd5b8551637dc7a0d960e11b81526001600160a01b039190911660048201526024810184905260448101859052606490fd5b9291906001600160a01b0380851691821561227e571691821561226657815f5260209060108252604060ff815f20541661222d57845f52601083526121b860ff825f205416156124af565b835f5260028352805f2054968288106121fe575081849596975f80516020612d3c833981519152955f526002855203815f2055855f52805f2082815401905551908152a3565b905163391434e360e21b81526001600160a01b0390911660048201526024810187905260448101829052606490fd5b5162461bcd60e51b815260048101839052601360248201527214d15391115497d25397d0931050d2d31254d5606a1b6044820152606490fd5b60405163ec442f0560e01b81525f6004820152602490fd5b604051634b637e8f60e11b81525f6004820152602490fd5b90815f525f60205260405f209060018060a01b031690815f5260205260ff60405f205416155f1461230c57815f525f60205260405f20815f5260205260405f20600160ff1982541617905533917f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d5f80a4600190565b50505f90565b307f000000000000000000000000547213367cfb08ab418e7b54d7883b2c2aa27fd76001600160a01b03161480612414575b1561236d577ffa600f9fe157b49823151c7f071a53e2050fcbaa921bcdd9460801e7fd441f0590565b60405160208101907f8b73c3c69bb8fe3d512ecc4cf759cc79239f7b179b0ffacaa9a75d522b39400f82527f9b4a1562748b56fd67440df6b71461078eae626fc4a7f4ed43c740c7f9ee012460408201527fc89efdaa54c0f20c7adf612882df0950f5a951637e0307cdcb4c672f298b8bc660608201524660808201523060a082015260a0815260c0810181811067ffffffffffffffff821117611dba5760405251902090565b507f00000000000000000000000000000000000000000000000000000000000000014614612344565b90815f525f60205260405f209060018060a01b031690815f5260205260ff60405f2054165f1461230c57815f525f60205260405f20815f5260205260405f2060ff19815416905533917ff6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b5f80a4600190565b156124b657565b60405162461bcd60e51b8152602060048201526016602482015275149150d2541251539517d25397d0931050d2d31254d560521b6044820152606490fd5b60405163a9059cbb60e01b60208201526001600160a01b0392909216602483015260448083019390935291815261253591612530606483611dce565b612a37565b565b6040516323b872dd60e01b60208201526001600160a01b03928316602482015292909116604483015260648083019390935291815260a081019181831067ffffffffffffffff841117611dba5761253592604052612a37565b811561259a570490565b634e487b7160e01b5f52601260045260245ffd5b6002600154146125bf576002600155565b604051633ee5aeb560e01b8152600490fd5b91906125de828285612c26565b92821561259a57096125ed5790565b60018101809111611d525790565b6001600160a01b0390811691821561267057169182156126585760207f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92591835f526003825260405f20855f5282528060405f2055604051908152a3565b604051634a1406b160e11b81525f6004820152602490fd5b60405163e602df0560e01b81525f6004820152602490fd5b60018060a01b03811691825f526020916010835260409060ff825f205416612764575f8052601084526126c160ff835f205416156124af565b846126f9575091815f94936126e65f80516020612d3c83398151915294600454611d45565b6004555b816004540360045551908152a3565b845f5260028452815f205490838210612733575091849391815f80516020612d3c833981519152945f9788526002855203818720556126ea565b825163391434e360e21b81526001600160a01b03919091166004820152602481019190915260448101839052606490fd5b815162461bcd60e51b815260048101859052601360248201527214d15391115497d25397d0931050d2d31254d5606a1b6044820152606490fd5b5f805260106020527f6e0956cda88cad152e89927e53611735b61a5c762d1428573c6931b0a5efcb015460ff16612841575f80516020612d3c83398151915260205f9260018060a01b0316938484526010825261280260ff604086205416156124af565b61280e81600454611d45565b6004558415841461282b5780600454036004555b604051908152a3565b8484526002825260408420818154019055612822565b60405162461bcd60e51b815260206004820152601360248201527214d15391115497d25397d0931050d2d31254d5606a1b6044820152606490fd5b60ff81146128ba5760ff811690601f82116128a8576040519161289e83611d9e565b8252602082015290565b604051632cd44ac360e21b8152600490fd5b50604051600754815f6128cc83611d66565b8083529260209060019081811690811561295657506001146128f7575b5050611ea992500382611dce565b91509260075f527fa66cc928b5edb82af9bd49922954155ab7b0942694bea4ce44661d9a8736c688935f925b82841061293e5750611ea99450505081016020015f806128e9565b85548785018301529485019486945092810192612923565b91505060209250611ea994915060ff191682840152151560051b8201015f806128e9565b60ff811461299c5760ff811690601f82116128a8576040519161289e83611d9e565b50604051600854815f6129ae83611d66565b8083529260209060019081811690811561295657506001146129d8575050611ea992500382611dce565b91509260085f527ff3f7a9fe364faab93b216da50a3214154f22a0a2b415b23a84c8169e8b636ee3935f925b828410612a1f5750611ea99450505081016020015f806128e9565b85548785018301529485019486945092810192612a04565b81516001600160a01b03909116915f91829160200182855af13d15612ae4573d67ffffffffffffffff8111611dba57612a929160405191612a826020601f19601f8401160184611dce565b82523d5f602084013e5b83612cb8565b8051908115159182612ac0575b5050612aa85750565b60249060405190635274afe760e01b82526004820152fd5b81925090602091810103126116dd57602001518015908115036116dd575f80612a9f565b612a9290606090612a8c565b91907f7fffffffffffffffffffffffffffffff5d576e7357a4501ddfe92f46681b20a08411612b72579160209360809260ff5f9560405194855216868401526040830152606082015282805260015afa15612b67575f516001600160a01b03811615612b5d57905f905f90565b505f906001905f90565b6040513d5f823e3d90fd5b5050505f9160039190565b60041115612b8757565b634e487b7160e01b5f52602160045260245ffd5b612ba481612b7d565b80612bad575050565b612bb681612b7d565b60018103612bd05760405163f645eedf60e01b8152600490fd5b612bd981612b7d565b60028103612bfa5760405163fce698f760e01b815260048101839052602490fd5b80612c06600392612b7d565b14612c0e5750565b602490604051906335e2f38360e21b82526004820152fd5b9091828202915f1984820993838086109503948086039514612cab5784831115612c9957829109815f038216809204600280826003021880830282030280830282030280830282030280830282030280830282030280920290030293600183805f03040190848311900302920304170290565b60405163227bc15360e01b8152600490fd5b505090611ea99250612590565b90612cdf5750805115612ccd57805190602001fd5b604051630a12f52160e11b8152600490fd5b81511580612d12575b612cf0575090565b604051639996b31560e01b81526001600160a01b039091166004820152602490fd5b50803b15612ce856fefbde797d201c681b91056529119e0b02407c7bb96a4a2c75c01fc9667232c8dbddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3efa2646970667358221220d37ec05dfd1df6d59ba72ba186b8759d635794cb296990adf90df7170027b32164736f6c63430008180033
Constructor Arguments (ABI-Encoded and is the last bytes of the Contract Creation Code above)
0000000000000000000000003def017cd003f44aa7b49bdfcf95fd61cf5294cb000000000000000000000000a469b7ee9ee773642b3e93e842e5d9b5baa100670000000000000000000000000000000000000000000000000000000000278d00
-----Decoded View---------------
Arg [0] : _admin (address): 0x3deF017cd003f44aa7b49BdFcF95fD61cF5294Cb
Arg [1] : _asset (address): 0xA469B7Ee9ee773642b3e93E842e5D9b5BaA10067
Arg [2] : _CDPeriod (uint24): 2592000
-----Encoded View---------------
3 Constructor Arguments found :
Arg [0] : 0000000000000000000000003def017cd003f44aa7b49bdfcf95fd61cf5294cb
Arg [1] : 000000000000000000000000a469b7ee9ee773642b3e93e842e5d9b5baa10067
Arg [2] : 0000000000000000000000000000000000000000000000000000000000278d00
Loading...
Loading
Loading...
Loading
[ Download: CSV Export ]
[ Download: CSV Export ]
A token is a representation of an on-chain or off-chain asset. The token page shows information such as price, total supply, holders, transfers and social links. Learn more about this page in our Knowledge Base.