ERC-20
Overview
Max Total Supply
11.448761961394733788 Hedgehog
Holders
69
Total Transfers
-
Market
Onchain Market Cap
$0.00
Circulating Supply Market Cap
-
Other Info
Token Contract (WITH 18 Decimals)
Loading...
Loading
Loading...
Loading
Loading...
Loading
# | Exchange | Pair | Price | 24H Volume | % Volume |
---|
Contract Name:
Vault
Compiler Version
v0.8.4+commit.c7e474f2
Optimization Enabled:
No with 200 runs
Other Settings:
default evmVersion
Contract Source Code (Solidity Standard Json-Input format)
// SPDX-License-Identifier: Unlicense pragma solidity =0.8.4; pragma abicoder v2; import {ReentrancyGuard} from "@openzeppelin/contracts/security/ReentrancyGuard.sol"; import {ERC20} from "@openzeppelin/contracts/token/ERC20/ERC20.sol"; import {IERC20} from "@openzeppelin/contracts/token/ERC20/IERC20.sol"; import {SafeERC20} from "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol"; import {IVault} from "../interfaces/IVault.sol"; import {IVaultMath} from "../interfaces/IVaultMath.sol"; import {IVaultTreasury} from "../interfaces/IVaultTreasury.sol"; import {IVaultStorage} from "../interfaces/IVaultStorage.sol"; import {SharedEvents} from "../libraries/SharedEvents.sol"; import {Constants} from "../libraries/Constants.sol"; import {PRBMathUD60x18} from "../libraries/math/PRBMathUD60x18.sol"; import {Faucet} from "../libraries/Faucet.sol"; import {VaultAuction} from "./VaultAuction.sol"; /** * Error * C0: Paused * C1: Amount ETH min * C2: Amount USDC min * C3: Amount oSQTH min * C4: Cap is reached * C5: Shares to withdraw is zero * C6: No liquidity * C7: Amount of ETH is smaller when amountEthMin * C8: Amount of USDC is smaller when amountUsdcMin * C9: Amount of OSQTH is smaller when amountOsqthMin * C10: Time rebalance not allowed * C11: Price rebalance not allowed * C12: Not a vault or auction * C13: Not a vault math * C14: Not a contracts * C15: Not a governance * C16: Zero amount * C17: Wrong address * C18: Int overflow * C19: Max TWAP Deviation * C20: Wrong pool * C21: Less than the minimum in rebalancing * C22: Not a keeper */ contract Vault is IVault, ERC20, ReentrancyGuard, Faucet { using PRBMathUD60x18 for uint256; using SafeERC20 for IERC20; /** * @notice strategy constructor */ constructor() ERC20("Liqui Hedgehog ", "Hedgehog") {} /** @notice deposit tokens in proportion to the vault's holding @param amountEth ETH amount to deposit @param amountUsdc USDC amount to deposit @param amountOsqth oSQTH amount to deposit @param to receiver address @param amountEthMin revert if resulting amount of ETH is smaller than this @param amountUsdcMin revert if resulting amount of USDC is smaller than this @param amountOsqthMin revert if resulting amount of oSQTH is smaller than this @return shares minted shares */ function deposit( uint256 amountEth, uint256 amountUsdc, uint256 amountOsqth, address to, uint256 amountEthMin, uint256 amountUsdcMin, uint256 amountOsqthMin ) external override nonReentrant notPaused returns (uint256) { require(amountEth > 0, "C16"); require(to != address(0) && to != address(this), "C17"); //Poke positions so vault's current holdings are up to date IVaultTreasury(vaultTreasury).pokePools(); uint256 _totalSupply = totalSupply(); if (_totalSupply == 0) { (uint256 ethPrice, ) = IVaultMath(vaultMath).getPrices(); IVaultStorage(vaultStorage).setParamsBeforeDeposit( block.timestamp, IVaultMath(vaultMath).getIV(), ethPrice ); } //Calculate shares to mint (uint256 _shares, uint256 _amountEth, uint256 _amountUsdc, uint256 _amountOsqth) = calcSharesAndAmounts( amountEth, amountUsdc, amountOsqth, _totalSupply, false ); require(_amountEth >= amountEthMin, "C1"); require(_amountUsdc >= amountUsdcMin, "C2"); require(_amountOsqth >= amountOsqthMin, "C3"); //Pull in tokens if (_amountEth > 0) Constants.weth.transferFrom(msg.sender, vaultTreasury, _amountEth); if (_amountUsdc > 0) Constants.usdc.transferFrom(msg.sender, vaultTreasury, _amountUsdc); if (_amountOsqth > 0) Constants.osqth.transferFrom(msg.sender, vaultTreasury, _amountOsqth); //Mint shares to user _mint(to, _shares); //Check deposit cap require(totalSupply() <= IVaultStorage(vaultStorage).cap(), "C4"); IVaultStorage(vaultStorage).setDepositCount(IVaultStorage(vaultStorage).depositCount() + 1); emit SharedEvents.Deposit(to, _shares); return _shares; } /** @notice withdraws tokens in proportion to the vault's holdings. @dev provide strategy tokens, returns set of wETH, USDC, and oSQTH @param shares shares burned by sender @param amountEthMin revert if resulting amount of wETH is smaller than this @param amountUsdcMin revert if resulting amount of USDC is smaller than this @param amountOsqthMin revert if resulting amount of oSQTH is smaller than this */ function withdraw( uint256 shares, uint256 amountEthMin, uint256 amountUsdcMin, uint256 amountOsqthMin ) external override nonReentrant { require(shares > 0, "C5"); uint256 _totalSupply = totalSupply(); //Burn shares _burn(msg.sender, shares); uint256 ratio = shares.div(_totalSupply); //poke pools to update fees IVaultTreasury(vaultTreasury).pokePools(); uint256 amountEth; uint256 amountUsdc; uint256 amountOsqth; if (IVaultStorage(vaultStorage).depositCount() == 0) { //if there were no deposits after rebalance auction -> burn share of the liquidity belonged to the user uint256 amountEth0; (amountUsdc, amountEth0) = IVaultMath(vaultMath).burnLiquidityShare( Constants.poolEthUsdc, IVaultStorage(vaultStorage).orderEthUsdcLower(), IVaultStorage(vaultStorage).orderEthUsdcUpper(), ratio ); uint256 amountEth1; (amountEth1, amountOsqth) = IVaultMath(vaultMath).burnLiquidityShare( Constants.poolEthOsqth, IVaultStorage(vaultStorage).orderOsqthEthLower(), IVaultStorage(vaultStorage).orderOsqthEthUpper(), ratio ); amountEth = amountEth0 + amountEth1; } else { //if there were some deposits -> burn liquidity and match it with tokens that weren't provided to the pool yet uint256 bETH = (_getBalance(Constants.weth).sub(IVaultStorage(vaultStorage).accruedFeesEth())).mul(ratio); uint256 bUSDC = (_getBalance(Constants.usdc).sub(IVaultStorage(vaultStorage).accruedFeesUsdc())).mul(ratio); uint256 bOSQTH = (_getBalance(Constants.osqth).sub(IVaultStorage(vaultStorage).accruedFeesOsqth())).mul( ratio ); uint256 amountEth0; (amountUsdc, amountEth0) = IVaultMath(vaultMath).burnLiquidityShare( Constants.poolEthUsdc, IVaultStorage(vaultStorage).orderEthUsdcLower(), IVaultStorage(vaultStorage).orderEthUsdcUpper(), ratio ); uint256 amountEth1; (amountEth1, amountOsqth) = IVaultMath(vaultMath).burnLiquidityShare( Constants.poolEthOsqth, IVaultStorage(vaultStorage).orderOsqthEthLower(), IVaultStorage(vaultStorage).orderOsqthEthUpper(), ratio ); amountEth = amountEth0.add(amountEth1).add(bETH); amountUsdc = amountUsdc.add(bUSDC); amountOsqth = amountOsqth.add(bOSQTH); } require(amountEth != 0 || amountUsdc != 0 || amountOsqth != 0, "C6"); require(amountEth >= amountEthMin, "C7"); require(amountUsdc >= amountUsdcMin, "C8"); require(amountOsqth >= amountOsqthMin, "C9"); //send tokens to user if (amountEth > 0) IVaultTreasury(vaultTreasury).transfer(Constants.weth, msg.sender, amountEth); if (amountUsdc > 0) IVaultTreasury(vaultTreasury).transfer(Constants.usdc, msg.sender, amountUsdc); if (amountOsqth > 0) IVaultTreasury(vaultTreasury).transfer(Constants.osqth, msg.sender, amountOsqth); emit SharedEvents.Withdraw(msg.sender, shares, amountEth, amountUsdc, amountOsqth); } /** * @notice Used to collect accumulated protocol fees. * @param amountEth amount of wETH to withdraw * @param amountUsdc amount of USDC to withdraw * @param amountOsqth amount of oSQTH to withdraw * @param to recipient address */ function collectProtocol( uint256 amountEth, uint256 amountUsdc, uint256 amountOsqth, address to ) external nonReentrant onlyGovernance { IVaultStorage(vaultStorage).updateAccruedFees(amountEth, amountUsdc, amountOsqth); if (amountUsdc > 0) IVaultTreasury(vaultTreasury).transfer(Constants.usdc, to, amountUsdc); if (amountEth > 0) IVaultTreasury(vaultTreasury).transfer(Constants.weth, to, amountEth); if (amountOsqth > 0) IVaultTreasury(vaultTreasury).transfer(Constants.osqth, to, amountOsqth); } /** * @notice Calculate shares and token amounts for deposit * @param _amountEth desired amount of wETH to deposit * @param _amountUsdc desired amount of USDC to deposit * @param _amountOsqth desired amount of oSQTH to deposit * @return shares to mint * @return ethToDeposit required amount of wETH to deposit * @return usdcToDeposit required amount of USDC to deposit * @return osqthToDeposit required amount of oSQTH to deposit */ function calcSharesAndAmounts( uint256 _amountEth, uint256 _amountUsdc, uint256 _amountOsqth, uint256 _totalSupply, bool _isFlash ) public view override returns ( uint256 shares, uint256 ethToDeposit, uint256 usdcToDeposit, uint256 osqthToDeposit ) { //Get current prices (uint256 ethUsdcPrice, uint256 osqthEthPrice) = IVaultMath(vaultMath).getPrices(); uint256 depositorValue = _isFlash ? _amountEth : IVaultMath(vaultMath).getValue(_amountEth, _amountUsdc, _amountOsqth, ethUsdcPrice, osqthEthPrice); if (_totalSupply == 0) { //deposit in a 50% eth, 25% usdc, and 25% osqth proportion shares = depositorValue; ethToDeposit = depositorValue.mul(5e17); usdcToDeposit = depositorValue.mul(25e16).mul(ethUsdcPrice).div(uint256(1e30)); osqthToDeposit = depositorValue.mul(25e16).div(osqthEthPrice); } else { //Get total amounts of token balances (uint256 ethAmount, uint256 usdcAmount, uint256 osqthAmount) = IVaultMath(vaultMath).getTotalAmounts(); uint256 ratio; { uint256 totalValue = IVaultMath(vaultMath).getValue( ethAmount, usdcAmount, osqthAmount, ethUsdcPrice, osqthEthPrice ); ratio = depositorValue.div(totalValue); uint256 sharePrice = totalValue.div(_totalSupply); shares = depositorValue.div(sharePrice); } ethToDeposit = ethAmount.mul(ratio); usdcToDeposit = usdcAmount.mul(ratio); osqthToDeposit = osqthAmount.mul(ratio); } } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (security/ReentrancyGuard.sol) pragma solidity ^0.8.0; /** * @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; 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() { // On the first call to nonReentrant, _notEntered will be true require(_status != _ENTERED, "ReentrancyGuard: reentrant call"); // Any calls to nonReentrant after this point will fail _status = _ENTERED; _; // By storing the original value once again, a refund is triggered (see // https://eips.ethereum.org/EIPS/eip-2200) _status = _NOT_ENTERED; } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.5.0) (token/ERC20/ERC20.sol) pragma solidity ^0.8.0; import "./IERC20.sol"; import "./extensions/IERC20Metadata.sol"; import "../../utils/Context.sol"; /** * @dev Implementation of the {IERC20} interface. * * This implementation is agnostic to the way tokens are created. This means * that a supply mechanism has to be added in a derived contract using {_mint}. * For a generic mechanism see {ERC20PresetMinterPauser}. * * TIP: For a detailed writeup see our guide * https://forum.zeppelin.solutions/t/how-to-implement-erc20-supply-mechanisms/226[How * to implement supply mechanisms]. * * We have followed general OpenZeppelin Contracts guidelines: functions revert * instead returning `false` on failure. This behavior is nonetheless * conventional and does not conflict with the expectations of ERC20 * applications. * * Additionally, an {Approval} event is emitted on calls to {transferFrom}. * This allows applications to reconstruct the allowance for all accounts just * by listening to said events. Other implementations of the EIP may not emit * these events, as it isn't required by the specification. * * Finally, the non-standard {decreaseAllowance} and {increaseAllowance} * functions have been added to mitigate the well-known issues around setting * allowances. See {IERC20-approve}. */ contract ERC20 is Context, IERC20, IERC20Metadata { mapping(address => uint256) private _balances; mapping(address => mapping(address => uint256)) private _allowances; uint256 private _totalSupply; string private _name; string private _symbol; /** * @dev Sets the values for {name} and {symbol}. * * The default value of {decimals} is 18. To select a different value for * {decimals} you should overload it. * * All two of these values are immutable: they can only be set once during * construction. */ constructor(string memory name_, string memory symbol_) { _name = name_; _symbol = symbol_; } /** * @dev Returns the name of the token. */ function name() public view virtual override returns (string memory) { return _name; } /** * @dev Returns the symbol of the token, usually a shorter version of the * name. */ function symbol() public view virtual override returns (string memory) { return _symbol; } /** * @dev Returns the number of decimals used to get its user representation. * For example, if `decimals` equals `2`, a balance of `505` tokens should * be displayed to a user as `5.05` (`505 / 10 ** 2`). * * Tokens usually opt for a value of 18, imitating the relationship between * Ether and Wei. This is the value {ERC20} uses, unless this function is * overridden; * * NOTE: This information is only used for _display_ purposes: it in * no way affects any of the arithmetic of the contract, including * {IERC20-balanceOf} and {IERC20-transfer}. */ function decimals() public view virtual override returns (uint8) { return 18; } /** * @dev See {IERC20-totalSupply}. */ function totalSupply() public view virtual override returns (uint256) { return _totalSupply; } /** * @dev See {IERC20-balanceOf}. */ function balanceOf(address account) public view virtual override returns (uint256) { return _balances[account]; } /** * @dev See {IERC20-transfer}. * * Requirements: * * - `to` cannot be the zero address. * - the caller must have a balance of at least `amount`. */ function transfer(address to, uint256 amount) public virtual override returns (bool) { address owner = _msgSender(); _transfer(owner, to, amount); return true; } /** * @dev See {IERC20-allowance}. */ function allowance(address owner, address spender) public view virtual override returns (uint256) { return _allowances[owner][spender]; } /** * @dev See {IERC20-approve}. * * NOTE: If `amount` is the maximum `uint256`, the allowance is not updated on * `transferFrom`. This is semantically equivalent to an infinite approval. * * Requirements: * * - `spender` cannot be the zero address. */ function approve(address spender, uint256 amount) public virtual override returns (bool) { address owner = _msgSender(); _approve(owner, spender, amount); return true; } /** * @dev See {IERC20-transferFrom}. * * Emits an {Approval} event indicating the updated allowance. This is not * required by the EIP. See the note at the beginning of {ERC20}. * * NOTE: Does not update the allowance if the current allowance * is the maximum `uint256`. * * Requirements: * * - `from` and `to` cannot be the zero address. * - `from` must have a balance of at least `amount`. * - the caller must have allowance for ``from``'s tokens of at least * `amount`. */ function transferFrom( address from, address to, uint256 amount ) public virtual override returns (bool) { address spender = _msgSender(); _spendAllowance(from, spender, amount); _transfer(from, to, amount); return true; } /** * @dev Atomically increases the allowance granted to `spender` by the caller. * * This is an alternative to {approve} that can be used as a mitigation for * problems described in {IERC20-approve}. * * Emits an {Approval} event indicating the updated allowance. * * Requirements: * * - `spender` cannot be the zero address. */ function increaseAllowance(address spender, uint256 addedValue) public virtual returns (bool) { address owner = _msgSender(); _approve(owner, spender, _allowances[owner][spender] + addedValue); return true; } /** * @dev Atomically decreases the allowance granted to `spender` by the caller. * * This is an alternative to {approve} that can be used as a mitigation for * problems described in {IERC20-approve}. * * Emits an {Approval} event indicating the updated allowance. * * Requirements: * * - `spender` cannot be the zero address. * - `spender` must have allowance for the caller of at least * `subtractedValue`. */ function decreaseAllowance(address spender, uint256 subtractedValue) public virtual returns (bool) { address owner = _msgSender(); uint256 currentAllowance = _allowances[owner][spender]; require(currentAllowance >= subtractedValue, "ERC20: decreased allowance below zero"); unchecked { _approve(owner, spender, currentAllowance - subtractedValue); } return true; } /** * @dev Moves `amount` of tokens from `sender` to `recipient`. * * This internal function is equivalent to {transfer}, and can be used to * e.g. implement automatic token fees, slashing mechanisms, etc. * * Emits a {Transfer} event. * * Requirements: * * - `from` cannot be the zero address. * - `to` cannot be the zero address. * - `from` must have a balance of at least `amount`. */ function _transfer( address from, address to, uint256 amount ) internal virtual { require(from != address(0), "ERC20: transfer from the zero address"); require(to != address(0), "ERC20: transfer to the zero address"); _beforeTokenTransfer(from, to, amount); uint256 fromBalance = _balances[from]; require(fromBalance >= amount, "ERC20: transfer amount exceeds balance"); unchecked { _balances[from] = fromBalance - amount; } _balances[to] += amount; emit Transfer(from, to, amount); _afterTokenTransfer(from, to, amount); } /** @dev Creates `amount` tokens and assigns them to `account`, increasing * the total supply. * * Emits a {Transfer} event with `from` set to the zero address. * * Requirements: * * - `account` cannot be the zero address. */ function _mint(address account, uint256 amount) internal virtual { require(account != address(0), "ERC20: mint to the zero address"); _beforeTokenTransfer(address(0), account, amount); _totalSupply += amount; _balances[account] += amount; emit Transfer(address(0), account, amount); _afterTokenTransfer(address(0), account, amount); } /** * @dev Destroys `amount` tokens from `account`, reducing the * total supply. * * Emits a {Transfer} event with `to` set to the zero address. * * Requirements: * * - `account` cannot be the zero address. * - `account` must have at least `amount` tokens. */ function _burn(address account, uint256 amount) internal virtual { require(account != address(0), "ERC20: burn from the zero address"); _beforeTokenTransfer(account, address(0), amount); uint256 accountBalance = _balances[account]; require(accountBalance >= amount, "ERC20: burn amount exceeds balance"); unchecked { _balances[account] = accountBalance - amount; } _totalSupply -= amount; emit Transfer(account, address(0), amount); _afterTokenTransfer(account, address(0), amount); } /** * @dev Sets `amount` as the allowance of `spender` over the `owner` s tokens. * * This internal function is equivalent to `approve`, and can be used to * e.g. set automatic allowances for certain subsystems, etc. * * Emits an {Approval} event. * * Requirements: * * - `owner` cannot be the zero address. * - `spender` cannot be the zero address. */ function _approve( address owner, address spender, uint256 amount ) internal virtual { require(owner != address(0), "ERC20: approve from the zero address"); require(spender != address(0), "ERC20: approve to the zero address"); _allowances[owner][spender] = amount; emit Approval(owner, spender, amount); } /** * @dev Spend `amount` form the allowance of `owner` toward `spender`. * * Does not update the allowance amount in case of infinite allowance. * Revert if not enough allowance is available. * * Might emit an {Approval} event. */ function _spendAllowance( address owner, address spender, uint256 amount ) internal virtual { uint256 currentAllowance = allowance(owner, spender); if (currentAllowance != type(uint256).max) { require(currentAllowance >= amount, "ERC20: insufficient allowance"); unchecked { _approve(owner, spender, currentAllowance - amount); } } } /** * @dev Hook that is called before any transfer of tokens. This includes * minting and burning. * * Calling conditions: * * - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens * will be transferred to `to`. * - when `from` is zero, `amount` tokens will be minted for `to`. * - when `to` is zero, `amount` of ``from``'s tokens will be burned. * - `from` and `to` are never both zero. * * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks]. */ function _beforeTokenTransfer( address from, address to, uint256 amount ) internal virtual {} /** * @dev Hook that is called after any transfer of tokens. This includes * minting and burning. * * Calling conditions: * * - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens * has been transferred to `to`. * - when `from` is zero, `amount` tokens have been minted for `to`. * - when `to` is zero, `amount` of ``from``'s tokens have been burned. * - `from` and `to` are never both zero. * * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks]. */ function _afterTokenTransfer( address from, address to, uint256 amount ) internal virtual {} }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.5.0) (token/ERC20/IERC20.sol) pragma solidity ^0.8.0; /** * @dev Interface of the ERC20 standard as defined in the EIP. */ interface IERC20 { /** * @dev Returns the amount of tokens in existence. */ function totalSupply() external view returns (uint256); /** * @dev Returns the amount of tokens owned by `account`. */ function balanceOf(address account) external view returns (uint256); /** * @dev Moves `amount` tokens from the caller's account to `to`. * * Returns a boolean value indicating whether the operation succeeded. * * Emits a {Transfer} event. */ function transfer(address to, uint256 amount) external returns (bool); /** * @dev Returns the remaining number of tokens that `spender` will be * allowed to spend on behalf of `owner` through {transferFrom}. This is * zero by default. * * This value changes when {approve} or {transferFrom} are called. */ function allowance(address owner, address spender) external view returns (uint256); /** * @dev Sets `amount` as the allowance of `spender` over the caller's tokens. * * Returns a boolean value indicating whether the operation succeeded. * * IMPORTANT: Beware that changing an allowance with this method brings the risk * that someone may use both the old and the new allowance by unfortunate * transaction ordering. One possible solution to mitigate this race * condition is to first reduce the spender's allowance to 0 and set the * desired value afterwards: * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729 * * Emits an {Approval} event. */ function approve(address spender, uint256 amount) external returns (bool); /** * @dev Moves `amount` tokens from `from` to `to` using the * allowance mechanism. `amount` is then deducted from the caller's * allowance. * * Returns a boolean value indicating whether the operation succeeded. * * Emits a {Transfer} event. */ function transferFrom( address from, address to, uint256 amount ) external returns (bool); /** * @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); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (token/ERC20/utils/SafeERC20.sol) pragma solidity ^0.8.0; import "../IERC20.sol"; import "../../../utils/Address.sol"; /** * @title SafeERC20 * @dev Wrappers around ERC20 operations that throw on failure (when the token * contract returns false). Tokens that return no value (and instead revert or * throw on failure) are also supported, non-reverting calls are assumed to be * successful. * To use this library you can add a `using SafeERC20 for IERC20;` statement to your contract, * which allows you to call the safe operations as `token.safeTransfer(...)`, etc. */ library SafeERC20 { using Address for address; function safeTransfer( IERC20 token, address to, uint256 value ) internal { _callOptionalReturn(token, abi.encodeWithSelector(token.transfer.selector, to, value)); } function safeTransferFrom( IERC20 token, address from, address to, uint256 value ) internal { _callOptionalReturn(token, abi.encodeWithSelector(token.transferFrom.selector, from, to, value)); } /** * @dev Deprecated. This function has issues similar to the ones found in * {IERC20-approve}, and its usage is discouraged. * * Whenever possible, use {safeIncreaseAllowance} and * {safeDecreaseAllowance} instead. */ function safeApprove( IERC20 token, address spender, uint256 value ) internal { // safeApprove should only be called when setting an initial allowance, // or when resetting it to zero. To increase and decrease it, use // 'safeIncreaseAllowance' and 'safeDecreaseAllowance' require( (value == 0) || (token.allowance(address(this), spender) == 0), "SafeERC20: approve from non-zero to non-zero allowance" ); _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, value)); } function safeIncreaseAllowance( IERC20 token, address spender, uint256 value ) internal { uint256 newAllowance = token.allowance(address(this), spender) + value; _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance)); } function safeDecreaseAllowance( IERC20 token, address spender, uint256 value ) internal { unchecked { uint256 oldAllowance = token.allowance(address(this), spender); require(oldAllowance >= value, "SafeERC20: decreased allowance below zero"); uint256 newAllowance = oldAllowance - value; _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance)); } } /** * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement * on the return value: the return value is optional (but if data is returned, it must not be false). * @param token The token targeted by the call. * @param data The call data (encoded using abi.encode or one of its variants). */ function _callOptionalReturn(IERC20 token, bytes memory data) private { // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since // we're implementing it ourselves. We use {Address.functionCall} to perform this call, which verifies that // the target address contains contract code and also asserts for success in the low-level call. bytes memory returndata = address(token).functionCall(data, "SafeERC20: low-level call failed"); if (returndata.length > 0) { // Return data is optional require(abi.decode(returndata, (bool)), "SafeERC20: ERC20 operation did not succeed"); } } }
// SPDX-License-Identifier: Unlicense pragma solidity =0.8.4; import {IFaucet} from "../libraries/Faucet.sol"; import {IERC20} from "@openzeppelin/contracts/token/ERC20/IERC20.sol"; interface IVault is IFaucet, IERC20 { function deposit( uint256, uint256, uint256, address, uint256, uint256, uint256 ) external returns (uint256); function withdraw( uint256, uint256, uint256, uint256 ) external; function calcSharesAndAmounts( uint256 _amountEth, uint256 _amountUsdc, uint256 _amountOsqth, uint256 _totalSupply, bool _isFlash ) external view returns ( uint256, uint256, uint256, uint256 ); }
// SPDX-License-Identifier: Unlicense pragma solidity =0.8.4; pragma abicoder v2; import "../libraries/Constants.sol"; interface IVaultMath { function isTimeRebalance() external view returns (bool, uint256); function isPriceRebalance(uint256 _auctionTriggerTime) external view returns (bool); function burnAndCollect( address pool, int24 tickLower, int24 tickUpper, uint128 liquidity ) external returns ( uint256 burned0, uint256 burned1, uint256 feesToVault0, uint256 feesToVault1 ); function burnLiquidityShare( address pool, int24 tickLower, int24 tickUpper, uint256 ratio ) external returns (uint256 amount0, uint256 amount1); function getTotalAmounts() external view returns ( uint256, uint256, uint256 ); function getPrices() external view returns (uint256 ethUsdcPrice, uint256 osqthEthPrice); function getIV() external view returns (uint256); function getValue( uint256 amountEth, uint256 amountUsdc, uint256 amountOsqth, uint256 ethUsdcPrice, uint256 osqthEthPrice ) external pure returns (uint256); function getPriceMultiplier(uint256 _auctionTriggerTime) external view returns (uint256); function getLiquidityForValue( uint256 v, uint256 p, uint256 pL, uint256 pH, uint256 digits ) external pure returns (uint128); function getPriceFromTick(int24 tick) external view returns (uint256); }
// SPDX-License-Identifier: Unlicense pragma solidity =0.8.4; pragma abicoder v2; import {IERC20} from "@openzeppelin/contracts/token/ERC20/IERC20.sol"; import {Constants} from "../libraries/Constants.sol"; interface IVaultTreasury { function burn( address pool, int24 tickLower, int24 tickUpper, uint128 liquidity ) external returns (uint256, uint256); function collect( address pool, int24 tickLower, int24 tickUpper ) external returns (uint256 collect0, uint256 collect1); function mintLiquidity( address pool, int24 tickLower, int24 tickUpper, uint128 liquidity ) external; function transfer( IERC20 token, address recipient, uint256 amount ) external; function amountsForLiquidity( address pool, int24 tickLower, int24 tickUpper, uint128 liquidity ) external view returns (uint256, uint256); function allAmountsForLiquidity( Constants.Boundaries memory boundaries, uint128 liquidityEthUsdc, uint128 liquidityOsqthEth ) external view returns ( uint256, uint256, uint256 ); function position( address pool, int24 tickLower, int24 tickUpper ) external view returns ( uint128, uint256, uint256, uint128, uint128 ); function positionLiquidityEthUsdc() external view returns (uint128); function positionLiquidityEthOsqth() external view returns (uint128); function pokePools() external; function externalPoke() external; }
// SPDX-License-Identifier: Unlicense pragma solidity =0.8.4; import {Constants} from "../libraries/Constants.sol"; interface IVaultStorage { function orderEthUsdcLower() external view returns (int24); function orderEthUsdcUpper() external view returns (int24); function orderOsqthEthLower() external view returns (int24); function orderOsqthEthUpper() external view returns (int24); function accruedFeesEth() external view returns (uint256); function accruedFeesUsdc() external view returns (uint256); function accruedFeesOsqth() external view returns (uint256); function protocolFee() external view returns (uint256); function timeAtLastRebalance() external view returns (uint256); function ivAtLastRebalance() external view returns (uint256); function totalValue() external view returns (uint256); function setParamsBeforeDeposit( uint256 _timeAtLastRebalance, uint256 _ivAtLastRebalance, uint256 _ethPriceAtLastRebalance ) external; function rebalanceTimeThreshold() external view returns (uint256); function ethPriceAtLastRebalance() external view returns (uint256); function rebalanceThreshold() external view returns (uint256); function rebalancePriceThreshold() external view returns (uint256); function maxPriceMultiplier() external view returns (uint256); function minPriceMultiplier() external view returns (uint256); function depositCount() external view returns (uint256); function setDepositCount(uint256 _depositCount) external; function auctionTime() external view returns (uint256); function adjParam() external view returns (uint256); function twapPeriod() external view returns (uint32); function baseThreshold() external view returns (int24); function tickSpacing() external view returns (int24); function updateAccruedFees( uint256, uint256, uint256 ) external; function setAccruedFeesEth(uint256) external; function setAccruedFeesUsdc(uint256) external; function setAccruedFeesOsqth(uint256) external; function cap() external view returns (uint256); function setSnapshot( int24 _orderEthUsdcLower, int24 _orderEthUsdcUpper, int24 _orderOsqthEthLower, int24 _orderOsqthEthUpper, uint256 _timeAtLastRebalance, uint256 _ivAtLastRebalance, uint256 _totalValue, uint256 _ethPriceAtLastRebalance ) external; function isSystemPaused() external view returns (bool); function governance() external view returns (address); function keeper() external view returns (address); function setGovernance(address _governance) external; function setKeeper(address _keeper) external; }
// SPDX-License-Identifier: Unlicense pragma solidity =0.8.4; library SharedEvents { event Deposit(address indexed sender, uint256 shares); event TimeRebalance( address indexed hedger, uint256 auctionTriggerTime, uint256 amountEth, uint256 amountUsdc, uint256 amountOsqth ); event NoRebalance(address indexed hedger, uint256 auctionTriggerTime, uint256 ratio); event PriceRebalance(address indexed hedger, uint256 amountEth, uint256 amountUsdc, uint256 amountOsqth); event Withdraw(address indexed hedger, uint256 shares, uint256 amountEth, uint256 amountUsdc, uint256 amountOsqth); event Rebalance(address indexed hedger, uint256 amountEth, uint256 amountUsdc, uint256 amountOsqth); event CollectFees(uint256 feesToVault0, uint256 feesToVault1, uint256 feesToProtocol0, uint256 feesToProtocol1); event Paused(bool changedState); // event Snapshot(int24 tick, uint256 totalAmount0, uint256 totalAmount1, uint256 totalSupply); }
// SPDX-License-Identifier: Unlicense pragma solidity =0.8.4; import {IUniswapV3Pool} from "@uniswap/v3-core/contracts/interfaces/IUniswapV3Pool.sol"; import {IERC20} from "@openzeppelin/contracts/token/ERC20/IERC20.sol"; import {IOracle} from "./uniswap/IOracle.sol"; import {IOsqthController} from "./osqth/IController.sol"; import {IUniswapMath} from "./uniswap/IUniswapMath.sol"; library Constants { //@dev ETH-USDC Uniswap pool address public constant poolEthUsdc = 0x8ad599c3A0ff1De082011EFDDc58f1908eb6e6D8; //@dev oSQTH-ETH Uniswap pool address public constant poolEthOsqth = 0x82c427AdFDf2d245Ec51D8046b41c4ee87F0d29C; //@dev wETH, USDC and oSQTH tokens IERC20 public constant weth = IERC20(0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2); IERC20 public constant usdc = IERC20(0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48); IERC20 public constant osqth = IERC20(0xf1B99e3E573A1a9C5E6B2Ce818b617F0E664E86B); //@dev strategy Uniswap oracle IOracle public constant oracle = IOracle(0x65D66c76447ccB45dAf1e8044e918fA786A483A1); IOsqthController public constant osqthController = IOsqthController(0x64187ae08781B09368e6253F9E94951243A493D5); struct Boundaries { int24 ethUsdcLower; int24 ethUsdcUpper; int24 osqthEthLower; int24 osqthEthUpper; } struct AuctionParams { Boundaries boundaries; uint128 liquidityEthUsdc; uint128 liquidityOsqthEth; uint256 totalValue; uint256 ethUsdcPrice; } struct AuctionMinAmounts { uint256 minAmountEth; uint256 minAmountUsdc; uint256 minAmountOsqth; } }
// SPDX-License-Identifier: Unlicense pragma solidity >=0.8.4; import "./PRBMath.sol"; /// @title PRBMathUD60x18 /// @author Paul Razvan Berg /// @notice Smart contract library for advanced fixed-point math that works with uint256 numbers considered to have 18 /// trailing decimals. We call this number representation unsigned 60.18-decimal fixed-point, since there can be up to 60 /// digits in the integer part and up to 18 decimals in the fractional part. The numbers are bound by the minimum and the /// maximum values permitted by the Solidity type uint256. library PRBMathUD60x18 { /// @dev Half the SCALE number. uint256 internal constant HALF_SCALE = 5e17; /// @dev log2(e) as an unsigned 60.18-decimal fixed-point number. uint256 internal constant LOG2_E = 1_442695040888963407; /// @dev The maximum value an unsigned 60.18-decimal fixed-point number can have. uint256 internal constant MAX_UD60x18 = 115792089237316195423570985008687907853269984665640564039457_584007913129639935; /// @dev The maximum whole value an unsigned 60.18-decimal fixed-point number can have. uint256 internal constant MAX_WHOLE_UD60x18 = 115792089237316195423570985008687907853269984665640564039457_000000000000000000; /// @dev How many trailing decimals can be represented. uint256 internal constant SCALE = 1e18; /// @notice Calculates the arithmetic average of x and y, rounding down. /// @param x The first operand as an unsigned 60.18-decimal fixed-point number. /// @param y The second operand as an unsigned 60.18-decimal fixed-point number. /// @return result The arithmetic average as an unsigned 60.18-decimal fixed-point number. function avg(uint256 x, uint256 y) internal pure returns (uint256 result) { // The operations can never overflow. unchecked { // The last operand checks if both x and y are odd and if that is the case, we add 1 to the result. We need // to do this because if both numbers are odd, the 0.5 remainder gets truncated twice. result = (x >> 1) + (y >> 1) + (x & y & 1); } } /// @notice Yields the least unsigned 60.18 decimal fixed-point number greater than or equal to x. /// /// @dev Optimized for fractional value inputs, because for every whole value there are (1e18 - 1) fractional counterparts. /// See https://en.wikipedia.org/wiki/Floor_and_ceiling_functions. /// /// Requirements: /// - x must be less than or equal to MAX_WHOLE_UD60x18. /// /// @param x The unsigned 60.18-decimal fixed-point number to ceil. /// @param result The least integer greater than or equal to x, as an unsigned 60.18-decimal fixed-point number. function ceil(uint256 x) internal pure returns (uint256 result) { if (x > MAX_WHOLE_UD60x18) { revert PRBMathUD60x18__CeilOverflow(x); } assembly { // Equivalent to "x % SCALE" but faster. let remainder := mod(x, SCALE) // Equivalent to "SCALE - remainder" but faster. let delta := sub(SCALE, remainder) // Equivalent to "x + delta * (remainder > 0 ? 1 : 0)" but faster. result := add(x, mul(delta, gt(remainder, 0))) } } /// @notice Divides two unsigned 60.18-decimal fixed-point numbers, returning a new unsigned 60.18-decimal fixed-point number. /// /// @dev Uses mulDiv to enable overflow-safe multiplication and division. /// /// Requirements: /// - The denominator cannot be zero. /// /// @param x The numerator as an unsigned 60.18-decimal fixed-point number. /// @param y The denominator as an unsigned 60.18-decimal fixed-point number. /// @param result The quotient as an unsigned 60.18-decimal fixed-point number. function div(uint256 x, uint256 y) internal pure returns (uint256 result) { result = PRBMath.mulDiv(x, SCALE, y); } /// @notice Returns Euler's number as an unsigned 60.18-decimal fixed-point number. /// @dev See https://en.wikipedia.org/wiki/E_(mathematical_constant). function e() internal pure returns (uint256 result) { result = 2_718281828459045235; } /// @notice Calculates the natural exponent of x. /// /// @dev Based on the insight that e^x = 2^(x * log2(e)). /// /// Requirements: /// - All from "log2". /// - x must be less than 133.084258667509499441. /// /// @param x The exponent as an unsigned 60.18-decimal fixed-point number. /// @return result The result as an unsigned 60.18-decimal fixed-point number. function exp(uint256 x) internal pure returns (uint256 result) { // Without this check, the value passed to "exp2" would be greater than 192. if (x >= 133_084258667509499441) { revert PRBMathUD60x18__ExpInputTooBig(x); } // Do the fixed-point multiplication inline to save gas. unchecked { uint256 doubleScaleProduct = x * LOG2_E; result = exp2((doubleScaleProduct + HALF_SCALE) / SCALE); } } /// @notice Calculates the binary exponent of x using the binary fraction method. /// /// @dev See https://ethereum.stackexchange.com/q/79903/24693. /// /// Requirements: /// - x must be 192 or less. /// - The result must fit within MAX_UD60x18. /// /// @param x The exponent as an unsigned 60.18-decimal fixed-point number. /// @return result The result as an unsigned 60.18-decimal fixed-point number. function exp2(uint256 x) internal pure returns (uint256 result) { // 2^192 doesn't fit within the 192.64-bit format used internally in this function. if (x >= 192e18) { revert PRBMathUD60x18__Exp2InputTooBig(x); } unchecked { // Convert x to the 192.64-bit fixed-point format. uint256 x192x64 = (x << 64) / SCALE; // Pass x to the PRBMath.exp2 function, which uses the 192.64-bit fixed-point number representation. result = PRBMath.exp2(x192x64); } } /// @notice Yields the greatest unsigned 60.18 decimal fixed-point number less than or equal to x. /// @dev Optimized for fractional value inputs, because for every whole value there are (1e18 - 1) fractional counterparts. /// See https://en.wikipedia.org/wiki/Floor_and_ceiling_functions. /// @param x The unsigned 60.18-decimal fixed-point number to floor. /// @param result The greatest integer less than or equal to x, as an unsigned 60.18-decimal fixed-point number. function floor(uint256 x) internal pure returns (uint256 result) { assembly { // Equivalent to "x % SCALE" but faster. let remainder := mod(x, SCALE) // Equivalent to "x - remainder * (remainder > 0 ? 1 : 0)" but faster. result := sub(x, mul(remainder, gt(remainder, 0))) } } /// @notice Yields the excess beyond the floor of x. /// @dev Based on the odd function definition https://en.wikipedia.org/wiki/Fractional_part. /// @param x The unsigned 60.18-decimal fixed-point number to get the fractional part of. /// @param result The fractional part of x as an unsigned 60.18-decimal fixed-point number. function frac(uint256 x) internal pure returns (uint256 result) { assembly { result := mod(x, SCALE) } } function sub(uint256 x, uint256 y) internal pure returns (uint256 z) { z = x - y; } function add(uint256 x, uint256 y) internal pure returns (uint256 z) { z = x + y; } function suba(uint256 x, uint256 y) internal pure returns (uint256) { return x > y ? sub(x, y) : sub(y, x); } /// @notice Converts a number from basic integer form to unsigned 60.18-decimal fixed-point representation. /// /// @dev Requirements: /// - x must be less than or equal to MAX_UD60x18 divided by SCALE. /// /// @param x The basic integer to convert. /// @param result The same number in unsigned 60.18-decimal fixed-point representation. function fromUint(uint256 x) internal pure returns (uint256 result) { unchecked { if (x > MAX_UD60x18 / SCALE) { revert PRBMathUD60x18__FromUintOverflow(x); } result = x * SCALE; } } /// @notice Calculates geometric mean of x and y, i.e. sqrt(x * y), rounding down. /// /// @dev Requirements: /// - x * y must fit within MAX_UD60x18, lest it overflows. /// /// @param x The first operand as an unsigned 60.18-decimal fixed-point number. /// @param y The second operand as an unsigned 60.18-decimal fixed-point number. /// @return result The result as an unsigned 60.18-decimal fixed-point number. function gm(uint256 x, uint256 y) internal pure returns (uint256 result) { if (x == 0) { return 0; } unchecked { // Checking for overflow this way is faster than letting Solidity do it. uint256 xy = x * y; if (xy / x != y) { revert PRBMathUD60x18__GmOverflow(x, y); } // We don't need to multiply by the SCALE here because the x*y product had already picked up a factor of SCALE // during multiplication. See the comments within the "sqrt" function. result = PRBMath.sqrt(xy); } } /// @notice Calculates 1 / x, rounding toward zero. /// /// @dev Requirements: /// - x cannot be zero. /// /// @param x The unsigned 60.18-decimal fixed-point number for which to calculate the inverse. /// @return result The inverse as an unsigned 60.18-decimal fixed-point number. function inv(uint256 x) internal pure returns (uint256 result) { unchecked { // 1e36 is SCALE * SCALE. result = 1e36 / x; } } /// @notice Calculates the natural logarithm of x. /// /// @dev Based on the insight that ln(x) = log2(x) / log2(e). /// /// Requirements: /// - All from "log2". /// /// Caveats: /// - All from "log2". /// - This doesn't return exactly 1 for 2.718281828459045235, for that we would need more fine-grained precision. /// /// @param x The unsigned 60.18-decimal fixed-point number for which to calculate the natural logarithm. /// @return result The natural logarithm as an unsigned 60.18-decimal fixed-point number. function ln(uint256 x) internal pure returns (uint256 result) { // Do the fixed-point multiplication inline to save gas. This is overflow-safe because the maximum value that log2(x) // can return is 196205294292027477728. unchecked { result = (log2(x) * SCALE) / LOG2_E; } } /// @notice Calculates the common logarithm of x. /// /// @dev First checks if x is an exact power of ten and it stops if yes. If it's not, calculates the common /// logarithm based on the insight that log10(x) = log2(x) / log2(10). /// /// Requirements: /// - All from "log2". /// /// Caveats: /// - All from "log2". /// /// @param x The unsigned 60.18-decimal fixed-point number for which to calculate the common logarithm. /// @return result The common logarithm as an unsigned 60.18-decimal fixed-point number. function log10(uint256 x) internal pure returns (uint256 result) { if (x < SCALE) { revert PRBMathUD60x18__LogInputTooSmall(x); } // Note that the "mul" in this block is the assembly multiplication operation, not the "mul" function defined // in this contract. // prettier-ignore assembly { switch x case 1 { result := mul(SCALE, sub(0, 18)) } case 10 { result := mul(SCALE, sub(1, 18)) } case 100 { result := mul(SCALE, sub(2, 18)) } case 1000 { result := mul(SCALE, sub(3, 18)) } case 10000 { result := mul(SCALE, sub(4, 18)) } case 100000 { result := mul(SCALE, sub(5, 18)) } case 1000000 { result := mul(SCALE, sub(6, 18)) } case 10000000 { result := mul(SCALE, sub(7, 18)) } case 100000000 { result := mul(SCALE, sub(8, 18)) } case 1000000000 { result := mul(SCALE, sub(9, 18)) } case 10000000000 { result := mul(SCALE, sub(10, 18)) } case 100000000000 { result := mul(SCALE, sub(11, 18)) } case 1000000000000 { result := mul(SCALE, sub(12, 18)) } case 10000000000000 { result := mul(SCALE, sub(13, 18)) } case 100000000000000 { result := mul(SCALE, sub(14, 18)) } case 1000000000000000 { result := mul(SCALE, sub(15, 18)) } case 10000000000000000 { result := mul(SCALE, sub(16, 18)) } case 100000000000000000 { result := mul(SCALE, sub(17, 18)) } case 1000000000000000000 { result := 0 } case 10000000000000000000 { result := SCALE } case 100000000000000000000 { result := mul(SCALE, 2) } case 1000000000000000000000 { result := mul(SCALE, 3) } case 10000000000000000000000 { result := mul(SCALE, 4) } case 100000000000000000000000 { result := mul(SCALE, 5) } case 1000000000000000000000000 { result := mul(SCALE, 6) } case 10000000000000000000000000 { result := mul(SCALE, 7) } case 100000000000000000000000000 { result := mul(SCALE, 8) } case 1000000000000000000000000000 { result := mul(SCALE, 9) } case 10000000000000000000000000000 { result := mul(SCALE, 10) } case 100000000000000000000000000000 { result := mul(SCALE, 11) } case 1000000000000000000000000000000 { result := mul(SCALE, 12) } case 10000000000000000000000000000000 { result := mul(SCALE, 13) } case 100000000000000000000000000000000 { result := mul(SCALE, 14) } case 1000000000000000000000000000000000 { result := mul(SCALE, 15) } case 10000000000000000000000000000000000 { result := mul(SCALE, 16) } case 100000000000000000000000000000000000 { result := mul(SCALE, 17) } case 1000000000000000000000000000000000000 { result := mul(SCALE, 18) } case 10000000000000000000000000000000000000 { result := mul(SCALE, 19) } case 100000000000000000000000000000000000000 { result := mul(SCALE, 20) } case 1000000000000000000000000000000000000000 { result := mul(SCALE, 21) } case 10000000000000000000000000000000000000000 { result := mul(SCALE, 22) } case 100000000000000000000000000000000000000000 { result := mul(SCALE, 23) } case 1000000000000000000000000000000000000000000 { result := mul(SCALE, 24) } case 10000000000000000000000000000000000000000000 { result := mul(SCALE, 25) } case 100000000000000000000000000000000000000000000 { result := mul(SCALE, 26) } case 1000000000000000000000000000000000000000000000 { result := mul(SCALE, 27) } case 10000000000000000000000000000000000000000000000 { result := mul(SCALE, 28) } case 100000000000000000000000000000000000000000000000 { result := mul(SCALE, 29) } case 1000000000000000000000000000000000000000000000000 { result := mul(SCALE, 30) } case 10000000000000000000000000000000000000000000000000 { result := mul(SCALE, 31) } case 100000000000000000000000000000000000000000000000000 { result := mul(SCALE, 32) } case 1000000000000000000000000000000000000000000000000000 { result := mul(SCALE, 33) } case 10000000000000000000000000000000000000000000000000000 { result := mul(SCALE, 34) } case 100000000000000000000000000000000000000000000000000000 { result := mul(SCALE, 35) } case 1000000000000000000000000000000000000000000000000000000 { result := mul(SCALE, 36) } case 10000000000000000000000000000000000000000000000000000000 { result := mul(SCALE, 37) } case 100000000000000000000000000000000000000000000000000000000 { result := mul(SCALE, 38) } case 1000000000000000000000000000000000000000000000000000000000 { result := mul(SCALE, 39) } case 10000000000000000000000000000000000000000000000000000000000 { result := mul(SCALE, 40) } case 100000000000000000000000000000000000000000000000000000000000 { result := mul(SCALE, 41) } case 1000000000000000000000000000000000000000000000000000000000000 { result := mul(SCALE, 42) } case 10000000000000000000000000000000000000000000000000000000000000 { result := mul(SCALE, 43) } case 100000000000000000000000000000000000000000000000000000000000000 { result := mul(SCALE, 44) } case 1000000000000000000000000000000000000000000000000000000000000000 { result := mul(SCALE, 45) } case 10000000000000000000000000000000000000000000000000000000000000000 { result := mul(SCALE, 46) } case 100000000000000000000000000000000000000000000000000000000000000000 { result := mul(SCALE, 47) } case 1000000000000000000000000000000000000000000000000000000000000000000 { result := mul(SCALE, 48) } case 10000000000000000000000000000000000000000000000000000000000000000000 { result := mul(SCALE, 49) } case 100000000000000000000000000000000000000000000000000000000000000000000 { result := mul(SCALE, 50) } case 1000000000000000000000000000000000000000000000000000000000000000000000 { result := mul(SCALE, 51) } case 10000000000000000000000000000000000000000000000000000000000000000000000 { result := mul(SCALE, 52) } case 100000000000000000000000000000000000000000000000000000000000000000000000 { result := mul(SCALE, 53) } case 1000000000000000000000000000000000000000000000000000000000000000000000000 { result := mul(SCALE, 54) } case 10000000000000000000000000000000000000000000000000000000000000000000000000 { result := mul(SCALE, 55) } case 100000000000000000000000000000000000000000000000000000000000000000000000000 { result := mul(SCALE, 56) } case 1000000000000000000000000000000000000000000000000000000000000000000000000000 { result := mul(SCALE, 57) } case 10000000000000000000000000000000000000000000000000000000000000000000000000000 { result := mul(SCALE, 58) } case 100000000000000000000000000000000000000000000000000000000000000000000000000000 { result := mul(SCALE, 59) } default { result := MAX_UD60x18 } } if (result == MAX_UD60x18) { // Do the fixed-point division inline to save gas. The denominator is log2(10). unchecked { result = (log2(x) * SCALE) / 3_321928094887362347; } } } /// @notice Calculates the binary logarithm of x. /// /// @dev Based on the iterative approximation algorithm. /// https://en.wikipedia.org/wiki/Binary_logarithm#Iterative_approximation /// /// Requirements: /// - x must be greater than or equal to SCALE, otherwise the result would be negative. /// /// Caveats: /// - The results are nor perfectly accurate to the last decimal, due to the lossy precision of the iterative approximation. /// /// @param x The unsigned 60.18-decimal fixed-point number for which to calculate the binary logarithm. /// @return result The binary logarithm as an unsigned 60.18-decimal fixed-point number. function log2(uint256 x) internal pure returns (uint256 result) { if (x < SCALE) { revert PRBMathUD60x18__LogInputTooSmall(x); } unchecked { // Calculate the integer part of the logarithm and add it to the result and finally calculate y = x * 2^(-n). uint256 n = PRBMath.mostSignificantBit(x / SCALE); // The integer part of the logarithm as an unsigned 60.18-decimal fixed-point number. The operation can't overflow // because n is maximum 255 and SCALE is 1e18. result = n * SCALE; // This is y = x * 2^(-n). uint256 y = x >> n; // If y = 1, the fractional part is zero. if (y == SCALE) { return result; } // Calculate the fractional part via the iterative approximation. // The "delta >>= 1" part is equivalent to "delta /= 2", but shifting bits is faster. for (uint256 delta = HALF_SCALE; delta > 0; delta >>= 1) { y = (y * y) / SCALE; // Is y^2 > 2 and so in the range [2,4)? if (y >= 2 * SCALE) { // Add the 2^(-m) factor to the logarithm. result += delta; // Corresponds to z/2 on Wikipedia. y >>= 1; } } } } /// @notice Multiplies two unsigned 60.18-decimal fixed-point numbers together, returning a new unsigned 60.18-decimal /// fixed-point number. /// @dev See the documentation for the "PRBMath.mulDivFixedPoint" function. /// @param x The multiplicand as an unsigned 60.18-decimal fixed-point number. /// @param y The multiplier as an unsigned 60.18-decimal fixed-point number. /// @return result The product as an unsigned 60.18-decimal fixed-point number. function mul(uint256 x, uint256 y) internal pure returns (uint256 result) { result = PRBMath.mulDivFixedPoint(x, y); } /// @notice Returns PI as an unsigned 60.18-decimal fixed-point number. function pi() internal pure returns (uint256 result) { result = 3_141592653589793238; } /// @notice Raises x to the power of y. /// /// @dev Based on the insight that x^y = 2^(log2(x) * y). /// /// Requirements: /// - All from "exp2", "log2" and "mul". /// /// Caveats: /// - All from "exp2", "log2" and "mul". /// - Assumes 0^0 is 1. /// /// @param x Number to raise to given power y, as an unsigned 60.18-decimal fixed-point number. /// @param y Exponent to raise x to, as an unsigned 60.18-decimal fixed-point number. /// @return result x raised to power y, as an unsigned 60.18-decimal fixed-point number. function pow(uint256 x, uint256 y) internal pure returns (uint256 result) { if (x == 0) { result = y == 0 ? SCALE : uint256(0); } else { result = exp2(mul(log2(x), y)); } } /// @notice Raises x (unsigned 60.18-decimal fixed-point number) to the power of y (basic unsigned integer) using the /// famous algorithm "exponentiation by squaring". /// /// @dev See https://en.wikipedia.org/wiki/Exponentiation_by_squaring /// /// Requirements: /// - The result must fit within MAX_UD60x18. /// /// Caveats: /// - All from "mul". /// - Assumes 0^0 is 1. /// /// @param x The base as an unsigned 60.18-decimal fixed-point number. /// @param y The exponent as an uint256. /// @return result The result as an unsigned 60.18-decimal fixed-point number. function powu(uint256 x, uint256 y) internal pure returns (uint256 result) { // Calculate the first iteration of the loop in advance. result = y & 1 > 0 ? x : SCALE; // Equivalent to "for(y /= 2; y > 0; y /= 2)" but faster. for (y >>= 1; y > 0; y >>= 1) { x = PRBMath.mulDivFixedPoint(x, x); // Equivalent to "y % 2 == 1" but faster. if (y & 1 > 0) { result = PRBMath.mulDivFixedPoint(result, x); } } } /// @notice Returns 1 as an unsigned 60.18-decimal fixed-point number. function scale() internal pure returns (uint256 result) { result = SCALE; } /// @notice Calculates the square root of x, rounding down. /// @dev Uses the Babylonian method https://en.wikipedia.org/wiki/Methods_of_computing_square_roots#Babylonian_method. /// /// Requirements: /// - x must be less than MAX_UD60x18 / SCALE. /// /// @param x The unsigned 60.18-decimal fixed-point number for which to calculate the square root. /// @return result The result as an unsigned 60.18-decimal fixed-point . function sqrt(uint256 x) internal pure returns (uint256 result) { unchecked { if (x > MAX_UD60x18 / SCALE) { revert PRBMathUD60x18__SqrtOverflow(x); } // Multiply x by the SCALE to account for the factor of SCALE that is picked up when multiplying two unsigned // 60.18-decimal fixed-point numbers together (in this case, those two numbers are both the square root). result = PRBMath.sqrt(x * SCALE); } } /// @notice Converts a unsigned 60.18-decimal fixed-point number to basic integer form, rounding down in the process. /// @param x The unsigned 60.18-decimal fixed-point number to convert. /// @return result The same number in basic integer form. function toUint(uint256 x) internal pure returns (uint256 result) { unchecked { result = x / SCALE; } } }
// SPDX-License-Identifier: Unlicense pragma solidity =0.8.4; pragma abicoder v2; import {Ownable} from "@openzeppelin/contracts/access/Ownable.sol"; import {IERC20} from "@openzeppelin/contracts/token/ERC20/IERC20.sol"; interface IVaultStorage { function isSystemPaused() external view returns (bool); function governance() external view returns (address); function keeper() external view returns (address); } interface IFaucet { function setComponents( address, address, address, address, address, address ) external; } contract Faucet is IFaucet, Ownable { address public uniswapMath; address public vault; address public auction; address public vaultMath; address public vaultTreasury; address public vaultStorage; constructor() Ownable() {} function setComponents( address _uniswapMath, address _vault, address _auction, address _vaultMath, address _vaultTreasury, address _vaultStorage ) public override onlyOwner { (uniswapMath, vault, auction, vaultMath, vaultTreasury, vaultStorage) = ( _uniswapMath, _vault, _auction, _vaultMath, _vaultTreasury, _vaultStorage ); } modifier onlyVault() { require(msg.sender == vault || msg.sender == auction, "C12"); _; } modifier onlyMath() { require(msg.sender == vaultMath, "C13"); _; } modifier onlyContracts() { require(msg.sender == vault || msg.sender == vaultMath || msg.sender == auction, "C14"); _; } modifier onlyGovernance() { require(msg.sender == IVaultStorage(vaultStorage).governance(), "C15"); _; } modifier onlyKeeper() { require(msg.sender == IVaultStorage(vaultStorage).keeper(), "C22"); _; } /** * @notice current balance of a certain token */ function _getBalance(IERC20 token) internal view returns (uint256) { return token.balanceOf(vaultTreasury); } modifier notPaused() { require(!IVaultStorage(vaultStorage).isSystemPaused(), "C0"); _; } }
// SPDX-License-Identifier: Unlicense pragma solidity =0.8.4; pragma abicoder v2; import {ReentrancyGuard} from "@openzeppelin/contracts/security/ReentrancyGuard.sol"; import {IERC20} from "@openzeppelin/contracts/token/ERC20/IERC20.sol"; import {IVaultTreasury} from "../interfaces/IVaultTreasury.sol"; import {IVaultMath} from "../interfaces/IVaultMath.sol"; import {IAuction} from "../interfaces/IAuction.sol"; import {IVaultStorage} from "../interfaces/IVaultStorage.sol"; import {SharedEvents} from "../libraries/SharedEvents.sol"; import {PRBMathUD60x18} from "../libraries/math/PRBMathUD60x18.sol"; import {Constants} from "../libraries/Constants.sol"; import {Faucet} from "../libraries/Faucet.sol"; import {IUniswapMath} from "../libraries/uniswap/IUniswapMath.sol"; contract VaultAuction is IAuction, Faucet, ReentrancyGuard { using PRBMathUD60x18 for uint256; /** * @notice strategy constructor */ constructor() Faucet() {} /** * @notice strategy rebalancing based on time threshold * @param keeper keeper address * @param minAmountEth min amount of wETH to receive * @param minAmountUsdc min amount of USDC to receive * @param minAmountOsqth miin amount of oSQTH to receive */ function timeRebalance( address keeper, uint256 minAmountEth, uint256 minAmountUsdc, uint256 minAmountOsqth ) external override nonReentrant notPaused { //check if rebalancing based on time threshold is allowed (bool isTimeRebalanceAllowed, uint256 auctionTriggerTime) = IVaultMath(vaultMath).isTimeRebalance(); require(isTimeRebalanceAllowed, "C10"); //current EthUsdc price (uint256 ethUsdcPrice, ) = IVaultMath(vaultMath).getPrices(); //EthUsdc price at last rebalance uint256 cachedPrice = IVaultStorage(vaultStorage).ethPriceAtLastRebalance(); uint256 ratio = cachedPrice > ethUsdcPrice ? cachedPrice.div(ethUsdcPrice) : ethUsdcPrice.div(cachedPrice); uint256 cachedValue = IVaultStorage(vaultStorage).totalValue(); // no rebalance if the price change <= rebalanceThreshold if (ratio <= IVaultStorage(vaultStorage).rebalanceThreshold() && cachedValue != 0) { IVaultStorage(vaultStorage).setSnapshot( IVaultStorage(vaultStorage).orderEthUsdcLower(), IVaultStorage(vaultStorage).orderEthUsdcUpper(), IVaultStorage(vaultStorage).orderOsqthEthLower(), IVaultStorage(vaultStorage).orderOsqthEthUpper(), block.timestamp, IVaultMath(vaultMath).getIV(), cachedValue, cachedPrice ); emit SharedEvents.NoRebalance(keeper, auctionTriggerTime, ratio); } else { _executeAuction( keeper, auctionTriggerTime, Constants.AuctionMinAmounts(minAmountEth, minAmountUsdc, minAmountOsqth) ); emit SharedEvents.TimeRebalance(keeper, auctionTriggerTime, minAmountEth, minAmountUsdc, minAmountOsqth); } } /** * @notice strategy rebalancing based on price threshold * @param keeper keeper address * @param auctionTriggerTime the time when the price deviation threshold was exceeded and when the auction started * @param minAmountEth min amount of wETH to receive * @param minAmountUsdc min amount of USDC to receive * @param minAmountOsqth miin amount of oSQTH to receive */ function priceRebalance( address keeper, uint256 auctionTriggerTime, uint256 minAmountEth, uint256 minAmountUsdc, uint256 minAmountOsqth ) external override nonReentrant notPaused { //check if rebalancing based on price threshold is allowed require(IVaultMath(vaultMath).isPriceRebalance(auctionTriggerTime), "C11"); _executeAuction( keeper, auctionTriggerTime, Constants.AuctionMinAmounts(minAmountEth, minAmountUsdc, minAmountOsqth) ); emit SharedEvents.PriceRebalance(keeper, minAmountEth, minAmountUsdc, minAmountOsqth); } /** * @notice execute auction based on the parameters calculated * @dev withdraw all liquidity from the positions * @dev pull in tokens from keeper * @dev sell excess tokens to sender * @dev place new positions in ETH-USDC pool and oSQTH-ETH pool */ function _executeAuction( address _keeper, uint256 _auctionTriggerTime, Constants.AuctionMinAmounts memory minAmounts ) internal { //Withdraw all the liqudity from the positions IVaultMath(vaultMath).burnAndCollect( Constants.poolEthUsdc, IVaultStorage(vaultStorage).orderEthUsdcLower(), IVaultStorage(vaultStorage).orderEthUsdcUpper(), IVaultTreasury(vaultTreasury).positionLiquidityEthUsdc() ); IVaultMath(vaultMath).burnAndCollect( Constants.poolEthOsqth, IVaultStorage(vaultStorage).orderOsqthEthLower(), IVaultStorage(vaultStorage).orderOsqthEthUpper(), IVaultTreasury(vaultTreasury).positionLiquidityEthOsqth() ); //Calculate auction params Constants.AuctionParams memory params = _getAuctionParams(_auctionTriggerTime); //Calculate amounts that need to be exchanged with keeper (uint256 ethBalance, uint256 usdcBalance, uint256 osqthBalance) = IVaultMath(vaultMath).getTotalAmounts(); (uint256 targetEth, uint256 targetUsdc, uint256 targetOsqth) = _getTargets( params.boundaries, params.liquidityEthUsdc, params.liquidityOsqthEth ); //Exchange tokens with keeper _swapWithKeeper(ethBalance, targetEth, minAmounts.minAmountEth, address(Constants.weth), _keeper); _swapWithKeeper(usdcBalance, targetUsdc, minAmounts.minAmountUsdc, address(Constants.usdc), _keeper); _swapWithKeeper(osqthBalance, targetOsqth, minAmounts.minAmountOsqth, address(Constants.osqth), _keeper); //Place new positions IVaultTreasury(vaultTreasury).mintLiquidity( Constants.poolEthUsdc, params.boundaries.ethUsdcLower, params.boundaries.ethUsdcUpper, params.liquidityEthUsdc ); IVaultTreasury(vaultTreasury).mintLiquidity( Constants.poolEthOsqth, params.boundaries.osqthEthLower, params.boundaries.osqthEthUpper, params.liquidityOsqthEth ); IVaultStorage(vaultStorage).setSnapshot( params.boundaries.ethUsdcLower, params.boundaries.ethUsdcUpper, params.boundaries.osqthEthLower, params.boundaries.osqthEthUpper, block.timestamp, IVaultMath(vaultMath).getIV(), params.totalValue, params.ethUsdcPrice ); IVaultStorage(vaultStorage).setDepositCount(0); } /** * @notice calculate all auction parameters * @param _auctionTriggerTime timestamp when auction started */ function _getAuctionParams(uint256 _auctionTriggerTime) internal view returns (Constants.AuctionParams memory) { //current ETH/USDC and oSQTH/ETH price (uint256 ethUsdcPrice, uint256 osqthEthPrice) = IVaultMath(vaultMath).getPrices(); //total ETH value of the strategy holdings at the current prices uint256 totalValue; { //scope to avoid stack too deep error //current balances (uint256 ethBalance, uint256 usdcBalance, uint256 osqthBalance) = IVaultMath(vaultMath).getTotalAmounts(); totalValue = IVaultMath(vaultMath).getValue( ethBalance, usdcBalance, osqthBalance, ethUsdcPrice, osqthEthPrice ); } uint256 priceMultiplier; uint256 weight; Constants.Boundaries memory boundaries; { //scope to avoid stack too deep error //current implied volatility uint256 cIV = IVaultMath(vaultMath).getIV(); //previous implied volatility uint256 pIV = IVaultStorage(vaultStorage).ivAtLastRebalance(); //is a positive IV bump bool isPosIVbump = cIV < pIV; priceMultiplier = IVaultMath(vaultMath).getPriceMultiplier(_auctionTriggerTime); //expected IV bump uint256 expIVbump; if (isPosIVbump) { expIVbump = pIV.div(cIV); weight = priceMultiplier.div(priceMultiplier + uint256(1e18)) + uint256(1e16).div(cIV); } else { expIVbump = cIV.div(pIV); weight = priceMultiplier.div(priceMultiplier + uint256(1e18)) - uint256(1e16).div(cIV); } uint256 cachedBump = expIVbump.mul(2e18).sub(2e18); expIVbump = cachedBump > uint256(99e16) ? uint256(99e16) : cachedBump; //boundaries for auction prices (current price * multiplier) boundaries = _getBoundaries( ethUsdcPrice.mul(priceMultiplier), osqthEthPrice.mul(priceMultiplier), isPosIVbump, expIVbump ); } //Calculate liquidities uint128 liquidityEthUsdc = IVaultMath(vaultMath).getLiquidityForValue( totalValue.mul(ethUsdcPrice).mul(weight).mul(priceMultiplier), ethUsdcPrice, uint256(1e30).div(IVaultMath(vaultMath).getPriceFromTick(boundaries.ethUsdcLower)), uint256(1e30).div(IVaultMath(vaultMath).getPriceFromTick(boundaries.ethUsdcUpper)), 1e12 ); uint128 liquidityOsqthEth = IVaultMath(vaultMath).getLiquidityForValue( totalValue.mul(uint256(1e18) - weight).mul(priceMultiplier), osqthEthPrice, uint256(1e18).div(IVaultMath(vaultMath).getPriceFromTick(boundaries.osqthEthLower)), uint256(1e18).div(IVaultMath(vaultMath).getPriceFromTick(boundaries.osqthEthUpper)), 1e18 ); return Constants.AuctionParams( boundaries, liquidityEthUsdc, liquidityOsqthEth, totalValue, ethUsdcPrice.mul(priceMultiplier) ); } /** * @notice calculate amounts that will be exchanged during auction * @param boundaries positions boundaries * @param liquidityEthUsdc target liquidity for ETH:USDC pool * @param liquidityOsqthEth target liquidity for oSQTH:ETH pool */ function _getTargets( Constants.Boundaries memory boundaries, uint128 liquidityEthUsdc, uint128 liquidityOsqthEth ) internal view returns ( uint256, uint256, uint256 ) { (uint256 ethAmount, uint256 usdcAmount, uint256 osqthAmount) = IVaultTreasury(vaultTreasury) .allAmountsForLiquidity(boundaries, liquidityEthUsdc, liquidityOsqthEth); return (ethAmount, usdcAmount, osqthAmount); } /** * @notice calculate lp-positions boundaries * @param aEthUsdcPrice auction EthUsdc price * @param aOsqthEthPrice auction OsqthEth price */ function _getBoundaries( uint256 aEthUsdcPrice, uint256 aOsqthEthPrice, bool isPosIVbump, uint256 expIVbump ) internal view returns (Constants.Boundaries memory) { int24 tickSpacing = IVaultStorage(vaultStorage).tickSpacing(); //const = 2^96 int24 tickFloorEthUsdc = _floor( IUniswapMath(uniswapMath).getTickAtSqrtRatio( _toUint160(((uint256(1e30).div(aEthUsdcPrice)).sqrt()).mul(79228162514264337593543950336)) ), tickSpacing ); int24 tickFloorOsqthEth = _floor( IUniswapMath(uniswapMath).getTickAtSqrtRatio( _toUint160(((uint256(1e18).div(aOsqthEthPrice)).sqrt()).mul(79228162514264337593543950336)) ), tickSpacing ); //base thresholds int24 baseThreshold = IVaultStorage(vaultStorage).baseThreshold(); //iv adj parameter int24 tickAdj; { int24 baseAdj = toInt24( int256( ((expIVbump.div(IVaultStorage(vaultStorage).adjParam())).floor() * uint256(int256(tickSpacing))) .div(1e36) ) ); tickAdj = baseAdj < int24(120) ? int24(60) : baseAdj; } if (isPosIVbump) { return Constants.Boundaries( tickFloorEthUsdc - baseThreshold - tickAdj, tickFloorEthUsdc + tickSpacing + baseThreshold - tickAdj, tickFloorOsqthEth - baseThreshold - tickAdj, tickFloorOsqthEth + tickSpacing + baseThreshold - tickAdj ); } else { return Constants.Boundaries( tickFloorEthUsdc - baseThreshold + tickAdj, tickFloorEthUsdc + tickSpacing + baseThreshold + tickAdj, tickFloorOsqthEth - baseThreshold + tickAdj, tickFloorOsqthEth + tickSpacing + baseThreshold + tickAdj ); } } /// @dev exchange tokens with keeper function _swapWithKeeper( uint256 balance, uint256 target, uint256 minAmount, address coin, address keeper ) internal { if (target >= balance) { IERC20(coin).transferFrom(keeper, vaultTreasury, target.sub(balance).add(10)); } else { uint256 amount = balance.sub(target).sub(10); require(amount >= minAmount, "C21"); IVaultTreasury(vaultTreasury).transfer(IERC20(coin), keeper, amount); } } /** * @notice external function to get all auction parameters * @param _auctionTriggerTime timestamp when auction started * @return targetEth target amount of ETH * @return targetUsdc target amount of USDC * @return targetOsqth target amount of Osqth * @return ethBalance current ETH balance * @return usdcBalance current USDC balance * @return osqthBalance current Osqth balance */ function getParams(uint256 _auctionTriggerTime) external view override returns ( uint256, uint256, uint256, uint256, uint256, uint256 ) { Constants.AuctionParams memory auctionDetails = _getAuctionParams(_auctionTriggerTime); (uint256 targetEth, uint256 targetUsdc, uint256 targetOsqth) = _getTargets( auctionDetails.boundaries, auctionDetails.liquidityEthUsdc, auctionDetails.liquidityOsqthEth ); (uint256 ethBalance, uint256 usdcBalance, uint256 osqthBalance) = IVaultMath(vaultMath).getTotalAmounts(); return (targetEth, targetUsdc, targetOsqth, ethBalance, usdcBalance, osqthBalance); } /// @dev Rounds tick down towards negative infinity so that it's a multiple /// of `tickSpacing`. function _floor(int24 tick, int24 tickSpacing) internal pure returns (int24) { int24 compressed = tick / tickSpacing; if (tick < 0 && tick % tickSpacing != 0) compressed--; return compressed * tickSpacing; } /// @dev Casts uint256 to uint160 with overflow check. function _toUint160(uint256 x) internal pure returns (uint160) { assert(x <= type(uint160).max); return uint160(x); } /// @dev Casts int256 to int24 with overflow check. function toInt24(int256 value) internal pure returns (int24) { require(value >= type(int24).min && value <= type(int24).max, "C18"); return int24(value); } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (token/ERC20/extensions/IERC20Metadata.sol) pragma solidity ^0.8.0; import "../IERC20.sol"; /** * @dev Interface for the optional metadata functions from the ERC20 standard. * * _Available since v4.1._ */ interface IERC20Metadata is IERC20 { /** * @dev Returns the name of the token. */ function name() external view returns (string memory); /** * @dev Returns the symbol of the token. */ function symbol() external view returns (string memory); /** * @dev Returns the decimals places of the token. */ function decimals() external view returns (uint8); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (utils/Context.sol) pragma solidity ^0.8.0; /** * @dev Provides information about the current execution context, including the * sender of the transaction and its data. While these are generally available * via msg.sender and msg.data, they should not be accessed in such a direct * manner, since when dealing with meta-transactions the account sending and * paying for execution may not be the actual sender (as far as an application * is concerned). * * This contract is only required for intermediate, library-like contracts. */ abstract contract Context { function _msgSender() internal view virtual returns (address) { return msg.sender; } function _msgData() internal view virtual returns (bytes calldata) { return msg.data; } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.5.0) (utils/Address.sol) pragma solidity ^0.8.1; /** * @dev Collection of functions related to the address type */ library Address { /** * @dev Returns true if `account` is a contract. * * [IMPORTANT] * ==== * It is unsafe to assume that an address for which this function returns * false is an externally-owned account (EOA) and not a contract. * * Among others, `isContract` will return false for the following * types of addresses: * * - an externally-owned account * - a contract in construction * - an address where a contract will be created * - an address where a contract lived, but was destroyed * ==== * * [IMPORTANT] * ==== * You shouldn't rely on `isContract` to protect against flash loan attacks! * * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract * constructor. * ==== */ function isContract(address account) internal view returns (bool) { // This method relies on extcodesize/address.code.length, which returns 0 // for contracts in construction, since the code is only stored at the end // of the constructor execution. return account.code.length > 0; } /** * @dev Replacement for Solidity's `transfer`: sends `amount` wei to * `recipient`, forwarding all available gas and reverting on errors. * * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost * of certain opcodes, possibly making contracts go over the 2300 gas limit * imposed by `transfer`, making them unable to receive funds via * `transfer`. {sendValue} removes this limitation. * * https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more]. * * IMPORTANT: because control is transferred to `recipient`, care must be * taken to not create reentrancy vulnerabilities. Consider using * {ReentrancyGuard} or the * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern]. */ function sendValue(address payable recipient, uint256 amount) internal { require(address(this).balance >= amount, "Address: insufficient balance"); (bool success, ) = recipient.call{value: amount}(""); require(success, "Address: unable to send value, recipient may have reverted"); } /** * @dev Performs a Solidity function call using a low level `call`. A * plain `call` is an unsafe replacement for a function call: use this * function instead. * * If `target` reverts with a revert reason, it is bubbled up by this * function (like regular Solidity function calls). * * Returns the raw returned data. To convert to the expected return value, * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`]. * * Requirements: * * - `target` must be a contract. * - calling `target` with `data` must not revert. * * _Available since v3.1._ */ function functionCall(address target, bytes memory data) internal returns (bytes memory) { return functionCall(target, data, "Address: low-level call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with * `errorMessage` as a fallback revert reason when `target` reverts. * * _Available since v3.1._ */ function functionCall( address target, bytes memory data, string memory errorMessage ) internal returns (bytes memory) { return functionCallWithValue(target, data, 0, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but also transferring `value` wei to `target`. * * Requirements: * * - the calling contract must have an ETH balance of at least `value`. * - the called Solidity function must be `payable`. * * _Available since v3.1._ */ function functionCallWithValue( address target, bytes memory data, uint256 value ) internal returns (bytes memory) { return functionCallWithValue(target, data, value, "Address: low-level call with value failed"); } /** * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but * with `errorMessage` as a fallback revert reason when `target` reverts. * * _Available since v3.1._ */ function functionCallWithValue( address target, bytes memory data, uint256 value, string memory errorMessage ) internal returns (bytes memory) { require(address(this).balance >= value, "Address: insufficient balance for call"); require(isContract(target), "Address: call to non-contract"); (bool success, bytes memory returndata) = target.call{value: value}(data); return verifyCallResult(success, returndata, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but performing a static call. * * _Available since v3.3._ */ function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) { return functionStaticCall(target, data, "Address: low-level static call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`], * but performing a static call. * * _Available since v3.3._ */ function functionStaticCall( address target, bytes memory data, string memory errorMessage ) internal view returns (bytes memory) { require(isContract(target), "Address: static call to non-contract"); (bool success, bytes memory returndata) = target.staticcall(data); return verifyCallResult(success, returndata, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but performing a delegate call. * * _Available since v3.4._ */ function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) { return functionDelegateCall(target, data, "Address: low-level delegate call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`], * but performing a delegate call. * * _Available since v3.4._ */ function functionDelegateCall( address target, bytes memory data, string memory errorMessage ) internal returns (bytes memory) { require(isContract(target), "Address: delegate call to non-contract"); (bool success, bytes memory returndata) = target.delegatecall(data); return verifyCallResult(success, returndata, errorMessage); } /** * @dev Tool to verifies that a low level call was successful, and revert if it wasn't, either by bubbling the * revert reason using the provided one. * * _Available since v4.3._ */ function verifyCallResult( bool success, bytes memory returndata, string memory errorMessage ) internal pure returns (bytes memory) { if (success) { return returndata; } else { // Look for revert reason and bubble it up if present if (returndata.length > 0) { // The easiest way to bubble the revert reason is using memory via assembly assembly { let returndata_size := mload(returndata) revert(add(32, returndata), returndata_size) } } else { revert(errorMessage); } } } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (access/Ownable.sol) pragma solidity ^0.8.0; import "../utils/Context.sol"; /** * @dev Contract module which provides a basic access control mechanism, where * there is an account (an owner) that can be granted exclusive access to * specific functions. * * By default, the owner account will be the one that deploys the contract. This * can later be changed with {transferOwnership}. * * This module is used through inheritance. It will make available the modifier * `onlyOwner`, which can be applied to your functions to restrict their use to * the owner. */ abstract contract Ownable is Context { address private _owner; event OwnershipTransferred(address indexed previousOwner, address indexed newOwner); /** * @dev Initializes the contract setting the deployer as the initial owner. */ constructor() { _transferOwnership(_msgSender()); } /** * @dev Returns the address of the current owner. */ function owner() public view virtual returns (address) { return _owner; } /** * @dev Throws if called by any account other than the owner. */ modifier onlyOwner() { require(owner() == _msgSender(), "Ownable: caller is not the owner"); _; } /** * @dev Leaves the contract without owner. It will not be possible to call * `onlyOwner` functions anymore. Can only be called by the current owner. * * NOTE: Renouncing ownership will leave the contract without an owner, * thereby removing any functionality that is only available to the owner. */ function renounceOwnership() public virtual onlyOwner { _transferOwnership(address(0)); } /** * @dev Transfers ownership of the contract to a new account (`newOwner`). * Can only be called by the current owner. */ function transferOwnership(address newOwner) public virtual onlyOwner { require(newOwner != address(0), "Ownable: new owner is the zero address"); _transferOwnership(newOwner); } /** * @dev Transfers ownership of the contract to a new account (`newOwner`). * Internal function without access restriction. */ function _transferOwnership(address newOwner) internal virtual { address oldOwner = _owner; _owner = newOwner; emit OwnershipTransferred(oldOwner, newOwner); } }
// SPDX-License-Identifier: GPL-2.0-or-later pragma solidity >=0.5.0; import './pool/IUniswapV3PoolImmutables.sol'; import './pool/IUniswapV3PoolState.sol'; import './pool/IUniswapV3PoolDerivedState.sol'; import './pool/IUniswapV3PoolActions.sol'; import './pool/IUniswapV3PoolOwnerActions.sol'; import './pool/IUniswapV3PoolEvents.sol'; /// @title The interface for a Uniswap V3 Pool /// @notice A Uniswap pool facilitates swapping and automated market making between any two assets that strictly conform /// to the ERC20 specification /// @dev The pool interface is broken up into many smaller pieces interface IUniswapV3Pool is IUniswapV3PoolImmutables, IUniswapV3PoolState, IUniswapV3PoolDerivedState, IUniswapV3PoolActions, IUniswapV3PoolOwnerActions, IUniswapV3PoolEvents { }
// SPDX-License-Identifier: MIT pragma solidity =0.8.4; interface IOracle { function getHistoricalTwap( address _pool, address _base, address _quote, uint32 _period, uint32 _periodToHistoricPrice ) external view returns (uint256); function getTwap( address _pool, address _base, address _quote, uint32 _period, bool _checkPeriod ) external view returns (uint256); function getMaxPeriod(address _pool) external view returns (uint32); function getTimeWeightedAverageTickSafe(address _pool, uint32 _period) external view returns (int24 timeWeightedAverageTick); }
// SPDX-License-Identifier: MIT pragma solidity =0.8.4; interface IOsqthController { function getDenormalizedMark(uint32 _period) external view returns (uint256); function getIndex(uint32 _period) external view returns (uint256); }
// SPDX-License-Identifier: Unlicense pragma solidity =0.8.4; pragma abicoder v2; import {Constants} from "../Constants.sol"; interface IUniswapMath { function getTickAtSqrtRatio(uint160 sqrtPriceX96) external pure returns (int24 tick); function getSqrtRatioAtTick(int24 tick) external pure returns (uint160 sqrtPriceX96); function getAmountsForLiquidity( uint160 sqrtRatioX96, uint160 sqrtRatioAX96, uint160 sqrtRatioBX96, uint128 liquidity ) external pure returns (uint256 amount0, uint256 amount1); function getLiquidityForAmounts( uint160 sqrtRatioX96, uint160 sqrtRatioAX96, uint160 sqrtRatioBX96, uint256 amount0, uint256 amount1 ) external pure returns (uint128 liquidity); }
// SPDX-License-Identifier: GPL-2.0-or-later pragma solidity >=0.5.0; /// @title Pool state that never changes /// @notice These parameters are fixed for a pool forever, i.e., the methods will always return the same values interface IUniswapV3PoolImmutables { /// @notice The contract that deployed the pool, which must adhere to the IUniswapV3Factory interface /// @return The contract address function factory() external view returns (address); /// @notice The first of the two tokens of the pool, sorted by address /// @return The token contract address function token0() external view returns (address); /// @notice The second of the two tokens of the pool, sorted by address /// @return The token contract address function token1() external view returns (address); /// @notice The pool's fee in hundredths of a bip, i.e. 1e-6 /// @return The fee function fee() external view returns (uint24); /// @notice The pool tick spacing /// @dev Ticks can only be used at multiples of this value, minimum of 1 and always positive /// e.g.: a tickSpacing of 3 means ticks can be initialized every 3rd tick, i.e., ..., -6, -3, 0, 3, 6, ... /// This value is an int24 to avoid casting even though it is always positive. /// @return The tick spacing function tickSpacing() external view returns (int24); /// @notice The maximum amount of position liquidity that can use any tick in the range /// @dev This parameter is enforced per tick to prevent liquidity from overflowing a uint128 at any point, and /// also prevents out-of-range liquidity from being used to prevent adding in-range liquidity to a pool /// @return The max amount of liquidity per tick function maxLiquidityPerTick() external view returns (uint128); }
// SPDX-License-Identifier: GPL-2.0-or-later pragma solidity >=0.5.0; /// @title Pool state that can change /// @notice These methods compose the pool's state, and can change with any frequency including multiple times /// per transaction interface IUniswapV3PoolState { /// @notice The 0th storage slot in the pool stores many values, and is exposed as a single method to save gas /// when accessed externally. /// @return sqrtPriceX96 The current price of the pool as a sqrt(token1/token0) Q64.96 value /// tick The current tick of the pool, i.e. according to the last tick transition that was run. /// This value may not always be equal to SqrtTickMath.getTickAtSqrtRatio(sqrtPriceX96) if the price is on a tick /// boundary. /// observationIndex The index of the last oracle observation that was written, /// observationCardinality The current maximum number of observations stored in the pool, /// observationCardinalityNext The next maximum number of observations, to be updated when the observation. /// feeProtocol The protocol fee for both tokens of the pool. /// Encoded as two 4 bit values, where the protocol fee of token1 is shifted 4 bits and the protocol fee of token0 /// is the lower 4 bits. Used as the denominator of a fraction of the swap fee, e.g. 4 means 1/4th of the swap fee. /// unlocked Whether the pool is currently locked to reentrancy function slot0() external view returns ( uint160 sqrtPriceX96, int24 tick, uint16 observationIndex, uint16 observationCardinality, uint16 observationCardinalityNext, uint8 feeProtocol, bool unlocked ); /// @notice The fee growth as a Q128.128 fees of token0 collected per unit of liquidity for the entire life of the pool /// @dev This value can overflow the uint256 function feeGrowthGlobal0X128() external view returns (uint256); /// @notice The fee growth as a Q128.128 fees of token1 collected per unit of liquidity for the entire life of the pool /// @dev This value can overflow the uint256 function feeGrowthGlobal1X128() external view returns (uint256); /// @notice The amounts of token0 and token1 that are owed to the protocol /// @dev Protocol fees will never exceed uint128 max in either token function protocolFees() external view returns (uint128 token0, uint128 token1); /// @notice The currently in range liquidity available to the pool /// @dev This value has no relationship to the total liquidity across all ticks function liquidity() external view returns (uint128); /// @notice Look up information about a specific tick in the pool /// @param tick The tick to look up /// @return liquidityGross the total amount of position liquidity that uses the pool either as tick lower or /// tick upper, /// liquidityNet how much liquidity changes when the pool price crosses the tick, /// feeGrowthOutside0X128 the fee growth on the other side of the tick from the current tick in token0, /// feeGrowthOutside1X128 the fee growth on the other side of the tick from the current tick in token1, /// tickCumulativeOutside the cumulative tick value on the other side of the tick from the current tick /// secondsPerLiquidityOutsideX128 the seconds spent per liquidity on the other side of the tick from the current tick, /// secondsOutside the seconds spent on the other side of the tick from the current tick, /// initialized Set to true if the tick is initialized, i.e. liquidityGross is greater than 0, otherwise equal to false. /// Outside values can only be used if the tick is initialized, i.e. if liquidityGross is greater than 0. /// In addition, these values are only relative and must be used only in comparison to previous snapshots for /// a specific position. function ticks(int24 tick) external view returns ( uint128 liquidityGross, int128 liquidityNet, uint256 feeGrowthOutside0X128, uint256 feeGrowthOutside1X128, int56 tickCumulativeOutside, uint160 secondsPerLiquidityOutsideX128, uint32 secondsOutside, bool initialized ); /// @notice Returns 256 packed tick initialized boolean values. See TickBitmap for more information function tickBitmap(int16 wordPosition) external view returns (uint256); /// @notice Returns the information about a position by the position's key /// @param key The position's key is a hash of a preimage composed by the owner, tickLower and tickUpper /// @return _liquidity The amount of liquidity in the position, /// Returns feeGrowthInside0LastX128 fee growth of token0 inside the tick range as of the last mint/burn/poke, /// Returns feeGrowthInside1LastX128 fee growth of token1 inside the tick range as of the last mint/burn/poke, /// Returns tokensOwed0 the computed amount of token0 owed to the position as of the last mint/burn/poke, /// Returns tokensOwed1 the computed amount of token1 owed to the position as of the last mint/burn/poke function positions(bytes32 key) external view returns ( uint128 _liquidity, uint256 feeGrowthInside0LastX128, uint256 feeGrowthInside1LastX128, uint128 tokensOwed0, uint128 tokensOwed1 ); /// @notice Returns data about a specific observation index /// @param index The element of the observations array to fetch /// @dev You most likely want to use #observe() instead of this method to get an observation as of some amount of time /// ago, rather than at a specific index in the array. /// @return blockTimestamp The timestamp of the observation, /// Returns tickCumulative the tick multiplied by seconds elapsed for the life of the pool as of the observation timestamp, /// Returns secondsPerLiquidityCumulativeX128 the seconds per in range liquidity for the life of the pool as of the observation timestamp, /// Returns initialized whether the observation has been initialized and the values are safe to use function observations(uint256 index) external view returns ( uint32 blockTimestamp, int56 tickCumulative, uint160 secondsPerLiquidityCumulativeX128, bool initialized ); }
// SPDX-License-Identifier: GPL-2.0-or-later pragma solidity >=0.5.0; /// @title Pool state that is not stored /// @notice Contains view functions to provide information about the pool that is computed rather than stored on the /// blockchain. The functions here may have variable gas costs. interface IUniswapV3PoolDerivedState { /// @notice Returns the cumulative tick and liquidity as of each timestamp `secondsAgo` from the current block timestamp /// @dev To get a time weighted average tick or liquidity-in-range, you must call this with two values, one representing /// the beginning of the period and another for the end of the period. E.g., to get the last hour time-weighted average tick, /// you must call it with secondsAgos = [3600, 0]. /// @dev The time weighted average tick represents the geometric time weighted average price of the pool, in /// log base sqrt(1.0001) of token1 / token0. The TickMath library can be used to go from a tick value to a ratio. /// @param secondsAgos From how long ago each cumulative tick and liquidity value should be returned /// @return tickCumulatives Cumulative tick values as of each `secondsAgos` from the current block timestamp /// @return secondsPerLiquidityCumulativeX128s Cumulative seconds per liquidity-in-range value as of each `secondsAgos` from the current block /// timestamp function observe(uint32[] calldata secondsAgos) external view returns (int56[] memory tickCumulatives, uint160[] memory secondsPerLiquidityCumulativeX128s); /// @notice Returns a snapshot of the tick cumulative, seconds per liquidity and seconds inside a tick range /// @dev Snapshots must only be compared to other snapshots, taken over a period for which a position existed. /// I.e., snapshots cannot be compared if a position is not held for the entire period between when the first /// snapshot is taken and the second snapshot is taken. /// @param tickLower The lower tick of the range /// @param tickUpper The upper tick of the range /// @return tickCumulativeInside The snapshot of the tick accumulator for the range /// @return secondsPerLiquidityInsideX128 The snapshot of seconds per liquidity for the range /// @return secondsInside The snapshot of seconds per liquidity for the range function snapshotCumulativesInside(int24 tickLower, int24 tickUpper) external view returns ( int56 tickCumulativeInside, uint160 secondsPerLiquidityInsideX128, uint32 secondsInside ); }
// SPDX-License-Identifier: GPL-2.0-or-later pragma solidity >=0.5.0; /// @title Permissionless pool actions /// @notice Contains pool methods that can be called by anyone interface IUniswapV3PoolActions { /// @notice Sets the initial price for the pool /// @dev Price is represented as a sqrt(amountToken1/amountToken0) Q64.96 value /// @param sqrtPriceX96 the initial sqrt price of the pool as a Q64.96 function initialize(uint160 sqrtPriceX96) external; /// @notice Adds liquidity for the given recipient/tickLower/tickUpper position /// @dev The caller of this method receives a callback in the form of IUniswapV3MintCallback#uniswapV3MintCallback /// in which they must pay any token0 or token1 owed for the liquidity. The amount of token0/token1 due depends /// on tickLower, tickUpper, the amount of liquidity, and the current price. /// @param recipient The address for which the liquidity will be created /// @param tickLower The lower tick of the position in which to add liquidity /// @param tickUpper The upper tick of the position in which to add liquidity /// @param amount The amount of liquidity to mint /// @param data Any data that should be passed through to the callback /// @return amount0 The amount of token0 that was paid to mint the given amount of liquidity. Matches the value in the callback /// @return amount1 The amount of token1 that was paid to mint the given amount of liquidity. Matches the value in the callback function mint( address recipient, int24 tickLower, int24 tickUpper, uint128 amount, bytes calldata data ) external returns (uint256 amount0, uint256 amount1); /// @notice Collects tokens owed to a position /// @dev Does not recompute fees earned, which must be done either via mint or burn of any amount of liquidity. /// Collect must be called by the position owner. To withdraw only token0 or only token1, amount0Requested or /// amount1Requested may be set to zero. To withdraw all tokens owed, caller may pass any value greater than the /// actual tokens owed, e.g. type(uint128).max. Tokens owed may be from accumulated swap fees or burned liquidity. /// @param recipient The address which should receive the fees collected /// @param tickLower The lower tick of the position for which to collect fees /// @param tickUpper The upper tick of the position for which to collect fees /// @param amount0Requested How much token0 should be withdrawn from the fees owed /// @param amount1Requested How much token1 should be withdrawn from the fees owed /// @return amount0 The amount of fees collected in token0 /// @return amount1 The amount of fees collected in token1 function collect( address recipient, int24 tickLower, int24 tickUpper, uint128 amount0Requested, uint128 amount1Requested ) external returns (uint128 amount0, uint128 amount1); /// @notice Burn liquidity from the sender and account tokens owed for the liquidity to the position /// @dev Can be used to trigger a recalculation of fees owed to a position by calling with an amount of 0 /// @dev Fees must be collected separately via a call to #collect /// @param tickLower The lower tick of the position for which to burn liquidity /// @param tickUpper The upper tick of the position for which to burn liquidity /// @param amount How much liquidity to burn /// @return amount0 The amount of token0 sent to the recipient /// @return amount1 The amount of token1 sent to the recipient function burn( int24 tickLower, int24 tickUpper, uint128 amount ) external returns (uint256 amount0, uint256 amount1); /// @notice Swap token0 for token1, or token1 for token0 /// @dev The caller of this method receives a callback in the form of IUniswapV3SwapCallback#uniswapV3SwapCallback /// @param recipient The address to receive the output of the swap /// @param zeroForOne The direction of the swap, true for token0 to token1, false for token1 to token0 /// @param amountSpecified The amount of the swap, which implicitly configures the swap as exact input (positive), or exact output (negative) /// @param sqrtPriceLimitX96 The Q64.96 sqrt price limit. If zero for one, the price cannot be less than this /// value after the swap. If one for zero, the price cannot be greater than this value after the swap /// @param data Any data to be passed through to the callback /// @return amount0 The delta of the balance of token0 of the pool, exact when negative, minimum when positive /// @return amount1 The delta of the balance of token1 of the pool, exact when negative, minimum when positive function swap( address recipient, bool zeroForOne, int256 amountSpecified, uint160 sqrtPriceLimitX96, bytes calldata data ) external returns (int256 amount0, int256 amount1); /// @notice Receive token0 and/or token1 and pay it back, plus a fee, in the callback /// @dev The caller of this method receives a callback in the form of IUniswapV3FlashCallback#uniswapV3FlashCallback /// @dev Can be used to donate underlying tokens pro-rata to currently in-range liquidity providers by calling /// with 0 amount{0,1} and sending the donation amount(s) from the callback /// @param recipient The address which will receive the token0 and token1 amounts /// @param amount0 The amount of token0 to send /// @param amount1 The amount of token1 to send /// @param data Any data to be passed through to the callback function flash( address recipient, uint256 amount0, uint256 amount1, bytes calldata data ) external; /// @notice Increase the maximum number of price and liquidity observations that this pool will store /// @dev This method is no-op if the pool already has an observationCardinalityNext greater than or equal to /// the input observationCardinalityNext. /// @param observationCardinalityNext The desired minimum number of observations for the pool to store function increaseObservationCardinalityNext(uint16 observationCardinalityNext) external; }
// SPDX-License-Identifier: GPL-2.0-or-later pragma solidity >=0.5.0; /// @title Permissioned pool actions /// @notice Contains pool methods that may only be called by the factory owner interface IUniswapV3PoolOwnerActions { /// @notice Set the denominator of the protocol's % share of the fees /// @param feeProtocol0 new protocol fee for token0 of the pool /// @param feeProtocol1 new protocol fee for token1 of the pool function setFeeProtocol(uint8 feeProtocol0, uint8 feeProtocol1) external; /// @notice Collect the protocol fee accrued to the pool /// @param recipient The address to which collected protocol fees should be sent /// @param amount0Requested The maximum amount of token0 to send, can be 0 to collect fees in only token1 /// @param amount1Requested The maximum amount of token1 to send, can be 0 to collect fees in only token0 /// @return amount0 The protocol fee collected in token0 /// @return amount1 The protocol fee collected in token1 function collectProtocol( address recipient, uint128 amount0Requested, uint128 amount1Requested ) external returns (uint128 amount0, uint128 amount1); }
// SPDX-License-Identifier: GPL-2.0-or-later pragma solidity >=0.5.0; /// @title Events emitted by a pool /// @notice Contains all events emitted by the pool interface IUniswapV3PoolEvents { /// @notice Emitted exactly once by a pool when #initialize is first called on the pool /// @dev Mint/Burn/Swap cannot be emitted by the pool before Initialize /// @param sqrtPriceX96 The initial sqrt price of the pool, as a Q64.96 /// @param tick The initial tick of the pool, i.e. log base 1.0001 of the starting price of the pool event Initialize(uint160 sqrtPriceX96, int24 tick); /// @notice Emitted when liquidity is minted for a given position /// @param sender The address that minted the liquidity /// @param owner The owner of the position and recipient of any minted liquidity /// @param tickLower The lower tick of the position /// @param tickUpper The upper tick of the position /// @param amount The amount of liquidity minted to the position range /// @param amount0 How much token0 was required for the minted liquidity /// @param amount1 How much token1 was required for the minted liquidity event Mint( address sender, address indexed owner, int24 indexed tickLower, int24 indexed tickUpper, uint128 amount, uint256 amount0, uint256 amount1 ); /// @notice Emitted when fees are collected by the owner of a position /// @dev Collect events may be emitted with zero amount0 and amount1 when the caller chooses not to collect fees /// @param owner The owner of the position for which fees are collected /// @param tickLower The lower tick of the position /// @param tickUpper The upper tick of the position /// @param amount0 The amount of token0 fees collected /// @param amount1 The amount of token1 fees collected event Collect( address indexed owner, address recipient, int24 indexed tickLower, int24 indexed tickUpper, uint128 amount0, uint128 amount1 ); /// @notice Emitted when a position's liquidity is removed /// @dev Does not withdraw any fees earned by the liquidity position, which must be withdrawn via #collect /// @param owner The owner of the position for which liquidity is removed /// @param tickLower The lower tick of the position /// @param tickUpper The upper tick of the position /// @param amount The amount of liquidity to remove /// @param amount0 The amount of token0 withdrawn /// @param amount1 The amount of token1 withdrawn event Burn( address indexed owner, int24 indexed tickLower, int24 indexed tickUpper, uint128 amount, uint256 amount0, uint256 amount1 ); /// @notice Emitted by the pool for any swaps between token0 and token1 /// @param sender The address that initiated the swap call, and that received the callback /// @param recipient The address that received the output of the swap /// @param amount0 The delta of the token0 balance of the pool /// @param amount1 The delta of the token1 balance of the pool /// @param sqrtPriceX96 The sqrt(price) of the pool after the swap, as a Q64.96 /// @param liquidity The liquidity of the pool after the swap /// @param tick The log base 1.0001 of price of the pool after the swap event Swap( address indexed sender, address indexed recipient, int256 amount0, int256 amount1, uint160 sqrtPriceX96, uint128 liquidity, int24 tick ); /// @notice Emitted by the pool for any flashes of token0/token1 /// @param sender The address that initiated the swap call, and that received the callback /// @param recipient The address that received the tokens from flash /// @param amount0 The amount of token0 that was flashed /// @param amount1 The amount of token1 that was flashed /// @param paid0 The amount of token0 paid for the flash, which can exceed the amount0 plus the fee /// @param paid1 The amount of token1 paid for the flash, which can exceed the amount1 plus the fee event Flash( address indexed sender, address indexed recipient, uint256 amount0, uint256 amount1, uint256 paid0, uint256 paid1 ); /// @notice Emitted by the pool for increases to the number of observations that can be stored /// @dev observationCardinalityNext is not the observation cardinality until an observation is written at the index /// just before a mint/swap/burn. /// @param observationCardinalityNextOld The previous value of the next observation cardinality /// @param observationCardinalityNextNew The updated value of the next observation cardinality event IncreaseObservationCardinalityNext( uint16 observationCardinalityNextOld, uint16 observationCardinalityNextNew ); /// @notice Emitted when the protocol fee is changed by the pool /// @param feeProtocol0Old The previous value of the token0 protocol fee /// @param feeProtocol1Old The previous value of the token1 protocol fee /// @param feeProtocol0New The updated value of the token0 protocol fee /// @param feeProtocol1New The updated value of the token1 protocol fee event SetFeeProtocol(uint8 feeProtocol0Old, uint8 feeProtocol1Old, uint8 feeProtocol0New, uint8 feeProtocol1New); /// @notice Emitted when the collected protocol fees are withdrawn by the factory owner /// @param sender The address that collects the protocol fees /// @param recipient The address that receives the collected protocol fees /// @param amount0 The amount of token0 protocol fees that is withdrawn /// @param amount0 The amount of token1 protocol fees that is withdrawn event CollectProtocol(address indexed sender, address indexed recipient, uint128 amount0, uint128 amount1); }
// SPDX-License-Identifier: Unlicense pragma solidity >=0.8.4; /// @notice Emitted when the result overflows uint256. error PRBMath__MulDivFixedPointOverflow(uint256 prod1); /// @notice Emitted when the result overflows uint256. error PRBMath__MulDivOverflow(uint256 prod1, uint256 denominator); /// @notice Emitted when one of the inputs is type(int256).min. error PRBMath__MulDivSignedInputTooSmall(); /// @notice Emitted when the intermediary absolute result overflows int256. error PRBMath__MulDivSignedOverflow(uint256 rAbs); /// @notice Emitted when the input is MIN_SD59x18. error PRBMathSD59x18__AbsInputTooSmall(); /// @notice Emitted when ceiling a number overflows SD59x18. error PRBMathSD59x18__CeilOverflow(int256 x); /// @notice Emitted when one of the inputs is MIN_SD59x18. error PRBMathSD59x18__DivInputTooSmall(); /// @notice Emitted when one of the intermediary unsigned results overflows SD59x18. error PRBMathSD59x18__DivOverflow(uint256 rAbs); /// @notice Emitted when the input is greater than 133.084258667509499441. error PRBMathSD59x18__ExpInputTooBig(int256 x); /// @notice Emitted when the input is greater than 192. error PRBMathSD59x18__Exp2InputTooBig(int256 x); /// @notice Emitted when flooring a number underflows SD59x18. error PRBMathSD59x18__FloorUnderflow(int256 x); /// @notice Emitted when converting a basic integer to the fixed-point format overflows SD59x18. error PRBMathSD59x18__FromIntOverflow(int256 x); /// @notice Emitted when converting a basic integer to the fixed-point format underflows SD59x18. error PRBMathSD59x18__FromIntUnderflow(int256 x); /// @notice Emitted when the product of the inputs is negative. error PRBMathSD59x18__GmNegativeProduct(int256 x, int256 y); /// @notice Emitted when multiplying the inputs overflows SD59x18. error PRBMathSD59x18__GmOverflow(int256 x, int256 y); /// @notice Emitted when the input is less than or equal to zero. error PRBMathSD59x18__LogInputTooSmall(int256 x); /// @notice Emitted when one of the inputs is MIN_SD59x18. error PRBMathSD59x18__MulInputTooSmall(); /// @notice Emitted when the intermediary absolute result overflows SD59x18. error PRBMathSD59x18__MulOverflow(uint256 rAbs); /// @notice Emitted when the intermediary absolute result overflows SD59x18. error PRBMathSD59x18__PowuOverflow(uint256 rAbs); /// @notice Emitted when the input is negative. error PRBMathSD59x18__SqrtNegativeInput(int256 x); /// @notice Emitted when the calculating the square root overflows SD59x18. error PRBMathSD59x18__SqrtOverflow(int256 x); /// @notice Emitted when addition overflows UD60x18. error PRBMathUD60x18__AddOverflow(uint256 x, uint256 y); /// @notice Emitted when ceiling a number overflows UD60x18. error PRBMathUD60x18__CeilOverflow(uint256 x); /// @notice Emitted when the input is greater than 133.084258667509499441. error PRBMathUD60x18__ExpInputTooBig(uint256 x); /// @notice Emitted when the input is greater than 192. error PRBMathUD60x18__Exp2InputTooBig(uint256 x); /// @notice Emitted when converting a basic integer to the fixed-point format format overflows UD60x18. error PRBMathUD60x18__FromUintOverflow(uint256 x); /// @notice Emitted when multiplying the inputs overflows UD60x18. error PRBMathUD60x18__GmOverflow(uint256 x, uint256 y); /// @notice Emitted when the input is less than 1. error PRBMathUD60x18__LogInputTooSmall(uint256 x); /// @notice Emitted when the calculating the square root overflows UD60x18. error PRBMathUD60x18__SqrtOverflow(uint256 x); /// @notice Emitted when subtraction underflows UD60x18. error PRBMathUD60x18__SubUnderflow(uint256 x, uint256 y); /// @dev Common mathematical functions used in both PRBMathSD59x18 and PRBMathUD60x18. Note that this shared library /// does not always assume the signed 59.18-decimal fixed-point or the unsigned 60.18-decimal fixed-point /// representation. When it does not, it is explicitly mentioned in the NatSpec documentation. library PRBMath { /// STRUCTS /// struct SD59x18 { int256 value; } struct UD60x18 { uint256 value; } /// STORAGE /// /// @dev How many trailing decimals can be represented. uint256 internal constant SCALE = 1e18; /// @dev Largest power of two divisor of SCALE. uint256 internal constant SCALE_LPOTD = 262144; /// @dev SCALE inverted mod 2^256. uint256 internal constant SCALE_INVERSE = 78156646155174841979727994598816262306175212592076161876661_508869554232690281; /// FUNCTIONS /// /// @notice Calculates the binary exponent of x using the binary fraction method. /// @dev Has to use 192.64-bit fixed-point numbers. /// See https://ethereum.stackexchange.com/a/96594/24693. /// @param x The exponent as an unsigned 192.64-bit fixed-point number. /// @return result The result as an unsigned 60.18-decimal fixed-point number. function exp2(uint256 x) internal pure returns (uint256 result) { unchecked { // Start from 0.5 in the 192.64-bit fixed-point format. result = 0x800000000000000000000000000000000000000000000000; // Multiply the result by root(2, 2^-i) when the bit at position i is 1. None of the intermediary results overflows // because the initial result is 2^191 and all magic factors are less than 2^65. if (x & 0x8000000000000000 > 0) { result = (result * 0x16A09E667F3BCC909) >> 64; } if (x & 0x4000000000000000 > 0) { result = (result * 0x1306FE0A31B7152DF) >> 64; } if (x & 0x2000000000000000 > 0) { result = (result * 0x1172B83C7D517ADCE) >> 64; } if (x & 0x1000000000000000 > 0) { result = (result * 0x10B5586CF9890F62A) >> 64; } if (x & 0x800000000000000 > 0) { result = (result * 0x1059B0D31585743AE) >> 64; } if (x & 0x400000000000000 > 0) { result = (result * 0x102C9A3E778060EE7) >> 64; } if (x & 0x200000000000000 > 0) { result = (result * 0x10163DA9FB33356D8) >> 64; } if (x & 0x100000000000000 > 0) { result = (result * 0x100B1AFA5ABCBED61) >> 64; } if (x & 0x80000000000000 > 0) { result = (result * 0x10058C86DA1C09EA2) >> 64; } if (x & 0x40000000000000 > 0) { result = (result * 0x1002C605E2E8CEC50) >> 64; } if (x & 0x20000000000000 > 0) { result = (result * 0x100162F3904051FA1) >> 64; } if (x & 0x10000000000000 > 0) { result = (result * 0x1000B175EFFDC76BA) >> 64; } if (x & 0x8000000000000 > 0) { result = (result * 0x100058BA01FB9F96D) >> 64; } if (x & 0x4000000000000 > 0) { result = (result * 0x10002C5CC37DA9492) >> 64; } if (x & 0x2000000000000 > 0) { result = (result * 0x1000162E525EE0547) >> 64; } if (x & 0x1000000000000 > 0) { result = (result * 0x10000B17255775C04) >> 64; } if (x & 0x800000000000 > 0) { result = (result * 0x1000058B91B5BC9AE) >> 64; } if (x & 0x400000000000 > 0) { result = (result * 0x100002C5C89D5EC6D) >> 64; } if (x & 0x200000000000 > 0) { result = (result * 0x10000162E43F4F831) >> 64; } if (x & 0x100000000000 > 0) { result = (result * 0x100000B1721BCFC9A) >> 64; } if (x & 0x80000000000 > 0) { result = (result * 0x10000058B90CF1E6E) >> 64; } if (x & 0x40000000000 > 0) { result = (result * 0x1000002C5C863B73F) >> 64; } if (x & 0x20000000000 > 0) { result = (result * 0x100000162E430E5A2) >> 64; } if (x & 0x10000000000 > 0) { result = (result * 0x1000000B172183551) >> 64; } if (x & 0x8000000000 > 0) { result = (result * 0x100000058B90C0B49) >> 64; } if (x & 0x4000000000 > 0) { result = (result * 0x10000002C5C8601CC) >> 64; } if (x & 0x2000000000 > 0) { result = (result * 0x1000000162E42FFF0) >> 64; } if (x & 0x1000000000 > 0) { result = (result * 0x10000000B17217FBB) >> 64; } if (x & 0x800000000 > 0) { result = (result * 0x1000000058B90BFCE) >> 64; } if (x & 0x400000000 > 0) { result = (result * 0x100000002C5C85FE3) >> 64; } if (x & 0x200000000 > 0) { result = (result * 0x10000000162E42FF1) >> 64; } if (x & 0x100000000 > 0) { result = (result * 0x100000000B17217F8) >> 64; } if (x & 0x80000000 > 0) { result = (result * 0x10000000058B90BFC) >> 64; } if (x & 0x40000000 > 0) { result = (result * 0x1000000002C5C85FE) >> 64; } if (x & 0x20000000 > 0) { result = (result * 0x100000000162E42FF) >> 64; } if (x & 0x10000000 > 0) { result = (result * 0x1000000000B17217F) >> 64; } if (x & 0x8000000 > 0) { result = (result * 0x100000000058B90C0) >> 64; } if (x & 0x4000000 > 0) { result = (result * 0x10000000002C5C860) >> 64; } if (x & 0x2000000 > 0) { result = (result * 0x1000000000162E430) >> 64; } if (x & 0x1000000 > 0) { result = (result * 0x10000000000B17218) >> 64; } if (x & 0x800000 > 0) { result = (result * 0x1000000000058B90C) >> 64; } if (x & 0x400000 > 0) { result = (result * 0x100000000002C5C86) >> 64; } if (x & 0x200000 > 0) { result = (result * 0x10000000000162E43) >> 64; } if (x & 0x100000 > 0) { result = (result * 0x100000000000B1721) >> 64; } if (x & 0x80000 > 0) { result = (result * 0x10000000000058B91) >> 64; } if (x & 0x40000 > 0) { result = (result * 0x1000000000002C5C8) >> 64; } if (x & 0x20000 > 0) { result = (result * 0x100000000000162E4) >> 64; } if (x & 0x10000 > 0) { result = (result * 0x1000000000000B172) >> 64; } if (x & 0x8000 > 0) { result = (result * 0x100000000000058B9) >> 64; } if (x & 0x4000 > 0) { result = (result * 0x10000000000002C5D) >> 64; } if (x & 0x2000 > 0) { result = (result * 0x1000000000000162E) >> 64; } if (x & 0x1000 > 0) { result = (result * 0x10000000000000B17) >> 64; } if (x & 0x800 > 0) { result = (result * 0x1000000000000058C) >> 64; } if (x & 0x400 > 0) { result = (result * 0x100000000000002C6) >> 64; } if (x & 0x200 > 0) { result = (result * 0x10000000000000163) >> 64; } if (x & 0x100 > 0) { result = (result * 0x100000000000000B1) >> 64; } if (x & 0x80 > 0) { result = (result * 0x10000000000000059) >> 64; } if (x & 0x40 > 0) { result = (result * 0x1000000000000002C) >> 64; } if (x & 0x20 > 0) { result = (result * 0x10000000000000016) >> 64; } if (x & 0x10 > 0) { result = (result * 0x1000000000000000B) >> 64; } if (x & 0x8 > 0) { result = (result * 0x10000000000000006) >> 64; } if (x & 0x4 > 0) { result = (result * 0x10000000000000003) >> 64; } if (x & 0x2 > 0) { result = (result * 0x10000000000000001) >> 64; } if (x & 0x1 > 0) { result = (result * 0x10000000000000001) >> 64; } // We're doing two things at the same time: // // 1. Multiply the result by 2^n + 1, where "2^n" is the integer part and the one is added to account for // the fact that we initially set the result to 0.5. This is accomplished by subtracting from 191 // rather than 192. // 2. Convert the result to the unsigned 60.18-decimal fixed-point format. // // This works because 2^(191-ip) = 2^ip / 2^191, where "ip" is the integer part "2^n". result *= SCALE; result >>= (191 - (x >> 64)); } } /// @notice Finds the zero-based index of the first one in the binary representation of x. /// @dev See the note on msb in the "Find First Set" Wikipedia article https://en.wikipedia.org/wiki/Find_first_set /// @param x The uint256 number for which to find the index of the most significant bit. /// @return msb The index of the most significant bit as an uint256. function mostSignificantBit(uint256 x) internal pure returns (uint256 msb) { if (x >= 2**128) { x >>= 128; msb += 128; } if (x >= 2**64) { x >>= 64; msb += 64; } if (x >= 2**32) { x >>= 32; msb += 32; } if (x >= 2**16) { x >>= 16; msb += 16; } if (x >= 2**8) { x >>= 8; msb += 8; } if (x >= 2**4) { x >>= 4; msb += 4; } if (x >= 2**2) { x >>= 2; msb += 2; } if (x >= 2**1) { // No need to shift x any more. msb += 1; } } /// @notice Calculates floor(x*y÷denominator) with full precision. /// /// @dev Credit to Remco Bloemen under MIT license https://xn--2-umb.com/21/muldiv. /// /// Requirements: /// - The denominator cannot be zero. /// - The result must fit within uint256. /// /// Caveats: /// - This function does not work with fixed-point numbers. /// /// @param x The multiplicand as an uint256. /// @param y The multiplier as an uint256. /// @param denominator The divisor as an uint256. /// @return result The result as an uint256. function mulDiv( uint256 x, uint256 y, uint256 denominator ) internal pure returns (uint256 result) { // 512-bit multiply [prod1 prod0] = x * y. Compute the product mod 2^256 and mod 2^256 - 1, then use // use the Chinese Remainder Theorem to reconstruct the 512 bit result. The result is stored in two 256 // variables such that product = prod1 * 2^256 + prod0. uint256 prod0; // Least significant 256 bits of the product uint256 prod1; // Most significant 256 bits of the product assembly { let mm := mulmod(x, y, not(0)) prod0 := mul(x, y) prod1 := sub(sub(mm, prod0), lt(mm, prod0)) } // Handle non-overflow cases, 256 by 256 division. if (prod1 == 0) { unchecked { result = prod0 / denominator; } return result; } // Make sure the result is less than 2^256. Also prevents denominator == 0. if (prod1 >= denominator) { revert PRBMath__MulDivOverflow(prod1, denominator); } /////////////////////////////////////////////// // 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. unchecked { // Does not overflow because the denominator cannot be zero at this stage in the function. uint256 lpotdod = denominator & (~denominator + 1); assembly { // Divide denominator by lpotdod. denominator := div(denominator, lpotdod) // Divide [prod1 prod0] by lpotdod. prod0 := div(prod0, lpotdod) // Flip lpotdod such that it is 2^256 / lpotdod. If lpotdod is zero, then it becomes one. lpotdod := add(div(sub(0, lpotdod), lpotdod), 1) } // Shift in bits from prod1 into prod0. prod0 |= prod1 * lpotdod; // 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 floor(x*y÷1e18) with full precision. /// /// @dev Variant of "mulDiv" with constant folding, i.e. in which the denominator is always 1e18. Before returning the /// final result, we add 1 if (x * y) % SCALE >= HALF_SCALE. Without this, 6.6e-19 would be truncated to 0 instead of /// being rounded to 1e-18. See "Listing 6" and text above it at https://accu.org/index.php/journals/1717. /// /// Requirements: /// - The result must fit within uint256. /// /// Caveats: /// - The body is purposely left uncommented; see the NatSpec comments in "PRBMath.mulDiv" to understand how this works. /// - It is assumed that the result can never be type(uint256).max when x and y solve the following two equations: /// 1. x * y = type(uint256).max * SCALE /// 2. (x * y) % SCALE >= SCALE / 2 /// /// @param x The multiplicand as an unsigned 60.18-decimal fixed-point number. /// @param y The multiplier as an unsigned 60.18-decimal fixed-point number. /// @return result The result as an unsigned 60.18-decimal fixed-point number. function mulDivFixedPoint(uint256 x, uint256 y) internal pure returns (uint256 result) { uint256 prod0; uint256 prod1; assembly { let mm := mulmod(x, y, not(0)) prod0 := mul(x, y) prod1 := sub(sub(mm, prod0), lt(mm, prod0)) } if (prod1 >= SCALE) { revert PRBMath__MulDivFixedPointOverflow(prod1); } uint256 remainder; uint256 roundUpUnit; assembly { remainder := mulmod(x, y, SCALE) roundUpUnit := gt(remainder, 499999999999999999) } if (prod1 == 0) { unchecked { result = (prod0 / SCALE) + roundUpUnit; return result; } } assembly { result := add( mul( or( div(sub(prod0, remainder), SCALE_LPOTD), mul(sub(prod1, gt(remainder, prod0)), add(div(sub(0, SCALE_LPOTD), SCALE_LPOTD), 1)) ), SCALE_INVERSE ), roundUpUnit ) } } /// @notice Calculates floor(x*y÷denominator) with full precision. /// /// @dev An extension of "mulDiv" for signed numbers. Works by computing the signs and the absolute values separately. /// /// Requirements: /// - None of the inputs can be type(int256).min. /// - The result must fit within int256. /// /// @param x The multiplicand as an int256. /// @param y The multiplier as an int256. /// @param denominator The divisor as an int256. /// @return result The result as an int256. function mulDivSigned( int256 x, int256 y, int256 denominator ) internal pure returns (int256 result) { if (x == type(int256).min || y == type(int256).min || denominator == type(int256).min) { revert PRBMath__MulDivSignedInputTooSmall(); } // Get hold of the absolute values of x, y and the denominator. uint256 ax; uint256 ay; uint256 ad; unchecked { ax = x < 0 ? uint256(-x) : uint256(x); ay = y < 0 ? uint256(-y) : uint256(y); ad = denominator < 0 ? uint256(-denominator) : uint256(denominator); } // Compute the absolute value of (x*y)÷denominator. The result must fit within int256. uint256 rAbs = mulDiv(ax, ay, ad); if (rAbs > uint256(type(int256).max)) { revert PRBMath__MulDivSignedOverflow(rAbs); } // Get the signs of x, y and the denominator. uint256 sx; uint256 sy; uint256 sd; assembly { sx := sgt(x, sub(0, 1)) sy := sgt(y, sub(0, 1)) sd := sgt(denominator, sub(0, 1)) } // XOR over sx, sy and sd. This is checking whether there are one or three negative signs in the inputs. // If yes, the result should be negative. result = sx ^ sy ^ sd == 0 ? -int256(rAbs) : int256(rAbs); } /// @notice Calculates the square root of x, rounding down. /// @dev Uses the Babylonian method https://en.wikipedia.org/wiki/Methods_of_computing_square_roots#Babylonian_method. /// /// Caveats: /// - This function does not work with fixed-point numbers. /// /// @param x The uint256 number for which to calculate the square root. /// @return result The result as an uint256. function sqrt(uint256 x) internal pure returns (uint256 result) { if (x == 0) { return 0; } // Set the initial guess to the least power of two that is greater than or equal to sqrt(x). uint256 xAux = uint256(x); result = 1; if (xAux >= 0x100000000000000000000000000000000) { xAux >>= 128; result <<= 64; } if (xAux >= 0x10000000000000000) { xAux >>= 64; result <<= 32; } if (xAux >= 0x100000000) { xAux >>= 32; result <<= 16; } if (xAux >= 0x10000) { xAux >>= 16; result <<= 8; } if (xAux >= 0x100) { xAux >>= 8; result <<= 4; } if (xAux >= 0x10) { xAux >>= 4; result <<= 2; } if (xAux >= 0x8) { result <<= 1; } // The operations can never overflow because the result is max 2^127 when it enters this block. unchecked { result = (result + x / result) >> 1; result = (result + x / result) >> 1; result = (result + x / result) >> 1; result = (result + x / result) >> 1; result = (result + x / result) >> 1; result = (result + x / result) >> 1; result = (result + x / result) >> 1; // Seven iterations should be enough uint256 roundedDownResult = x / result; return result >= roundedDownResult ? roundedDownResult : result; } } }
// SPDX-License-Identifier: Unlicense pragma solidity =0.8.4; interface IAuction { function timeRebalance( address keeper, uint256 minAmountEth, uint256 minAmountUsdc, uint256 minAmountOsqth ) external; function priceRebalance( address keeper, uint256 auctionTriggerTime, uint256 minAmountEth, uint256 minAmountUsdc, uint256 minAmountOsqth ) external; function getParams(uint256 _auctionTriggerTime) external view returns ( uint256, uint256, uint256, uint256, uint256, uint256 ); }
{ "optimizer": { "enabled": false, "runs": 200 }, "outputSelection": { "*": { "*": [ "evm.bytecode", "evm.deployedBytecode", "devdoc", "userdoc", "metadata", "abi" ] } }, "libraries": {} }
Contract Security Audit
- No Contract Security Audit Submitted- Submit Audit Here
[{"inputs":[],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[{"internalType":"uint256","name":"prod1","type":"uint256"}],"name":"PRBMath__MulDivFixedPointOverflow","type":"error"},{"inputs":[{"internalType":"uint256","name":"prod1","type":"uint256"},{"internalType":"uint256","name":"denominator","type":"uint256"}],"name":"PRBMath__MulDivOverflow","type":"error"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"owner","type":"address"},{"indexed":true,"internalType":"address","name":"spender","type":"address"},{"indexed":false,"internalType":"uint256","name":"value","type":"uint256"}],"name":"Approval","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"previousOwner","type":"address"},{"indexed":true,"internalType":"address","name":"newOwner","type":"address"}],"name":"OwnershipTransferred","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"},{"inputs":[{"internalType":"address","name":"owner","type":"address"},{"internalType":"address","name":"spender","type":"address"}],"name":"allowance","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"spender","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"approve","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"auction","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":"_amountEth","type":"uint256"},{"internalType":"uint256","name":"_amountUsdc","type":"uint256"},{"internalType":"uint256","name":"_amountOsqth","type":"uint256"},{"internalType":"uint256","name":"_totalSupply","type":"uint256"},{"internalType":"bool","name":"_isFlash","type":"bool"}],"name":"calcSharesAndAmounts","outputs":[{"internalType":"uint256","name":"shares","type":"uint256"},{"internalType":"uint256","name":"ethToDeposit","type":"uint256"},{"internalType":"uint256","name":"usdcToDeposit","type":"uint256"},{"internalType":"uint256","name":"osqthToDeposit","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"amountEth","type":"uint256"},{"internalType":"uint256","name":"amountUsdc","type":"uint256"},{"internalType":"uint256","name":"amountOsqth","type":"uint256"},{"internalType":"address","name":"to","type":"address"}],"name":"collectProtocol","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"decimals","outputs":[{"internalType":"uint8","name":"","type":"uint8"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"spender","type":"address"},{"internalType":"uint256","name":"subtractedValue","type":"uint256"}],"name":"decreaseAllowance","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"amountEth","type":"uint256"},{"internalType":"uint256","name":"amountUsdc","type":"uint256"},{"internalType":"uint256","name":"amountOsqth","type":"uint256"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"amountEthMin","type":"uint256"},{"internalType":"uint256","name":"amountUsdcMin","type":"uint256"},{"internalType":"uint256","name":"amountOsqthMin","type":"uint256"}],"name":"deposit","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"spender","type":"address"},{"internalType":"uint256","name":"addedValue","type":"uint256"}],"name":"increaseAllowance","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"name","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"renounceOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_uniswapMath","type":"address"},{"internalType":"address","name":"_vault","type":"address"},{"internalType":"address","name":"_auction","type":"address"},{"internalType":"address","name":"_vaultMath","type":"address"},{"internalType":"address","name":"_vaultTreasury","type":"address"},{"internalType":"address","name":"_vaultStorage","type":"address"}],"name":"setComponents","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"symbol","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"totalSupply","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"transfer","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"from","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"transferFrom","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"uniswapMath","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"vault","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"vaultMath","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"vaultStorage","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"vaultTreasury","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"shares","type":"uint256"},{"internalType":"uint256","name":"amountEthMin","type":"uint256"},{"internalType":"uint256","name":"amountUsdcMin","type":"uint256"},{"internalType":"uint256","name":"amountOsqthMin","type":"uint256"}],"name":"withdraw","outputs":[],"stateMutability":"nonpayable","type":"function"}]
Contract Creation Code
60806040523480156200001157600080fd5b506040518060400160405280600f81526020017f4c69717569204865646765686f672000000000000000000000000000000000008152506040518060400160405280600881526020017f4865646765686f67000000000000000000000000000000000000000000000000815250816003908051906020019062000096929190620001ae565b508060049080519060200190620000af929190620001ae565b5050506001600581905550620000da620000ce620000e060201b60201c565b620000e860201b60201c565b620002c3565b600033905090565b6000600660009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905081600660006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055508173ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a35050565b828054620001bc906200025e565b90600052602060002090601f016020900481019282620001e057600085556200022c565b82601f10620001fb57805160ff19168380011785556200022c565b828001600101855582156200022c579182015b828111156200022b5782518255916020019190600101906200020e565b5b5090506200023b91906200023f565b5090565b5b808211156200025a57600081600090555060010162000240565b5090565b600060028204905060018216806200027757607f821691505b602082108114156200028e576200028d62000294565b5b50919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602260045260246000fd5b61542780620002d36000396000f3fe608060405234801561001057600080fd5b50600436106101725760003560e01c806370a08231116100de578063a9059cbb11610097578063dd62ed3e11610071578063dd62ed3e14610468578063eaf5955714610498578063f2fde38b146104b4578063fbfa77cf146104d057610172565b8063a9059cbb146103e7578063afc4724414610417578063bef7df471461044a57610172565b806370a0823114610323578063715018a6146103535780637d9f6db51461035d5780638da5cb5b1461037b57806395d89b4114610399578063a457c2d7146103b757610172565b806325f368ae1161013057806325f368ae14610261578063313ce5671461027d578063367a87bb1461029b57806339509351146102b957806347db4dec146102e9578063674fb1b41461030757610172565b8062fe9ad41461017757806306fdde0314610195578063095ea7b3146101b35780630ca6157b146101e357806318160ddd1461021357806323b872dd14610231575b600080fd5b61017f6104ee565b60405161018c919061469c565b60405180910390f35b61019d610514565b6040516101aa9190614785565b60405180910390f35b6101cd60048036038101906101c89190613f5e565b6105a6565b6040516101da9190614733565b60405180910390f35b6101fd60048036038101906101f89190614103565b6105c9565b60405161020a9190614ae7565b60405180910390f35b61021b61103a565b6040516102289190614ae7565b60405180910390f35b61024b60048036038101906102469190613f0f565b611044565b6040516102589190614733565b60405180910390f35b61027b600480360381019061027691906140a0565b611073565b005b61028561147a565b6040516102929190614bfa565b60405180910390f35b6102a3611483565b6040516102b0919061469c565b60405180910390f35b6102d360048036038101906102ce9190613f5e565b6114a9565b6040516102e09190614733565b60405180910390f35b6102f1611553565b6040516102fe919061469c565b60405180910390f35b610321600480360381019061031c91906141a1565b611579565b005b61033d60048036038101906103389190613df8565b61264e565b60405161034a9190614ae7565b60405180910390f35b61035b612696565b005b61036561271e565b604051610372919061469c565b60405180910390f35b610383612744565b604051610390919061469c565b60405180910390f35b6103a161276e565b6040516103ae9190614785565b60405180910390f35b6103d160048036038101906103cc9190613f5e565b612800565b6040516103de9190614733565b60405180910390f35b61040160048036038101906103fc9190613f5e565b6128ea565b60405161040e9190614733565b60405180910390f35b610431600480360381019061042c9190614204565b61290d565b6040516104419493929190614b62565b60405180910390f35b610452612d20565b60405161045f919061469c565b60405180910390f35b610482600480360381019061047d9190613e4a565b612d46565b60405161048f9190614ae7565b60405180910390f35b6104b260048036038101906104ad9190613e86565b612dcd565b005b6104ce60048036038101906104c99190613df8565b612fef565b005b6104d86130e7565b6040516104e5919061469c565b60405180910390f35b600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60606003805461052390614d74565b80601f016020809104026020016040519081016040528092919081815260200182805461054f90614d74565b801561059c5780601f106105715761010080835404028352916020019161059c565b820191906000526020600020905b81548152906001019060200180831161057f57829003601f168201915b5050505050905090565b6000806105b161310d565b90506105be818585613115565b600191505092915050565b600060026005541415610611576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161060890614a27565b60405180910390fd5b6002600581905550600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16637691c4ac6040518163ffffffff1660e01b815260040160206040518083038186803b15801561068157600080fd5b505afa158015610695573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906106b99190613f9a565b156106f9576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016106f0906148e7565b60405180910390fd5b6000881161073c576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161073390614867565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168573ffffffffffffffffffffffffffffffffffffffff16141580156107a557503073ffffffffffffffffffffffffffffffffffffffff168573ffffffffffffffffffffffffffffffffffffffff1614155b6107e4576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016107db90614a07565b60405180910390fd5b600b60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663b01bae796040518163ffffffff1660e01b8152600401600060405180830381600087803b15801561084e57600080fd5b505af1158015610862573d6000803e3d6000fd5b50505050600061087061103a565b90506000811415610a51576000600a60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663bd9a548b6040518163ffffffff1660e01b8152600401604080518083038186803b1580156108e457600080fd5b505afa1580156108f8573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061091c9190614015565b509050600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663f49b192642600a60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663a569a2d76040518163ffffffff1660e01b815260040160206040518083038186803b1580156109c657600080fd5b505afa1580156109da573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906109fe9190613fec565b846040518463ffffffff1660e01b8152600401610a1d93929190614b2b565b600060405180830381600087803b158015610a3757600080fd5b505af1158015610a4b573d6000803e3d6000fd5b50505050505b600080600080610a658d8d8d88600061290d565b935093509350935088831015610ab0576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610aa7906148c7565b60405180910390fd5b87821015610af3576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610aea90614847565b60405180910390fd5b86811015610b36576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610b2d90614a67565b60405180910390fd5b6000831115610c065773c02aaa39b223fe8d0a0e5c4f27ead9083c756cc273ffffffffffffffffffffffffffffffffffffffff166323b872dd33600b60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16866040518463ffffffff1660e01b8152600401610bb2939291906146b7565b602060405180830381600087803b158015610bcc57600080fd5b505af1158015610be0573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610c049190613f9a565b505b6000821115610cd65773a0b86991c6218b36c1d19d4a2e9eb0ce3606eb4873ffffffffffffffffffffffffffffffffffffffff166323b872dd33600b60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16856040518463ffffffff1660e01b8152600401610c82939291906146b7565b602060405180830381600087803b158015610c9c57600080fd5b505af1158015610cb0573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610cd49190613f9a565b505b6000811115610da65773f1b99e3e573a1a9c5e6b2ce818b617f0e664e86b73ffffffffffffffffffffffffffffffffffffffff166323b872dd33600b60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16846040518463ffffffff1660e01b8152600401610d52939291906146b7565b602060405180830381600087803b158015610d6c57600080fd5b505af1158015610d80573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610da49190613f9a565b505b610db08a856132e0565b600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663355274ea6040518163ffffffff1660e01b815260040160206040518083038186803b158015610e1857600080fd5b505afa158015610e2c573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e509190613fec565b610e5861103a565b1115610e99576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610e90906149c7565b60405180910390fd5b600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16638fbc09836001600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16632dfdf0b56040518163ffffffff1660e01b815260040160206040518083038186803b158015610f4157600080fd5b505afa158015610f55573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610f799190613fec565b610f839190614c31565b6040518263ffffffff1660e01b8152600401610f9f9190614ae7565b600060405180830381600087803b158015610fb957600080fd5b505af1158015610fcd573d6000803e3d6000fd5b505050508973ffffffffffffffffffffffffffffffffffffffff167fe1fffcc4923d04b559f4d29a8bfc6cda04eb5b0d3c460751c2402c5c5cc9109c856040516110179190614ae7565b60405180910390a283955050505050506001600581905550979650505050505050565b6000600254905090565b60008061104f61310d565b905061105c858285613440565b6110678585856134cc565b60019150509392505050565b600260055414156110b9576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016110b090614a27565b60405180910390fd5b6002600581905550600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16635aa6e6756040518163ffffffff1660e01b815260040160206040518083038186803b15801561112957600080fd5b505afa15801561113d573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906111619190613e21565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16146111ce576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016111c590614907565b60405180910390fd5b600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663a58fa0348585856040518463ffffffff1660e01b815260040161122d93929190614b2b565b600060405180830381600087803b15801561124757600080fd5b505af115801561125b573d6000803e3d6000fd5b50505050600083111561130e57600b60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663beabacc873a0b86991c6218b36c1d19d4a2e9eb0ce3606eb4883866040518463ffffffff1660e01b81526004016112db9392919061474e565b600060405180830381600087803b1580156112f557600080fd5b505af1158015611309573d6000803e3d6000fd5b505050505b60008411156113bd57600b60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663beabacc873c02aaa39b223fe8d0a0e5c4f27ead9083c756cc283876040518463ffffffff1660e01b815260040161138a9392919061474e565b600060405180830381600087803b1580156113a457600080fd5b505af11580156113b8573d6000803e3d6000fd5b505050505b600082111561146c57600b60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663beabacc873f1b99e3e573a1a9c5e6b2ce818b617f0e664e86b83856040518463ffffffff1660e01b81526004016114399392919061474e565b600060405180830381600087803b15801561145357600080fd5b505af1158015611467573d6000803e3d6000fd5b505050505b600160058190555050505050565b60006012905090565b600b60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6000806114b461310d565b9050611548818585600160008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008973ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546115439190614c31565b613115565b600191505092915050565b600a60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b600260055414156115bf576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016115b690614a27565b60405180910390fd5b60026005819055506000841161160a576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161160190614aa7565b60405180910390fd5b600061161461103a565b9050611620338661374d565b6000611635828761392490919063ffffffff16565b9050600b60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663b01bae796040518163ffffffff1660e01b8152600401600060405180830381600087803b1580156116a157600080fd5b505af11580156116b5573d6000803e3d6000fd5b50505050600080600080600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16632dfdf0b56040518163ffffffff1660e01b815260040160206040518083038186803b15801561172757600080fd5b505afa15801561173b573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061175f9190613fec565b1415611b96576000600a60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663ac6f883e738ad599c3a0ff1de082011efddc58f1908eb6e6d8600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166303edf1dd6040518163ffffffff1660e01b815260040160206040518083038186803b15801561182257600080fd5b505afa158015611836573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061185a9190613fc3565b600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166375fae1606040518163ffffffff1660e01b815260040160206040518083038186803b1580156118c257600080fd5b505afa1580156118d6573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906118fa9190613fc3565b896040518563ffffffff1660e01b815260040161191a94939291906146ee565b6040805180830381600087803b15801561193357600080fd5b505af1158015611947573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061196b9190614015565b80925081945050506000600a60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663ac6f883e7382c427adfdf2d245ec51d8046b41c4ee87f0d29c600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16635ef3b35c6040518163ffffffff1660e01b815260040160206040518083038186803b158015611a3057600080fd5b505afa158015611a44573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611a689190613fc3565b600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663e3a62ed36040518163ffffffff1660e01b815260040160206040518083038186803b158015611ad057600080fd5b505afa158015611ae4573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611b089190613fc3565b8a6040518563ffffffff1660e01b8152600401611b2894939291906146ee565b6040805180830381600087803b158015611b4157600080fd5b505af1158015611b55573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611b799190614015565b80945081925050508082611b8d9190614c31565b945050506122b5565b6000611c7885611c6a600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663143f5aea6040518163ffffffff1660e01b815260040160206040518083038186803b158015611c0757600080fd5b505afa158015611c1b573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611c3f9190613fec565b611c5c73c02aaa39b223fe8d0a0e5c4f27ead9083c756cc2613941565b6139f590919063ffffffff16565b613a0b90919063ffffffff16565b90506000611d5c86611d4e600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16635987608c6040518163ffffffff1660e01b815260040160206040518083038186803b158015611ceb57600080fd5b505afa158015611cff573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611d239190613fec565b611d4073a0b86991c6218b36c1d19d4a2e9eb0ce3606eb48613941565b6139f590919063ffffffff16565b613a0b90919063ffffffff16565b90506000611e4087611e32600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16631b5e67426040518163ffffffff1660e01b815260040160206040518083038186803b158015611dcf57600080fd5b505afa158015611de3573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611e079190613fec565b611e2473f1b99e3e573a1a9c5e6b2ce818b617f0e664e86b613941565b6139f590919063ffffffff16565b613a0b90919063ffffffff16565b90506000600a60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663ac6f883e738ad599c3a0ff1de082011efddc58f1908eb6e6d8600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166303edf1dd6040518163ffffffff1660e01b815260040160206040518083038186803b158015611eff57600080fd5b505afa158015611f13573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611f379190613fc3565b600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166375fae1606040518163ffffffff1660e01b815260040160206040518083038186803b158015611f9f57600080fd5b505afa158015611fb3573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611fd79190613fc3565b8c6040518563ffffffff1660e01b8152600401611ff794939291906146ee565b6040805180830381600087803b15801561201057600080fd5b505af1158015612024573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906120489190614015565b80925081975050506000600a60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663ac6f883e7382c427adfdf2d245ec51d8046b41c4ee87f0d29c600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16635ef3b35c6040518163ffffffff1660e01b815260040160206040518083038186803b15801561210d57600080fd5b505afa158015612121573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906121459190613fc3565b600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663e3a62ed36040518163ffffffff1660e01b815260040160206040518083038186803b1580156121ad57600080fd5b505afa1580156121c1573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906121e59190613fc3565b8d6040518563ffffffff1660e01b815260040161220594939291906146ee565b6040805180830381600087803b15801561221e57600080fd5b505af1158015612232573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906122569190614015565b8097508192505050612283856122758385613a1f90919063ffffffff16565b613a1f90919063ffffffff16565b97506122988488613a1f90919063ffffffff16565b96506122ad8387613a1f90919063ffffffff16565b955050505050505b6000831415806122c6575060008214155b806122d2575060008114155b612311576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401612308906147c7565b60405180910390fd5b87831015612354576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161234b90614927565b60405180910390fd5b86821015612397576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161238e90614a47565b60405180910390fd5b858110156123da576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016123d1906149e7565b60405180910390fd5b600083111561248957600b60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663beabacc873c02aaa39b223fe8d0a0e5c4f27ead9083c756cc233866040518463ffffffff1660e01b81526004016124569392919061474e565b600060405180830381600087803b15801561247057600080fd5b505af1158015612484573d6000803e3d6000fd5b505050505b600082111561253857600b60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663beabacc873a0b86991c6218b36c1d19d4a2e9eb0ce3606eb4833856040518463ffffffff1660e01b81526004016125059392919061474e565b600060405180830381600087803b15801561251f57600080fd5b505af1158015612533573d6000803e3d6000fd5b505050505b60008111156125e757600b60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663beabacc873f1b99e3e573a1a9c5e6b2ce818b617f0e664e86b33846040518463ffffffff1660e01b81526004016125b49392919061474e565b600060405180830381600087803b1580156125ce57600080fd5b505af11580156125e2573d6000803e3d6000fd5b505050505b3373ffffffffffffffffffffffffffffffffffffffff167fe08737ac48a1dab4b1a46c7dc9398bd5bfc6d7ad6fabb7cd8caa254de14def358a8585856040516126339493929190614b62565b60405180910390a25050505050600160058190555050505050565b60008060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b61269e61310d565b73ffffffffffffffffffffffffffffffffffffffff166126bc612744565b73ffffffffffffffffffffffffffffffffffffffff1614612712576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161270990614947565b60405180910390fd5b61271c6000613a35565b565b600960009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6000600660009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b60606004805461277d90614d74565b80601f01602080910402602001604051908101604052809291908181526020018280546127a990614d74565b80156127f65780601f106127cb576101008083540402835291602001916127f6565b820191906000526020600020905b8154815290600101906020018083116127d957829003601f168201915b5050505050905090565b60008061280b61310d565b90506000600160008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050838110156128d1576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016128c890614a87565b60405180910390fd5b6128de8286868403613115565b60019250505092915050565b6000806128f561310d565b90506129028185856134cc565b600191505092915050565b600080600080600080600a60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663bd9a548b6040518163ffffffff1660e01b8152600401604080518083038186803b15801561297d57600080fd5b505afa158015612991573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906129b59190614015565b91509150600087612a7857600a60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16632e5a79ba8d8d8d87876040518663ffffffff1660e01b8152600401612a23959493929190614ba7565b60206040518083038186803b158015612a3b57600080fd5b505afa158015612a4f573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612a739190613fec565b612a7a565b8b5b90506000891415612b2757809650612aa36706f05b59d3b2000082613a0b90919063ffffffff16565b9550612af16c0c9f2c9cd04674edea40000000612ae385612ad56703782dace9d9000086613a0b90919063ffffffff16565b613a0b90919063ffffffff16565b61392490919063ffffffff16565b9450612b2082612b126703782dace9d9000084613a0b90919063ffffffff16565b61392490919063ffffffff16565b9350612d11565b6000806000600a60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663c4a7761e6040518163ffffffff1660e01b815260040160606040518083038186803b158015612b9457600080fd5b505afa158015612ba8573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612bcc9190614051565b925092509250600080600a60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16632e5a79ba8686868c8c6040518663ffffffff1660e01b8152600401612c38959493929190614ba7565b60206040518083038186803b158015612c5057600080fd5b505afa158015612c64573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612c889190613fec565b9050612c9d818761392490919063ffffffff16565b91506000612cb48f8361392490919063ffffffff16565b9050612cc9818861392490919063ffffffff16565b9c505050612ce08185613a0b90919063ffffffff16565b9950612cf58184613a0b90919063ffffffff16565b9850612d0a8183613a0b90919063ffffffff16565b9750505050505b50505095509550955095915050565b600760009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6000600160008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b612dd561310d565b73ffffffffffffffffffffffffffffffffffffffff16612df3612744565b73ffffffffffffffffffffffffffffffffffffffff1614612e49576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401612e4090614947565b60405180910390fd5b858585858585600760006008600060096000600a6000600b6000600c60008c91906101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055508b91906101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055508a91906101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055508991906101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055508891906101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055508791906101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550505050505050505050505050565b612ff761310d565b73ffffffffffffffffffffffffffffffffffffffff16613015612744565b73ffffffffffffffffffffffffffffffffffffffff161461306b576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161306290614947565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1614156130db576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016130d290614807565b60405180910390fd5b6130e481613a35565b50565b600860009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415613185576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161317c906149a7565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614156131f5576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016131ec90614827565b60405180910390fd5b80600160008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925836040516132d39190614ae7565b60405180910390a3505050565b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415613350576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161334790614ac7565b60405180910390fd5b61335c60008383613afb565b806002600082825461336e9190614c31565b92505081905550806000808473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008282546133c39190614c31565b925050819055508173ffffffffffffffffffffffffffffffffffffffff16600073ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef836040516134289190614ae7565b60405180910390a361343c60008383613b00565b5050565b600061344c8484612d46565b90507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff81146134c657818110156134b8576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016134af90614887565b60405180910390fd5b6134c58484848403613115565b5b50505050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16141561353c576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161353390614987565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614156135ac576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016135a3906147a7565b60405180910390fd5b6135b7838383613afb565b60008060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205490508181101561363d576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401613634906148a7565b60405180910390fd5b8181036000808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550816000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008282546136d09190614c31565b925050819055508273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040516137349190614ae7565b60405180910390a3613747848484613b00565b50505050565b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614156137bd576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016137b490614967565b60405180910390fd5b6137c982600083613afb565b60008060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205490508181101561384f576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401613846906147e7565b60405180910390fd5b8181036000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555081600260008282546138a69190614c87565b92505081905550600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8460405161390b9190614ae7565b60405180910390a361391f83600084613b00565b505050565b600061393983670de0b6b3a764000084613b05565b905092915050565b60008173ffffffffffffffffffffffffffffffffffffffff166370a08231600b60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff166040518263ffffffff1660e01b815260040161399e919061469c565b60206040518083038186803b1580156139b657600080fd5b505afa1580156139ca573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906139ee9190613fec565b9050919050565b60008183613a039190614c87565b905092915050565b6000613a178383613c41565b905092915050565b60008183613a2d9190614c31565b905092915050565b6000600660009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905081600660006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055508173ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a35050565b505050565b505050565b600080600080198587098587029250828110838203039150506000811415613b6757838281613b5d577f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b0492505050613c3a565b838110613bad5780846040517f773cc18c000000000000000000000000000000000000000000000000000000008152600401613ba4929190614b02565b60405180910390fd5b60008486880990508281118203915080830392506000600186190186169050808604955080840493506001818260000304019050808302841793506000600287600302189050808702600203810290508087026002038102905080870260020381029050808702600203810290508087026002038102905080870260020381029050808502955050505050505b9392505050565b60008060008019848609848602925082811083820303915050670de0b6b3a76400008110613ca657806040517fd31b3402000000000000000000000000000000000000000000000000000000008152600401613c9d9190614ae7565b60405180910390fd5b600080670de0b6b3a764000086880991506706f05b59d3b1ffff821190506000831415613d195780670de0b6b3a76400008581613d0c577f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b0401945050505050613d5f565b807faccb18165bd6fe31ae1cf318dc5b51eee0e1ba569b88cd74c1773b91fac1066960016204000080600003040186851186030262040000858803041702019450505050505b92915050565b600081359050613d7481615395565b92915050565b600081519050613d8981615395565b92915050565b600081359050613d9e816153ac565b92915050565b600081519050613db3816153ac565b92915050565b600081519050613dc8816153c3565b92915050565b600081359050613ddd816153da565b92915050565b600081519050613df2816153da565b92915050565b600060208284031215613e0a57600080fd5b6000613e1884828501613d65565b91505092915050565b600060208284031215613e3357600080fd5b6000613e4184828501613d7a565b91505092915050565b60008060408385031215613e5d57600080fd5b6000613e6b85828601613d65565b9250506020613e7c85828601613d65565b9150509250929050565b60008060008060008060c08789031215613e9f57600080fd5b6000613ead89828a01613d65565b9650506020613ebe89828a01613d65565b9550506040613ecf89828a01613d65565b9450506060613ee089828a01613d65565b9350506080613ef189828a01613d65565b92505060a0613f0289828a01613d65565b9150509295509295509295565b600080600060608486031215613f2457600080fd5b6000613f3286828701613d65565b9350506020613f4386828701613d65565b9250506040613f5486828701613dce565b9150509250925092565b60008060408385031215613f7157600080fd5b6000613f7f85828601613d65565b9250506020613f9085828601613dce565b9150509250929050565b600060208284031215613fac57600080fd5b6000613fba84828501613da4565b91505092915050565b600060208284031215613fd557600080fd5b6000613fe384828501613db9565b91505092915050565b600060208284031215613ffe57600080fd5b600061400c84828501613de3565b91505092915050565b6000806040838503121561402857600080fd5b600061403685828601613de3565b925050602061404785828601613de3565b9150509250929050565b60008060006060848603121561406657600080fd5b600061407486828701613de3565b935050602061408586828701613de3565b925050604061409686828701613de3565b9150509250925092565b600080600080608085870312156140b657600080fd5b60006140c487828801613dce565b94505060206140d587828801613dce565b93505060406140e687828801613dce565b92505060606140f787828801613d65565b91505092959194509250565b600080600080600080600060e0888a03121561411e57600080fd5b600061412c8a828b01613dce565b975050602061413d8a828b01613dce565b965050604061414e8a828b01613dce565b955050606061415f8a828b01613d65565b94505060806141708a828b01613dce565b93505060a06141818a828b01613dce565b92505060c06141928a828b01613dce565b91505092959891949750929550565b600080600080608085870312156141b757600080fd5b60006141c587828801613dce565b94505060206141d687828801613dce565b93505060406141e787828801613dce565b92505060606141f887828801613dce565b91505092959194509250565b600080600080600060a0868803121561421c57600080fd5b600061422a88828901613dce565b955050602061423b88828901613dce565b945050604061424c88828901613dce565b935050606061425d88828901613dce565b925050608061426e88828901613d8f565b9150509295509295909350565b61428481614cbb565b82525050565b61429381614ccd565b82525050565b6142a281614d1d565b82525050565b6142b181614cd9565b82525050565b60006142c282614c15565b6142cc8185614c20565b93506142dc818560208601614d41565b6142e581614e04565b840191505092915050565b60006142fd602383614c20565b915061430882614e15565b604082019050919050565b6000614320600283614c20565b915061432b82614e64565b602082019050919050565b6000614343602283614c20565b915061434e82614e8d565b604082019050919050565b6000614366602683614c20565b915061437182614edc565b604082019050919050565b6000614389602283614c20565b915061439482614f2b565b604082019050919050565b60006143ac600283614c20565b91506143b782614f7a565b602082019050919050565b60006143cf600383614c20565b91506143da82614fa3565b602082019050919050565b60006143f2601d83614c20565b91506143fd82614fcc565b602082019050919050565b6000614415602683614c20565b915061442082614ff5565b604082019050919050565b6000614438600283614c20565b915061444382615044565b602082019050919050565b600061445b600283614c20565b91506144668261506d565b602082019050919050565b600061447e600383614c20565b915061448982615096565b602082019050919050565b60006144a1600283614c20565b91506144ac826150bf565b602082019050919050565b60006144c4602083614c20565b91506144cf826150e8565b602082019050919050565b60006144e7602183614c20565b91506144f282615111565b604082019050919050565b600061450a602583614c20565b915061451582615160565b604082019050919050565b600061452d602483614c20565b9150614538826151af565b604082019050919050565b6000614550600283614c20565b915061455b826151fe565b602082019050919050565b6000614573600283614c20565b915061457e82615227565b602082019050919050565b6000614596600383614c20565b91506145a182615250565b602082019050919050565b60006145b9601f83614c20565b91506145c482615279565b602082019050919050565b60006145dc600283614c20565b91506145e7826152a2565b602082019050919050565b60006145ff600283614c20565b915061460a826152cb565b602082019050919050565b6000614622602583614c20565b915061462d826152f4565b604082019050919050565b6000614645600283614c20565b915061465082615343565b602082019050919050565b6000614668601f83614c20565b91506146738261536c565b602082019050919050565b61468781614d06565b82525050565b61469681614d10565b82525050565b60006020820190506146b1600083018461427b565b92915050565b60006060820190506146cc600083018661427b565b6146d9602083018561427b565b6146e6604083018461467e565b949350505050565b6000608082019050614703600083018761427b565b61471060208301866142a8565b61471d60408301856142a8565b61472a606083018461467e565b95945050505050565b6000602082019050614748600083018461428a565b92915050565b60006060820190506147636000830186614299565b614770602083018561427b565b61477d604083018461467e565b949350505050565b6000602082019050818103600083015261479f81846142b7565b905092915050565b600060208201905081810360008301526147c0816142f0565b9050919050565b600060208201905081810360008301526147e081614313565b9050919050565b6000602082019050818103600083015261480081614336565b9050919050565b6000602082019050818103600083015261482081614359565b9050919050565b600060208201905081810360008301526148408161437c565b9050919050565b600060208201905081810360008301526148608161439f565b9050919050565b60006020820190508181036000830152614880816143c2565b9050919050565b600060208201905081810360008301526148a0816143e5565b9050919050565b600060208201905081810360008301526148c081614408565b9050919050565b600060208201905081810360008301526148e08161442b565b9050919050565b600060208201905081810360008301526149008161444e565b9050919050565b6000602082019050818103600083015261492081614471565b9050919050565b6000602082019050818103600083015261494081614494565b9050919050565b60006020820190508181036000830152614960816144b7565b9050919050565b60006020820190508181036000830152614980816144da565b9050919050565b600060208201905081810360008301526149a0816144fd565b9050919050565b600060208201905081810360008301526149c081614520565b9050919050565b600060208201905081810360008301526149e081614543565b9050919050565b60006020820190508181036000830152614a0081614566565b9050919050565b60006020820190508181036000830152614a2081614589565b9050919050565b60006020820190508181036000830152614a40816145ac565b9050919050565b60006020820190508181036000830152614a60816145cf565b9050919050565b60006020820190508181036000830152614a80816145f2565b9050919050565b60006020820190508181036000830152614aa081614615565b9050919050565b60006020820190508181036000830152614ac081614638565b9050919050565b60006020820190508181036000830152614ae08161465b565b9050919050565b6000602082019050614afc600083018461467e565b92915050565b6000604082019050614b17600083018561467e565b614b24602083018461467e565b9392505050565b6000606082019050614b40600083018661467e565b614b4d602083018561467e565b614b5a604083018461467e565b949350505050565b6000608082019050614b77600083018761467e565b614b84602083018661467e565b614b91604083018561467e565b614b9e606083018461467e565b95945050505050565b600060a082019050614bbc600083018861467e565b614bc9602083018761467e565b614bd6604083018661467e565b614be3606083018561467e565b614bf0608083018461467e565b9695505050505050565b6000602082019050614c0f600083018461468d565b92915050565b600081519050919050565b600082825260208201905092915050565b6000614c3c82614d06565b9150614c4783614d06565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff03821115614c7c57614c7b614da6565b5b828201905092915050565b6000614c9282614d06565b9150614c9d83614d06565b925082821015614cb057614caf614da6565b5b828203905092915050565b6000614cc682614ce6565b9050919050565b60008115159050919050565b60008160020b9050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b600060ff82169050919050565b6000614d2882614d2f565b9050919050565b6000614d3a82614ce6565b9050919050565b60005b83811015614d5f578082015181840152602081019050614d44565b83811115614d6e576000848401525b50505050565b60006002820490506001821680614d8c57607f821691505b60208210811415614da057614d9f614dd5565b5b50919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602260045260246000fd5b6000601f19601f8301169050919050565b7f45524332303a207472616e7366657220746f20746865207a65726f206164647260008201527f6573730000000000000000000000000000000000000000000000000000000000602082015250565b7f4336000000000000000000000000000000000000000000000000000000000000600082015250565b7f45524332303a206275726e20616d6f756e7420657863656564732062616c616e60008201527f6365000000000000000000000000000000000000000000000000000000000000602082015250565b7f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160008201527f6464726573730000000000000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f766520746f20746865207a65726f20616464726560008201527f7373000000000000000000000000000000000000000000000000000000000000602082015250565b7f4332000000000000000000000000000000000000000000000000000000000000600082015250565b7f4331360000000000000000000000000000000000000000000000000000000000600082015250565b7f45524332303a20696e73756666696369656e7420616c6c6f77616e6365000000600082015250565b7f45524332303a207472616e7366657220616d6f756e742065786365656473206260008201527f616c616e63650000000000000000000000000000000000000000000000000000602082015250565b7f4331000000000000000000000000000000000000000000000000000000000000600082015250565b7f4330000000000000000000000000000000000000000000000000000000000000600082015250565b7f4331350000000000000000000000000000000000000000000000000000000000600082015250565b7f4337000000000000000000000000000000000000000000000000000000000000600082015250565b7f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572600082015250565b7f45524332303a206275726e2066726f6d20746865207a65726f2061646472657360008201527f7300000000000000000000000000000000000000000000000000000000000000602082015250565b7f45524332303a207472616e736665722066726f6d20746865207a65726f20616460008201527f6472657373000000000000000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f76652066726f6d20746865207a65726f2061646460008201527f7265737300000000000000000000000000000000000000000000000000000000602082015250565b7f4334000000000000000000000000000000000000000000000000000000000000600082015250565b7f4339000000000000000000000000000000000000000000000000000000000000600082015250565b7f4331370000000000000000000000000000000000000000000000000000000000600082015250565b7f5265656e7472616e637947756172643a207265656e7472616e742063616c6c00600082015250565b7f4338000000000000000000000000000000000000000000000000000000000000600082015250565b7f4333000000000000000000000000000000000000000000000000000000000000600082015250565b7f45524332303a2064656372656173656420616c6c6f77616e63652062656c6f7760008201527f207a65726f000000000000000000000000000000000000000000000000000000602082015250565b7f4335000000000000000000000000000000000000000000000000000000000000600082015250565b7f45524332303a206d696e7420746f20746865207a65726f206164647265737300600082015250565b61539e81614cbb565b81146153a957600080fd5b50565b6153b581614ccd565b81146153c057600080fd5b50565b6153cc81614cd9565b81146153d757600080fd5b50565b6153e381614d06565b81146153ee57600080fd5b5056fea26469706673582212205ca87734c9d07d51caf13a902f56571e4c2d6dfe754b4d5789a194901de0aaf064736f6c63430008040033
Deployed Bytecode
0x608060405234801561001057600080fd5b50600436106101725760003560e01c806370a08231116100de578063a9059cbb11610097578063dd62ed3e11610071578063dd62ed3e14610468578063eaf5955714610498578063f2fde38b146104b4578063fbfa77cf146104d057610172565b8063a9059cbb146103e7578063afc4724414610417578063bef7df471461044a57610172565b806370a0823114610323578063715018a6146103535780637d9f6db51461035d5780638da5cb5b1461037b57806395d89b4114610399578063a457c2d7146103b757610172565b806325f368ae1161013057806325f368ae14610261578063313ce5671461027d578063367a87bb1461029b57806339509351146102b957806347db4dec146102e9578063674fb1b41461030757610172565b8062fe9ad41461017757806306fdde0314610195578063095ea7b3146101b35780630ca6157b146101e357806318160ddd1461021357806323b872dd14610231575b600080fd5b61017f6104ee565b60405161018c919061469c565b60405180910390f35b61019d610514565b6040516101aa9190614785565b60405180910390f35b6101cd60048036038101906101c89190613f5e565b6105a6565b6040516101da9190614733565b60405180910390f35b6101fd60048036038101906101f89190614103565b6105c9565b60405161020a9190614ae7565b60405180910390f35b61021b61103a565b6040516102289190614ae7565b60405180910390f35b61024b60048036038101906102469190613f0f565b611044565b6040516102589190614733565b60405180910390f35b61027b600480360381019061027691906140a0565b611073565b005b61028561147a565b6040516102929190614bfa565b60405180910390f35b6102a3611483565b6040516102b0919061469c565b60405180910390f35b6102d360048036038101906102ce9190613f5e565b6114a9565b6040516102e09190614733565b60405180910390f35b6102f1611553565b6040516102fe919061469c565b60405180910390f35b610321600480360381019061031c91906141a1565b611579565b005b61033d60048036038101906103389190613df8565b61264e565b60405161034a9190614ae7565b60405180910390f35b61035b612696565b005b61036561271e565b604051610372919061469c565b60405180910390f35b610383612744565b604051610390919061469c565b60405180910390f35b6103a161276e565b6040516103ae9190614785565b60405180910390f35b6103d160048036038101906103cc9190613f5e565b612800565b6040516103de9190614733565b60405180910390f35b61040160048036038101906103fc9190613f5e565b6128ea565b60405161040e9190614733565b60405180910390f35b610431600480360381019061042c9190614204565b61290d565b6040516104419493929190614b62565b60405180910390f35b610452612d20565b60405161045f919061469c565b60405180910390f35b610482600480360381019061047d9190613e4a565b612d46565b60405161048f9190614ae7565b60405180910390f35b6104b260048036038101906104ad9190613e86565b612dcd565b005b6104ce60048036038101906104c99190613df8565b612fef565b005b6104d86130e7565b6040516104e5919061469c565b60405180910390f35b600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60606003805461052390614d74565b80601f016020809104026020016040519081016040528092919081815260200182805461054f90614d74565b801561059c5780601f106105715761010080835404028352916020019161059c565b820191906000526020600020905b81548152906001019060200180831161057f57829003601f168201915b5050505050905090565b6000806105b161310d565b90506105be818585613115565b600191505092915050565b600060026005541415610611576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161060890614a27565b60405180910390fd5b6002600581905550600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16637691c4ac6040518163ffffffff1660e01b815260040160206040518083038186803b15801561068157600080fd5b505afa158015610695573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906106b99190613f9a565b156106f9576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016106f0906148e7565b60405180910390fd5b6000881161073c576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161073390614867565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168573ffffffffffffffffffffffffffffffffffffffff16141580156107a557503073ffffffffffffffffffffffffffffffffffffffff168573ffffffffffffffffffffffffffffffffffffffff1614155b6107e4576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016107db90614a07565b60405180910390fd5b600b60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663b01bae796040518163ffffffff1660e01b8152600401600060405180830381600087803b15801561084e57600080fd5b505af1158015610862573d6000803e3d6000fd5b50505050600061087061103a565b90506000811415610a51576000600a60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663bd9a548b6040518163ffffffff1660e01b8152600401604080518083038186803b1580156108e457600080fd5b505afa1580156108f8573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061091c9190614015565b509050600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663f49b192642600a60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663a569a2d76040518163ffffffff1660e01b815260040160206040518083038186803b1580156109c657600080fd5b505afa1580156109da573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906109fe9190613fec565b846040518463ffffffff1660e01b8152600401610a1d93929190614b2b565b600060405180830381600087803b158015610a3757600080fd5b505af1158015610a4b573d6000803e3d6000fd5b50505050505b600080600080610a658d8d8d88600061290d565b935093509350935088831015610ab0576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610aa7906148c7565b60405180910390fd5b87821015610af3576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610aea90614847565b60405180910390fd5b86811015610b36576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610b2d90614a67565b60405180910390fd5b6000831115610c065773c02aaa39b223fe8d0a0e5c4f27ead9083c756cc273ffffffffffffffffffffffffffffffffffffffff166323b872dd33600b60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16866040518463ffffffff1660e01b8152600401610bb2939291906146b7565b602060405180830381600087803b158015610bcc57600080fd5b505af1158015610be0573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610c049190613f9a565b505b6000821115610cd65773a0b86991c6218b36c1d19d4a2e9eb0ce3606eb4873ffffffffffffffffffffffffffffffffffffffff166323b872dd33600b60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16856040518463ffffffff1660e01b8152600401610c82939291906146b7565b602060405180830381600087803b158015610c9c57600080fd5b505af1158015610cb0573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610cd49190613f9a565b505b6000811115610da65773f1b99e3e573a1a9c5e6b2ce818b617f0e664e86b73ffffffffffffffffffffffffffffffffffffffff166323b872dd33600b60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16846040518463ffffffff1660e01b8152600401610d52939291906146b7565b602060405180830381600087803b158015610d6c57600080fd5b505af1158015610d80573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610da49190613f9a565b505b610db08a856132e0565b600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663355274ea6040518163ffffffff1660e01b815260040160206040518083038186803b158015610e1857600080fd5b505afa158015610e2c573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e509190613fec565b610e5861103a565b1115610e99576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610e90906149c7565b60405180910390fd5b600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16638fbc09836001600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16632dfdf0b56040518163ffffffff1660e01b815260040160206040518083038186803b158015610f4157600080fd5b505afa158015610f55573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610f799190613fec565b610f839190614c31565b6040518263ffffffff1660e01b8152600401610f9f9190614ae7565b600060405180830381600087803b158015610fb957600080fd5b505af1158015610fcd573d6000803e3d6000fd5b505050508973ffffffffffffffffffffffffffffffffffffffff167fe1fffcc4923d04b559f4d29a8bfc6cda04eb5b0d3c460751c2402c5c5cc9109c856040516110179190614ae7565b60405180910390a283955050505050506001600581905550979650505050505050565b6000600254905090565b60008061104f61310d565b905061105c858285613440565b6110678585856134cc565b60019150509392505050565b600260055414156110b9576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016110b090614a27565b60405180910390fd5b6002600581905550600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16635aa6e6756040518163ffffffff1660e01b815260040160206040518083038186803b15801561112957600080fd5b505afa15801561113d573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906111619190613e21565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16146111ce576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016111c590614907565b60405180910390fd5b600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663a58fa0348585856040518463ffffffff1660e01b815260040161122d93929190614b2b565b600060405180830381600087803b15801561124757600080fd5b505af115801561125b573d6000803e3d6000fd5b50505050600083111561130e57600b60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663beabacc873a0b86991c6218b36c1d19d4a2e9eb0ce3606eb4883866040518463ffffffff1660e01b81526004016112db9392919061474e565b600060405180830381600087803b1580156112f557600080fd5b505af1158015611309573d6000803e3d6000fd5b505050505b60008411156113bd57600b60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663beabacc873c02aaa39b223fe8d0a0e5c4f27ead9083c756cc283876040518463ffffffff1660e01b815260040161138a9392919061474e565b600060405180830381600087803b1580156113a457600080fd5b505af11580156113b8573d6000803e3d6000fd5b505050505b600082111561146c57600b60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663beabacc873f1b99e3e573a1a9c5e6b2ce818b617f0e664e86b83856040518463ffffffff1660e01b81526004016114399392919061474e565b600060405180830381600087803b15801561145357600080fd5b505af1158015611467573d6000803e3d6000fd5b505050505b600160058190555050505050565b60006012905090565b600b60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6000806114b461310d565b9050611548818585600160008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008973ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546115439190614c31565b613115565b600191505092915050565b600a60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b600260055414156115bf576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016115b690614a27565b60405180910390fd5b60026005819055506000841161160a576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161160190614aa7565b60405180910390fd5b600061161461103a565b9050611620338661374d565b6000611635828761392490919063ffffffff16565b9050600b60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663b01bae796040518163ffffffff1660e01b8152600401600060405180830381600087803b1580156116a157600080fd5b505af11580156116b5573d6000803e3d6000fd5b50505050600080600080600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16632dfdf0b56040518163ffffffff1660e01b815260040160206040518083038186803b15801561172757600080fd5b505afa15801561173b573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061175f9190613fec565b1415611b96576000600a60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663ac6f883e738ad599c3a0ff1de082011efddc58f1908eb6e6d8600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166303edf1dd6040518163ffffffff1660e01b815260040160206040518083038186803b15801561182257600080fd5b505afa158015611836573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061185a9190613fc3565b600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166375fae1606040518163ffffffff1660e01b815260040160206040518083038186803b1580156118c257600080fd5b505afa1580156118d6573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906118fa9190613fc3565b896040518563ffffffff1660e01b815260040161191a94939291906146ee565b6040805180830381600087803b15801561193357600080fd5b505af1158015611947573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061196b9190614015565b80925081945050506000600a60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663ac6f883e7382c427adfdf2d245ec51d8046b41c4ee87f0d29c600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16635ef3b35c6040518163ffffffff1660e01b815260040160206040518083038186803b158015611a3057600080fd5b505afa158015611a44573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611a689190613fc3565b600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663e3a62ed36040518163ffffffff1660e01b815260040160206040518083038186803b158015611ad057600080fd5b505afa158015611ae4573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611b089190613fc3565b8a6040518563ffffffff1660e01b8152600401611b2894939291906146ee565b6040805180830381600087803b158015611b4157600080fd5b505af1158015611b55573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611b799190614015565b80945081925050508082611b8d9190614c31565b945050506122b5565b6000611c7885611c6a600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663143f5aea6040518163ffffffff1660e01b815260040160206040518083038186803b158015611c0757600080fd5b505afa158015611c1b573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611c3f9190613fec565b611c5c73c02aaa39b223fe8d0a0e5c4f27ead9083c756cc2613941565b6139f590919063ffffffff16565b613a0b90919063ffffffff16565b90506000611d5c86611d4e600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16635987608c6040518163ffffffff1660e01b815260040160206040518083038186803b158015611ceb57600080fd5b505afa158015611cff573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611d239190613fec565b611d4073a0b86991c6218b36c1d19d4a2e9eb0ce3606eb48613941565b6139f590919063ffffffff16565b613a0b90919063ffffffff16565b90506000611e4087611e32600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16631b5e67426040518163ffffffff1660e01b815260040160206040518083038186803b158015611dcf57600080fd5b505afa158015611de3573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611e079190613fec565b611e2473f1b99e3e573a1a9c5e6b2ce818b617f0e664e86b613941565b6139f590919063ffffffff16565b613a0b90919063ffffffff16565b90506000600a60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663ac6f883e738ad599c3a0ff1de082011efddc58f1908eb6e6d8600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166303edf1dd6040518163ffffffff1660e01b815260040160206040518083038186803b158015611eff57600080fd5b505afa158015611f13573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611f379190613fc3565b600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166375fae1606040518163ffffffff1660e01b815260040160206040518083038186803b158015611f9f57600080fd5b505afa158015611fb3573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611fd79190613fc3565b8c6040518563ffffffff1660e01b8152600401611ff794939291906146ee565b6040805180830381600087803b15801561201057600080fd5b505af1158015612024573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906120489190614015565b80925081975050506000600a60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663ac6f883e7382c427adfdf2d245ec51d8046b41c4ee87f0d29c600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16635ef3b35c6040518163ffffffff1660e01b815260040160206040518083038186803b15801561210d57600080fd5b505afa158015612121573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906121459190613fc3565b600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663e3a62ed36040518163ffffffff1660e01b815260040160206040518083038186803b1580156121ad57600080fd5b505afa1580156121c1573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906121e59190613fc3565b8d6040518563ffffffff1660e01b815260040161220594939291906146ee565b6040805180830381600087803b15801561221e57600080fd5b505af1158015612232573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906122569190614015565b8097508192505050612283856122758385613a1f90919063ffffffff16565b613a1f90919063ffffffff16565b97506122988488613a1f90919063ffffffff16565b96506122ad8387613a1f90919063ffffffff16565b955050505050505b6000831415806122c6575060008214155b806122d2575060008114155b612311576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401612308906147c7565b60405180910390fd5b87831015612354576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161234b90614927565b60405180910390fd5b86821015612397576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161238e90614a47565b60405180910390fd5b858110156123da576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016123d1906149e7565b60405180910390fd5b600083111561248957600b60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663beabacc873c02aaa39b223fe8d0a0e5c4f27ead9083c756cc233866040518463ffffffff1660e01b81526004016124569392919061474e565b600060405180830381600087803b15801561247057600080fd5b505af1158015612484573d6000803e3d6000fd5b505050505b600082111561253857600b60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663beabacc873a0b86991c6218b36c1d19d4a2e9eb0ce3606eb4833856040518463ffffffff1660e01b81526004016125059392919061474e565b600060405180830381600087803b15801561251f57600080fd5b505af1158015612533573d6000803e3d6000fd5b505050505b60008111156125e757600b60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663beabacc873f1b99e3e573a1a9c5e6b2ce818b617f0e664e86b33846040518463ffffffff1660e01b81526004016125b49392919061474e565b600060405180830381600087803b1580156125ce57600080fd5b505af11580156125e2573d6000803e3d6000fd5b505050505b3373ffffffffffffffffffffffffffffffffffffffff167fe08737ac48a1dab4b1a46c7dc9398bd5bfc6d7ad6fabb7cd8caa254de14def358a8585856040516126339493929190614b62565b60405180910390a25050505050600160058190555050505050565b60008060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b61269e61310d565b73ffffffffffffffffffffffffffffffffffffffff166126bc612744565b73ffffffffffffffffffffffffffffffffffffffff1614612712576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161270990614947565b60405180910390fd5b61271c6000613a35565b565b600960009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6000600660009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b60606004805461277d90614d74565b80601f01602080910402602001604051908101604052809291908181526020018280546127a990614d74565b80156127f65780601f106127cb576101008083540402835291602001916127f6565b820191906000526020600020905b8154815290600101906020018083116127d957829003601f168201915b5050505050905090565b60008061280b61310d565b90506000600160008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050838110156128d1576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016128c890614a87565b60405180910390fd5b6128de8286868403613115565b60019250505092915050565b6000806128f561310d565b90506129028185856134cc565b600191505092915050565b600080600080600080600a60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663bd9a548b6040518163ffffffff1660e01b8152600401604080518083038186803b15801561297d57600080fd5b505afa158015612991573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906129b59190614015565b91509150600087612a7857600a60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16632e5a79ba8d8d8d87876040518663ffffffff1660e01b8152600401612a23959493929190614ba7565b60206040518083038186803b158015612a3b57600080fd5b505afa158015612a4f573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612a739190613fec565b612a7a565b8b5b90506000891415612b2757809650612aa36706f05b59d3b2000082613a0b90919063ffffffff16565b9550612af16c0c9f2c9cd04674edea40000000612ae385612ad56703782dace9d9000086613a0b90919063ffffffff16565b613a0b90919063ffffffff16565b61392490919063ffffffff16565b9450612b2082612b126703782dace9d9000084613a0b90919063ffffffff16565b61392490919063ffffffff16565b9350612d11565b6000806000600a60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663c4a7761e6040518163ffffffff1660e01b815260040160606040518083038186803b158015612b9457600080fd5b505afa158015612ba8573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612bcc9190614051565b925092509250600080600a60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16632e5a79ba8686868c8c6040518663ffffffff1660e01b8152600401612c38959493929190614ba7565b60206040518083038186803b158015612c5057600080fd5b505afa158015612c64573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612c889190613fec565b9050612c9d818761392490919063ffffffff16565b91506000612cb48f8361392490919063ffffffff16565b9050612cc9818861392490919063ffffffff16565b9c505050612ce08185613a0b90919063ffffffff16565b9950612cf58184613a0b90919063ffffffff16565b9850612d0a8183613a0b90919063ffffffff16565b9750505050505b50505095509550955095915050565b600760009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6000600160008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b612dd561310d565b73ffffffffffffffffffffffffffffffffffffffff16612df3612744565b73ffffffffffffffffffffffffffffffffffffffff1614612e49576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401612e4090614947565b60405180910390fd5b858585858585600760006008600060096000600a6000600b6000600c60008c91906101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055508b91906101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055508a91906101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055508991906101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055508891906101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055508791906101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550505050505050505050505050565b612ff761310d565b73ffffffffffffffffffffffffffffffffffffffff16613015612744565b73ffffffffffffffffffffffffffffffffffffffff161461306b576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161306290614947565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1614156130db576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016130d290614807565b60405180910390fd5b6130e481613a35565b50565b600860009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415613185576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161317c906149a7565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614156131f5576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016131ec90614827565b60405180910390fd5b80600160008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925836040516132d39190614ae7565b60405180910390a3505050565b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415613350576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161334790614ac7565b60405180910390fd5b61335c60008383613afb565b806002600082825461336e9190614c31565b92505081905550806000808473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008282546133c39190614c31565b925050819055508173ffffffffffffffffffffffffffffffffffffffff16600073ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef836040516134289190614ae7565b60405180910390a361343c60008383613b00565b5050565b600061344c8484612d46565b90507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff81146134c657818110156134b8576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016134af90614887565b60405180910390fd5b6134c58484848403613115565b5b50505050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16141561353c576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161353390614987565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614156135ac576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016135a3906147a7565b60405180910390fd5b6135b7838383613afb565b60008060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205490508181101561363d576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401613634906148a7565b60405180910390fd5b8181036000808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550816000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008282546136d09190614c31565b925050819055508273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040516137349190614ae7565b60405180910390a3613747848484613b00565b50505050565b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614156137bd576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016137b490614967565b60405180910390fd5b6137c982600083613afb565b60008060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205490508181101561384f576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401613846906147e7565b60405180910390fd5b8181036000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555081600260008282546138a69190614c87565b92505081905550600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8460405161390b9190614ae7565b60405180910390a361391f83600084613b00565b505050565b600061393983670de0b6b3a764000084613b05565b905092915050565b60008173ffffffffffffffffffffffffffffffffffffffff166370a08231600b60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff166040518263ffffffff1660e01b815260040161399e919061469c565b60206040518083038186803b1580156139b657600080fd5b505afa1580156139ca573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906139ee9190613fec565b9050919050565b60008183613a039190614c87565b905092915050565b6000613a178383613c41565b905092915050565b60008183613a2d9190614c31565b905092915050565b6000600660009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905081600660006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055508173ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a35050565b505050565b505050565b600080600080198587098587029250828110838203039150506000811415613b6757838281613b5d577f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b0492505050613c3a565b838110613bad5780846040517f773cc18c000000000000000000000000000000000000000000000000000000008152600401613ba4929190614b02565b60405180910390fd5b60008486880990508281118203915080830392506000600186190186169050808604955080840493506001818260000304019050808302841793506000600287600302189050808702600203810290508087026002038102905080870260020381029050808702600203810290508087026002038102905080870260020381029050808502955050505050505b9392505050565b60008060008019848609848602925082811083820303915050670de0b6b3a76400008110613ca657806040517fd31b3402000000000000000000000000000000000000000000000000000000008152600401613c9d9190614ae7565b60405180910390fd5b600080670de0b6b3a764000086880991506706f05b59d3b1ffff821190506000831415613d195780670de0b6b3a76400008581613d0c577f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b0401945050505050613d5f565b807faccb18165bd6fe31ae1cf318dc5b51eee0e1ba569b88cd74c1773b91fac1066960016204000080600003040186851186030262040000858803041702019450505050505b92915050565b600081359050613d7481615395565b92915050565b600081519050613d8981615395565b92915050565b600081359050613d9e816153ac565b92915050565b600081519050613db3816153ac565b92915050565b600081519050613dc8816153c3565b92915050565b600081359050613ddd816153da565b92915050565b600081519050613df2816153da565b92915050565b600060208284031215613e0a57600080fd5b6000613e1884828501613d65565b91505092915050565b600060208284031215613e3357600080fd5b6000613e4184828501613d7a565b91505092915050565b60008060408385031215613e5d57600080fd5b6000613e6b85828601613d65565b9250506020613e7c85828601613d65565b9150509250929050565b60008060008060008060c08789031215613e9f57600080fd5b6000613ead89828a01613d65565b9650506020613ebe89828a01613d65565b9550506040613ecf89828a01613d65565b9450506060613ee089828a01613d65565b9350506080613ef189828a01613d65565b92505060a0613f0289828a01613d65565b9150509295509295509295565b600080600060608486031215613f2457600080fd5b6000613f3286828701613d65565b9350506020613f4386828701613d65565b9250506040613f5486828701613dce565b9150509250925092565b60008060408385031215613f7157600080fd5b6000613f7f85828601613d65565b9250506020613f9085828601613dce565b9150509250929050565b600060208284031215613fac57600080fd5b6000613fba84828501613da4565b91505092915050565b600060208284031215613fd557600080fd5b6000613fe384828501613db9565b91505092915050565b600060208284031215613ffe57600080fd5b600061400c84828501613de3565b91505092915050565b6000806040838503121561402857600080fd5b600061403685828601613de3565b925050602061404785828601613de3565b9150509250929050565b60008060006060848603121561406657600080fd5b600061407486828701613de3565b935050602061408586828701613de3565b925050604061409686828701613de3565b9150509250925092565b600080600080608085870312156140b657600080fd5b60006140c487828801613dce565b94505060206140d587828801613dce565b93505060406140e687828801613dce565b92505060606140f787828801613d65565b91505092959194509250565b600080600080600080600060e0888a03121561411e57600080fd5b600061412c8a828b01613dce565b975050602061413d8a828b01613dce565b965050604061414e8a828b01613dce565b955050606061415f8a828b01613d65565b94505060806141708a828b01613dce565b93505060a06141818a828b01613dce565b92505060c06141928a828b01613dce565b91505092959891949750929550565b600080600080608085870312156141b757600080fd5b60006141c587828801613dce565b94505060206141d687828801613dce565b93505060406141e787828801613dce565b92505060606141f887828801613dce565b91505092959194509250565b600080600080600060a0868803121561421c57600080fd5b600061422a88828901613dce565b955050602061423b88828901613dce565b945050604061424c88828901613dce565b935050606061425d88828901613dce565b925050608061426e88828901613d8f565b9150509295509295909350565b61428481614cbb565b82525050565b61429381614ccd565b82525050565b6142a281614d1d565b82525050565b6142b181614cd9565b82525050565b60006142c282614c15565b6142cc8185614c20565b93506142dc818560208601614d41565b6142e581614e04565b840191505092915050565b60006142fd602383614c20565b915061430882614e15565b604082019050919050565b6000614320600283614c20565b915061432b82614e64565b602082019050919050565b6000614343602283614c20565b915061434e82614e8d565b604082019050919050565b6000614366602683614c20565b915061437182614edc565b604082019050919050565b6000614389602283614c20565b915061439482614f2b565b604082019050919050565b60006143ac600283614c20565b91506143b782614f7a565b602082019050919050565b60006143cf600383614c20565b91506143da82614fa3565b602082019050919050565b60006143f2601d83614c20565b91506143fd82614fcc565b602082019050919050565b6000614415602683614c20565b915061442082614ff5565b604082019050919050565b6000614438600283614c20565b915061444382615044565b602082019050919050565b600061445b600283614c20565b91506144668261506d565b602082019050919050565b600061447e600383614c20565b915061448982615096565b602082019050919050565b60006144a1600283614c20565b91506144ac826150bf565b602082019050919050565b60006144c4602083614c20565b91506144cf826150e8565b602082019050919050565b60006144e7602183614c20565b91506144f282615111565b604082019050919050565b600061450a602583614c20565b915061451582615160565b604082019050919050565b600061452d602483614c20565b9150614538826151af565b604082019050919050565b6000614550600283614c20565b915061455b826151fe565b602082019050919050565b6000614573600283614c20565b915061457e82615227565b602082019050919050565b6000614596600383614c20565b91506145a182615250565b602082019050919050565b60006145b9601f83614c20565b91506145c482615279565b602082019050919050565b60006145dc600283614c20565b91506145e7826152a2565b602082019050919050565b60006145ff600283614c20565b915061460a826152cb565b602082019050919050565b6000614622602583614c20565b915061462d826152f4565b604082019050919050565b6000614645600283614c20565b915061465082615343565b602082019050919050565b6000614668601f83614c20565b91506146738261536c565b602082019050919050565b61468781614d06565b82525050565b61469681614d10565b82525050565b60006020820190506146b1600083018461427b565b92915050565b60006060820190506146cc600083018661427b565b6146d9602083018561427b565b6146e6604083018461467e565b949350505050565b6000608082019050614703600083018761427b565b61471060208301866142a8565b61471d60408301856142a8565b61472a606083018461467e565b95945050505050565b6000602082019050614748600083018461428a565b92915050565b60006060820190506147636000830186614299565b614770602083018561427b565b61477d604083018461467e565b949350505050565b6000602082019050818103600083015261479f81846142b7565b905092915050565b600060208201905081810360008301526147c0816142f0565b9050919050565b600060208201905081810360008301526147e081614313565b9050919050565b6000602082019050818103600083015261480081614336565b9050919050565b6000602082019050818103600083015261482081614359565b9050919050565b600060208201905081810360008301526148408161437c565b9050919050565b600060208201905081810360008301526148608161439f565b9050919050565b60006020820190508181036000830152614880816143c2565b9050919050565b600060208201905081810360008301526148a0816143e5565b9050919050565b600060208201905081810360008301526148c081614408565b9050919050565b600060208201905081810360008301526148e08161442b565b9050919050565b600060208201905081810360008301526149008161444e565b9050919050565b6000602082019050818103600083015261492081614471565b9050919050565b6000602082019050818103600083015261494081614494565b9050919050565b60006020820190508181036000830152614960816144b7565b9050919050565b60006020820190508181036000830152614980816144da565b9050919050565b600060208201905081810360008301526149a0816144fd565b9050919050565b600060208201905081810360008301526149c081614520565b9050919050565b600060208201905081810360008301526149e081614543565b9050919050565b60006020820190508181036000830152614a0081614566565b9050919050565b60006020820190508181036000830152614a2081614589565b9050919050565b60006020820190508181036000830152614a40816145ac565b9050919050565b60006020820190508181036000830152614a60816145cf565b9050919050565b60006020820190508181036000830152614a80816145f2565b9050919050565b60006020820190508181036000830152614aa081614615565b9050919050565b60006020820190508181036000830152614ac081614638565b9050919050565b60006020820190508181036000830152614ae08161465b565b9050919050565b6000602082019050614afc600083018461467e565b92915050565b6000604082019050614b17600083018561467e565b614b24602083018461467e565b9392505050565b6000606082019050614b40600083018661467e565b614b4d602083018561467e565b614b5a604083018461467e565b949350505050565b6000608082019050614b77600083018761467e565b614b84602083018661467e565b614b91604083018561467e565b614b9e606083018461467e565b95945050505050565b600060a082019050614bbc600083018861467e565b614bc9602083018761467e565b614bd6604083018661467e565b614be3606083018561467e565b614bf0608083018461467e565b9695505050505050565b6000602082019050614c0f600083018461468d565b92915050565b600081519050919050565b600082825260208201905092915050565b6000614c3c82614d06565b9150614c4783614d06565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff03821115614c7c57614c7b614da6565b5b828201905092915050565b6000614c9282614d06565b9150614c9d83614d06565b925082821015614cb057614caf614da6565b5b828203905092915050565b6000614cc682614ce6565b9050919050565b60008115159050919050565b60008160020b9050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b600060ff82169050919050565b6000614d2882614d2f565b9050919050565b6000614d3a82614ce6565b9050919050565b60005b83811015614d5f578082015181840152602081019050614d44565b83811115614d6e576000848401525b50505050565b60006002820490506001821680614d8c57607f821691505b60208210811415614da057614d9f614dd5565b5b50919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602260045260246000fd5b6000601f19601f8301169050919050565b7f45524332303a207472616e7366657220746f20746865207a65726f206164647260008201527f6573730000000000000000000000000000000000000000000000000000000000602082015250565b7f4336000000000000000000000000000000000000000000000000000000000000600082015250565b7f45524332303a206275726e20616d6f756e7420657863656564732062616c616e60008201527f6365000000000000000000000000000000000000000000000000000000000000602082015250565b7f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160008201527f6464726573730000000000000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f766520746f20746865207a65726f20616464726560008201527f7373000000000000000000000000000000000000000000000000000000000000602082015250565b7f4332000000000000000000000000000000000000000000000000000000000000600082015250565b7f4331360000000000000000000000000000000000000000000000000000000000600082015250565b7f45524332303a20696e73756666696369656e7420616c6c6f77616e6365000000600082015250565b7f45524332303a207472616e7366657220616d6f756e742065786365656473206260008201527f616c616e63650000000000000000000000000000000000000000000000000000602082015250565b7f4331000000000000000000000000000000000000000000000000000000000000600082015250565b7f4330000000000000000000000000000000000000000000000000000000000000600082015250565b7f4331350000000000000000000000000000000000000000000000000000000000600082015250565b7f4337000000000000000000000000000000000000000000000000000000000000600082015250565b7f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572600082015250565b7f45524332303a206275726e2066726f6d20746865207a65726f2061646472657360008201527f7300000000000000000000000000000000000000000000000000000000000000602082015250565b7f45524332303a207472616e736665722066726f6d20746865207a65726f20616460008201527f6472657373000000000000000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f76652066726f6d20746865207a65726f2061646460008201527f7265737300000000000000000000000000000000000000000000000000000000602082015250565b7f4334000000000000000000000000000000000000000000000000000000000000600082015250565b7f4339000000000000000000000000000000000000000000000000000000000000600082015250565b7f4331370000000000000000000000000000000000000000000000000000000000600082015250565b7f5265656e7472616e637947756172643a207265656e7472616e742063616c6c00600082015250565b7f4338000000000000000000000000000000000000000000000000000000000000600082015250565b7f4333000000000000000000000000000000000000000000000000000000000000600082015250565b7f45524332303a2064656372656173656420616c6c6f77616e63652062656c6f7760008201527f207a65726f000000000000000000000000000000000000000000000000000000602082015250565b7f4335000000000000000000000000000000000000000000000000000000000000600082015250565b7f45524332303a206d696e7420746f20746865207a65726f206164647265737300600082015250565b61539e81614cbb565b81146153a957600080fd5b50565b6153b581614ccd565b81146153c057600080fd5b50565b6153cc81614cd9565b81146153d757600080fd5b50565b6153e381614d06565b81146153ee57600080fd5b5056fea26469706673582212205ca87734c9d07d51caf13a902f56571e4c2d6dfe754b4d5789a194901de0aaf064736f6c63430008040033
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.