More Info
Private Name Tags
ContractCreator
Transaction Hash |
Method
|
Block
|
From
|
To
|
|||||
---|---|---|---|---|---|---|---|---|---|
Latest 17 internal transactions
Parent Transaction Hash | Block | From | To | |||
---|---|---|---|---|---|---|
16166240 | 26 days ago | 0.0001 S | ||||
16163358 | 26 days ago | 0.00000885 S | ||||
16163358 | 26 days ago | 0.00000885 S | ||||
16163109 | 26 days ago | 0.00000885 S | ||||
16163109 | 26 days ago | 0.00000885 S | ||||
16162868 | 26 days ago | 0.00008852 S | ||||
16162868 | 26 days ago | 0.00008852 S | ||||
16162402 | 26 days ago | 0.00001867 S | ||||
16162402 | 26 days ago | 0.00001867 S | ||||
16157311 | 26 days ago | 0.1 S | ||||
16155770 | 26 days ago | 0.0001 S | ||||
16155367 | 26 days ago | 0.00001 S | ||||
16155086 | 26 days ago | 0.00008941 S | ||||
16155086 | 26 days ago | 0.00008941 S | ||||
16154662 | 26 days ago | 0.0001 S | ||||
16153885 | 26 days ago | 0.0001 S | ||||
16109133 | 26 days ago | 0.0001 S |
Loading...
Loading
Contract Name:
Pool
Compiler Version
v0.8.4+commit.c7e474f2
Contract Source Code (Solidity Standard Json-Input format)
// SPDX-License-Identifier: MIT pragma solidity 0.8.4; import "@openzeppelin/contracts/token/ERC20/ERC20.sol"; import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol"; import "@openzeppelin/contracts/access/Ownable.sol"; import "@openzeppelin/contracts/security/ReentrancyGuard.sol"; import "@openzeppelin/contracts/utils/Address.sol"; import "@uniswap/v2-periphery/contracts/interfaces/IUniswapV2Router02.sol"; import "./interfaces/IXToken.sol"; import "./interfaces/IYToken.sol"; import "./interfaces/IYTokenReserve.sol"; import "./interfaces/IMasterOracle.sol"; import "./interfaces/IWETH.sol"; import "./interfaces/IStrategy.sol"; import "./interfaces/ISwapStrategy.sol"; import "./libs/WethUtils.sol"; contract Pool is Ownable, ReentrancyGuard { using SafeERC20 for ERC20; using SafeERC20 for IWETH; using SafeERC20 for IXToken; using SafeERC20 for IYToken; struct UserInfo { uint256 xTokenBalance; uint256 yTokenBalance; uint256 ethBalance; uint256 lastAction; } /* ========== ADDRESSES ================ */ IMasterOracle public oracle; IXToken public xToken; IYToken public yToken; IYTokenReserve public yTokenReserve; ISwapStrategy public swapStrategy; address public treasury; /* ========== STATE VARIABLES ========== */ mapping(address => UserInfo) public userInfo; uint256 public unclaimedEth; uint256 public unclaimedXToken; uint256 public unclaimedYToken; // Constants for various precisions uint256 private constant PRICE_PRECISION = 1e18; uint256 private constant COLLATERAL_RATIO_MAX = 1e6; uint256 private constant COLLATERAL_RATIO_MIN = 500000; uint256 private constant PRECISION = 1e6; // AccessControl state variables bool public mintPaused = false; bool public redeemPaused = false; // Collateral ratio uint256 public collateralRatio = 900000; uint256 public maxCapCollateralRatio = 900000; // 90% by default uint256 public lastRefreshCrTimestamp; uint256 public refreshCooldown = 3600; // = 1 hour uint256 public ratioStepUp = 2000; // = 0.002 or 0.2% -> ratioStep when CR increase uint256 public ratioStepDown = 1000; // = 0.001 or 0.1% -> ratioStep when CR decrease uint256 public priceTarget = 1e18; // = 1; 1 XToken pegged to the value of 1 ETH uint256 public priceBand = 5e15; // = 0.005; CR will be adjusted if XToken > 1.005 ETH or XToken < 0.995 ETH uint256 public minCollateralRatio = 700000; // 70% by default uint256 public yTokenSlippage = 1000000; // 100% at genesis bool public collateralRatioPaused = false; // fees uint256 public redemptionFee = 6500; // 6 decimals of precision uint256 public constant REDEMPTION_FEE_MAX = 10000; // 1% uint256 public mintingFee = 3500; // 6 decimals of precision uint256 public constant MINTING_FEE_MAX = 10000; // 1% address public strategy; address public nextStrategy; uint256 public constant TIMELOCK_STRATEGY = 96 * 60 * 60; //setting a strategy is protected by 96h internal timelock uint256 public nextStrategyTimestamp; /* ========== CONSTRUCTOR ========== */ constructor( address _xToken, address _yToken, address _yTokenReserve ) { require(_xToken != address(0), "Pool::initialize: invalidAddress"); require(_yToken != address(0), "Pool::initialize: invalidAddress"); require(_yTokenReserve != address(0), "Pool::initialize: invalidAddress"); xToken = IXToken(_xToken); xToken.setMinter(address(this)); yToken = IYToken(_yToken); yTokenReserve = IYTokenReserve(_yTokenReserve); yTokenReserve.setPool(address(this)); } /* ========== VIEWS ========== */ function WethAvailable() external view returns (uint256 _collateralBalance, uint256 _strategyWethAvailable){ _collateralBalance = usableCollateralBalance(); _strategyWethAvailable = IStrategy(strategy).wethAvailable(); } function info() external view returns ( uint256 _collateralRatio, uint256 _lastRefreshCrTimestamp, uint256 _mintingFee, uint256 _redemptionFee, bool _mintingPaused, bool _redemptionPaused, uint256 _collateralBalance ) { _collateralRatio = collateralRatio; _lastRefreshCrTimestamp = lastRefreshCrTimestamp; _mintingFee = mintingFee; _redemptionFee = redemptionFee; _mintingPaused = mintPaused; _redemptionPaused = redeemPaused; _collateralBalance = usableCollateralBalance(); } function usableCollateralBalance() public view returns (uint256) { uint256 _balance = WethUtils.weth.balanceOf(address(this)); return _balance > unclaimedEth ? (_balance - unclaimedEth) : 0; } /// @notice Calculate the expected results for zap minting /// @param _ethIn Amount of Collateral token input. /// @return _xTokenOut : the amount of XToken output. /// @return _yTokenOutTwap : the amount of YToken output by swapping based on Twap price /// @return _ethFee : the fee amount in Collateral token. /// @return _ethSwapIn : the amount of Collateral token to swap function calcMint(uint256 _ethIn) public view returns ( uint256 _xTokenOut, uint256 _yTokenOutTwap, uint256 _ethFee, uint256 _ethSwapIn ) { uint256 _yTokenTwap = oracle.getYTokenTWAP(); require(_yTokenTwap > 0, "Pool::calcMint: Invalid YToken price"); _ethSwapIn = (_ethIn * (COLLATERAL_RATIO_MAX - collateralRatio)) / COLLATERAL_RATIO_MAX; _yTokenOutTwap = (_ethSwapIn * PRICE_PRECISION) / _yTokenTwap; _ethFee = (_ethIn * mintingFee * collateralRatio) / COLLATERAL_RATIO_MAX / PRECISION; _xTokenOut = _ethIn - ((_ethIn * mintingFee) / PRECISION); } /// @notice Calculate the expected results for redemption /// @param _xTokenIn Amount of XToken input. /// @return _ethOut : the amount of Eth output /// @return _yTokenOutSpot : the amount of YToken output based on Spot prrice /// @return _yTokenOutTwap : the amount of YToken output based on TWAP /// @return _ethFee : the fee amount in Eth /// @return _requiredEthBalance : required Eth balance in the pool function calcRedeem(uint256 _xTokenIn) public view returns ( uint256 _ethOut, uint256 _yTokenOutSpot, uint256 _yTokenOutTwap, uint256 _ethFee, uint256 _requiredEthBalance ) { uint256 _yTokenPrice = oracle.getYTokenPrice(); uint256 _yTokenTWAP = oracle.getYTokenTWAP(); require(_yTokenPrice > 0, "Pool::calcRedeem: Invalid YToken price"); require(_yTokenTWAP > 0, "Pool::calcRedeem: Invalid yTokenTWAP"); _requiredEthBalance = (_xTokenIn * collateralRatio) / PRECISION; if (collateralRatio < COLLATERAL_RATIO_MAX) { _yTokenOutSpot = (_xTokenIn * (COLLATERAL_RATIO_MAX - collateralRatio) * (PRECISION - redemptionFee) * PRICE_PRECISION) / COLLATERAL_RATIO_MAX / PRECISION / _yTokenPrice; _yTokenOutTwap = (_xTokenIn * (COLLATERAL_RATIO_MAX - collateralRatio) * (PRECISION - redemptionFee) * PRICE_PRECISION) / COLLATERAL_RATIO_MAX / PRECISION / _yTokenTWAP; } if (collateralRatio > 0) { _ethOut = (_xTokenIn * collateralRatio * (PRECISION - redemptionFee)) / COLLATERAL_RATIO_MAX / PRECISION; _ethFee = (_xTokenIn * collateralRatio * redemptionFee) / COLLATERAL_RATIO_MAX / PRECISION; } } /// @notice Calculate the excess collateral balance function calcExcessCollateralBalance() public view returns (uint256 _delta, bool _exceeded) { uint256 _requiredCollateralBal = (xToken.totalSupply() * collateralRatio) / COLLATERAL_RATIO_MAX; uint256 _usableCollateralBal = usableCollateralBalance(); if (_usableCollateralBal >= _requiredCollateralBal) { _delta = _usableCollateralBal - _requiredCollateralBal; _exceeded = true; } else { _delta = _requiredCollateralBal - _usableCollateralBal; _exceeded = false; } } /* ========== PUBLIC FUNCTIONS ========== */ /// @notice Update collateral ratio and adjust based on the TWAP price of XToken function refreshCollateralRatio() public { require(collateralRatioPaused == false, "Pool::refreshCollateralRatio: Collateral Ratio has been paused"); require(block.timestamp - lastRefreshCrTimestamp >= refreshCooldown, "Pool::refreshCollateralRatio: Must wait for the refresh cooldown since last refresh"); uint256 _xTokenPrice = oracle.getXTokenTWAP(); if (_xTokenPrice > priceTarget + priceBand) { if (collateralRatio <= ratioStepDown) { collateralRatio = 0; } else { uint256 _newCR = collateralRatio - ratioStepDown; if (_newCR <= minCollateralRatio) { collateralRatio = minCollateralRatio; } else { collateralRatio = _newCR; } } } else if (_xTokenPrice < priceTarget - priceBand) { if (collateralRatio + ratioStepUp >= maxCapCollateralRatio) { collateralRatio = maxCapCollateralRatio; } else { collateralRatio = collateralRatio + ratioStepUp; } } lastRefreshCrTimestamp = block.timestamp; emit NewCollateralRatioSet(collateralRatio); } /// @notice fallback for payable -> required to unwrap WETH receive() external payable {} /* ========== MUTATIVE FUNCTIONS ========== */ function mint(uint256 _minXTokenOut) external payable nonReentrant { require(!mintPaused, "Pool::mint: Minting is paused"); uint256 _ethIn = msg.value; address _sender = msg.sender; (uint256 _xTokenOut, uint256 _yTokenOutTwap, uint256 _fee, uint256 _wethSwapIn) = calcMint(_ethIn); require(_xTokenOut >= _minXTokenOut, "Pool::mint: > slippage"); oracle.updateAllPairs(); WethUtils.wrap(_ethIn); if (_yTokenOutTwap > 0 && _wethSwapIn > 0) { WethUtils.weth.safeIncreaseAllowance(address(swapStrategy), _wethSwapIn); swapStrategy.execute(_wethSwapIn, _yTokenOutTwap); } if (_xTokenOut > 0) { userInfo[_sender].xTokenBalance = userInfo[_sender].xTokenBalance + _xTokenOut; unclaimedXToken = unclaimedXToken + _xTokenOut; } transferToTreasury(_fee); emit Mint(_sender, _xTokenOut, _ethIn, _fee); } function redeem( uint256 _xTokenIn, uint256 _minYTokenOut, uint256 _minEthOut ) external nonReentrant { require(!redeemPaused, "Pool::redeem: Redeeming is paused"); oracle.updateAllPairs(); address _sender = msg.sender; (uint256 _ethOut, uint256 _yTokenOutSpot, uint256 _yTokenOutTwap, uint256 _fee, uint256 _requiredEthBalance) = calcRedeem(_xTokenIn); // Check if collateral balance meets and meet output expectation require(_requiredEthBalance <= usableCollateralBalance(), "Pool::redeem: > ETH balance"); // Prevent price manipulation to get more yToken checkPriceFluctuation(_yTokenOutSpot, _yTokenOutTwap); require(_minEthOut <= _ethOut && _minYTokenOut <= _yTokenOutSpot, "Pool::redeem: >slippage"); if (_ethOut > 0) { userInfo[_sender].ethBalance = userInfo[_sender].ethBalance + _ethOut; unclaimedEth = unclaimedEth + _ethOut; } if (_yTokenOutSpot > 0) { userInfo[_sender].yTokenBalance = userInfo[_sender].yTokenBalance + _yTokenOutSpot; unclaimedYToken = unclaimedYToken + _yTokenOutSpot; } userInfo[_sender].lastAction = block.number; // Move all external functions to the end xToken.burnFrom(_sender, _xTokenIn); transferToTreasury(_fee); emit Redeem(_sender, _xTokenIn, _ethOut, _yTokenOutSpot, _fee); } /** * @notice collect all minting and redemption */ function collect() external nonReentrant { address _sender = msg.sender; require(userInfo[_sender].lastAction < block.number, "Pool::collect: <minimum_delay"); bool _sendXToken = false; bool _sendYToken = false; bool _sendEth = false; uint256 _xTokenAmount; uint256 _yTokenAmount; uint256 _ethAmount; // Use Checks-Effects-Interactions pattern if (userInfo[_sender].xTokenBalance > 0) { _xTokenAmount = userInfo[_sender].xTokenBalance; userInfo[_sender].xTokenBalance = 0; unclaimedXToken = unclaimedXToken - _xTokenAmount; _sendXToken = true; } if (userInfo[_sender].yTokenBalance > 0) { _yTokenAmount = userInfo[_sender].yTokenBalance; userInfo[_sender].yTokenBalance = 0; unclaimedYToken = unclaimedYToken - _yTokenAmount; _sendYToken = true; } if (userInfo[_sender].ethBalance > 0) { _ethAmount = userInfo[_sender].ethBalance; userInfo[_sender].ethBalance = 0; unclaimedEth = unclaimedEth - _ethAmount; _sendEth = true; } if (_sendXToken) { xToken.mint(_sender, _xTokenAmount); } if (_sendYToken) { if (yToken.balanceOf(address(yTokenReserve))<_yTokenAmount){ yTokenReserve.transfer(_sender, yToken.balanceOf(address(yTokenReserve))); } else{ yTokenReserve.transfer(_sender, _yTokenAmount); } } if (_sendEth) { WethUtils.unwrap(_ethAmount); Address.sendValue(payable(_sender), _ethAmount); } } /// @notice Function to recollateralize the pool by receiving ETH function recollateralize() external payable { uint256 _amount = msg.value; require(_amount > 0, "Pool::recollateralize: Invalid amount"); WethUtils.wrap(_amount); emit Recollateralized(msg.sender, _amount); } function checkPriceFluctuation(uint256 _yAmountSpotPrice, uint256 _yAmountTwap) internal view { uint256 _diff; if (_yAmountSpotPrice > _yAmountTwap) { _diff = _yAmountSpotPrice - _yAmountTwap; } else { _diff = _yAmountTwap - _yAmountSpotPrice; } require(_diff <= ((_yAmountTwap * yTokenSlippage) / PRECISION), "Pool::checkPriceFluctuation: > yTokenSlippage"); } /* ========== RESTRICTED FUNCTIONS ========== */ /// @notice Set next strategy address /// @param _strategy next strategy address function setNextStrategy(address _strategy) public onlyOwner { nextStrategy = _strategy; nextStrategyTimestamp = block.timestamp + TIMELOCK_STRATEGY; emit SetNextStrategy(_strategy); } /// @notice Set new strategy address from nextStrategy address function setStrategy() public onlyOwner { require (block.timestamp >= nextStrategyTimestamp); require (nextStrategyTimestamp > 0); strategy = nextStrategy; nextStrategyTimestamp = 0; emit SetStrategy(strategy); } /// @notice transfert weth from pool to strategy /// @param _wethIn amount of weth to transfert function sendToStrategy(uint256 _wethIn)public onlyOwner { require(_wethIn<= usableCollateralBalance(), "Pool::sendToStrategy: _wethIn > ETH balance"); WethUtils.transfer(strategy, _wethIn); IStrategy(strategy).add(_wethIn); emit SendToStrategy(_wethIn); } /// @notice transfert weth from strategy to pool /// @param _wethOut amount of weth to transfert function receiveFromStrategy(uint256 _wethOut)public onlyOwner { uint256 realWethOut = IStrategy(strategy).remove(_wethOut); emit ReceiveFromStrategy(_wethOut, realWethOut); } /// @notice Turn on / off minting and redemption /// @param _mintPaused Paused or NotPaused Minting /// @param _redeemPaused Paused or NotPaused Redemption function toggle(bool _mintPaused, bool _redeemPaused) public onlyOwner { mintPaused = _mintPaused; redeemPaused = _redeemPaused; emit Toggled(_mintPaused, _redeemPaused); } /// @notice Configure variables related to Collateral Ratio /// @param _ratioStepUp Step which Collateral Ratio will be increased each updates /// @param _ratioStepDown Step which Collateral Ratio will be decreased each updates /// @param _priceBand The collateral ratio will only be adjusted if current price move out of this band /// @param _refreshCooldown The minimum delay between each Collateral Ratio updates function setCollateralRatioOptions( uint256 _ratioStepUp, uint256 _ratioStepDown, uint256 _priceBand, uint256 _refreshCooldown ) public onlyOwner { ratioStepUp = _ratioStepUp; ratioStepDown = _ratioStepDown; priceBand = _priceBand; refreshCooldown = _refreshCooldown; emit NewCollateralRatioOptions(_ratioStepUp, _ratioStepDown, _priceBand, _refreshCooldown); } /// @notice Pause or unpause collateral ratio updates /// @param _collateralRatioPaused `true` or `false` function toggleCollateralRatio(bool _collateralRatioPaused) public onlyOwner { if (collateralRatioPaused != _collateralRatioPaused) { collateralRatioPaused = _collateralRatioPaused; emit UpdateCollateralRatioPaused(_collateralRatioPaused); } } /// @notice Set the protocol fees /// @param _mintingFee Minting fee in percentage /// @param _redemptionFee Redemption fee in percentage function setFees(uint256 _mintingFee, uint256 _redemptionFee) public onlyOwner { require(_mintingFee <= MINTING_FEE_MAX, "Pool::setFees:>MINTING_FEE_MAX"); require(_redemptionFee <= REDEMPTION_FEE_MAX, "Pool::setFees:>REDEMPTION_FEE_MAX"); redemptionFee = _redemptionFee; mintingFee = _mintingFee; emit FeesUpdated(_mintingFee, _redemptionFee); } /// @notice Set the minimum Collateral Ratio /// @param _minCollateralRatio value of minimum Collateral Ratio in 1e6 precision function setMinCollateralRatio(uint256 _minCollateralRatio) external onlyOwner { require(_minCollateralRatio <= COLLATERAL_RATIO_MAX, "Pool::setMinCollateralRatio:>COLLATERAL_RATIO_MAX"); require(_minCollateralRatio >= COLLATERAL_RATIO_MIN, "Pool::setMinCollateralRatio:<COLLATERAL_RATIO_MIN"); minCollateralRatio = _minCollateralRatio; emit MinCollateralRatioUpdated(_minCollateralRatio); } /// @notice Set the capped Collateral Ratio maximum value /// @param _maxCapCollateralRatio value of capped max Collateral Ratio in 1e6 precision function setCapMaxCollateralRatio(uint256 _maxCapCollateralRatio) external onlyOwner { require(_maxCapCollateralRatio <= COLLATERAL_RATIO_MAX, "Pool::setCapMaxCollateralRatio:>COLLATERAL_RATIO_MAX"); require(_maxCapCollateralRatio >= COLLATERAL_RATIO_MIN, "Pool::setCapMaxCollateralRatio:<COLLATERAL_RATIO_MIN"); maxCapCollateralRatio = _maxCapCollateralRatio; emit MaxCapCollateralRatioUpdated(_maxCapCollateralRatio); } /// @notice Transfer the excess balance of WETH to FeeReserve /// @param _amount amount of WETH to reduce function reduceExcessCollateral(uint256 _amount) external onlyOwner { (uint256 _excessWethBal, bool exceeded) = calcExcessCollateralBalance(); if (exceeded && _excessWethBal > 0) { require(_amount <= _excessWethBal, "Pool::reduceExcessCollateral: The amount is too large"); transferToTreasury(_amount); } } /// @notice Set the address of Swapper utils /// @param _swapStrategy address of Swapper utils contract function setSwapStrategy(ISwapStrategy _swapStrategy) external onlyOwner { require(address(_swapStrategy) != address(0), "Pool::setSwapStrategy: invalid address"); swapStrategy = _swapStrategy; emit SwapStrategyChanged(address(_swapStrategy)); } /// @notice Set new oracle address /// @param _oracle address of the oracle function setOracle(IMasterOracle _oracle) external onlyOwner { require(address(_oracle) != address(0), "Pool::setOracle: invalid address"); oracle = _oracle; emit OracleChanged(address(_oracle)); } /// @notice Set yTokenSlipage function setYTokenSlippage(uint256 _slippage) external onlyOwner { require(_slippage <= 400000, "Pool::setYTokenSlippage: yTokenSlippage cannot be more than 40%"); yTokenSlippage = _slippage; emit YTokenSlippageSet(_slippage); } /// @notice Set the address of Treasury /// @param _treasury address of Treasury contract function setTreasury(address _treasury) external { require(treasury == address(0), "Pool::setTreasury: not allowed"); treasury = _treasury; emit TreasurySet(_treasury); } /// @notice Move weth to treasury function transferToTreasury(uint256 _amount) internal { require(treasury != address(0), "Pool::transferToTreasury:Invalid address"); if (_amount > 0) { WethUtils.weth.safeTransfer(treasury, _amount); } } // EVENTS event OracleChanged(address indexed _oracle); event Toggled(bool _mintPaused, bool _redeemPaused); event SetStrategy(address _strategy); event SetNextStrategy(address _strategy); event Mint(address minter, uint256 amount, uint256 ethIn, uint256 fee); event Redeem(address redeemer, uint256 amount, uint256 ethOut, uint256 yTokenOut, uint256 fee); event UpdateCollateralRatioPaused(bool _collateralRatioPaused); event NewCollateralRatioOptions(uint256 _ratioStepUp, uint256 _ratioStepDown, uint256 _priceBand, uint256 _refreshCooldown); event MinCollateralRatioUpdated(uint256 _minCollateralRatio); event MaxCapCollateralRatioUpdated(uint256 _maxCapCollateralRatio); event NewCollateralRatioSet(uint256 _cr); event FeesUpdated(uint256 _mintingFee, uint256 _redemptionFee); event Recollateralized(address indexed _sender, uint256 _amount); event SwapStrategyChanged(address indexed _swapper); event TreasurySet(address indexed _treasury); event YTokenSlippageSet(uint256 _slippage); event SendToStrategy(uint256 _wethIn); event ReceiveFromStrategy(uint256 _wethOut, uint256 realWethOut); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.9.0) (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 Throws if called by any account other than the owner. */ modifier onlyOwner() { _checkOwner(); _; } /** * @dev Returns the address of the current owner. */ function owner() public view virtual returns (address) { return _owner; } /** * @dev Throws if the sender is not the owner. */ function _checkOwner() internal view virtual { require(owner() == _msgSender(), "Ownable: caller is not the owner"); } /** * @dev Leaves the contract without owner. It will not be possible to call * `onlyOwner` functions. Can only be called by the current owner. * * NOTE: Renouncing ownership will leave the contract without an owner, * thereby disabling any functionality that is only available to the owner. */ function renounceOwnership() public virtual onlyOwner { _transferOwnership(address(0)); } /** * @dev Transfers ownership of the contract to a new account (`newOwner`). * Can only be called by the current owner. */ function transferOwnership(address newOwner) public virtual onlyOwner { require(newOwner != address(0), "Ownable: new owner is the zero address"); _transferOwnership(newOwner); } /** * @dev Transfers ownership of the contract to a new account (`newOwner`). * Internal function without access restriction. */ function _transferOwnership(address newOwner) internal virtual { address oldOwner = _owner; _owner = newOwner; emit OwnershipTransferred(oldOwner, newOwner); } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.9.0) (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() { _nonReentrantBefore(); _; _nonReentrantAfter(); } function _nonReentrantBefore() private { // On the first call to nonReentrant, _status will be _NOT_ENTERED require(_status != _ENTERED, "ReentrancyGuard: reentrant call"); // Any calls to nonReentrant after this point will fail _status = _ENTERED; } function _nonReentrantAfter() private { // By storing the original value once again, a refund is triggered (see // https://eips.ethereum.org/EIPS/eip-2200) _status = _NOT_ENTERED; } /** * @dev Returns true if the reentrancy guard is currently set to "entered", which indicates there is a * `nonReentrant` function in the call stack. */ function _reentrancyGuardEntered() internal view returns (bool) { return _status == _ENTERED; } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.9.0) (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.openzeppelin.com/t/how-to-implement-erc20-supply-mechanisms/226[How * to implement supply mechanisms]. * * The default value of {decimals} is 18. To change this, you should override * this function so it returns a different value. * * We have followed general OpenZeppelin Contracts guidelines: functions revert * instead returning `false` on failure. This behavior is nonetheless * conventional and does not conflict with the expectations of ERC20 * applications. * * Additionally, an {Approval} event is emitted on calls to {transferFrom}. * This allows applications to reconstruct the allowance for all accounts just * by listening to said events. Other implementations of the EIP may not emit * these events, as it isn't required by the specification. * * Finally, the non-standard {decreaseAllowance} and {increaseAllowance} * functions have been added to mitigate the well-known issues around setting * allowances. See {IERC20-approve}. */ contract ERC20 is Context, IERC20, IERC20Metadata { mapping(address => uint256) private _balances; mapping(address => mapping(address => uint256)) private _allowances; uint256 private _totalSupply; string private _name; string private _symbol; /** * @dev Sets the values for {name} and {symbol}. * * All two of these values are immutable: they can only be set once during * construction. */ constructor(string memory name_, string memory symbol_) { _name = name_; _symbol = symbol_; } /** * @dev Returns the name of the token. */ function name() public view virtual override returns (string memory) { return _name; } /** * @dev Returns the symbol of the token, usually a shorter version of the * name. */ function symbol() public view virtual override returns (string memory) { return _symbol; } /** * @dev Returns the number of decimals used to get its user representation. * For example, if `decimals` equals `2`, a balance of `505` tokens should * be displayed to a user as `5.05` (`505 / 10 ** 2`). * * Tokens usually opt for a value of 18, imitating the relationship between * Ether and Wei. This is the default value returned by this function, unless * it's overridden. * * NOTE: This information is only used for _display_ purposes: it in * no way affects any of the arithmetic of the contract, including * {IERC20-balanceOf} and {IERC20-transfer}. */ function decimals() public view virtual override returns (uint8) { return 18; } /** * @dev See {IERC20-totalSupply}. */ function totalSupply() public view virtual override returns (uint256) { return _totalSupply; } /** * @dev See {IERC20-balanceOf}. */ function balanceOf(address account) public view virtual override returns (uint256) { return _balances[account]; } /** * @dev See {IERC20-transfer}. * * Requirements: * * - `to` cannot be the zero address. * - the caller must have a balance of at least `amount`. */ function transfer(address to, uint256 amount) public virtual override returns (bool) { address owner = _msgSender(); _transfer(owner, to, amount); return true; } /** * @dev See {IERC20-allowance}. */ function allowance(address owner, address spender) public view virtual override returns (uint256) { return _allowances[owner][spender]; } /** * @dev See {IERC20-approve}. * * NOTE: If `amount` is the maximum `uint256`, the allowance is not updated on * `transferFrom`. This is semantically equivalent to an infinite approval. * * Requirements: * * - `spender` cannot be the zero address. */ function approve(address spender, uint256 amount) public virtual override returns (bool) { address owner = _msgSender(); _approve(owner, spender, amount); return true; } /** * @dev See {IERC20-transferFrom}. * * Emits an {Approval} event indicating the updated allowance. This is not * required by the EIP. See the note at the beginning of {ERC20}. * * NOTE: Does not update the allowance if the current allowance * is the maximum `uint256`. * * Requirements: * * - `from` and `to` cannot be the zero address. * - `from` must have a balance of at least `amount`. * - the caller must have allowance for ``from``'s tokens of at least * `amount`. */ function transferFrom(address from, address to, uint256 amount) public virtual override returns (bool) { address spender = _msgSender(); _spendAllowance(from, spender, amount); _transfer(from, to, amount); return true; } /** * @dev Atomically increases the allowance granted to `spender` by the caller. * * This is an alternative to {approve} that can be used as a mitigation for * problems described in {IERC20-approve}. * * Emits an {Approval} event indicating the updated allowance. * * Requirements: * * - `spender` cannot be the zero address. */ function increaseAllowance(address spender, uint256 addedValue) public virtual returns (bool) { address owner = _msgSender(); _approve(owner, spender, allowance(owner, spender) + addedValue); return true; } /** * @dev Atomically decreases the allowance granted to `spender` by the caller. * * This is an alternative to {approve} that can be used as a mitigation for * problems described in {IERC20-approve}. * * Emits an {Approval} event indicating the updated allowance. * * Requirements: * * - `spender` cannot be the zero address. * - `spender` must have allowance for the caller of at least * `subtractedValue`. */ function decreaseAllowance(address spender, uint256 subtractedValue) public virtual returns (bool) { address owner = _msgSender(); uint256 currentAllowance = allowance(owner, spender); require(currentAllowance >= subtractedValue, "ERC20: decreased allowance below zero"); unchecked { _approve(owner, spender, currentAllowance - subtractedValue); } return true; } /** * @dev Moves `amount` of tokens from `from` to `to`. * * This internal function is equivalent to {transfer}, and can be used to * e.g. implement automatic token fees, slashing mechanisms, etc. * * Emits a {Transfer} event. * * Requirements: * * - `from` cannot be the zero address. * - `to` cannot be the zero address. * - `from` must have a balance of at least `amount`. */ function _transfer(address from, address to, uint256 amount) internal virtual { require(from != address(0), "ERC20: transfer from the zero address"); require(to != address(0), "ERC20: transfer to the zero address"); _beforeTokenTransfer(from, to, amount); uint256 fromBalance = _balances[from]; require(fromBalance >= amount, "ERC20: transfer amount exceeds balance"); unchecked { _balances[from] = fromBalance - amount; // Overflow not possible: the sum of all balances is capped by totalSupply, and the sum is preserved by // decrementing then incrementing. _balances[to] += amount; } emit Transfer(from, to, amount); _afterTokenTransfer(from, to, amount); } /** @dev Creates `amount` tokens and assigns them to `account`, increasing * the total supply. * * Emits a {Transfer} event with `from` set to the zero address. * * Requirements: * * - `account` cannot be the zero address. */ function _mint(address account, uint256 amount) internal virtual { require(account != address(0), "ERC20: mint to the zero address"); _beforeTokenTransfer(address(0), account, amount); _totalSupply += amount; unchecked { // Overflow not possible: balance + amount is at most totalSupply + amount, which is checked above. _balances[account] += amount; } emit Transfer(address(0), account, amount); _afterTokenTransfer(address(0), account, amount); } /** * @dev Destroys `amount` tokens from `account`, reducing the * total supply. * * Emits a {Transfer} event with `to` set to the zero address. * * Requirements: * * - `account` cannot be the zero address. * - `account` must have at least `amount` tokens. */ function _burn(address account, uint256 amount) internal virtual { require(account != address(0), "ERC20: burn from the zero address"); _beforeTokenTransfer(account, address(0), amount); uint256 accountBalance = _balances[account]; require(accountBalance >= amount, "ERC20: burn amount exceeds balance"); unchecked { _balances[account] = accountBalance - amount; // Overflow not possible: amount <= accountBalance <= totalSupply. _totalSupply -= amount; } emit Transfer(account, address(0), amount); _afterTokenTransfer(account, address(0), amount); } /** * @dev Sets `amount` as the allowance of `spender` over the `owner` s tokens. * * This internal function is equivalent to `approve`, and can be used to * e.g. set automatic allowances for certain subsystems, etc. * * Emits an {Approval} event. * * Requirements: * * - `owner` cannot be the zero address. * - `spender` cannot be the zero address. */ function _approve(address owner, address spender, uint256 amount) internal virtual { require(owner != address(0), "ERC20: approve from the zero address"); require(spender != address(0), "ERC20: approve to the zero address"); _allowances[owner][spender] = amount; emit Approval(owner, spender, amount); } /** * @dev Updates `owner` s allowance for `spender` based on spent `amount`. * * Does not update the allowance amount in case of infinite allowance. * Revert if not enough allowance is available. * * Might emit an {Approval} event. */ function _spendAllowance(address owner, address spender, uint256 amount) internal virtual { uint256 currentAllowance = allowance(owner, spender); if (currentAllowance != type(uint256).max) { require(currentAllowance >= amount, "ERC20: insufficient allowance"); unchecked { _approve(owner, spender, currentAllowance - amount); } } } /** * @dev Hook that is called before any transfer of tokens. This includes * minting and burning. * * Calling conditions: * * - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens * will be transferred to `to`. * - when `from` is zero, `amount` tokens will be minted for `to`. * - when `to` is zero, `amount` of ``from``'s tokens will be burned. * - `from` and `to` are never both zero. * * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks]. */ function _beforeTokenTransfer(address from, address to, uint256 amount) internal virtual {} /** * @dev Hook that is called after any transfer of tokens. This includes * minting and burning. * * Calling conditions: * * - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens * has been transferred to `to`. * - when `from` is zero, `amount` tokens have been minted for `to`. * - when `to` is zero, `amount` of ``from``'s tokens have been burned. * - `from` and `to` are never both zero. * * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks]. */ function _afterTokenTransfer(address from, address to, uint256 amount) internal virtual {} }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.9.0) (token/ERC20/IERC20.sol) pragma solidity ^0.8.0; /** * @dev Interface of the ERC20 standard as defined in the EIP. */ interface IERC20 { /** * @dev Emitted when `value` tokens are moved from one account (`from`) to * another (`to`). * * Note that `value` may be zero. */ event Transfer(address indexed from, address indexed to, uint256 value); /** * @dev Emitted when the allowance of a `spender` for an `owner` is set by * a call to {approve}. `value` is the new allowance. */ event Approval(address indexed owner, address indexed spender, uint256 value); /** * @dev Returns the amount of tokens in existence. */ function totalSupply() external view returns (uint256); /** * @dev Returns the amount of tokens owned by `account`. */ function balanceOf(address account) external view returns (uint256); /** * @dev Moves `amount` tokens from the caller's account to `to`. * * Returns a boolean value indicating whether the operation succeeded. * * Emits a {Transfer} event. */ function transfer(address to, uint256 amount) external returns (bool); /** * @dev Returns the remaining number of tokens that `spender` will be * allowed to spend on behalf of `owner` through {transferFrom}. This is * zero by default. * * This value changes when {approve} or {transferFrom} are called. */ function allowance(address owner, address spender) external view returns (uint256); /** * @dev Sets `amount` as the allowance of `spender` over the caller's tokens. * * Returns a boolean value indicating whether the operation succeeded. * * IMPORTANT: Beware that changing an allowance with this method brings the risk * that someone may use both the old and the new allowance by unfortunate * transaction ordering. One possible solution to mitigate this race * condition is to first reduce the spender's allowance to 0 and set the * desired value afterwards: * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729 * * Emits an {Approval} event. */ function approve(address spender, uint256 amount) external returns (bool); /** * @dev Moves `amount` tokens from `from` to `to` using the * allowance mechanism. `amount` is then deducted from the caller's * allowance. * * Returns a boolean value indicating whether the operation succeeded. * * Emits a {Transfer} event. */ function transferFrom(address from, address to, uint256 amount) external returns (bool); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (token/ERC20/extensions/IERC20Metadata.sol) pragma solidity ^0.8.0; import "../IERC20.sol"; /** * @dev Interface for the optional metadata functions from the ERC20 standard. * * _Available since v4.1._ */ interface IERC20Metadata is IERC20 { /** * @dev Returns the name of the token. */ function name() external view returns (string memory); /** * @dev Returns the symbol of the token. */ function symbol() external view returns (string memory); /** * @dev Returns the decimals places of the token. */ function decimals() external view returns (uint8); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.9.4) (token/ERC20/extensions/IERC20Permit.sol) pragma solidity ^0.8.0; /** * @dev Interface of the ERC20 Permit extension allowing approvals to be made via signatures, as defined in * https://eips.ethereum.org/EIPS/eip-2612[EIP-2612]. * * Adds the {permit} method, which can be used to change an account's ERC20 allowance (see {IERC20-allowance}) by * presenting a message signed by the account. By not relying on {IERC20-approve}, the token holder account doesn't * need to send a transaction, and thus is not required to hold Ether at all. * * ==== Security Considerations * * There are two important considerations concerning the use of `permit`. The first is that a valid permit signature * expresses an allowance, and it should not be assumed to convey additional meaning. In particular, it should not be * considered as an intention to spend the allowance in any specific way. The second is that because permits have * built-in replay protection and can be submitted by anyone, they can be frontrun. A protocol that uses permits should * take this into consideration and allow a `permit` call to fail. Combining these two aspects, a pattern that may be * generally recommended is: * * ```solidity * function doThingWithPermit(..., uint256 value, uint256 deadline, uint8 v, bytes32 r, bytes32 s) public { * try token.permit(msg.sender, address(this), value, deadline, v, r, s) {} catch {} * doThing(..., value); * } * * function doThing(..., uint256 value) public { * token.safeTransferFrom(msg.sender, address(this), value); * ... * } * ``` * * Observe that: 1) `msg.sender` is used as the owner, leaving no ambiguity as to the signer intent, and 2) the use of * `try/catch` allows the permit to fail and makes the code tolerant to frontrunning. (See also * {SafeERC20-safeTransferFrom}). * * Additionally, note that smart contract wallets (such as Argent or Safe) are not able to produce permit signatures, so * contracts should have entry points that don't rely on permit. */ interface IERC20Permit { /** * @dev Sets `value` as the allowance of `spender` over ``owner``'s tokens, * given ``owner``'s signed approval. * * IMPORTANT: The same issues {IERC20-approve} has related to transaction * ordering also apply here. * * Emits an {Approval} event. * * Requirements: * * - `spender` cannot be the zero address. * - `deadline` must be a timestamp in the future. * - `v`, `r` and `s` must be a valid `secp256k1` signature from `owner` * over the EIP712-formatted function arguments. * - the signature must use ``owner``'s current nonce (see {nonces}). * * For more information on the signature format, see the * https://eips.ethereum.org/EIPS/eip-2612#specification[relevant EIP * section]. * * CAUTION: See Security Considerations above. */ function permit( address owner, address spender, uint256 value, uint256 deadline, uint8 v, bytes32 r, bytes32 s ) external; /** * @dev Returns the current nonce for `owner`. This value must be * included whenever a signature is generated for {permit}. * * Every successful call to {permit} increases ``owner``'s nonce by one. This * prevents a signature from being used multiple times. */ function nonces(address owner) external view returns (uint256); /** * @dev Returns the domain separator used in the encoding of the signature for {permit}, as defined by {EIP712}. */ // solhint-disable-next-line func-name-mixedcase function DOMAIN_SEPARATOR() external view returns (bytes32); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.9.3) (token/ERC20/utils/SafeERC20.sol) pragma solidity ^0.8.0; import "../IERC20.sol"; import "../extensions/IERC20Permit.sol"; import "../../../utils/Address.sol"; /** * @title SafeERC20 * @dev Wrappers around ERC20 operations that throw on failure (when the token * contract returns false). Tokens that return no value (and instead revert or * throw on failure) are also supported, non-reverting calls are assumed to be * successful. * To use this library you can add a `using SafeERC20 for IERC20;` statement to your contract, * which allows you to call the safe operations as `token.safeTransfer(...)`, etc. */ library SafeERC20 { using Address for address; /** * @dev Transfer `value` amount of `token` from the calling contract to `to`. If `token` returns no value, * non-reverting calls are assumed to be successful. */ function safeTransfer(IERC20 token, address to, uint256 value) internal { _callOptionalReturn(token, abi.encodeWithSelector(token.transfer.selector, to, value)); } /** * @dev Transfer `value` amount of `token` from `from` to `to`, spending the approval given by `from` to the * calling contract. If `token` returns no value, non-reverting calls are assumed to be successful. */ function safeTransferFrom(IERC20 token, address from, address to, uint256 value) internal { _callOptionalReturn(token, abi.encodeWithSelector(token.transferFrom.selector, from, to, value)); } /** * @dev Deprecated. This function has issues similar to the ones found in * {IERC20-approve}, and its usage is discouraged. * * Whenever possible, use {safeIncreaseAllowance} and * {safeDecreaseAllowance} instead. */ function safeApprove(IERC20 token, address spender, uint256 value) internal { // safeApprove should only be called when setting an initial allowance, // or when resetting it to zero. To increase and decrease it, use // 'safeIncreaseAllowance' and 'safeDecreaseAllowance' require( (value == 0) || (token.allowance(address(this), spender) == 0), "SafeERC20: approve from non-zero to non-zero allowance" ); _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, value)); } /** * @dev Increase the calling contract's allowance toward `spender` by `value`. If `token` returns no value, * non-reverting calls are assumed to be successful. */ function safeIncreaseAllowance(IERC20 token, address spender, uint256 value) internal { uint256 oldAllowance = token.allowance(address(this), spender); _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, oldAllowance + value)); } /** * @dev Decrease the calling contract's allowance toward `spender` by `value`. If `token` returns no value, * non-reverting calls are assumed to be successful. */ function safeDecreaseAllowance(IERC20 token, address spender, uint256 value) internal { unchecked { uint256 oldAllowance = token.allowance(address(this), spender); require(oldAllowance >= value, "SafeERC20: decreased allowance below zero"); _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, oldAllowance - value)); } } /** * @dev Set the calling contract's allowance toward `spender` to `value`. If `token` returns no value, * non-reverting calls are assumed to be successful. Meant to be used with tokens that require the approval * to be set to zero before setting it to a non-zero value, such as USDT. */ function forceApprove(IERC20 token, address spender, uint256 value) internal { bytes memory approvalCall = abi.encodeWithSelector(token.approve.selector, spender, value); if (!_callOptionalReturnBool(token, approvalCall)) { _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, 0)); _callOptionalReturn(token, approvalCall); } } /** * @dev Use a ERC-2612 signature to set the `owner` approval toward `spender` on `token`. * Revert on invalid signature. */ function safePermit( IERC20Permit token, address owner, address spender, uint256 value, uint256 deadline, uint8 v, bytes32 r, bytes32 s ) internal { uint256 nonceBefore = token.nonces(owner); token.permit(owner, spender, value, deadline, v, r, s); uint256 nonceAfter = token.nonces(owner); require(nonceAfter == nonceBefore + 1, "SafeERC20: permit did not succeed"); } /** * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement * on the return value: the return value is optional (but if data is returned, it must not be false). * @param token The token targeted by the call. * @param data The call data (encoded using abi.encode or one of its variants). */ function _callOptionalReturn(IERC20 token, bytes memory data) private { // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since // we're implementing it ourselves. We use {Address-functionCall} to perform this call, which verifies that // the target address contains contract code and also asserts for success in the low-level call. bytes memory returndata = address(token).functionCall(data, "SafeERC20: low-level call failed"); require(returndata.length == 0 || abi.decode(returndata, (bool)), "SafeERC20: ERC20 operation did not succeed"); } /** * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement * on the return value: the return value is optional (but if data is returned, it must not be false). * @param token The token targeted by the call. * @param data The call data (encoded using abi.encode or one of its variants). * * This is a variant of {_callOptionalReturn} that silents catches all reverts and returns a bool instead. */ function _callOptionalReturnBool(IERC20 token, bytes memory data) private returns (bool) { // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since // we're implementing it ourselves. We cannot use {Address-functionCall} here since this should return false // and not revert is the subcall reverts. (bool success, bytes memory returndata) = address(token).call(data); return success && (returndata.length == 0 || abi.decode(returndata, (bool))) && Address.isContract(address(token)); } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.9.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 * * Furthermore, `isContract` will also return true if the target contract within * the same transaction is already scheduled for destruction by `SELFDESTRUCT`, * which only has an effect at the end of a transaction. * ==== * * [IMPORTANT] * ==== * You shouldn't rely on `isContract` to protect against flash loan attacks! * * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract * constructor. * ==== */ function isContract(address account) internal view returns (bool) { // This method relies on extcodesize/address.code.length, which returns 0 // for contracts in construction, since the code is only stored at the end // of the constructor execution. return account.code.length > 0; } /** * @dev Replacement for Solidity's `transfer`: sends `amount` wei to * `recipient`, forwarding all available gas and reverting on errors. * * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost * of certain opcodes, possibly making contracts go over the 2300 gas limit * imposed by `transfer`, making them unable to receive funds via * `transfer`. {sendValue} removes this limitation. * * https://consensys.net/diligence/blog/2019/09/stop-using-soliditys-transfer-now/[Learn more]. * * IMPORTANT: because control is transferred to `recipient`, care must be * taken to not create reentrancy vulnerabilities. Consider using * {ReentrancyGuard} or the * https://solidity.readthedocs.io/en/v0.8.0/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern]. */ function sendValue(address payable recipient, uint256 amount) internal { require(address(this).balance >= amount, "Address: insufficient balance"); (bool success, ) = recipient.call{value: amount}(""); require(success, "Address: unable to send value, recipient may have reverted"); } /** * @dev Performs a Solidity function call using a low level `call`. A * plain `call` is an unsafe replacement for a function call: use this * function instead. * * If `target` reverts with a revert reason, it is bubbled up by this * function (like regular Solidity function calls). * * Returns the raw returned data. To convert to the expected return value, * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`]. * * Requirements: * * - `target` must be a contract. * - calling `target` with `data` must not revert. * * _Available since v3.1._ */ function functionCall(address target, bytes memory data) internal returns (bytes memory) { return functionCallWithValue(target, data, 0, "Address: low-level call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with * `errorMessage` as a fallback revert reason when `target` reverts. * * _Available since v3.1._ */ function functionCall( address target, bytes memory data, string memory errorMessage ) internal returns (bytes memory) { return functionCallWithValue(target, data, 0, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but also transferring `value` wei to `target`. * * Requirements: * * - the calling contract must have an ETH balance of at least `value`. * - the called Solidity function must be `payable`. * * _Available since v3.1._ */ function functionCallWithValue(address target, bytes memory data, uint256 value) internal returns (bytes memory) { return functionCallWithValue(target, data, value, "Address: low-level call with value failed"); } /** * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but * with `errorMessage` as a fallback revert reason when `target` reverts. * * _Available since v3.1._ */ function functionCallWithValue( address target, bytes memory data, uint256 value, string memory errorMessage ) internal returns (bytes memory) { require(address(this).balance >= value, "Address: insufficient balance for call"); (bool success, bytes memory returndata) = target.call{value: value}(data); return verifyCallResultFromTarget(target, success, returndata, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but performing a static call. * * _Available since v3.3._ */ function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) { return functionStaticCall(target, data, "Address: low-level static call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`], * but performing a static call. * * _Available since v3.3._ */ function functionStaticCall( address target, bytes memory data, string memory errorMessage ) internal view returns (bytes memory) { (bool success, bytes memory returndata) = target.staticcall(data); return verifyCallResultFromTarget(target, success, returndata, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but performing a delegate call. * * _Available since v3.4._ */ function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) { return functionDelegateCall(target, data, "Address: low-level delegate call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`], * but performing a delegate call. * * _Available since v3.4._ */ function functionDelegateCall( address target, bytes memory data, string memory errorMessage ) internal returns (bytes memory) { (bool success, bytes memory returndata) = target.delegatecall(data); return verifyCallResultFromTarget(target, success, returndata, errorMessage); } /** * @dev Tool to verify that a low level call to smart-contract was successful, and revert (either by bubbling * the revert reason or using the provided one) in case of unsuccessful call or if target was not a contract. * * _Available since v4.8._ */ function verifyCallResultFromTarget( address target, bool success, bytes memory returndata, string memory errorMessage ) internal view returns (bytes memory) { if (success) { if (returndata.length == 0) { // only check isContract if the call was successful and the return data is empty // otherwise we already know that it was a contract require(isContract(target), "Address: call to non-contract"); } return returndata; } else { _revert(returndata, errorMessage); } } /** * @dev Tool to verify that a low level call was successful, and revert if it wasn't, either by bubbling the * revert reason or using the provided one. * * _Available since v4.3._ */ function verifyCallResult( bool success, bytes memory returndata, string memory errorMessage ) internal pure returns (bytes memory) { if (success) { return returndata; } else { _revert(returndata, errorMessage); } } function _revert(bytes memory returndata, string memory errorMessage) private pure { // Look for revert reason and bubble it up if present if (returndata.length > 0) { // The easiest way to bubble the revert reason is using memory via assembly /// @solidity memory-safe-assembly assembly { let returndata_size := mload(returndata) revert(add(32, returndata), returndata_size) } } else { revert(errorMessage); } } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.9.4) (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; } function _contextSuffixLength() internal view virtual returns (uint256) { return 0; } }
pragma solidity >=0.6.2; interface IUniswapV2Router01 { function factory() external pure returns (address); function WETH() external pure returns (address); function addLiquidity( address tokenA, address tokenB, uint amountADesired, uint amountBDesired, uint amountAMin, uint amountBMin, address to, uint deadline ) external returns (uint amountA, uint amountB, uint liquidity); function addLiquidityETH( address token, uint amountTokenDesired, uint amountTokenMin, uint amountETHMin, address to, uint deadline ) external payable returns (uint amountToken, uint amountETH, uint liquidity); function removeLiquidity( address tokenA, address tokenB, uint liquidity, uint amountAMin, uint amountBMin, address to, uint deadline ) external returns (uint amountA, uint amountB); function removeLiquidityETH( address token, uint liquidity, uint amountTokenMin, uint amountETHMin, address to, uint deadline ) external returns (uint amountToken, uint amountETH); function removeLiquidityWithPermit( address tokenA, address tokenB, uint liquidity, uint amountAMin, uint amountBMin, address to, uint deadline, bool approveMax, uint8 v, bytes32 r, bytes32 s ) external returns (uint amountA, uint amountB); function removeLiquidityETHWithPermit( address token, uint liquidity, uint amountTokenMin, uint amountETHMin, address to, uint deadline, bool approveMax, uint8 v, bytes32 r, bytes32 s ) external returns (uint amountToken, uint amountETH); function swapExactTokensForTokens( uint amountIn, uint amountOutMin, address[] calldata path, address to, uint deadline ) external returns (uint[] memory amounts); function swapTokensForExactTokens( uint amountOut, uint amountInMax, address[] calldata path, address to, uint deadline ) external returns (uint[] memory amounts); function swapExactETHForTokens(uint amountOutMin, address[] calldata path, address to, uint deadline) external payable returns (uint[] memory amounts); function swapTokensForExactETH(uint amountOut, uint amountInMax, address[] calldata path, address to, uint deadline) external returns (uint[] memory amounts); function swapExactTokensForETH(uint amountIn, uint amountOutMin, address[] calldata path, address to, uint deadline) external returns (uint[] memory amounts); function swapETHForExactTokens(uint amountOut, address[] calldata path, address to, uint deadline) external payable returns (uint[] memory amounts); function quote(uint amountA, uint reserveA, uint reserveB) external pure returns (uint amountB); function getAmountOut(uint amountIn, uint reserveIn, uint reserveOut) external pure returns (uint amountOut); function getAmountIn(uint amountOut, uint reserveIn, uint reserveOut) external pure returns (uint amountIn); function getAmountsOut(uint amountIn, address[] calldata path) external view returns (uint[] memory amounts); function getAmountsIn(uint amountOut, address[] calldata path) external view returns (uint[] memory amounts); }
pragma solidity >=0.6.2; import './IUniswapV2Router01.sol'; interface IUniswapV2Router02 is IUniswapV2Router01 { function removeLiquidityETHSupportingFeeOnTransferTokens( address token, uint liquidity, uint amountTokenMin, uint amountETHMin, address to, uint deadline ) external returns (uint amountETH); function removeLiquidityETHWithPermitSupportingFeeOnTransferTokens( address token, uint liquidity, uint amountTokenMin, uint amountETHMin, address to, uint deadline, bool approveMax, uint8 v, bytes32 r, bytes32 s ) external returns (uint amountETH); function swapExactTokensForTokensSupportingFeeOnTransferTokens( uint amountIn, uint amountOutMin, address[] calldata path, address to, uint deadline ) external; function swapExactETHForTokensSupportingFeeOnTransferTokens( uint amountOutMin, address[] calldata path, address to, uint deadline ) external payable; function swapExactTokensForETHSupportingFeeOnTransferTokens( uint amountIn, uint amountOutMin, address[] calldata path, address to, uint deadline ) external; }
// SPDX-License-Identifier: MIT pragma solidity 0.8.4; interface IMasterOracle { function getXTokenPrice() external view returns (uint256); function getYTokenPrice() external view returns (uint256); function getYTokenTWAP() external view returns (uint256); function getXTokenTWAP() external view returns (uint256); function updateAllPairs() external; }
// SPDX-License-Identifier: MIT pragma solidity 0.8.4; interface IStrategy { function add(uint256 _wethIn) external; function remove(uint256 _wethOut) external returns (uint256 realWethOut); function wethAvailable() external view returns (uint256 _wethAvailable); }
// SPDX-License-Identifier: MIT pragma solidity 0.8.4; interface ISwapStrategy { function execute(uint256 _wethIn, uint256 _yTokenOut) external; }
// SPDX-License-Identifier: MIT pragma solidity 0.8.4; import "@openzeppelin/contracts/token/ERC20/IERC20.sol"; interface IWETH is IERC20 { function deposit() external payable; function withdraw(uint256 wad) external; }
// SPDX-License-Identifier: MIT pragma solidity 0.8.4; import "@openzeppelin/contracts/token/ERC20/IERC20.sol"; interface IXToken is IERC20 { function burnFrom(address account, uint256 amount) external; function burn(uint256 _amount) external; function mint(address _address, uint256 _amount) external; function setMinter(address _minter) external; }
// SPDX-License-Identifier: MIT pragma solidity 0.8.4; import "@openzeppelin/contracts/token/ERC20/IERC20.sol"; interface IYToken is IERC20 { function burn(uint256 _amount) external; }
// SPDX-License-Identifier: MIT pragma solidity 0.8.4; interface IYTokenReserve { function transfer(address _address, uint256 _amount) external; function setRewarder(address _rewarder) external returns (bool); function setPool(address _pool) external returns (bool); }
// SPDX-License-Identifier: MIT pragma solidity 0.8.4; import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol"; import "../interfaces/IWETH.sol"; library WethUtils { using SafeERC20 for IWETH; IWETH public constant weth = IWETH(0x039e2fB66102314Ce7b64Ce5Ce3E5183bc94aD38); //wS function isWeth(address token) internal pure returns (bool) { return address(weth) == token; } function wrap(uint256 amount) internal { weth.deposit{value: amount}(); } function unwrap(uint256 amount) internal { weth.withdraw(amount); } function transfer(address to, uint256 amount) internal { weth.safeTransfer(to, amount); } }
{ "evmVersion": "istanbul", "libraries": {}, "metadata": { "bytecodeHash": "ipfs", "useLiteralContent": true }, "optimizer": { "enabled": true, "runs": 200 }, "remappings": [], "outputSelection": { "*": { "*": [ "evm.bytecode", "evm.deployedBytecode", "devdoc", "userdoc", "metadata", "abi" ] } } }
Contract Security Audit
- No Contract Security Audit Submitted- Submit Audit Here
Contract ABI
API[{"inputs":[{"internalType":"address","name":"_xToken","type":"address"},{"internalType":"address","name":"_yToken","type":"address"},{"internalType":"address","name":"_yTokenReserve","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"_mintingFee","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"_redemptionFee","type":"uint256"}],"name":"FeesUpdated","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"_maxCapCollateralRatio","type":"uint256"}],"name":"MaxCapCollateralRatioUpdated","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"_minCollateralRatio","type":"uint256"}],"name":"MinCollateralRatioUpdated","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"minter","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"ethIn","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"fee","type":"uint256"}],"name":"Mint","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"_ratioStepUp","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"_ratioStepDown","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"_priceBand","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"_refreshCooldown","type":"uint256"}],"name":"NewCollateralRatioOptions","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"_cr","type":"uint256"}],"name":"NewCollateralRatioSet","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"_oracle","type":"address"}],"name":"OracleChanged","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"previousOwner","type":"address"},{"indexed":true,"internalType":"address","name":"newOwner","type":"address"}],"name":"OwnershipTransferred","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"_wethOut","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"realWethOut","type":"uint256"}],"name":"ReceiveFromStrategy","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"_sender","type":"address"},{"indexed":false,"internalType":"uint256","name":"_amount","type":"uint256"}],"name":"Recollateralized","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"redeemer","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"ethOut","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"yTokenOut","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"fee","type":"uint256"}],"name":"Redeem","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"_wethIn","type":"uint256"}],"name":"SendToStrategy","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"_strategy","type":"address"}],"name":"SetNextStrategy","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"_strategy","type":"address"}],"name":"SetStrategy","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"_swapper","type":"address"}],"name":"SwapStrategyChanged","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"bool","name":"_mintPaused","type":"bool"},{"indexed":false,"internalType":"bool","name":"_redeemPaused","type":"bool"}],"name":"Toggled","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"_treasury","type":"address"}],"name":"TreasurySet","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"bool","name":"_collateralRatioPaused","type":"bool"}],"name":"UpdateCollateralRatioPaused","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"_slippage","type":"uint256"}],"name":"YTokenSlippageSet","type":"event"},{"inputs":[],"name":"MINTING_FEE_MAX","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"REDEMPTION_FEE_MAX","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"TIMELOCK_STRATEGY","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"WethAvailable","outputs":[{"internalType":"uint256","name":"_collateralBalance","type":"uint256"},{"internalType":"uint256","name":"_strategyWethAvailable","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"calcExcessCollateralBalance","outputs":[{"internalType":"uint256","name":"_delta","type":"uint256"},{"internalType":"bool","name":"_exceeded","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_ethIn","type":"uint256"}],"name":"calcMint","outputs":[{"internalType":"uint256","name":"_xTokenOut","type":"uint256"},{"internalType":"uint256","name":"_yTokenOutTwap","type":"uint256"},{"internalType":"uint256","name":"_ethFee","type":"uint256"},{"internalType":"uint256","name":"_ethSwapIn","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_xTokenIn","type":"uint256"}],"name":"calcRedeem","outputs":[{"internalType":"uint256","name":"_ethOut","type":"uint256"},{"internalType":"uint256","name":"_yTokenOutSpot","type":"uint256"},{"internalType":"uint256","name":"_yTokenOutTwap","type":"uint256"},{"internalType":"uint256","name":"_ethFee","type":"uint256"},{"internalType":"uint256","name":"_requiredEthBalance","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"collateralRatio","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"collateralRatioPaused","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"collect","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"info","outputs":[{"internalType":"uint256","name":"_collateralRatio","type":"uint256"},{"internalType":"uint256","name":"_lastRefreshCrTimestamp","type":"uint256"},{"internalType":"uint256","name":"_mintingFee","type":"uint256"},{"internalType":"uint256","name":"_redemptionFee","type":"uint256"},{"internalType":"bool","name":"_mintingPaused","type":"bool"},{"internalType":"bool","name":"_redemptionPaused","type":"bool"},{"internalType":"uint256","name":"_collateralBalance","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"lastRefreshCrTimestamp","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"maxCapCollateralRatio","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"minCollateralRatio","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_minXTokenOut","type":"uint256"}],"name":"mint","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[],"name":"mintPaused","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"mintingFee","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"nextStrategy","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"nextStrategyTimestamp","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"oracle","outputs":[{"internalType":"contract IMasterOracle","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"priceBand","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"priceTarget","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"ratioStepDown","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"ratioStepUp","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_wethOut","type":"uint256"}],"name":"receiveFromStrategy","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"recollateralize","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_xTokenIn","type":"uint256"},{"internalType":"uint256","name":"_minYTokenOut","type":"uint256"},{"internalType":"uint256","name":"_minEthOut","type":"uint256"}],"name":"redeem","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"redeemPaused","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"redemptionFee","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_amount","type":"uint256"}],"name":"reduceExcessCollateral","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"refreshCollateralRatio","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"refreshCooldown","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"renounceOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_wethIn","type":"uint256"}],"name":"sendToStrategy","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_maxCapCollateralRatio","type":"uint256"}],"name":"setCapMaxCollateralRatio","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_ratioStepUp","type":"uint256"},{"internalType":"uint256","name":"_ratioStepDown","type":"uint256"},{"internalType":"uint256","name":"_priceBand","type":"uint256"},{"internalType":"uint256","name":"_refreshCooldown","type":"uint256"}],"name":"setCollateralRatioOptions","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_mintingFee","type":"uint256"},{"internalType":"uint256","name":"_redemptionFee","type":"uint256"}],"name":"setFees","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_minCollateralRatio","type":"uint256"}],"name":"setMinCollateralRatio","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_strategy","type":"address"}],"name":"setNextStrategy","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"contract IMasterOracle","name":"_oracle","type":"address"}],"name":"setOracle","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"setStrategy","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"contract ISwapStrategy","name":"_swapStrategy","type":"address"}],"name":"setSwapStrategy","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_treasury","type":"address"}],"name":"setTreasury","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_slippage","type":"uint256"}],"name":"setYTokenSlippage","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"strategy","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"swapStrategy","outputs":[{"internalType":"contract ISwapStrategy","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bool","name":"_mintPaused","type":"bool"},{"internalType":"bool","name":"_redeemPaused","type":"bool"}],"name":"toggle","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bool","name":"_collateralRatioPaused","type":"bool"}],"name":"toggleCollateralRatio","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"treasury","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"unclaimedEth","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"unclaimedXToken","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"unclaimedYToken","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"usableCollateralBalance","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"userInfo","outputs":[{"internalType":"uint256","name":"xTokenBalance","type":"uint256"},{"internalType":"uint256","name":"yTokenBalance","type":"uint256"},{"internalType":"uint256","name":"ethBalance","type":"uint256"},{"internalType":"uint256","name":"lastAction","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"xToken","outputs":[{"internalType":"contract IXToken","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"yToken","outputs":[{"internalType":"contract IYToken","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"yTokenReserve","outputs":[{"internalType":"contract IYTokenReserve","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"yTokenSlippage","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"stateMutability":"payable","type":"receive"}]
Contract Creation Code
6080604052600c805461ffff19169055620dbba0600d819055600e55610e106010556107d06011556103e8601255670de0b6b3a76400006013556611c37937e08000601455620aae60601555620f42406016556017805460ff19169055611964601855610dac6019553480156200007557600080fd5b506040516200386138038062003861833981016040819052620000989162000308565b620000a3336200029b565b600180556001600160a01b038316620000f25760405162461bcd60e51b815260206004820181905260248201526000805160206200384183398151915260448201526064015b60405180910390fd5b6001600160a01b038216620001395760405162461bcd60e51b81526020600482018190526024820152600080516020620038418339815191526044820152606401620000e9565b6001600160a01b038116620001805760405162461bcd60e51b81526020600482018190526024820152600080516020620038418339815191526044820152606401620000e9565b600380546001600160a01b0319166001600160a01b038516908117909155604051637e51dad560e11b815230600482015263fca3b5aa90602401600060405180830381600087803b158015620001d557600080fd5b505af1158015620001ea573d6000803e3d6000fd5b5050600480546001600160a01b038681166001600160a01b03199283161783556005805491871691909216811790915560405163221b8a9560e11b815230928101929092529250634437152a9150602401602060405180830381600087803b1580156200025657600080fd5b505af11580156200026b573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019062000291919062000351565b505050506200037a565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b80516001600160a01b03811681146200030357600080fd5b919050565b6000806000606084860312156200031d578283fd5b6200032884620002eb565b92506200033860208501620002eb565b91506200034860408501620002eb565b90509250925092565b60006020828403121562000363578081fd5b8151801515811462000373578182fd5b9392505050565b6134b7806200038a6000396000f3fe60806040526004361061039b5760003560e01c80637e4831d3116101dc578063b819220511610102578063e5225381116100a0578063f0f442601161006f578063f0f4426014610a72578063f2fde38b14610a92578063f84dfc6614610ab2578063f8c321241461061c57600080fd5b8063e5225381146109df578063e969355f146109f4578063ea5f7abe14610a14578063ed21b97514610a2a57600080fd5b8063c97b4960116100dc578063c97b496014610969578063d300138614610989578063d5d0cb161461099f578063e175ae13146109bf57600080fd5b8063b819220514610913578063bfebc96214610933578063c29118fc1461094957600080fd5b8063924958831161017a578063a85ebc5c11610149578063a85ebc5c146108a9578063a8c62e76146108be578063b235d468146108de578063b4eae1cb146108fd57600080fd5b806392495883146108405780639f1bf63e1461086a578063a0712d6814610880578063a8508d3e1461089357600080fd5b8063827a4b0b116101b6578063827a4b0b146107df57806384da2666146107f6578063868a27241461080c5780638da5cb5b1461082257600080fd5b80637e4831d31461078f5780638088c318146107a957806380fe2b75146107c957600080fd5b8063458f5815116102c1578063542b3ad11161025f57806373b82edd1161022e57806373b82edd146107055780637a991b6d146107255780637adbf9731461074f5780637dc0d1d01461076f57600080fd5b8063542b3ad11461069a5780635a64ad95146106ba57806361d027b3146106d0578063715018a6146106f057600080fd5b80634e040e441161029b5780634e040e44146106325780634ebc1aef146106485780634ebf441814610668578063514330cb1461067057600080fd5b8063458f5815146105e657806349bfcca1146105fc5780634bfe4a571461061c57600080fd5b80631e53529711610339578063385362751161030857806338536275146105715780633e09a95f146105915780634013124a146105b157806340d48c07146105c657600080fd5b80631e535297146104cd5780632ebfa5bd146104ed578063370158ea14610503578063370421421461055157600080fd5b80630e96fa87116103755780630e96fa871461042a57806310b0e7e81461043f5780631959a002146104555780631be626c1146104b757600080fd5b8063088b699e146103a75780630b68acac146103e45780630b78f9c01461040857600080fd5b366103a257005b600080fd5b3480156103b357600080fd5b506003546103c7906001600160a01b031681565b6040516001600160a01b0390911681526020015b60405180910390f35b3480156103f057600080fd5b506103fa60115481565b6040519081526020016103db565b34801561041457600080fd5b506104286104233660046132e2565b610ad2565b005b34801561043657600080fd5b50610428610bd5565b34801561044b57600080fd5b506103fa60165481565b34801561046157600080fd5b5061049761047036600461321f565b60086020526000908152604090208054600182015460028301546003909301549192909184565b6040805194855260208501939093529183015260608201526080016103db565b3480156104c357600080fd5b506103fa60095481565b3480156104d957600080fd5b506104286104e83660046132b2565b610c56565b3480156104f957600080fd5b506103fa600a5481565b34801561050f57600080fd5b50610518610d79565b60408051978852602088019690965294860193909352606085019190915215156080840152151560a083015260c082015260e0016103db565b34801561055d57600080fd5b506005546103c7906001600160a01b031681565b34801561057d57600080fd5b5061042861058c3660046132b2565b610da9565b34801561059d57600080fd5b506104286105ac36600461321f565b610ec0565b3480156105bd57600080fd5b50610428610f77565b3480156105d257600080fd5b506104286105e136600461321f565b6111f4565b3480156105f257600080fd5b506103fa60185481565b34801561060857600080fd5b506004546103c7906001600160a01b031681565b34801561062857600080fd5b506103fa61271081565b34801561063e57600080fd5b506103fa600e5481565b34801561065457600080fd5b506104286106633660046132b2565b611260565b610428611320565b34801561067c57600080fd5b506106856113bd565b604080519283529015156020830152016103db565b3480156106a657600080fd5b506104286106b53660046132b2565b6114a4565b3480156106c657600080fd5b506103fa60195481565b3480156106dc57600080fd5b506007546103c7906001600160a01b031681565b3480156106fc57600080fd5b506104286115c1565b34801561071157600080fd5b5061042861072036600461332e565b6115d5565b34801561073157600080fd5b5060175461073f9060ff1681565b60405190151581526020016103db565b34801561075b57600080fd5b5061042861076a36600461321f565b61163f565b34801561077b57600080fd5b506002546103c7906001600160a01b031681565b34801561079b57600080fd5b50600c5461073f9060ff1681565b3480156107b557600080fd5b506006546103c7906001600160a01b031681565b3480156107d557600080fd5b506103fa60125481565b3480156107eb57600080fd5b506103fa6205460081565b34801561080257600080fd5b506103fa60155481565b34801561081857600080fd5b506103fa600f5481565b34801561082e57600080fd5b506000546001600160a01b03166103c7565b34801561084c57600080fd5b506108556116e7565b604080519283526020830191909152016103db565b34801561087657600080fd5b506103fa60145481565b61042861088e3660046132b2565b611780565b34801561089f57600080fd5b506103fa60135481565b3480156108b557600080fd5b506103fa611a15565b3480156108ca57600080fd5b50601a546103c7906001600160a01b031681565b3480156108ea57600080fd5b50600c5461073f90610100900460ff1681565b34801561090957600080fd5b506103fa600d5481565b34801561091f57600080fd5b5061042861092e366004613303565b611ac1565b34801561093f57600080fd5b506103fa601c5481565b34801561095557600080fd5b5061042861096436600461327a565b611e18565b34801561097557600080fd5b506104286109843660046132b2565b611e7c565b34801561099557600080fd5b506103fa600b5481565b3480156109ab57600080fd5b506104286109ba366004613242565b611f32565b3480156109cb57600080fd5b50601b546103c7906001600160a01b031681565b3480156109eb57600080fd5b50610428611f8b565b348015610a0057600080fd5b50610428610a0f3660046132b2565b612381565b348015610a2057600080fd5b506103fa60105481565b348015610a3657600080fd5b50610a4a610a453660046132b2565b612421565b604080519586526020860194909452928401919091526060830152608082015260a0016103db565b348015610a7e57600080fd5b50610428610a8d36600461321f565b61278c565b348015610a9e57600080fd5b50610428610aad36600461321f565b61282f565b348015610abe57600080fd5b50610497610acd3660046132b2565b6128a5565b610ada612a41565b612710821115610b315760405162461bcd60e51b815260206004820152601e60248201527f506f6f6c3a3a736574466565733a3e4d494e54494e475f4645455f4d4158000060448201526064015b60405180910390fd5b612710811115610b8d5760405162461bcd60e51b815260206004820152602160248201527f506f6f6c3a3a736574466565733a3e524544454d5054494f4e5f4645455f4d416044820152600b60fb1b6064820152608401610b28565b6018819055601982905560408051838152602081018390527f5c6323bf1c2d7aaea2c091a4751c1c87af7f2864650c336507a77d0557af37a191015b60405180910390a15050565b610bdd612a41565b601c54421015610bec57600080fd5b6000601c5411610bfb57600080fd5b601b54601a80546001600160a01b0319166001600160a01b0390921691821790556000601c556040519081527f3412691e1ea2503d6eec15597247048016213c19646b73d4320a20c790b67ee29060200160405180910390a1565b610c5e612a41565b610c66611a15565b811115610cc95760405162461bcd60e51b815260206004820152602b60248201527f506f6f6c3a3a73656e64546f53747261746567793a205f77657468496e203e2060448201526a4554482062616c616e636560a81b6064820152608401610b28565b601a54610cdf906001600160a01b031682612a9b565b601a54604051630801f16960e11b8152600481018390526001600160a01b0390911690631003e2d290602401600060405180830381600087803b158015610d2557600080fd5b505af1158015610d39573d6000803e3d6000fd5b505050507fe44825d83994ef6dad657d0eaeea9bb8e34eea535b12d97e12d652b551e2b32481604051610d6e91815260200190565b60405180910390a150565b600d54600f54601954601854600c5460ff808216916101009004166000610d9e611a15565b905090919293949596565b610db1612a41565b620f4240811115610e1e5760405162461bcd60e51b815260206004820152603160248201527f506f6f6c3a3a7365744d696e436f6c6c61746572616c526174696f3a3e434f4c60448201527009882a88aa48298bea482a8929ebe9a82b607b1b6064820152608401610b28565b6207a120811015610e8b5760405162461bcd60e51b815260206004820152603160248201527f506f6f6c3a3a7365744d696e436f6c6c61746572616c526174696f3a3c434f4c6044820152702620aa22a920a62fa920aa24a7afa6a4a760791b6064820152608401610b28565b60158190556040518181527f5982e574cb778844329684a34107b512e3a2413a153fc02af924390158148c6f90602001610d6e565b610ec8612a41565b6001600160a01b038116610f2d5760405162461bcd60e51b815260206004820152602660248201527f506f6f6c3a3a7365745377617053747261746567793a20696e76616c6964206160448201526564647265737360d01b6064820152608401610b28565b600680546001600160a01b0319166001600160a01b0383169081179091556040517ff42b2d6189f0c63bb22abb0ec7e0e9d32a43085515d7256a8a0786989e7f38fa90600090a250565b60175460ff1615610ff05760405162461bcd60e51b815260206004820152603e60248201527f506f6f6c3a3a72656672657368436f6c6c61746572616c526174696f3a20436f60448201527f6c6c61746572616c20526174696f20686173206265656e2070617573656400006064820152608401610b28565b601054600f546110009042613405565b10156110905760405162461bcd60e51b815260206004820152605360248201527f506f6f6c3a3a72656672657368436f6c6c61746572616c526174696f3a204d7560448201527f7374207761697420666f7220746865207265667265736820636f6f6c646f776e606482015272040e6d2dcc6ca40d8c2e6e840e4cacce4cae6d606b1b608482015260a401610b28565b60025460408051631819cc4760e31b815290516000926001600160a01b03169163c0ce6238916004808301926020929190829003018186803b1580156110d557600080fd5b505afa1580156110e9573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061110d91906132ca565b905060145460135461111f91906133ae565b81111561116f57601254600d541161113b576000600d556111bd565b6000601254600d5461114d9190613405565b9050601554811161116357601554600d55611169565b600d8190555b506111bd565b60145460135461117f9190613405565b8110156111bd57600e54601154600d5461119991906133ae565b106111a957600e54600d556111bd565b601154600d546111b991906133ae565b600d555b42600f55600d546040519081527f43dd06cd14239ec6c5a1b4ea9c2def7d8940aeda88ead0ab6fb960ce3c3c412d90602001610d6e565b6111fc612a41565b601b80546001600160a01b0319166001600160a01b03831617905561122462054600426133ae565b601c556040516001600160a01b03821681527f2eba073752bc8b1c0404227a8952a0c055cb2d447b7e45865132f8d88be557c690602001610d6e565b611268612a41565b601a54604051634cc8221560e01b8152600481018390526000916001600160a01b031690634cc8221590602401602060405180830381600087803b1580156112af57600080fd5b505af11580156112c3573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906112e791906132ca565b60408051848152602081018390529192507f02a7bcf01b76097b415880cdc5d2c15309ba3f824b739177fd037ae3034dfd549101610bc9565b348061137c5760405162461bcd60e51b815260206004820152602560248201527f506f6f6c3a3a7265636f6c6c61746572616c697a653a20496e76616c696420616044820152641b5bdd5b9d60da1b6064820152608401610b28565b61138581612abe565b60405181815233907fbcce792384bcc41455f8efeface08ee7880d3a4264ada39bb979554fd5985d609060200160405180910390a250565b6000806000620f4240600d54600360009054906101000a90046001600160a01b03166001600160a01b03166318160ddd6040518163ffffffff1660e01b815260040160206040518083038186803b15801561141757600080fd5b505afa15801561142b573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061144f91906132ca565b61145991906133e6565b61146391906133c6565b9050600061146f611a15565b905081811061148d576114828282613405565b93506001925061149e565b6114978183613405565b9350600092505b50509091565b6114ac612a41565b620f424081111561151c5760405162461bcd60e51b815260206004820152603460248201527f506f6f6c3a3a7365744361704d6178436f6c6c61746572616c526174696f3a3e6044820152730869e989882a88aa48298bea482a8929ebe9a82b60631b6064820152608401610b28565b6207a12081101561158c5760405162461bcd60e51b815260206004820152603460248201527f506f6f6c3a3a7365744361704d6178436f6c6c61746572616c526174696f3a3c60448201527321a7a62620aa22a920a62fa920aa24a7afa6a4a760611b6064820152608401610b28565b600e8190556040518181527f4efd4e5e1c1fc517dc0874f2307cf013bb59d339fd12edc71491ad14836f7b1890602001610d6e565b6115c9612a41565b6115d36000612b29565b565b6115dd612a41565b60118490556012839055601482905560108190556040805185815260208101859052908101839052606081018290527f038f57571f57da47bfdd27bbcac94efe4d37d76fc9711fbeb5e68e75bc8243049060800160405180910390a150505050565b611647612a41565b6001600160a01b03811661169d5760405162461bcd60e51b815260206004820181905260248201527f506f6f6c3a3a7365744f7261636c653a20696e76616c696420616464726573736044820152606401610b28565b600280546001600160a01b0319166001600160a01b0383169081179091556040517f0e05ae75e8b926552cf6fcd744d19f422561e3ced1e426868730852702dbe41890600090a250565b6000806116f2611a15565b9150601a60009054906101000a90046001600160a01b03166001600160a01b031663b8cf71336040518163ffffffff1660e01b815260040160206040518083038186803b15801561174257600080fd5b505afa158015611756573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061177a91906132ca565b90509091565b611788612b79565b600c5460ff16156117db5760405162461bcd60e51b815260206004820152601d60248201527f506f6f6c3a3a6d696e743a204d696e74696e67206973207061757365640000006044820152606401610b28565b343360008080806117eb866128a5565b93509350935093508684101561183c5760405162461bcd60e51b8152602060048201526016602482015275506f6f6c3a3a6d696e743a203e20736c69707061676560501b6044820152606401610b28565b600260009054906101000a90046001600160a01b03166001600160a01b031663534ee2bf6040518163ffffffff1660e01b8152600401600060405180830381600087803b15801561188c57600080fd5b505af11580156118a0573d6000803e3d6000fd5b505050506118ad86612abe565b6000831180156118bd5750600081115b15611954576006546118ee9073039e2fb66102314ce7b64ce5ce3e5183bc94ad38906001600160a01b031683612bd3565b600654604051632b00f57560e11b815260048101839052602481018590526001600160a01b0390911690635601eaea90604401600060405180830381600087803b15801561193b57600080fd5b505af115801561194f573d6000803e3d6000fd5b505050505b83156119a9576001600160a01b03851660009081526008602052604090205461197e9085906133ae565b6001600160a01b038616600090815260086020526040902055600a546119a59085906133ae565b600a555b6119b282612cc8565b604080516001600160a01b038716815260208101869052908101879052606081018390527fb4c03061fb5b7fed76389d5af8f2e0ddb09f8c70d1333abbb62582835e10accb9060800160405180910390a1505050505050611a1260018055565b50565b6040516370a0823160e01b8152306004820152600090819073039e2fb66102314ce7b64ce5ce3e5183bc94ad38906370a082319060240160206040518083038186803b158015611a6457600080fd5b505afa158015611a78573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611a9c91906132ca565b90506009548111611aae576000611abb565b600954611abb9082613405565b91505090565b611ac9612b79565b600c54610100900460ff1615611b2b5760405162461bcd60e51b815260206004820152602160248201527f506f6f6c3a3a72656465656d3a2052656465656d696e672069732070617573656044820152601960fa1b6064820152608401610b28565b600260009054906101000a90046001600160a01b03166001600160a01b031663534ee2bf6040518163ffffffff1660e01b8152600401600060405180830381600087803b158015611b7b57600080fd5b505af1158015611b8f573d6000803e3d6000fd5b5050505060003390506000806000806000611ba989612421565b94509450945094509450611bbb611a15565b811115611c0a5760405162461bcd60e51b815260206004820152601b60248201527f506f6f6c3a3a72656465656d3a203e204554482062616c616e636500000000006044820152606401610b28565b611c148484612d63565b848711158015611c245750838811155b611c705760405162461bcd60e51b815260206004820152601760248201527f506f6f6c3a3a72656465656d3a203e736c6970706167650000000000000000006044820152606401610b28565b8415611ccb576001600160a01b038616600090815260086020526040902060020154611c9d9086906133ae565b6001600160a01b038716600090815260086020526040902060020155600954611cc79086906133ae565b6009555b8315611d26576001600160a01b038616600090815260086020526040902060010154611cf89085906133ae565b6001600160a01b038716600090815260086020526040902060010155600b54611d229085906133ae565b600b555b6001600160a01b03868116600081815260086020526040908190204360039182015554905163079cc67960e41b81526004810192909252602482018c9052909116906379cc679090604401600060405180830381600087803b158015611d8b57600080fd5b505af1158015611d9f573d6000803e3d6000fd5b50505050611dac82612cc8565b604080516001600160a01b0388168152602081018b905290810186905260608101859052608081018390527fe02f6383e19e87c24e0c03e2cd5dbd05156cb29a1b0f3dbca1fa3430e444f63d9060a00160405180910390a1505050505050611e1360018055565b505050565b611e20612a41565b600c8054821515610100810261ff001986151590811661ffff1990941693909317179092556040805191825260208201929092527fe4e2759610fe740b4c8247147491ae3e248b92fb63181dc697aff6faf00f65d79101610bc9565b611e84612a41565b62061a80811115611efd5760405162461bcd60e51b815260206004820152603f60248201527f506f6f6c3a3a73657459546f6b656e536c6970706167653a2079546f6b656e5360448201527f6c6970706167652063616e6e6f74206265206d6f7265207468616e20343025006064820152608401610b28565b60168190556040518181527fd86c2dfaa734f6aef8a960c73c2d669e130018cc4f61aeb1f115c64844a96e0a90602001610d6e565b611f3a612a41565b60175460ff16151581151514611a12576017805460ff19168215159081179091556040519081527fe9b03f52b6ce464fd3d6eec943f0c67d7575005f3b0bbf2fad4ea38b4ed7208490602001610d6e565b611f93612b79565b336000818152600860205260409020600301544311611ff45760405162461bcd60e51b815260206004820152601d60248201527f506f6f6c3a3a636f6c6c6563743a203c6d696e696d756d5f64656c61790000006044820152606401610b28565b6001600160a01b0381166000908152600860205260408120548190819081908190819015612052576001600160a01b03871660009081526008602052604081208054919055600a5490935061204a908490613405565b600a55600195505b6001600160a01b038716600090815260086020526040902060010154156120ac576001600160a01b03871660009081526008602052604081206001018054919055600b549092506120a4908390613405565b600b55600194505b6001600160a01b0387166000908152600860205260409020600201541561210457506001600160a01b038616600090815260086020526040812060020180549190556009546120fc908290613405565b600955600193505b8515612171576003546040516340c10f1960e01b81526001600160a01b03898116600483015260248201869052909116906340c10f1990604401600060405180830381600087803b15801561215857600080fd5b505af115801561216c573d6000803e3d6000fd5b505050505b841561235857600480546005546040516370a0823160e01b81526001600160a01b039182169381019390935284929116906370a082319060240160206040518083038186803b1580156121c357600080fd5b505afa1580156121d7573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906121fb91906132ca565b10156122f157600554600480546040516370a0823160e01b81526001600160a01b03938416928101839052919263a9059cbb928b9291909116906370a082319060240160206040518083038186803b15801561225657600080fd5b505afa15801561226a573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061228e91906132ca565b6040516001600160e01b031960e085901b1681526001600160a01b0390921660048301526024820152604401600060405180830381600087803b1580156122d457600080fd5b505af11580156122e8573d6000803e3d6000fd5b50505050612358565b60055460405163a9059cbb60e01b81526001600160a01b038981166004830152602482018590529091169063a9059cbb90604401600060405180830381600087803b15801561233f57600080fd5b505af1158015612353573d6000803e3d6000fd5b505050505b83156123715761236781612e0c565b6123718782612e74565b505050505050506115d360018055565b612389612a41565b6000806123946113bd565b915091508080156123a55750600082115b15611e1357818311156124185760405162461bcd60e51b815260206004820152603560248201527f506f6f6c3a3a726564756365457863657373436f6c6c61746572616c3a2054686044820152746520616d6f756e7420697320746f6f206c6172676560581b6064820152608401610b28565b611e1383612cc8565b600080600080600080600260009054906101000a90046001600160a01b03166001600160a01b0316636e16399c6040518163ffffffff1660e01b815260040160206040518083038186803b15801561247857600080fd5b505afa15801561248c573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906124b091906132ca565b90506000600260009054906101000a90046001600160a01b03166001600160a01b0316635f4370a56040518163ffffffff1660e01b815260040160206040518083038186803b15801561250257600080fd5b505afa158015612516573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061253a91906132ca565b90506000821161259b5760405162461bcd60e51b815260206004820152602660248201527f506f6f6c3a3a63616c6352656465656d3a20496e76616c69642059546f6b656e60448201526520707269636560d01b6064820152608401610b28565b600081116125f75760405162461bcd60e51b8152602060048201526024808201527f506f6f6c3a3a63616c6352656465656d3a20496e76616c69642079546f6b656e6044820152630545741560e41b6064820152608401610b28565b620f4240600d548961260991906133e6565b61261391906133c6565b9250620f4240600d5410156126ff5781620f424080670de0b6b3a7640000601854620f42406126429190613405565b600d5461265290620f4240613405565b61265c908e6133e6565b61266691906133e6565b61267091906133e6565b61267a91906133c6565b61268491906133c6565b61268e91906133c6565b955080620f424080670de0b6b3a7640000601854620f42406126b09190613405565b600d546126c090620f4240613405565b6126ca908e6133e6565b6126d491906133e6565b6126de91906133e6565b6126e891906133c6565b6126f291906133c6565b6126fc91906133c6565b94505b600d541561278157620f424080601854620f424061271d9190613405565b600d5461272a908c6133e6565b61273491906133e6565b61273e91906133c6565b61274891906133c6565b9650620f424080601854600d548b61276091906133e6565b61276a91906133e6565b61277491906133c6565b61277e91906133c6565b93505b505091939590929450565b6007546001600160a01b0316156127e55760405162461bcd60e51b815260206004820152601e60248201527f506f6f6c3a3a73657454726561737572793a206e6f7420616c6c6f77656400006044820152606401610b28565b600780546001600160a01b0319166001600160a01b0383169081179091556040517f3c864541ef71378c6229510ed90f376565ee42d9c5e0904a984a9e863e6db44f90600090a250565b612837612a41565b6001600160a01b03811661289c5760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b6064820152608401610b28565b611a1281612b29565b6000806000806000600260009054906101000a90046001600160a01b03166001600160a01b0316635f4370a56040518163ffffffff1660e01b815260040160206040518083038186803b1580156128fb57600080fd5b505afa15801561290f573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061293391906132ca565b9050600081116129915760405162461bcd60e51b8152602060048201526024808201527f506f6f6c3a3a63616c634d696e743a20496e76616c69642059546f6b656e20706044820152637269636560e01b6064820152608401610b28565b620f4240600d54620f42406129a69190613405565b6129b090886133e6565b6129ba91906133c6565b9150806129cf670de0b6b3a7640000846133e6565b6129d991906133c6565b9350620f424080600d54601954896129f191906133e6565b6129fb91906133e6565b612a0591906133c6565b612a0f91906133c6565b9250620f424060195487612a2391906133e6565b612a2d91906133c6565b612a379087613405565b9450509193509193565b6000546001600160a01b031633146115d35760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610b28565b612aba73039e2fb66102314ce7b64ce5ce3e5183bc94ad388383612f8d565b5050565b73039e2fb66102314ce7b64ce5ce3e5183bc94ad386001600160a01b031663d0e30db0826040518263ffffffff1660e01b81526004016000604051808303818588803b158015612b0d57600080fd5b505af1158015612b21573d6000803e3d6000fd5b505050505050565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b60026001541415612bcc5760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c006044820152606401610b28565b6002600155565b604051636eb1769f60e11b81523060048201526001600160a01b0383811660248301526000919085169063dd62ed3e9060440160206040518083038186803b158015612c1e57600080fd5b505afa158015612c32573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612c5691906132ca565b9050612cc28463095ea7b360e01b85612c6f86866133ae565b6040516001600160a01b03909216602483015260448201526064015b60408051601f198184030181529190526020810180516001600160e01b03166001600160e01b031990931692909217909152612fbd565b50505050565b6007546001600160a01b0316612d315760405162461bcd60e51b815260206004820152602860248201527f506f6f6c3a3a7472616e73666572546f54726561737572793a496e76616c6964604482015267206164647265737360c01b6064820152608401610b28565b8015611a1257600754611a129073039e2fb66102314ce7b64ce5ce3e5183bc94ad38906001600160a01b031683612f8d565b600081831115612d7e57612d778284613405565b9050612d8b565b612d888383613405565b90505b620f424060165483612d9d91906133e6565b612da791906133c6565b811115611e135760405162461bcd60e51b815260206004820152602d60248201527f506f6f6c3a3a636865636b5072696365466c756374756174696f6e3a203e207960448201526c546f6b656e536c69707061676560981b6064820152608401610b28565b604051632e1a7d4d60e01b81526004810182905273039e2fb66102314ce7b64ce5ce3e5183bc94ad3890632e1a7d4d90602401600060405180830381600087803b158015612e5957600080fd5b505af1158015612e6d573d6000803e3d6000fd5b5050505050565b80471015612ec45760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a20696e73756666696369656e742062616c616e63650000006044820152606401610b28565b6000826001600160a01b03168260405160006040518083038185875af1925050503d8060008114612f11576040519150601f19603f3d011682016040523d82523d6000602084013e612f16565b606091505b5050905080611e135760405162461bcd60e51b815260206004820152603a60248201527f416464726573733a20756e61626c6520746f2073656e642076616c75652c207260448201527f6563697069656e74206d617920686176652072657665727465640000000000006064820152608401610b28565b6040516001600160a01b038316602482015260448101829052611e1390849063a9059cbb60e01b90606401612c8b565b6000613012826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b03166130929092919063ffffffff16565b9050805160001480613033575080806020019051810190613033919061325e565b611e135760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b6064820152608401610b28565b60606130a184846000856130a9565b949350505050565b60608247101561310a5760405162461bcd60e51b815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f6044820152651c8818d85b1b60d21b6064820152608401610b28565b600080866001600160a01b03168587604051613126919061335f565b60006040518083038185875af1925050503d8060008114613163576040519150601f19603f3d011682016040523d82523d6000602084013e613168565b606091505b509150915061317987838387613184565b979650505050505050565b606083156131f05782516131e9576001600160a01b0385163b6131e95760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e74726163740000006044820152606401610b28565b50816130a1565b6130a183838151156132055781518083602001fd5b8060405162461bcd60e51b8152600401610b28919061337b565b600060208284031215613230578081fd5b813561323b8161345e565b9392505050565b600060208284031215613253578081fd5b813561323b81613473565b60006020828403121561326f578081fd5b815161323b81613473565b6000806040838503121561328c578081fd5b823561329781613473565b915060208301356132a781613473565b809150509250929050565b6000602082840312156132c3578081fd5b5035919050565b6000602082840312156132db578081fd5b5051919050565b600080604083850312156132f4578182fd5b50508035926020909101359150565b600080600060608486031215613317578081fd5b505081359360208301359350604090920135919050565b60008060008060808587031215613343578081fd5b5050823594602084013594506040840135936060013592509050565b6000825161337181846020870161341c565b9190910192915050565b602081526000825180602084015261339a81604085016020870161341c565b601f01601f19169190910160400192915050565b600082198211156133c1576133c1613448565b500190565b6000826133e157634e487b7160e01b81526012600452602481fd5b500490565b600081600019048311821515161561340057613400613448565b500290565b60008282101561341757613417613448565b500390565b60005b8381101561343757818101518382015260200161341f565b83811115612cc25750506000910152565b634e487b7160e01b600052601160045260246000fd5b6001600160a01b0381168114611a1257600080fd5b8015158114611a1257600080fdfea26469706673582212205032586f9db44f9f1f20d9d3565cb83f0e1c2fddf09ded4aa05e2f483c5a84f564736f6c63430008040033506f6f6c3a3a696e697469616c697a653a20696e76616c696441646472657373000000000000000000000000b7e013d0552c82c3d4366e4c7c838017306369e00000000000000000000000003c678380405a6b2fc3bcb35e55e6ee3676dc89a40000000000000000000000001fbb1ba53ba4e4cac2759c2d5526ae73ec78bddf
Deployed Bytecode
0x60806040526004361061039b5760003560e01c80637e4831d3116101dc578063b819220511610102578063e5225381116100a0578063f0f442601161006f578063f0f4426014610a72578063f2fde38b14610a92578063f84dfc6614610ab2578063f8c321241461061c57600080fd5b8063e5225381146109df578063e969355f146109f4578063ea5f7abe14610a14578063ed21b97514610a2a57600080fd5b8063c97b4960116100dc578063c97b496014610969578063d300138614610989578063d5d0cb161461099f578063e175ae13146109bf57600080fd5b8063b819220514610913578063bfebc96214610933578063c29118fc1461094957600080fd5b8063924958831161017a578063a85ebc5c11610149578063a85ebc5c146108a9578063a8c62e76146108be578063b235d468146108de578063b4eae1cb146108fd57600080fd5b806392495883146108405780639f1bf63e1461086a578063a0712d6814610880578063a8508d3e1461089357600080fd5b8063827a4b0b116101b6578063827a4b0b146107df57806384da2666146107f6578063868a27241461080c5780638da5cb5b1461082257600080fd5b80637e4831d31461078f5780638088c318146107a957806380fe2b75146107c957600080fd5b8063458f5815116102c1578063542b3ad11161025f57806373b82edd1161022e57806373b82edd146107055780637a991b6d146107255780637adbf9731461074f5780637dc0d1d01461076f57600080fd5b8063542b3ad11461069a5780635a64ad95146106ba57806361d027b3146106d0578063715018a6146106f057600080fd5b80634e040e441161029b5780634e040e44146106325780634ebc1aef146106485780634ebf441814610668578063514330cb1461067057600080fd5b8063458f5815146105e657806349bfcca1146105fc5780634bfe4a571461061c57600080fd5b80631e53529711610339578063385362751161030857806338536275146105715780633e09a95f146105915780634013124a146105b157806340d48c07146105c657600080fd5b80631e535297146104cd5780632ebfa5bd146104ed578063370158ea14610503578063370421421461055157600080fd5b80630e96fa87116103755780630e96fa871461042a57806310b0e7e81461043f5780631959a002146104555780631be626c1146104b757600080fd5b8063088b699e146103a75780630b68acac146103e45780630b78f9c01461040857600080fd5b366103a257005b600080fd5b3480156103b357600080fd5b506003546103c7906001600160a01b031681565b6040516001600160a01b0390911681526020015b60405180910390f35b3480156103f057600080fd5b506103fa60115481565b6040519081526020016103db565b34801561041457600080fd5b506104286104233660046132e2565b610ad2565b005b34801561043657600080fd5b50610428610bd5565b34801561044b57600080fd5b506103fa60165481565b34801561046157600080fd5b5061049761047036600461321f565b60086020526000908152604090208054600182015460028301546003909301549192909184565b6040805194855260208501939093529183015260608201526080016103db565b3480156104c357600080fd5b506103fa60095481565b3480156104d957600080fd5b506104286104e83660046132b2565b610c56565b3480156104f957600080fd5b506103fa600a5481565b34801561050f57600080fd5b50610518610d79565b60408051978852602088019690965294860193909352606085019190915215156080840152151560a083015260c082015260e0016103db565b34801561055d57600080fd5b506005546103c7906001600160a01b031681565b34801561057d57600080fd5b5061042861058c3660046132b2565b610da9565b34801561059d57600080fd5b506104286105ac36600461321f565b610ec0565b3480156105bd57600080fd5b50610428610f77565b3480156105d257600080fd5b506104286105e136600461321f565b6111f4565b3480156105f257600080fd5b506103fa60185481565b34801561060857600080fd5b506004546103c7906001600160a01b031681565b34801561062857600080fd5b506103fa61271081565b34801561063e57600080fd5b506103fa600e5481565b34801561065457600080fd5b506104286106633660046132b2565b611260565b610428611320565b34801561067c57600080fd5b506106856113bd565b604080519283529015156020830152016103db565b3480156106a657600080fd5b506104286106b53660046132b2565b6114a4565b3480156106c657600080fd5b506103fa60195481565b3480156106dc57600080fd5b506007546103c7906001600160a01b031681565b3480156106fc57600080fd5b506104286115c1565b34801561071157600080fd5b5061042861072036600461332e565b6115d5565b34801561073157600080fd5b5060175461073f9060ff1681565b60405190151581526020016103db565b34801561075b57600080fd5b5061042861076a36600461321f565b61163f565b34801561077b57600080fd5b506002546103c7906001600160a01b031681565b34801561079b57600080fd5b50600c5461073f9060ff1681565b3480156107b557600080fd5b506006546103c7906001600160a01b031681565b3480156107d557600080fd5b506103fa60125481565b3480156107eb57600080fd5b506103fa6205460081565b34801561080257600080fd5b506103fa60155481565b34801561081857600080fd5b506103fa600f5481565b34801561082e57600080fd5b506000546001600160a01b03166103c7565b34801561084c57600080fd5b506108556116e7565b604080519283526020830191909152016103db565b34801561087657600080fd5b506103fa60145481565b61042861088e3660046132b2565b611780565b34801561089f57600080fd5b506103fa60135481565b3480156108b557600080fd5b506103fa611a15565b3480156108ca57600080fd5b50601a546103c7906001600160a01b031681565b3480156108ea57600080fd5b50600c5461073f90610100900460ff1681565b34801561090957600080fd5b506103fa600d5481565b34801561091f57600080fd5b5061042861092e366004613303565b611ac1565b34801561093f57600080fd5b506103fa601c5481565b34801561095557600080fd5b5061042861096436600461327a565b611e18565b34801561097557600080fd5b506104286109843660046132b2565b611e7c565b34801561099557600080fd5b506103fa600b5481565b3480156109ab57600080fd5b506104286109ba366004613242565b611f32565b3480156109cb57600080fd5b50601b546103c7906001600160a01b031681565b3480156109eb57600080fd5b50610428611f8b565b348015610a0057600080fd5b50610428610a0f3660046132b2565b612381565b348015610a2057600080fd5b506103fa60105481565b348015610a3657600080fd5b50610a4a610a453660046132b2565b612421565b604080519586526020860194909452928401919091526060830152608082015260a0016103db565b348015610a7e57600080fd5b50610428610a8d36600461321f565b61278c565b348015610a9e57600080fd5b50610428610aad36600461321f565b61282f565b348015610abe57600080fd5b50610497610acd3660046132b2565b6128a5565b610ada612a41565b612710821115610b315760405162461bcd60e51b815260206004820152601e60248201527f506f6f6c3a3a736574466565733a3e4d494e54494e475f4645455f4d4158000060448201526064015b60405180910390fd5b612710811115610b8d5760405162461bcd60e51b815260206004820152602160248201527f506f6f6c3a3a736574466565733a3e524544454d5054494f4e5f4645455f4d416044820152600b60fb1b6064820152608401610b28565b6018819055601982905560408051838152602081018390527f5c6323bf1c2d7aaea2c091a4751c1c87af7f2864650c336507a77d0557af37a191015b60405180910390a15050565b610bdd612a41565b601c54421015610bec57600080fd5b6000601c5411610bfb57600080fd5b601b54601a80546001600160a01b0319166001600160a01b0390921691821790556000601c556040519081527f3412691e1ea2503d6eec15597247048016213c19646b73d4320a20c790b67ee29060200160405180910390a1565b610c5e612a41565b610c66611a15565b811115610cc95760405162461bcd60e51b815260206004820152602b60248201527f506f6f6c3a3a73656e64546f53747261746567793a205f77657468496e203e2060448201526a4554482062616c616e636560a81b6064820152608401610b28565b601a54610cdf906001600160a01b031682612a9b565b601a54604051630801f16960e11b8152600481018390526001600160a01b0390911690631003e2d290602401600060405180830381600087803b158015610d2557600080fd5b505af1158015610d39573d6000803e3d6000fd5b505050507fe44825d83994ef6dad657d0eaeea9bb8e34eea535b12d97e12d652b551e2b32481604051610d6e91815260200190565b60405180910390a150565b600d54600f54601954601854600c5460ff808216916101009004166000610d9e611a15565b905090919293949596565b610db1612a41565b620f4240811115610e1e5760405162461bcd60e51b815260206004820152603160248201527f506f6f6c3a3a7365744d696e436f6c6c61746572616c526174696f3a3e434f4c60448201527009882a88aa48298bea482a8929ebe9a82b607b1b6064820152608401610b28565b6207a120811015610e8b5760405162461bcd60e51b815260206004820152603160248201527f506f6f6c3a3a7365744d696e436f6c6c61746572616c526174696f3a3c434f4c6044820152702620aa22a920a62fa920aa24a7afa6a4a760791b6064820152608401610b28565b60158190556040518181527f5982e574cb778844329684a34107b512e3a2413a153fc02af924390158148c6f90602001610d6e565b610ec8612a41565b6001600160a01b038116610f2d5760405162461bcd60e51b815260206004820152602660248201527f506f6f6c3a3a7365745377617053747261746567793a20696e76616c6964206160448201526564647265737360d01b6064820152608401610b28565b600680546001600160a01b0319166001600160a01b0383169081179091556040517ff42b2d6189f0c63bb22abb0ec7e0e9d32a43085515d7256a8a0786989e7f38fa90600090a250565b60175460ff1615610ff05760405162461bcd60e51b815260206004820152603e60248201527f506f6f6c3a3a72656672657368436f6c6c61746572616c526174696f3a20436f60448201527f6c6c61746572616c20526174696f20686173206265656e2070617573656400006064820152608401610b28565b601054600f546110009042613405565b10156110905760405162461bcd60e51b815260206004820152605360248201527f506f6f6c3a3a72656672657368436f6c6c61746572616c526174696f3a204d7560448201527f7374207761697420666f7220746865207265667265736820636f6f6c646f776e606482015272040e6d2dcc6ca40d8c2e6e840e4cacce4cae6d606b1b608482015260a401610b28565b60025460408051631819cc4760e31b815290516000926001600160a01b03169163c0ce6238916004808301926020929190829003018186803b1580156110d557600080fd5b505afa1580156110e9573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061110d91906132ca565b905060145460135461111f91906133ae565b81111561116f57601254600d541161113b576000600d556111bd565b6000601254600d5461114d9190613405565b9050601554811161116357601554600d55611169565b600d8190555b506111bd565b60145460135461117f9190613405565b8110156111bd57600e54601154600d5461119991906133ae565b106111a957600e54600d556111bd565b601154600d546111b991906133ae565b600d555b42600f55600d546040519081527f43dd06cd14239ec6c5a1b4ea9c2def7d8940aeda88ead0ab6fb960ce3c3c412d90602001610d6e565b6111fc612a41565b601b80546001600160a01b0319166001600160a01b03831617905561122462054600426133ae565b601c556040516001600160a01b03821681527f2eba073752bc8b1c0404227a8952a0c055cb2d447b7e45865132f8d88be557c690602001610d6e565b611268612a41565b601a54604051634cc8221560e01b8152600481018390526000916001600160a01b031690634cc8221590602401602060405180830381600087803b1580156112af57600080fd5b505af11580156112c3573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906112e791906132ca565b60408051848152602081018390529192507f02a7bcf01b76097b415880cdc5d2c15309ba3f824b739177fd037ae3034dfd549101610bc9565b348061137c5760405162461bcd60e51b815260206004820152602560248201527f506f6f6c3a3a7265636f6c6c61746572616c697a653a20496e76616c696420616044820152641b5bdd5b9d60da1b6064820152608401610b28565b61138581612abe565b60405181815233907fbcce792384bcc41455f8efeface08ee7880d3a4264ada39bb979554fd5985d609060200160405180910390a250565b6000806000620f4240600d54600360009054906101000a90046001600160a01b03166001600160a01b03166318160ddd6040518163ffffffff1660e01b815260040160206040518083038186803b15801561141757600080fd5b505afa15801561142b573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061144f91906132ca565b61145991906133e6565b61146391906133c6565b9050600061146f611a15565b905081811061148d576114828282613405565b93506001925061149e565b6114978183613405565b9350600092505b50509091565b6114ac612a41565b620f424081111561151c5760405162461bcd60e51b815260206004820152603460248201527f506f6f6c3a3a7365744361704d6178436f6c6c61746572616c526174696f3a3e6044820152730869e989882a88aa48298bea482a8929ebe9a82b60631b6064820152608401610b28565b6207a12081101561158c5760405162461bcd60e51b815260206004820152603460248201527f506f6f6c3a3a7365744361704d6178436f6c6c61746572616c526174696f3a3c60448201527321a7a62620aa22a920a62fa920aa24a7afa6a4a760611b6064820152608401610b28565b600e8190556040518181527f4efd4e5e1c1fc517dc0874f2307cf013bb59d339fd12edc71491ad14836f7b1890602001610d6e565b6115c9612a41565b6115d36000612b29565b565b6115dd612a41565b60118490556012839055601482905560108190556040805185815260208101859052908101839052606081018290527f038f57571f57da47bfdd27bbcac94efe4d37d76fc9711fbeb5e68e75bc8243049060800160405180910390a150505050565b611647612a41565b6001600160a01b03811661169d5760405162461bcd60e51b815260206004820181905260248201527f506f6f6c3a3a7365744f7261636c653a20696e76616c696420616464726573736044820152606401610b28565b600280546001600160a01b0319166001600160a01b0383169081179091556040517f0e05ae75e8b926552cf6fcd744d19f422561e3ced1e426868730852702dbe41890600090a250565b6000806116f2611a15565b9150601a60009054906101000a90046001600160a01b03166001600160a01b031663b8cf71336040518163ffffffff1660e01b815260040160206040518083038186803b15801561174257600080fd5b505afa158015611756573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061177a91906132ca565b90509091565b611788612b79565b600c5460ff16156117db5760405162461bcd60e51b815260206004820152601d60248201527f506f6f6c3a3a6d696e743a204d696e74696e67206973207061757365640000006044820152606401610b28565b343360008080806117eb866128a5565b93509350935093508684101561183c5760405162461bcd60e51b8152602060048201526016602482015275506f6f6c3a3a6d696e743a203e20736c69707061676560501b6044820152606401610b28565b600260009054906101000a90046001600160a01b03166001600160a01b031663534ee2bf6040518163ffffffff1660e01b8152600401600060405180830381600087803b15801561188c57600080fd5b505af11580156118a0573d6000803e3d6000fd5b505050506118ad86612abe565b6000831180156118bd5750600081115b15611954576006546118ee9073039e2fb66102314ce7b64ce5ce3e5183bc94ad38906001600160a01b031683612bd3565b600654604051632b00f57560e11b815260048101839052602481018590526001600160a01b0390911690635601eaea90604401600060405180830381600087803b15801561193b57600080fd5b505af115801561194f573d6000803e3d6000fd5b505050505b83156119a9576001600160a01b03851660009081526008602052604090205461197e9085906133ae565b6001600160a01b038616600090815260086020526040902055600a546119a59085906133ae565b600a555b6119b282612cc8565b604080516001600160a01b038716815260208101869052908101879052606081018390527fb4c03061fb5b7fed76389d5af8f2e0ddb09f8c70d1333abbb62582835e10accb9060800160405180910390a1505050505050611a1260018055565b50565b6040516370a0823160e01b8152306004820152600090819073039e2fb66102314ce7b64ce5ce3e5183bc94ad38906370a082319060240160206040518083038186803b158015611a6457600080fd5b505afa158015611a78573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611a9c91906132ca565b90506009548111611aae576000611abb565b600954611abb9082613405565b91505090565b611ac9612b79565b600c54610100900460ff1615611b2b5760405162461bcd60e51b815260206004820152602160248201527f506f6f6c3a3a72656465656d3a2052656465656d696e672069732070617573656044820152601960fa1b6064820152608401610b28565b600260009054906101000a90046001600160a01b03166001600160a01b031663534ee2bf6040518163ffffffff1660e01b8152600401600060405180830381600087803b158015611b7b57600080fd5b505af1158015611b8f573d6000803e3d6000fd5b5050505060003390506000806000806000611ba989612421565b94509450945094509450611bbb611a15565b811115611c0a5760405162461bcd60e51b815260206004820152601b60248201527f506f6f6c3a3a72656465656d3a203e204554482062616c616e636500000000006044820152606401610b28565b611c148484612d63565b848711158015611c245750838811155b611c705760405162461bcd60e51b815260206004820152601760248201527f506f6f6c3a3a72656465656d3a203e736c6970706167650000000000000000006044820152606401610b28565b8415611ccb576001600160a01b038616600090815260086020526040902060020154611c9d9086906133ae565b6001600160a01b038716600090815260086020526040902060020155600954611cc79086906133ae565b6009555b8315611d26576001600160a01b038616600090815260086020526040902060010154611cf89085906133ae565b6001600160a01b038716600090815260086020526040902060010155600b54611d229085906133ae565b600b555b6001600160a01b03868116600081815260086020526040908190204360039182015554905163079cc67960e41b81526004810192909252602482018c9052909116906379cc679090604401600060405180830381600087803b158015611d8b57600080fd5b505af1158015611d9f573d6000803e3d6000fd5b50505050611dac82612cc8565b604080516001600160a01b0388168152602081018b905290810186905260608101859052608081018390527fe02f6383e19e87c24e0c03e2cd5dbd05156cb29a1b0f3dbca1fa3430e444f63d9060a00160405180910390a1505050505050611e1360018055565b505050565b611e20612a41565b600c8054821515610100810261ff001986151590811661ffff1990941693909317179092556040805191825260208201929092527fe4e2759610fe740b4c8247147491ae3e248b92fb63181dc697aff6faf00f65d79101610bc9565b611e84612a41565b62061a80811115611efd5760405162461bcd60e51b815260206004820152603f60248201527f506f6f6c3a3a73657459546f6b656e536c6970706167653a2079546f6b656e5360448201527f6c6970706167652063616e6e6f74206265206d6f7265207468616e20343025006064820152608401610b28565b60168190556040518181527fd86c2dfaa734f6aef8a960c73c2d669e130018cc4f61aeb1f115c64844a96e0a90602001610d6e565b611f3a612a41565b60175460ff16151581151514611a12576017805460ff19168215159081179091556040519081527fe9b03f52b6ce464fd3d6eec943f0c67d7575005f3b0bbf2fad4ea38b4ed7208490602001610d6e565b611f93612b79565b336000818152600860205260409020600301544311611ff45760405162461bcd60e51b815260206004820152601d60248201527f506f6f6c3a3a636f6c6c6563743a203c6d696e696d756d5f64656c61790000006044820152606401610b28565b6001600160a01b0381166000908152600860205260408120548190819081908190819015612052576001600160a01b03871660009081526008602052604081208054919055600a5490935061204a908490613405565b600a55600195505b6001600160a01b038716600090815260086020526040902060010154156120ac576001600160a01b03871660009081526008602052604081206001018054919055600b549092506120a4908390613405565b600b55600194505b6001600160a01b0387166000908152600860205260409020600201541561210457506001600160a01b038616600090815260086020526040812060020180549190556009546120fc908290613405565b600955600193505b8515612171576003546040516340c10f1960e01b81526001600160a01b03898116600483015260248201869052909116906340c10f1990604401600060405180830381600087803b15801561215857600080fd5b505af115801561216c573d6000803e3d6000fd5b505050505b841561235857600480546005546040516370a0823160e01b81526001600160a01b039182169381019390935284929116906370a082319060240160206040518083038186803b1580156121c357600080fd5b505afa1580156121d7573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906121fb91906132ca565b10156122f157600554600480546040516370a0823160e01b81526001600160a01b03938416928101839052919263a9059cbb928b9291909116906370a082319060240160206040518083038186803b15801561225657600080fd5b505afa15801561226a573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061228e91906132ca565b6040516001600160e01b031960e085901b1681526001600160a01b0390921660048301526024820152604401600060405180830381600087803b1580156122d457600080fd5b505af11580156122e8573d6000803e3d6000fd5b50505050612358565b60055460405163a9059cbb60e01b81526001600160a01b038981166004830152602482018590529091169063a9059cbb90604401600060405180830381600087803b15801561233f57600080fd5b505af1158015612353573d6000803e3d6000fd5b505050505b83156123715761236781612e0c565b6123718782612e74565b505050505050506115d360018055565b612389612a41565b6000806123946113bd565b915091508080156123a55750600082115b15611e1357818311156124185760405162461bcd60e51b815260206004820152603560248201527f506f6f6c3a3a726564756365457863657373436f6c6c61746572616c3a2054686044820152746520616d6f756e7420697320746f6f206c6172676560581b6064820152608401610b28565b611e1383612cc8565b600080600080600080600260009054906101000a90046001600160a01b03166001600160a01b0316636e16399c6040518163ffffffff1660e01b815260040160206040518083038186803b15801561247857600080fd5b505afa15801561248c573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906124b091906132ca565b90506000600260009054906101000a90046001600160a01b03166001600160a01b0316635f4370a56040518163ffffffff1660e01b815260040160206040518083038186803b15801561250257600080fd5b505afa158015612516573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061253a91906132ca565b90506000821161259b5760405162461bcd60e51b815260206004820152602660248201527f506f6f6c3a3a63616c6352656465656d3a20496e76616c69642059546f6b656e60448201526520707269636560d01b6064820152608401610b28565b600081116125f75760405162461bcd60e51b8152602060048201526024808201527f506f6f6c3a3a63616c6352656465656d3a20496e76616c69642079546f6b656e6044820152630545741560e41b6064820152608401610b28565b620f4240600d548961260991906133e6565b61261391906133c6565b9250620f4240600d5410156126ff5781620f424080670de0b6b3a7640000601854620f42406126429190613405565b600d5461265290620f4240613405565b61265c908e6133e6565b61266691906133e6565b61267091906133e6565b61267a91906133c6565b61268491906133c6565b61268e91906133c6565b955080620f424080670de0b6b3a7640000601854620f42406126b09190613405565b600d546126c090620f4240613405565b6126ca908e6133e6565b6126d491906133e6565b6126de91906133e6565b6126e891906133c6565b6126f291906133c6565b6126fc91906133c6565b94505b600d541561278157620f424080601854620f424061271d9190613405565b600d5461272a908c6133e6565b61273491906133e6565b61273e91906133c6565b61274891906133c6565b9650620f424080601854600d548b61276091906133e6565b61276a91906133e6565b61277491906133c6565b61277e91906133c6565b93505b505091939590929450565b6007546001600160a01b0316156127e55760405162461bcd60e51b815260206004820152601e60248201527f506f6f6c3a3a73657454726561737572793a206e6f7420616c6c6f77656400006044820152606401610b28565b600780546001600160a01b0319166001600160a01b0383169081179091556040517f3c864541ef71378c6229510ed90f376565ee42d9c5e0904a984a9e863e6db44f90600090a250565b612837612a41565b6001600160a01b03811661289c5760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b6064820152608401610b28565b611a1281612b29565b6000806000806000600260009054906101000a90046001600160a01b03166001600160a01b0316635f4370a56040518163ffffffff1660e01b815260040160206040518083038186803b1580156128fb57600080fd5b505afa15801561290f573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061293391906132ca565b9050600081116129915760405162461bcd60e51b8152602060048201526024808201527f506f6f6c3a3a63616c634d696e743a20496e76616c69642059546f6b656e20706044820152637269636560e01b6064820152608401610b28565b620f4240600d54620f42406129a69190613405565b6129b090886133e6565b6129ba91906133c6565b9150806129cf670de0b6b3a7640000846133e6565b6129d991906133c6565b9350620f424080600d54601954896129f191906133e6565b6129fb91906133e6565b612a0591906133c6565b612a0f91906133c6565b9250620f424060195487612a2391906133e6565b612a2d91906133c6565b612a379087613405565b9450509193509193565b6000546001600160a01b031633146115d35760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610b28565b612aba73039e2fb66102314ce7b64ce5ce3e5183bc94ad388383612f8d565b5050565b73039e2fb66102314ce7b64ce5ce3e5183bc94ad386001600160a01b031663d0e30db0826040518263ffffffff1660e01b81526004016000604051808303818588803b158015612b0d57600080fd5b505af1158015612b21573d6000803e3d6000fd5b505050505050565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b60026001541415612bcc5760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c006044820152606401610b28565b6002600155565b604051636eb1769f60e11b81523060048201526001600160a01b0383811660248301526000919085169063dd62ed3e9060440160206040518083038186803b158015612c1e57600080fd5b505afa158015612c32573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612c5691906132ca565b9050612cc28463095ea7b360e01b85612c6f86866133ae565b6040516001600160a01b03909216602483015260448201526064015b60408051601f198184030181529190526020810180516001600160e01b03166001600160e01b031990931692909217909152612fbd565b50505050565b6007546001600160a01b0316612d315760405162461bcd60e51b815260206004820152602860248201527f506f6f6c3a3a7472616e73666572546f54726561737572793a496e76616c6964604482015267206164647265737360c01b6064820152608401610b28565b8015611a1257600754611a129073039e2fb66102314ce7b64ce5ce3e5183bc94ad38906001600160a01b031683612f8d565b600081831115612d7e57612d778284613405565b9050612d8b565b612d888383613405565b90505b620f424060165483612d9d91906133e6565b612da791906133c6565b811115611e135760405162461bcd60e51b815260206004820152602d60248201527f506f6f6c3a3a636865636b5072696365466c756374756174696f6e3a203e207960448201526c546f6b656e536c69707061676560981b6064820152608401610b28565b604051632e1a7d4d60e01b81526004810182905273039e2fb66102314ce7b64ce5ce3e5183bc94ad3890632e1a7d4d90602401600060405180830381600087803b158015612e5957600080fd5b505af1158015612e6d573d6000803e3d6000fd5b5050505050565b80471015612ec45760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a20696e73756666696369656e742062616c616e63650000006044820152606401610b28565b6000826001600160a01b03168260405160006040518083038185875af1925050503d8060008114612f11576040519150601f19603f3d011682016040523d82523d6000602084013e612f16565b606091505b5050905080611e135760405162461bcd60e51b815260206004820152603a60248201527f416464726573733a20756e61626c6520746f2073656e642076616c75652c207260448201527f6563697069656e74206d617920686176652072657665727465640000000000006064820152608401610b28565b6040516001600160a01b038316602482015260448101829052611e1390849063a9059cbb60e01b90606401612c8b565b6000613012826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b03166130929092919063ffffffff16565b9050805160001480613033575080806020019051810190613033919061325e565b611e135760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b6064820152608401610b28565b60606130a184846000856130a9565b949350505050565b60608247101561310a5760405162461bcd60e51b815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f6044820152651c8818d85b1b60d21b6064820152608401610b28565b600080866001600160a01b03168587604051613126919061335f565b60006040518083038185875af1925050503d8060008114613163576040519150601f19603f3d011682016040523d82523d6000602084013e613168565b606091505b509150915061317987838387613184565b979650505050505050565b606083156131f05782516131e9576001600160a01b0385163b6131e95760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e74726163740000006044820152606401610b28565b50816130a1565b6130a183838151156132055781518083602001fd5b8060405162461bcd60e51b8152600401610b28919061337b565b600060208284031215613230578081fd5b813561323b8161345e565b9392505050565b600060208284031215613253578081fd5b813561323b81613473565b60006020828403121561326f578081fd5b815161323b81613473565b6000806040838503121561328c578081fd5b823561329781613473565b915060208301356132a781613473565b809150509250929050565b6000602082840312156132c3578081fd5b5035919050565b6000602082840312156132db578081fd5b5051919050565b600080604083850312156132f4578182fd5b50508035926020909101359150565b600080600060608486031215613317578081fd5b505081359360208301359350604090920135919050565b60008060008060808587031215613343578081fd5b5050823594602084013594506040840135936060013592509050565b6000825161337181846020870161341c565b9190910192915050565b602081526000825180602084015261339a81604085016020870161341c565b601f01601f19169190910160400192915050565b600082198211156133c1576133c1613448565b500190565b6000826133e157634e487b7160e01b81526012600452602481fd5b500490565b600081600019048311821515161561340057613400613448565b500290565b60008282101561341757613417613448565b500390565b60005b8381101561343757818101518382015260200161341f565b83811115612cc25750506000910152565b634e487b7160e01b600052601160045260246000fd5b6001600160a01b0381168114611a1257600080fd5b8015158114611a1257600080fdfea26469706673582212205032586f9db44f9f1f20d9d3565cb83f0e1c2fddf09ded4aa05e2f483c5a84f564736f6c63430008040033
Constructor Arguments (ABI-Encoded and is the last bytes of the Contract Creation Code above)
000000000000000000000000b7e013d0552c82c3d4366e4c7c838017306369e00000000000000000000000003c678380405a6b2fc3bcb35e55e6ee3676dc89a40000000000000000000000001fbb1ba53ba4e4cac2759c2d5526ae73ec78bddf
-----Decoded View---------------
Arg [0] : _xToken (address): 0xb7E013d0552C82C3D4366E4c7c838017306369e0
Arg [1] : _yToken (address): 0x3c678380405A6b2FC3Bcb35E55E6eE3676dC89a4
Arg [2] : _yTokenReserve (address): 0x1FbB1BA53ba4E4CAc2759C2D5526ae73Ec78BdDf
-----Encoded View---------------
3 Constructor Arguments found :
Arg [0] : 000000000000000000000000b7e013d0552c82c3d4366e4c7c838017306369e0
Arg [1] : 0000000000000000000000003c678380405a6b2fc3bcb35e55e6ee3676dc89a4
Arg [2] : 0000000000000000000000001fbb1ba53ba4e4cac2759c2d5526ae73ec78bddf
Loading...
Loading
Loading...
Loading
Multichain Portfolio | 34 Chains
Chain | Token | Portfolio % | Price | Amount | Value |
---|
Loading...
Loading
Loading...
Loading
[ Download: CSV Export ]
A contract address hosts a smart contract, which is a set of code stored on the blockchain that runs when predetermined conditions are met. Learn more about addresses in our Knowledge Base.