Overview
S Balance
S Value
$0.00More Info
Private Name Tags
ContractCreator
Loading...
Loading
Contract Name:
Vault
Compiler Version
v0.8.9+commit.e5eed63a
Optimization Enabled:
Yes with 200 runs
Other Settings:
default evmVersion
Contract Source Code (Solidity Standard Json-Input format)
// SPDX-License-Identifier: MIT pragma solidity 0.8.9; import "@openzeppelin/contracts-upgradeable/utils/AddressUpgradeable.sol"; import "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol"; import "@openzeppelin/contracts-upgradeable/token/ERC20/IERC20Upgradeable.sol"; import "@openzeppelin/contracts-upgradeable/token/ERC20/utils/SafeERC20Upgradeable.sol"; import "@openzeppelin/contracts-upgradeable/security/ReentrancyGuardUpgradeable.sol"; import "../tokens/interfaces/IMintable.sol"; import "../tokens/interfaces/IMUSD.sol"; import "./interfaces/IPositionVault.sol"; import "./interfaces/ILiquidateVault.sol"; import "./interfaces/IOrderVault.sol"; import "./interfaces/IPriceManager.sol"; import "./interfaces/ISettingsManager.sol"; import "./interfaces/IVault.sol"; import "./interfaces/IOperators.sol"; import {Constants} from "../access/Constants.sol"; import {Position, OrderStatus, OrderType, WithdrawalRequest} from "./structs.sol"; contract Vault is Constants, Initializable, ReentrancyGuardUpgradeable, IVault { using SafeERC20Upgradeable for IERC20Upgradeable; // constants IPositionVault private positionVault; IOrderVault private orderVault; ILiquidateVault private liquidateVault; IOperators public operators; IPriceManager private priceManager; ISettingsManager private settingsManager; address private usdm; address private musd; bool private isInitialized; // variables uint256 public totalUSD; mapping(address => uint256) public override lastStakedAt; IERC20Upgradeable private USDC; mapping(address => uint256) public lastStakedBlockAt; mapping(address => address) public platformUsed; // trader address => address of platform used uint256 public nextWithdrawalRequestId; mapping(uint256 => WithdrawalRequest) public withdrawalRequests; // withdrawalRequestId => WithdrawalRequest event Deposit(address indexed account, address indexed token, uint256 amount); event Withdraw(uint256 withdrawalRequestId, address indexed account, address indexed token, uint256 amount); event Stake(address indexed account, address token, uint256 amount, uint256 mintAmount); event Unstake(address indexed account, address token, uint256 usdmAmount, uint256 amountOut); event ForceClose(uint256 indexed posId, address indexed account, uint256 exceededPnl); event SupplyMusdToVault(address indexed account, uint256 musdAmount); event Seize(address indexed account, uint256 musdAmount); event ReferFeeTransfer(address indexed account, uint256 amount); event ReferFeeTraderRebate(address indexed account, uint256 amount, address indexed trader, uint256 rebate); event PlatformFeeTransfer(address indexed account, uint256 amount, address indexed trader); modifier onlyVault() { _onlyVault(); _; } function _onlyVault() private view { require( msg.sender == address(positionVault) || msg.sender == address(liquidateVault) || msg.sender == address(orderVault), "Only vault" ); } modifier preventBanners() { _preventBanners(); _; } function _preventBanners() private view { require(!settingsManager.checkBanList(msg.sender), "Account banned"); } modifier onlyOperator(uint256 level) { _onlyOperator(level); _; } function _onlyOperator(uint256 level) private view { require(operators.getOperatorLevel(msg.sender) >= level, "invalid operator"); } /* ========== INITIALIZE FUNCTIONS ========== */ function initialize(address _operators, address _usdm, address _musd) public initializer { require(AddressUpgradeable.isContract(_operators), "operators invalid"); __ReentrancyGuard_init(); operators = IOperators(_operators); usdm = _usdm; musd = _musd; } function setVaultSettings( IPriceManager _priceManager, ISettingsManager _settingsManager, IPositionVault _positionVault, IOrderVault _orderVault, ILiquidateVault _liquidateVault ) external onlyOperator(4) { require(!isInitialized, "initialized"); require(AddressUpgradeable.isContract(address(_priceManager)), "priceManager invalid"); require(AddressUpgradeable.isContract(address(_settingsManager)), "settingsManager invalid"); require(AddressUpgradeable.isContract(address(_positionVault)), "positionVault invalid"); require(AddressUpgradeable.isContract(address(_orderVault)), "orderVault invalid"); require(AddressUpgradeable.isContract(address(_liquidateVault)), "liquidateVault invalid"); priceManager = _priceManager; settingsManager = _settingsManager; positionVault = _positionVault; orderVault = _orderVault; liquidateVault = _liquidateVault; isInitialized = true; } function setUSDC(IERC20Upgradeable _token) external onlyOperator(3) { USDC = _token; } /* ========== CORE FUNCTIONS ========== */ // deposit stablecoin to mint musd function deposit(address _account, address _token, uint256 _amount) public override nonReentrant preventBanners { require(settingsManager.isDeposit(_token), "deposit not allowed"); require(_amount > 0, "zero amount"); if (_account != msg.sender) { require(settingsManager.checkDelegation(_account, msg.sender), "Not allowed"); } IERC20Upgradeable(_token).safeTransferFrom(msg.sender, address(this), _amount); uint256 usdAmount = priceManager.tokenToUsd(_token, _amount); uint256 depositFee = (usdAmount * settingsManager.depositFee(_token)) / BASIS_POINTS_DIVISOR; _distributeFee(depositFee, address(0), address(0)); IMUSD(musd).mint(_account, usdAmount - depositFee); emit Deposit(_account, _token, _amount); } function depositSelf(address _token, uint256 _amount) external { deposit(msg.sender, _token, _amount); } function depositSelfUSDC(uint256 _amount) external { deposit(msg.sender, address(USDC), _amount); } function depositSelfAllUSDC() external { deposit(msg.sender, address(USDC), USDC.balanceOf(msg.sender)); } // withdraw musd immediately function withdraw(address _token, uint256 _amount) external nonReentrant preventBanners { require(settingsManager.isWithdraw(_token), "withdraw not allowed"); require(_amount > 0, "zero amount"); require(!settingsManager.checkBanList(msg.sender), "Account banned"); // Burn MUSD first IMUSD(musd).burn(msg.sender, _amount); // Calculate and distribute fee uint256 withdrawFee = (_amount * settingsManager.withdrawFee(_token)) / BASIS_POINTS_DIVISOR; _distributeFee(withdrawFee, address(0), address(0)); // Calculate final token amount and transfer uint256 tokenAmount = priceManager.usdToToken(_token, _amount - withdrawFee); IERC20Upgradeable(_token).safeTransfer(msg.sender, tokenAmount); emit Withdraw(0, msg.sender, _token, tokenAmount); } // stake stablecoin to mint usdm function stake(address _account, address _token, uint256 _amount) public override nonReentrant preventBanners { require(settingsManager.isStakingEnabled(_token), "staking disabled"); require(_amount > 0, "zero amount"); if (_account != msg.sender) require(settingsManager.checkDelegation(_account, msg.sender), "Not allowed"); IERC20Upgradeable(_token).safeTransferFrom(msg.sender, address(this), _amount); uint256 usdAmount = priceManager.tokenToUsd(_token, _amount); uint256 stakingFee = (usdAmount * settingsManager.stakingFee(_token)) / BASIS_POINTS_DIVISOR; uint256 usdAmountAfterFee = usdAmount - stakingFee; uint256 mintAmount; uint256 totalUSDM = IERC20Upgradeable(usdm).totalSupply(); if (totalUSDM == 0) { mintAmount = (usdAmountAfterFee * DEFAULT_USDM_PRICE * (10 ** USDM_DECIMALS)) / (PRICE_PRECISION * BASIS_POINTS_DIVISOR); } else { mintAmount = (usdAmountAfterFee * totalUSDM) / totalUSD; } require(totalUSDM + mintAmount <= settingsManager.maxTotalUSDm(), "max total usdm exceeded"); _distributeFee(stakingFee, address(0), address(0)); totalUSD += usdAmountAfterFee; lastStakedAt[_account] = block.timestamp; IMintable(usdm).mint(_account, mintAmount); emit Stake(_account, _token, _amount, mintAmount); } function stakeSelf(address _token, uint256 _amount) external { stake(msg.sender, _token, _amount); } function stakeSelfUSDC(uint256 _amount) external { stake(msg.sender, address(USDC), _amount); } function stakeSelfAllUSDC() external { stake(msg.sender, address(USDC), USDC.balanceOf(msg.sender)); } // burn usdm to unstake stablecoin // usdm cannot be unstaked or transferred within cooldown period, except whitelisted contracts function unstake(address _tokenOut, uint256 _usdmAmount) public nonReentrant preventBanners { require(settingsManager.isUnstakingEnabled(_tokenOut), "unstaking disabled"); uint256 totalUSDM = IERC20Upgradeable(usdm).totalSupply(); require(_usdmAmount > 0 && _usdmAmount <= totalUSDM, "usdmAmount error"); if (settingsManager.isWhitelistedFromCooldown(msg.sender) == false) { require( lastStakedAt[msg.sender] + settingsManager.cooldownDuration() <= block.timestamp, "cooldown duration not yet passed" ); } IMintable(usdm).burn(msg.sender, _usdmAmount); uint256 usdAmount = (_usdmAmount * totalUSD) / totalUSDM; uint256 unstakingFee = (usdAmount * settingsManager.unstakingFee(_tokenOut)) / BASIS_POINTS_DIVISOR; _distributeFee(unstakingFee, address(0), address(0)); totalUSD -= usdAmount; uint256 tokenAmountOut = priceManager.usdToToken(_tokenOut, usdAmount - unstakingFee); IERC20Upgradeable(_tokenOut).safeTransfer(msg.sender, tokenAmountOut); emit Unstake(msg.sender, _tokenOut, _usdmAmount, tokenAmountOut); } function unstakeUSDC(uint256 _usdmAmount) external { unstake(address(USDC), _usdmAmount); } function unstakeAllUSDC() external { unstake(address(USDC), IERC20Upgradeable(usdm).balanceOf(msg.sender)); } // submit order to create a new position function newPositionOrder( uint256 _tokenId, bool _isLong, OrderType _orderType, // 0 -> market order // 1 -> limit order // 2 -> stop-market order // 3 -> stop-limit order uint256[] memory _params, // for market order: _params[0] -> allowed price (revert if exceeded) // for limit order: _params[0] -> limit price // In stop-market order: _params[1] -> stop price, // In stop-limit order: _params[0] -> limit price, _params[1] -> stop price // for all orders: _params[2] -> collateral // for all orders: _params[3] -> size address _refer ) public payable nonReentrant preventBanners { if (_orderType == OrderType.MARKET) { require(msg.value == settingsManager.marketOrderGasFee(), "invalid marketOrderGasFee"); } else { require(msg.value == settingsManager.triggerGasFee(), "invalid triggerGasFee"); } _sendGasFee(); require(_refer != msg.sender, "Refer error"); positionVault.newPositionOrder(msg.sender, _tokenId, _isLong, _orderType, _params, _refer); } function newPositionOrderPacked(uint256 a, uint256 b, uint256 c) external payable { uint256 tokenId = a / 2 ** 240; //16 bits for tokenId uint256 tmp = (a % 2 ** 240) / 2 ** 232; bool isLong = tmp / 2 ** 7 == 1; // 1 bit for isLong OrderType orderType = OrderType(tmp % 2 ** 7); // 7 bits for orderType address refer = address(uint160(a)); //last 160 bit for refer uint256[] memory params = new uint256[](4); params[0] = b / 2 ** 128; //price params[1] = b % 2 ** 128; //price params[2] = c / 2 ** 128; //collateral params[3] = c % 2 ** 128; //size newPositionOrder(tokenId, isLong, orderType, params, refer); } // submit order to create a new position with take profit / stop loss orders function newPositionOrderWithTPSL( uint256 _tokenId, bool _isLong, OrderType _orderType, // 0 -> market order // 1 -> limit order // 2 -> stop-market order // 3 -> stop-limit order uint256[] memory _params, // for market order: _params[0] -> allowed price (revert if exceeded) // for limit order: _params[0] -> limit price // In stop-market order: _params[1] -> stop price, // In stop-limit order: _params[0] -> limit price, _params[1] -> stop price // for all orders: _params[2] -> collateral // for all orders: _params[3] -> size address _refer, bool[] memory _isTPs, uint256[] memory _prices, uint256[] memory _amountPercents ) external payable nonReentrant preventBanners { if (_orderType == OrderType.MARKET) { require( msg.value == settingsManager.marketOrderGasFee() + _prices.length * settingsManager.triggerGasFee(), "invalid marketOrderGasFee" ); } else { require(msg.value == (_prices.length + 1) * settingsManager.triggerGasFee(), "invalid triggerGasFee"); } _sendGasFee(); require(_refer != msg.sender, "Refer error"); positionVault.newPositionOrder(msg.sender, _tokenId, _isLong, _orderType, _params, _refer); orderVault.addTriggerOrders(positionVault.lastPosId() - 1, msg.sender, _isTPs, _prices, _amountPercents); } // submit market order to increase size of exisiting position function addPosition( uint256 _posId, uint256 _collateralDelta, uint256 _sizeDelta, uint256 _allowedPrice ) public payable nonReentrant preventBanners { require(msg.value == settingsManager.marketOrderGasFee(), "invalid triggerGasFee"); _sendGasFee(); positionVault.createAddPositionOrder(msg.sender, _posId, _collateralDelta, _sizeDelta, _allowedPrice); } function addPositionPacked(uint256 a, uint256 b) external payable { uint256 posId = a / 2 ** 128; uint256 collateralDelta = a % 2 ** 128; uint256 sizeDelta = b / 2 ** 128; uint256 allowedPrice = b % 2 ** 128; addPosition(posId, collateralDelta, sizeDelta, allowedPrice); } // submit trigger order to increase size of exisiting position function createAddPositionTriggerOrder( uint256 _posId, uint256 _collateralDelta, uint256 _sizeDelta, uint256 _triggerPrice, bool isTriggerAbove ) public payable nonReentrant preventBanners { require(msg.value == settingsManager.triggerGasFee(), "invalid triggerGasFee"); _sendGasFee(); positionVault.createAddPositionTrigger( msg.sender, isTriggerAbove, _posId, _triggerPrice, _collateralDelta, _sizeDelta ); } // add collateral to reduce leverage function addCollateral(uint256 _posId, uint256 _amount) public nonReentrant preventBanners { positionVault.addOrRemoveCollateral(msg.sender, _posId, true, _amount); } // remove collateral to increase leverage function removeCollateral(uint256 _posId, uint256 _amount) public payable nonReentrant preventBanners { require(msg.value == settingsManager.marketOrderGasFee(), "invalid triggerGasFee"); _sendGasFee(); positionVault.addOrRemoveCollateral(msg.sender, _posId, false, _amount); } function addOrRemoveCollateralPacked(uint256 a) external { uint256 posId = a >> 128; bool isPlus = (a >> 127) % 2 == 1; uint256 amount = a % 2 ** 127; if (isPlus) { return addCollateral(posId, amount); } else { return removeCollateral(posId, amount); } } // submit market order to decrease size of exisiting position function decreasePosition( uint256 _sizeDelta, uint256 _allowedPrice, uint256 _posId ) public payable nonReentrant preventBanners { require(msg.value == settingsManager.marketOrderGasFee(), "invalid marketOrderGasFee"); _sendGasFee(); positionVault.createDecreasePositionOrder(_posId, msg.sender, _sizeDelta, _allowedPrice); } function decreasePositionPacked(uint256 a, uint256 _posId) external payable { uint256 sizeDelta = a / 2 ** 128; uint256 allowedPrice = a % 2 ** 128; return decreasePosition(sizeDelta, allowedPrice, _posId); } function addTPSL( uint256 _posId, bool[] memory _isTPs, uint256[] memory _prices, uint256[] memory _amountPercents ) public payable nonReentrant preventBanners { require(msg.value == settingsManager.triggerGasFee() * _prices.length, "invalid triggerGasFee"); _sendGasFee(); orderVault.addTriggerOrders(_posId, msg.sender, _isTPs, _prices, _amountPercents); } function addTPSLPacked(uint256 a, uint256[] calldata _tps) external payable { uint256 posId = a / 2 ** 128; uint256 length = _tps.length; bool[] memory isTPs = new bool[](length); uint256[] memory prices = new uint256[](length); uint256[] memory amountPercents = new uint256[](length); for (uint i; i < length; ++i) { prices[i] = _tps[i] / 2 ** 128; isTPs[i] = (_tps[i] / 2 ** 127) % 2 == 1; amountPercents[i] = _tps[i] % 2 ** 127; } addTPSL(posId, isTPs, prices, amountPercents); } // submit trailing stop order to decrease size of exisiting position function addTrailingStop(uint256 _posId, uint256[] memory _params) external payable nonReentrant preventBanners { require(msg.value == settingsManager.triggerGasFee(), "invalid triggerGasFee"); _sendGasFee(); orderVault.addTrailingStop(msg.sender, _posId, _params); } // cancel pending newPositionOrder / trailingStopOrder function cancelPendingOrder(uint256 _posId) public nonReentrant preventBanners { orderVault.cancelPendingOrder(msg.sender, _posId); } // cancel multiple pending newPositionOrder / trailingStopOrder function cancelPendingOrders(uint256[] memory _posIds) external preventBanners { for (uint i = 0; i < _posIds.length; ++i) { orderVault.cancelPendingOrder(msg.sender, _posIds[i]); } } function setPlatformUsed(address _platform) external { platformUsed[msg.sender] = _platform; } /* ========== HELPER FUNCTIONS ========== */ // account trader's profit / loss into vault function accountDeltaIntoTotalUSD(bool _isIncrease, uint256 _delta) external override onlyVault { if (_delta > 0) { if (_isIncrease) { totalUSD += _delta; } else { require(totalUSD >= _delta, "exceeded USDM bottom"); totalUSD -= _delta; } } } function distributeFee(uint256 _fee, address _refer, address _trader) external override onlyVault { _distributeFee(_fee, _refer, _trader); } // to distribute fee among referrer, vault and feeManager function _distributeFee(uint256 _fee, address _refer, address _trader) internal { if (_fee > 0) { if (_refer != address(0)) { (uint256 referFee, uint256 traderRebate) = settingsManager.getReferFeeAndTraderRebate(_refer); referFee = (_fee * referFee) / BASIS_POINTS_DIVISOR; traderRebate = (_fee * traderRebate) / BASIS_POINTS_DIVISOR; IMUSD(musd).mint(_refer, referFee); if (traderRebate > 0) IMUSD(musd).mint(_trader, traderRebate); _fee -= referFee + traderRebate; emit ReferFeeTraderRebate(_refer, referFee, _trader, traderRebate); } if (_trader != address(0)) { address platform = platformUsed[_trader]; uint256 platformFee = settingsManager.platformFees(platform); if (platformFee > 0) { platformFee = (_fee * platformFee) / BASIS_POINTS_DIVISOR; IMUSD(musd).mint(platform, platformFee); _fee -= platformFee; emit PlatformFeeTransfer(platform, platformFee, _trader); } } uint256 feeForUSDM = (_fee * settingsManager.feeRewardBasisPoints()) / BASIS_POINTS_DIVISOR; totalUSD += feeForUSDM; IMUSD(musd).mint(settingsManager.feeManager(), _fee - feeForUSDM); } } function _sendGasFee() internal { (bool success, ) = payable(settingsManager.feeManager()).call{value: msg.value}(""); require(success, "failed to send"); } function takeMUSDIn(address _account, uint256 _amount) external override onlyVault { IMUSD(musd).burn(_account, _amount); } function takeMUSDOut(address _account, uint256 _amount) external override onlyVault { IMUSD(musd).mint(_account, _amount); } /* ========== OPERATOR FUNCTIONS ========== */ // allow admin to force close a user's position if the position profit > max profit % of totalUSD function forceClosePosition(uint256 _posId) external payable nonReentrant onlyOperator(1) { Position memory position = positionVault.getPosition(_posId); uint256 price = priceManager.getLastPrice(position.tokenId); (int256 pnl, , ) = settingsManager.getPnl( position.tokenId, position.isLong, position.size, position.averagePrice, price, position.lastIncreasedTime, position.accruedBorrowFee, position.fundingIndex ); uint256 _maxProfitPercent = settingsManager.maxProfitPercent(position.tokenId) == 0 ? settingsManager.defaultMaxProfitPercent() : settingsManager.maxProfitPercent(position.tokenId); uint256 maxPnl = (totalUSD * _maxProfitPercent) / BASIS_POINTS_DIVISOR; require(pnl > int256(maxPnl), "not allowed"); positionVault.decreasePosition(_posId, price, position.size); uint256 exceededPnl = uint256(pnl) - maxPnl; IMUSD(musd).burn(position.owner, exceededPnl); // cap user's pnl to maxPnl totalUSD += exceededPnl; // send pnl back to vault emit ForceClose(_posId, position.owner, exceededPnl); } function supplyMusdToVault(uint256 _musdAmount) external nonReentrant onlyOperator(3) { IMUSD(musd).burn(msg.sender, _musdAmount); totalUSD += _musdAmount; emit SupplyMusdToVault(msg.sender, _musdAmount); } function seize(address _exploiter) external nonReentrant onlyOperator(3) { require(settingsManager.checkBanList(_exploiter), "not exploiter"); uint256 musdBalance = IMUSD(musd).balanceOf(_exploiter); IMUSD(musd).burn(_exploiter, musdBalance); totalUSD += musdBalance; emit Seize(_exploiter, musdBalance); } /* ========== VIEW FUNCTIONS ========== */ function getUSDMPrice() external view returns (uint256) { uint256 totalUSDM = IERC20Upgradeable(usdm).totalSupply(); if (totalUSDM == 0) { return DEFAULT_USDM_PRICE; } else { return (BASIS_POINTS_DIVISOR * (10 ** USDM_DECIMALS) * totalUSD) / (totalUSDM * PRICE_PRECISION); } } function getVaultUSDBalance() external view override returns (uint256) { return totalUSD; } }
// 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 AddressUpgradeable { /** * @dev Returns true if `account` is a contract. * * [IMPORTANT] * ==== * It is unsafe to assume that an address for which this function returns * false is an externally-owned account (EOA) and not a contract. * * Among others, `isContract` will return false for the following * types of addresses: * * - an externally-owned account * - a contract in construction * - an address where a contract will be created * - an address where a contract lived, but was destroyed * * 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.0) (proxy/utils/Initializable.sol) pragma solidity ^0.8.2; import "../../utils/AddressUpgradeable.sol"; /** * @dev This is a base contract to aid in writing upgradeable contracts, or any kind of contract that will be deployed * behind a proxy. Since proxied contracts do not make use of a constructor, it's common to move constructor logic to an * external initializer function, usually called `initialize`. It then becomes necessary to protect this initializer * function so it can only be called once. The {initializer} modifier provided by this contract will have this effect. * * The initialization functions use a version number. Once a version number is used, it is consumed and cannot be * reused. This mechanism prevents re-execution of each "step" but allows the creation of new initialization steps in * case an upgrade adds a module that needs to be initialized. * * For example: * * [.hljs-theme-light.nopadding] * ```solidity * contract MyToken is ERC20Upgradeable { * function initialize() initializer public { * __ERC20_init("MyToken", "MTK"); * } * } * * contract MyTokenV2 is MyToken, ERC20PermitUpgradeable { * function initializeV2() reinitializer(2) public { * __ERC20Permit_init("MyToken"); * } * } * ``` * * TIP: To avoid leaving the proxy in an uninitialized state, the initializer function should be called as early as * possible by providing the encoded function call as the `_data` argument to {ERC1967Proxy-constructor}. * * CAUTION: When used with inheritance, manual care must be taken to not invoke a parent initializer twice, or to ensure * that all initializers are idempotent. This is not verified automatically as constructors are by Solidity. * * [CAUTION] * ==== * Avoid leaving a contract uninitialized. * * An uninitialized contract can be taken over by an attacker. This applies to both a proxy and its implementation * contract, which may impact the proxy. To prevent the implementation contract from being used, you should invoke * the {_disableInitializers} function in the constructor to automatically lock it when it is deployed: * * [.hljs-theme-light.nopadding] * ``` * /// @custom:oz-upgrades-unsafe-allow constructor * constructor() { * _disableInitializers(); * } * ``` * ==== */ abstract contract Initializable { /** * @dev Indicates that the contract has been initialized. * @custom:oz-retyped-from bool */ uint8 private _initialized; /** * @dev Indicates that the contract is in the process of being initialized. */ bool private _initializing; /** * @dev Triggered when the contract has been initialized or reinitialized. */ event Initialized(uint8 version); /** * @dev A modifier that defines a protected initializer function that can be invoked at most once. In its scope, * `onlyInitializing` functions can be used to initialize parent contracts. * * Similar to `reinitializer(1)`, except that functions marked with `initializer` can be nested in the context of a * constructor. * * Emits an {Initialized} event. */ modifier initializer() { bool isTopLevelCall = !_initializing; require( (isTopLevelCall && _initialized < 1) || (!AddressUpgradeable.isContract(address(this)) && _initialized == 1), "Initializable: contract is already initialized" ); _initialized = 1; if (isTopLevelCall) { _initializing = true; } _; if (isTopLevelCall) { _initializing = false; emit Initialized(1); } } /** * @dev A modifier that defines a protected reinitializer function that can be invoked at most once, and only if the * contract hasn't been initialized to a greater version before. In its scope, `onlyInitializing` functions can be * used to initialize parent contracts. * * A reinitializer may be used after the original initialization step. This is essential to configure modules that * are added through upgrades and that require initialization. * * When `version` is 1, this modifier is similar to `initializer`, except that functions marked with `reinitializer` * cannot be nested. If one is invoked in the context of another, execution will revert. * * Note that versions can jump in increments greater than 1; this implies that if multiple reinitializers coexist in * a contract, executing them in the right order is up to the developer or operator. * * WARNING: setting the version to 255 will prevent any future reinitialization. * * Emits an {Initialized} event. */ modifier reinitializer(uint8 version) { require(!_initializing && _initialized < version, "Initializable: contract is already initialized"); _initialized = version; _initializing = true; _; _initializing = false; emit Initialized(version); } /** * @dev Modifier to protect an initialization function so that it can only be invoked by functions with the * {initializer} and {reinitializer} modifiers, directly or indirectly. */ modifier onlyInitializing() { require(_initializing, "Initializable: contract is not initializing"); _; } /** * @dev Locks the contract, preventing any future reinitialization. This cannot be part of an initializer call. * Calling this in the constructor of a contract will prevent that contract from being initialized or reinitialized * to any version. It is recommended to use this to lock implementation contracts that are designed to be called * through proxies. * * Emits an {Initialized} event the first time it is successfully executed. */ function _disableInitializers() internal virtual { require(!_initializing, "Initializable: contract is initializing"); if (_initialized != type(uint8).max) { _initialized = type(uint8).max; emit Initialized(type(uint8).max); } } /** * @dev Returns the highest version that has been initialized. See {reinitializer}. */ function _getInitializedVersion() internal view returns (uint8) { return _initialized; } /** * @dev Returns `true` if the contract is currently initializing. See {onlyInitializing}. */ function _isInitializing() internal view returns (bool) { return _initializing; } }
// 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 IERC20Upgradeable { /** * @dev Emitted when `value` tokens are moved from one account (`from`) to * another (`to`). * * Note that `value` may be zero. */ event Transfer(address indexed from, address indexed to, uint256 value); /** * @dev Emitted when the allowance of a `spender` for an `owner` is set by * a call to {approve}. `value` is the new allowance. */ event Approval(address indexed owner, address indexed spender, uint256 value); /** * @dev Returns the amount of tokens in existence. */ function totalSupply() external view returns (uint256); /** * @dev Returns the amount of tokens owned by `account`. */ function balanceOf(address account) external view returns (uint256); /** * @dev Moves `amount` tokens from the caller's account to `to`. * * Returns a boolean value indicating whether the operation succeeded. * * Emits a {Transfer} event. */ function transfer(address to, uint256 amount) external returns (bool); /** * @dev Returns the remaining number of tokens that `spender` will be * allowed to spend on behalf of `owner` through {transferFrom}. This is * zero by default. * * This value changes when {approve} or {transferFrom} are called. */ function allowance(address owner, address spender) external view returns (uint256); /** * @dev Sets `amount` as the allowance of `spender` over the caller's tokens. * * Returns a boolean value indicating whether the operation succeeded. * * IMPORTANT: Beware that changing an allowance with this method brings the risk * that someone may use both the old and the new allowance by unfortunate * transaction ordering. One possible solution to mitigate this race * condition is to first reduce the spender's allowance to 0 and set the * desired value afterwards: * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729 * * Emits an {Approval} event. */ function approve(address spender, uint256 amount) external returns (bool); /** * @dev Moves `amount` tokens from `from` to `to` using the * allowance mechanism. `amount` is then deducted from the caller's * allowance. * * Returns a boolean value indicating whether the operation succeeded. * * Emits a {Transfer} event. */ function transferFrom(address from, address to, uint256 amount) external returns (bool); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.9.0) (token/ERC20/utils/SafeERC20.sol) pragma solidity ^0.8.0; import "../IERC20Upgradeable.sol"; import "../extensions/IERC20PermitUpgradeable.sol"; import "../../../utils/AddressUpgradeable.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 SafeERC20Upgradeable { using AddressUpgradeable 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(IERC20Upgradeable 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(IERC20Upgradeable 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(IERC20Upgradeable 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(IERC20Upgradeable 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(IERC20Upgradeable 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. Compatible with tokens that require the approval to be set to * 0 before setting it to a non-zero value. */ function forceApprove(IERC20Upgradeable 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( IERC20PermitUpgradeable 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(IERC20Upgradeable 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(IERC20Upgradeable 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))) && AddressUpgradeable.isContract(address(token)); } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.9.0) (security/ReentrancyGuard.sol) pragma solidity ^0.8.0; import "../proxy/utils/Initializable.sol"; /** * @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 ReentrancyGuardUpgradeable is Initializable { // 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; function __ReentrancyGuard_init() internal onlyInitializing { __ReentrancyGuard_init_unchained(); } function __ReentrancyGuard_init_unchained() internal onlyInitializing { _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; } /** * @dev This empty reserved space is put in place to allow future versions to add new * variables without shifting down storage in the inheritance chain. * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps */ uint256[49] private __gap; }
// SPDX-License-Identifier: MIT pragma solidity 0.8.9; interface IMintable { function burn(address _account, uint256 _amount) external; function mint(address _account, uint256 _amount) external; }
// SPDX-License-Identifier: MIT pragma solidity 0.8.9; interface IMUSD { function burn(address _account, uint256 _amount) external; function mint(address _account, uint256 _amount) external; function balanceOf(address _account) external view returns (uint256); }
// SPDX-License-Identifier: MIT pragma solidity 0.8.9; import {Position, Order, OrderType, PaidFees} from "../structs.sol"; interface IPositionVault { function newPositionOrder( address _account, uint256 _tokenId, bool _isLong, OrderType _orderType, uint256[] memory _params, address _refer ) external; function addOrRemoveCollateral(address _account, uint256 _posId, bool isPlus, uint256 _amount) external; function createAddPositionOrder( address _account, uint256 _posId, uint256 _collateralDelta, uint256 _sizeDelta, uint256 _allowedPrice ) external; function createAddPositionTrigger( address _account, bool _isTriggerAbove, uint256 _posId, uint256 _triggerPrice, uint256 _collateral, uint256 _size ) external; function createDecreasePositionOrder( uint256 _posId, address _account, uint256 _sizeDelta, uint256 _allowedPrice ) external; function increasePosition( uint256 _posId, address _account, uint256 _tokenId, bool _isLong, uint256 _price, uint256 _collateralDelta, uint256 _sizeDelta, uint256 _fee ) external; function decreasePosition(uint256 _posId, uint256 _price, uint256 _sizeDelta) external; function decreasePositionByOrderVault(uint256 _posId, uint256 _price, uint256 _sizeDelta) external; function removeUserAlivePosition(address _user, uint256 _posId) external; function removeUserOpenOrder(address _user, uint256 _posId) external; function lastPosId() external view returns (uint256); function queueIndex() external view returns (uint256); function getNumOfUnexecuted() external view returns (uint256); function queuePosIds(uint256 _id) external view returns (uint256); function getPosition(uint256 _posId) external view returns (Position memory); function getUserPositionIds(address _account) external view returns (uint256[] memory); function getUserOpenOrderIds(address _account) external view returns (uint256[] memory); function getPaidFees(uint256 _posId) external view returns (PaidFees memory); function getVaultUSDBalance() external view returns (uint256); function executeOrders(uint256 numOfOrders) external; }
// SPDX-License-Identifier: MIT pragma solidity 0.8.9; import {Position, Order, OrderType} from "../structs.sol"; interface ILiquidateVault { function validateLiquidationWithPosid(uint256 _posId) external view returns (bool, int256, int256, int256); function liquidatePosition(uint256 _posId) external; }
// SPDX-License-Identifier: MIT pragma solidity 0.8.9; import {Order, OrderType, OrderStatus, AddPositionOrder, DecreasePositionOrder, PositionTrigger} from "../structs.sol"; interface IOrderVault { function addTrailingStop(address _account, uint256 _posId, uint256[] memory _params) external; function addTriggerOrders( uint256 _posId, address _account, bool[] memory _isTPs, uint256[] memory _prices, uint256[] memory _amountPercents ) external; function cancelPendingOrder(address _account, uint256 _posId) external; function updateOrder( uint256 _posId, uint256 _positionType, uint256 _collateral, uint256 _size, OrderStatus _status ) external; function cancelMarketOrder(uint256 _posId) external; function createNewOrder( uint256 _posId, address _accout, bool _isLong, uint256 _tokenId, uint256 _positionType, uint256[] memory _params, address _refer ) external; function createAddPositionOrder( address _owner, uint256 _posId, uint256 _collateralDelta, uint256 _sizeDelta, uint256 _allowedPrice, uint256 _fee ) external; function createAddPositionTrigger( bool _isTriggerAbove, uint256 _posId, uint256 _tokenId, uint256 _triggerPrice, uint256 _collateral, uint256 _size, uint256 _fee ) external; function createDecreasePositionOrder(uint256 _posId, uint256 _sizeDelta, uint256 _allowedPrice) external; function cancelAddPositionOrder(uint256 _posId) external; function deleteAddPositionOrder(uint256 _posId) external; function cancelPosAddPositionTriggers(uint256 _posId, address _positionOwner) external; function deleteDecreasePositionOrder(uint256 _posId) external; function getOrder(uint256 _posId) external view returns (Order memory); function getAddPositionOrder(uint256 _posId) external view returns (AddPositionOrder memory); function getDecreasePositionOrder(uint256 _posId) external view returns (DecreasePositionOrder memory); function getTriggerOrderInfo(uint256 _posId) external view returns (PositionTrigger memory); function triggerForOpenOrders(uint256 _posId) external; function triggerForTPSL(uint256 _posId) external; function updateTrailingStop(uint256 _posId) external; }
// SPDX-License-Identifier: MIT pragma solidity 0.8.9; import "@pythnetwork/pyth-sdk-solidity/IPyth.sol"; interface IPriceManager { function assets(uint256 _assetId) external view returns ( string memory symbol, bytes32 pythId, uint256 price, uint256 timestamp, uint256 allowedStaleness, uint256 allowedDeviation, uint256 maxLeverage, uint256 tokenDecimals ); function getLastPrice(uint256 _tokenId) external view returns (uint256); function getPythLastPrice(uint256 _assetId, bool _requireFreshness) external view returns (uint256); function pyth() external view returns (IPyth); function maxLeverage(uint256 _tokenId) external view returns (uint256); function tokenToUsd(address _token, uint256 _tokenAmount) external view returns (uint256); function usdToToken(address _token, uint256 _usdAmount) external view returns (uint256); function setPrice(uint256 _assetId, uint256 _price, uint256 _ts) external; }
// SPDX-License-Identifier: MIT pragma solidity 0.8.9; interface ISettingsManager { function decreaseOpenInterest(uint256 _tokenId, address _sender, bool _isLong, uint256 _amount) external; function increaseOpenInterest(uint256 _tokenId, address _sender, bool _isLong, uint256 _amount) external; function openInterestPerAssetPerSide(uint256 _tokenId, bool _isLong) external view returns (uint256); function openInterestPerUser(address _sender) external view returns (uint256); function bountyPercent() external view returns (uint32, uint32); function checkBanList(address _delegate) external view returns (bool); function checkDelegation(address _master, address _delegate) external view returns (bool); function minCollateral() external view returns (uint256); function closeDeltaTime() external view returns (uint256); function expiryDuration() external view returns (uint256); function selfExecuteCooldown() external view returns (uint256); function cooldownDuration() external view returns (uint256); function liquidationPendingTime() external view returns (uint256); function depositFee(address token) external view returns (uint256); function withdrawFee(address token) external view returns (uint256); function feeManager() external view returns (address); function feeRewardBasisPoints() external view returns (uint256); function defaultBorrowFeeFactor() external view returns (uint256); function borrowFeeFactor(uint256 tokenId) external view returns (uint256); function totalOpenInterest() external view returns (uint256); function basisFundingRateFactor() external view returns (uint256); function deductFeePercent(address _account) external view returns (uint256); function referrerTiers(address _referrer) external view returns (uint256); function tierFees(uint256 _tier) external view returns (uint256); function fundingIndex(uint256 _tokenId) external view returns (int256); function fundingRateFactor(uint256 _tokenId) external view returns (uint256); function slippageFactor(uint256 _tokenId) external view returns (uint256); function getFundingFee( uint256 _tokenId, bool _isLong, uint256 _size, int256 _fundingIndex ) external view returns (int256); function getBorrowRate(uint256 _tokenId, bool _isLong) external view returns (uint256); function getFundingRate(uint256 _tokenId) external view returns (int256); function getTradingFee( address _account, uint256 _tokenId, bool _isLong, uint256 _sizeDelta ) external view returns (uint256); function getPnl( uint256 _tokenId, bool _isLong, uint256 _size, uint256 _averagePrice, uint256 _lastPrice, uint256 _lastIncreasedTime, uint256 _accruedBorrowFee, int256 _fundingIndex ) external view returns (int256, int256, int256); function updateFunding(uint256 _tokenId) external; function getBorrowFee( uint256 _borrowedSize, uint256 _lastIncreasedTime, uint256 _tokenId, bool _isLong ) external view returns (uint256); function getUndiscountedTradingFee( uint256 _tokenId, bool _isLong, uint256 _sizeDelta ) external view returns (uint256); function getReferFee(address _refer) external view returns (uint256); function getReferFeeAndTraderRebate(address _refer) external view returns (uint256 referFee, uint256 traderRebate); function platformFees(address _platform) external view returns (uint256); function getPriceWithSlippage( uint256 _tokenId, bool _isLong, uint256 _size, uint256 _price ) external view returns (uint256); function getDelegates(address _master) external view returns (address[] memory); function getSlippage(uint256 _slippageFactor, uint256 _size) external view returns (uint256); function isDeposit(address _token) external view returns (bool); function isStakingEnabled(address _token) external view returns (bool); function isUnstakingEnabled(address _token) external view returns (bool); function isIncreasingPositionDisabled(uint256 _tokenId) external view returns (bool); function isDecreasingPositionDisabled(uint256 _tokenId) external view returns (bool); function isWhitelistedFromCooldown(address _addr) external view returns (bool); function isWhitelistedFromTransferCooldown(address _addr) external view returns (bool); function isWhitelistedFromWithdrawCooldown(address _addr) external view returns (bool); function isWithdraw(address _token) external view returns (bool); function lastFundingTimes(uint256 _tokenId) external view returns (uint256); function liquidateThreshold(uint256) external view returns (uint256); function tradingFee(uint256 _tokenId, bool _isLong) external view returns (uint256); function defaultMaxOpenInterestPerUser() external view returns (uint256); function maxProfitPercent(uint256 _tokenId) external view returns (uint256); function defaultMaxProfitPercent() external view returns (uint256); function maxOpenInterestPerAssetPerSide(uint256 _tokenId, bool _isLong) external view returns (uint256); function priceMovementPercent() external view returns (uint256); function maxOpenInterestPerUser(address _account) external view returns (uint256); function stakingFee(address token) external view returns (uint256); function unstakingFee(address token) external view returns (uint256); function triggerGasFee() external view returns (uint256); function marketOrderGasFee() external view returns (uint256); function maxTriggerPerPosition() external view returns (uint256); function maxFundingRate() external view returns (uint256); function maxTotalUSDm() external view returns (uint256); function minProfitDurations(uint256 tokenId) external view returns (uint256); function maxCloseProfits(uint256 tokenId) external view returns (uint256); function maxCloseProfitPercents(uint256 tokenId) external view returns (uint256); function setMaxOpenInterestPerAsset(uint256 _tokenId, uint256 _maxAmount) external; function withdrawalExecutionDelay() external view returns (uint256); function lastFundingRates(uint256 tokenId) external view returns (int256); function tempMaxFundingRateFactors(uint256 tokenId) external view returns (uint256); function volatilityFactors(uint256 tokenId) external view returns (uint256); function longBiasFactors(uint256 tokenId) external view returns (uint256); function fundingRateVelocityFactors(uint256 tokenId) external view returns (uint256); }
// SPDX-License-Identifier: MIT pragma solidity 0.8.9; interface IVault { function deposit(address _account, address _token, uint256 _amount) external; function stake(address _account, address _token, uint256 _amount) external; function accountDeltaIntoTotalUSD(bool _isIncrease, uint256 _delta) external; function distributeFee(uint256 _fee, address _refer, address _trader) external; function takeMUSDIn(address _account, uint256 _amount) external; function takeMUSDOut(address _account, uint256 _amount) external; function lastStakedAt(address _account) external view returns (uint256); function getVaultUSDBalance() external view returns (uint256); function getUSDMPrice() external view returns (uint256); }
// SPDX-License-Identifier: MIT pragma solidity 0.8.9; interface IOperators { function getOperatorLevel(address op) external view returns (uint256); }
// SPDX-License-Identifier: MIT pragma solidity 0.8.9; contract Constants { uint8 internal constant STAKING_PID_FOR_CHARGE_FEE = 1; uint256 internal constant BASIS_POINTS_DIVISOR = 100000; uint256 internal constant LIQUIDATE_THRESHOLD_DIVISOR = 10 * BASIS_POINTS_DIVISOR; uint256 internal constant DEFAULT_USDM_PRICE = 100000; uint256 internal constant FUNDING_RATE_PRECISION = BASIS_POINTS_DIVISOR ** 3; // 1e15 uint256 internal constant MAX_DEPOSIT_WITHDRAW_FEE = 10000; // 10% uint256 internal constant MAX_DELTA_TIME = 24 hours; uint256 internal constant MAX_COOLDOWN_DURATION = 30 days; uint256 internal constant MAX_FEE_BASIS_POINTS = 5000; // 5% uint256 internal constant MAX_PRICE_MOVEMENT_PERCENT = 10000; // 10% uint256 internal constant MAX_BORROW_FEE_FACTOR = 500; // 0.5% per hour uint256 internal constant MAX_FUNDING_RATE = FUNDING_RATE_PRECISION / 10; // 10% per hour uint256 internal constant MAX_STAKING_UNSTAKING_FEE = 10000; // 10% uint256 internal constant MAX_EXPIRY_DURATION = 60; // 60 seconds uint256 internal constant MAX_SELF_EXECUTE_COOLDOWN = 300; // 5 minutes uint256 internal constant MAX_TOKENFARM_COOLDOWN_DURATION = 4 weeks; uint256 internal constant MAX_TRIGGER_GAS_FEE = 1e8 gwei; uint256 internal constant MAX_MARKET_ORDER_GAS_FEE = 1e8 gwei; uint256 internal constant MAX_VESTING_DURATION = 700 days; uint256 internal constant MIN_LEVERAGE = 10000; // 1x uint256 internal constant POSITION_MARKET = 0; uint256 internal constant POSITION_LIMIT = 1; uint256 internal constant POSITION_STOP_MARKET = 2; uint256 internal constant POSITION_STOP_LIMIT = 3; uint256 internal constant POSITION_TRAILING_STOP = 4; uint256 internal constant PRICE_PRECISION = 10 ** 30; uint256 internal constant TRAILING_STOP_TYPE_AMOUNT = 0; uint256 internal constant TRAILING_STOP_TYPE_PERCENT = 1; uint256 internal constant USDM_DECIMALS = 18; function uintToBytes(uint v) internal pure returns (bytes32 ret) { if (v == 0) { ret = "0"; } else { while (v > 0) { ret = bytes32(uint(ret) / (2 ** 8)); ret |= bytes32(((v % 10) + 48) * 2 ** (8 * 31)); v /= 10; } } return ret; } function checkSlippage(bool isLong, uint256 allowedPrice, uint256 actualMarketPrice) internal pure { if (isLong) { require( actualMarketPrice <= allowedPrice, string( abi.encodePacked( "long: slippage exceeded ", uintToBytes(actualMarketPrice), " ", uintToBytes(allowedPrice) ) ) ); } else { require( actualMarketPrice >= allowedPrice, string( abi.encodePacked( "short: slippage exceeded ", uintToBytes(actualMarketPrice), " ", uintToBytes(allowedPrice) ) ) ); } } }
// SPDX-License-Identifier: MIT pragma solidity 0.8.9; enum OrderType { MARKET, LIMIT, STOP, STOP_LIMIT } enum OrderStatus { NONE, PENDING, FILLED, CANCELED } enum TriggerStatus { NONE, PENDING, OPEN, TRIGGERED, CANCELLED } struct Order { OrderStatus status; uint256 lmtPrice; uint256 size; uint256 collateral; uint256 positionType; uint256 stepAmount; uint256 stepType; uint256 stpPrice; uint256 timestamp; } struct AddPositionOrder { address owner; uint256 collateral; uint256 size; uint256 allowedPrice; uint256 timestamp; uint256 fee; } struct AddPositionTrigger { bool isTriggerAbove; uint256 posId; uint256 triggerPrice; uint256 collateral; uint256 size; uint256 fee; } struct DecreasePositionOrder { uint256 size; uint256 allowedPrice; uint256 timestamp; } struct Position { address owner; address refer; bool isLong; uint256 tokenId; uint256 averagePrice; uint256 collateral; int256 fundingIndex; uint256 lastIncreasedTime; uint256 size; uint256 accruedBorrowFee; } struct PaidFees { uint256 paidPositionFee; uint256 paidBorrowFee; int256 paidFundingFee; } struct Temp { uint256 a; uint256 b; uint256 c; uint256 d; uint256 e; } struct TriggerInfo { bool isTP; uint256 amountPercent; uint256 createdAt; uint256 price; uint256 triggeredAmount; uint256 triggeredAt; TriggerStatus status; } struct PositionTrigger { TriggerInfo[] triggers; } struct WithdrawalRequest { bool isOpen; address account; address token; uint256 musdAmount; uint256 timestamp; }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.9.0) (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. */ interface IERC20PermitUpgradeable { /** * @dev Sets `value` as the allowance of `spender` over ``owner``'s tokens, * given ``owner``'s signed approval. * * IMPORTANT: The same issues {IERC20-approve} has related to transaction * ordering also apply here. * * Emits an {Approval} event. * * Requirements: * * - `spender` cannot be the zero address. * - `deadline` must be a timestamp in the future. * - `v`, `r` and `s` must be a valid `secp256k1` signature from `owner` * over the EIP712-formatted function arguments. * - the signature must use ``owner``'s current nonce (see {nonces}). * * For more information on the signature format, see the * https://eips.ethereum.org/EIPS/eip-2612#specification[relevant EIP * section]. */ function permit( address owner, address spender, uint256 value, uint256 deadline, uint8 v, bytes32 r, bytes32 s ) external; /** * @dev Returns the current nonce for `owner`. This value must be * included whenever a signature is generated for {permit}. * * Every successful call to {permit} increases ``owner``'s nonce by one. This * prevents a signature from being used multiple times. */ function nonces(address owner) external view returns (uint256); /** * @dev Returns the domain separator used in the encoding of the signature for {permit}, as defined by {EIP712}. */ // solhint-disable-next-line func-name-mixedcase function DOMAIN_SEPARATOR() external view returns (bytes32); }
// SPDX-License-Identifier: Apache-2.0 pragma solidity ^0.8.0; import "./PythStructs.sol"; import "./IPythEvents.sol"; /// @title Consume prices from the Pyth Network (https://pyth.network/). /// @dev Please refer to the guidance at https://docs.pyth.network/documentation/pythnet-price-feeds/best-practices for how to consume prices safely. /// @author Pyth Data Association interface IPyth is IPythEvents { /// @notice Returns the period (in seconds) that a price feed is considered valid since its publish time function getValidTimePeriod() external view returns (uint validTimePeriod); /// @notice Returns the price and confidence interval. /// @dev Reverts if the price has not been updated within the last `getValidTimePeriod()` seconds. /// @param id The Pyth Price Feed ID of which to fetch the price and confidence interval. /// @return price - please read the documentation of PythStructs.Price to understand how to use this safely. function getPrice( bytes32 id ) external view returns (PythStructs.Price memory price); /// @notice Returns the exponentially-weighted moving average price and confidence interval. /// @dev Reverts if the EMA price is not available. /// @param id The Pyth Price Feed ID of which to fetch the EMA price and confidence interval. /// @return price - please read the documentation of PythStructs.Price to understand how to use this safely. function getEmaPrice( bytes32 id ) external view returns (PythStructs.Price memory price); /// @notice Returns the price of a price feed without any sanity checks. /// @dev This function returns the most recent price update in this contract without any recency checks. /// This function is unsafe as the returned price update may be arbitrarily far in the past. /// /// Users of this function should check the `publishTime` in the price to ensure that the returned price is /// sufficiently recent for their application. If you are considering using this function, it may be /// safer / easier to use either `getPrice` or `getPriceNoOlderThan`. /// @return price - please read the documentation of PythStructs.Price to understand how to use this safely. function getPriceUnsafe( bytes32 id ) external view returns (PythStructs.Price memory price); /// @notice Returns the price that is no older than `age` seconds of the current time. /// @dev This function is a sanity-checked version of `getPriceUnsafe` which is useful in /// applications that require a sufficiently-recent price. Reverts if the price wasn't updated sufficiently /// recently. /// @return price - please read the documentation of PythStructs.Price to understand how to use this safely. function getPriceNoOlderThan( bytes32 id, uint age ) external view returns (PythStructs.Price memory price); /// @notice Returns the exponentially-weighted moving average price of a price feed without any sanity checks. /// @dev This function returns the same price as `getEmaPrice` in the case where the price is available. /// However, if the price is not recent this function returns the latest available price. /// /// The returned price can be from arbitrarily far in the past; this function makes no guarantees that /// the returned price is recent or useful for any particular application. /// /// Users of this function should check the `publishTime` in the price to ensure that the returned price is /// sufficiently recent for their application. If you are considering using this function, it may be /// safer / easier to use either `getEmaPrice` or `getEmaPriceNoOlderThan`. /// @return price - please read the documentation of PythStructs.Price to understand how to use this safely. function getEmaPriceUnsafe( bytes32 id ) external view returns (PythStructs.Price memory price); /// @notice Returns the exponentially-weighted moving average price that is no older than `age` seconds /// of the current time. /// @dev This function is a sanity-checked version of `getEmaPriceUnsafe` which is useful in /// applications that require a sufficiently-recent price. Reverts if the price wasn't updated sufficiently /// recently. /// @return price - please read the documentation of PythStructs.Price to understand how to use this safely. function getEmaPriceNoOlderThan( bytes32 id, uint age ) external view returns (PythStructs.Price memory price); /// @notice Update price feeds with given update messages. /// This method requires the caller to pay a fee in wei; the required fee can be computed by calling /// `getUpdateFee` with the length of the `updateData` array. /// Prices will be updated if they are more recent than the current stored prices. /// The call will succeed even if the update is not the most recent. /// @dev Reverts if the transferred fee is not sufficient or the updateData is invalid. /// @param updateData Array of price update data. function updatePriceFeeds(bytes[] calldata updateData) external payable; /// @notice Wrapper around updatePriceFeeds that rejects fast if a price update is not necessary. A price update is /// necessary if the current on-chain publishTime is older than the given publishTime. It relies solely on the /// given `publishTimes` for the price feeds and does not read the actual price update publish time within `updateData`. /// /// This method requires the caller to pay a fee in wei; the required fee can be computed by calling /// `getUpdateFee` with the length of the `updateData` array. /// /// `priceIds` and `publishTimes` are two arrays with the same size that correspond to senders known publishTime /// of each priceId when calling this method. If all of price feeds within `priceIds` have updated and have /// a newer or equal publish time than the given publish time, it will reject the transaction to save gas. /// Otherwise, it calls updatePriceFeeds method to update the prices. /// /// @dev Reverts if update is not needed or the transferred fee is not sufficient or the updateData is invalid. /// @param updateData Array of price update data. /// @param priceIds Array of price ids. /// @param publishTimes Array of publishTimes. `publishTimes[i]` corresponds to known `publishTime` of `priceIds[i]` function updatePriceFeedsIfNecessary( bytes[] calldata updateData, bytes32[] calldata priceIds, uint64[] calldata publishTimes ) external payable; /// @notice Returns the required fee to update an array of price updates. /// @param updateData Array of price update data. /// @return feeAmount The required fee in Wei. function getUpdateFee( bytes[] calldata updateData ) external view returns (uint feeAmount); /// @notice Parse `updateData` and return price feeds of the given `priceIds` if they are all published /// within `minPublishTime` and `maxPublishTime`. /// /// You can use this method if you want to use a Pyth price at a fixed time and not the most recent price; /// otherwise, please consider using `updatePriceFeeds`. This method may store the price updates on-chain, if they /// are more recent than the current stored prices. /// /// This method requires the caller to pay a fee in wei; the required fee can be computed by calling /// `getUpdateFee` with the length of the `updateData` array. /// /// /// @dev Reverts if the transferred fee is not sufficient or the updateData is invalid or there is /// no update for any of the given `priceIds` within the given time range. /// @param updateData Array of price update data. /// @param priceIds Array of price ids. /// @param minPublishTime minimum acceptable publishTime for the given `priceIds`. /// @param maxPublishTime maximum acceptable publishTime for the given `priceIds`. /// @return priceFeeds Array of the price feeds corresponding to the given `priceIds` (with the same order). function parsePriceFeedUpdates( bytes[] calldata updateData, bytes32[] calldata priceIds, uint64 minPublishTime, uint64 maxPublishTime ) external payable returns (PythStructs.PriceFeed[] memory priceFeeds); /// @notice Similar to `parsePriceFeedUpdates` but ensures the updates returned are /// the first updates published in minPublishTime. That is, if there are multiple updates for a given timestamp, /// this method will return the first update. This method may store the price updates on-chain, if they /// are more recent than the current stored prices. /// /// /// @dev Reverts if the transferred fee is not sufficient or the updateData is invalid or there is /// no update for any of the given `priceIds` within the given time range and uniqueness condition. /// @param updateData Array of price update data. /// @param priceIds Array of price ids. /// @param minPublishTime minimum acceptable publishTime for the given `priceIds`. /// @param maxPublishTime maximum acceptable publishTime for the given `priceIds`. /// @return priceFeeds Array of the price feeds corresponding to the given `priceIds` (with the same order). function parsePriceFeedUpdatesUnique( bytes[] calldata updateData, bytes32[] calldata priceIds, uint64 minPublishTime, uint64 maxPublishTime ) external payable returns (PythStructs.PriceFeed[] memory priceFeeds); }
// SPDX-License-Identifier: Apache-2.0 pragma solidity ^0.8.0; contract PythStructs { // A price with a degree of uncertainty, represented as a price +- a confidence interval. // // The confidence interval roughly corresponds to the standard error of a normal distribution. // Both the price and confidence are stored in a fixed-point numeric representation, // `x * (10^expo)`, where `expo` is the exponent. // // Please refer to the documentation at https://docs.pyth.network/documentation/pythnet-price-feeds/best-practices for how // to how this price safely. struct Price { // Price int64 price; // Confidence interval around the price uint64 conf; // Price exponent int32 expo; // Unix timestamp describing when the price was published uint publishTime; } // PriceFeed represents a current aggregate price from pyth publisher feeds. struct PriceFeed { // The price ID. bytes32 id; // Latest available price Price price; // Latest available exponentially-weighted moving average price Price emaPrice; } }
// SPDX-License-Identifier: Apache-2.0 pragma solidity ^0.8.0; /// @title IPythEvents contains the events that Pyth contract emits. /// @dev This interface can be used for listening to the updates for off-chain and testing purposes. interface IPythEvents { /// @dev Emitted when the price feed with `id` has received a fresh update. /// @param id The Pyth Price Feed ID. /// @param publishTime Publish time of the given price update. /// @param price Price of the given price update. /// @param conf Confidence interval of the given price update. event PriceFeedUpdate( bytes32 indexed id, uint64 publishTime, int64 price, uint64 conf ); }
{ "optimizer": { "enabled": true, "runs": 200 }, "outputSelection": { "*": { "*": [ "evm.bytecode", "evm.deployedBytecode", "devdoc", "userdoc", "metadata", "abi" ] } }, "libraries": {} }
Contract Security Audit
- No Contract Security Audit Submitted- Submit Audit Here
Contract ABI
API[{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"account","type":"address"},{"indexed":true,"internalType":"address","name":"token","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"Deposit","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"posId","type":"uint256"},{"indexed":true,"internalType":"address","name":"account","type":"address"},{"indexed":false,"internalType":"uint256","name":"exceededPnl","type":"uint256"}],"name":"ForceClose","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint8","name":"version","type":"uint8"}],"name":"Initialized","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"account","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"},{"indexed":true,"internalType":"address","name":"trader","type":"address"}],"name":"PlatformFeeTransfer","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"account","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"},{"indexed":true,"internalType":"address","name":"trader","type":"address"},{"indexed":false,"internalType":"uint256","name":"rebate","type":"uint256"}],"name":"ReferFeeTraderRebate","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"account","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"ReferFeeTransfer","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"account","type":"address"},{"indexed":false,"internalType":"uint256","name":"musdAmount","type":"uint256"}],"name":"Seize","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"account","type":"address"},{"indexed":false,"internalType":"address","name":"token","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"mintAmount","type":"uint256"}],"name":"Stake","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"account","type":"address"},{"indexed":false,"internalType":"uint256","name":"musdAmount","type":"uint256"}],"name":"SupplyMusdToVault","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"account","type":"address"},{"indexed":false,"internalType":"address","name":"token","type":"address"},{"indexed":false,"internalType":"uint256","name":"usdmAmount","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"amountOut","type":"uint256"}],"name":"Unstake","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"withdrawalRequestId","type":"uint256"},{"indexed":true,"internalType":"address","name":"account","type":"address"},{"indexed":true,"internalType":"address","name":"token","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"Withdraw","type":"event"},{"inputs":[{"internalType":"bool","name":"_isIncrease","type":"bool"},{"internalType":"uint256","name":"_delta","type":"uint256"}],"name":"accountDeltaIntoTotalUSD","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_posId","type":"uint256"},{"internalType":"uint256","name":"_amount","type":"uint256"}],"name":"addCollateral","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"a","type":"uint256"}],"name":"addOrRemoveCollateralPacked","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_posId","type":"uint256"},{"internalType":"uint256","name":"_collateralDelta","type":"uint256"},{"internalType":"uint256","name":"_sizeDelta","type":"uint256"},{"internalType":"uint256","name":"_allowedPrice","type":"uint256"}],"name":"addPosition","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"uint256","name":"a","type":"uint256"},{"internalType":"uint256","name":"b","type":"uint256"}],"name":"addPositionPacked","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_posId","type":"uint256"},{"internalType":"bool[]","name":"_isTPs","type":"bool[]"},{"internalType":"uint256[]","name":"_prices","type":"uint256[]"},{"internalType":"uint256[]","name":"_amountPercents","type":"uint256[]"}],"name":"addTPSL","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"uint256","name":"a","type":"uint256"},{"internalType":"uint256[]","name":"_tps","type":"uint256[]"}],"name":"addTPSLPacked","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_posId","type":"uint256"},{"internalType":"uint256[]","name":"_params","type":"uint256[]"}],"name":"addTrailingStop","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_posId","type":"uint256"}],"name":"cancelPendingOrder","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256[]","name":"_posIds","type":"uint256[]"}],"name":"cancelPendingOrders","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_posId","type":"uint256"},{"internalType":"uint256","name":"_collateralDelta","type":"uint256"},{"internalType":"uint256","name":"_sizeDelta","type":"uint256"},{"internalType":"uint256","name":"_triggerPrice","type":"uint256"},{"internalType":"bool","name":"isTriggerAbove","type":"bool"}],"name":"createAddPositionTriggerOrder","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_sizeDelta","type":"uint256"},{"internalType":"uint256","name":"_allowedPrice","type":"uint256"},{"internalType":"uint256","name":"_posId","type":"uint256"}],"name":"decreasePosition","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"uint256","name":"a","type":"uint256"},{"internalType":"uint256","name":"_posId","type":"uint256"}],"name":"decreasePositionPacked","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"address","name":"_account","type":"address"},{"internalType":"address","name":"_token","type":"address"},{"internalType":"uint256","name":"_amount","type":"uint256"}],"name":"deposit","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_token","type":"address"},{"internalType":"uint256","name":"_amount","type":"uint256"}],"name":"depositSelf","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"depositSelfAllUSDC","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_amount","type":"uint256"}],"name":"depositSelfUSDC","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_fee","type":"uint256"},{"internalType":"address","name":"_refer","type":"address"},{"internalType":"address","name":"_trader","type":"address"}],"name":"distributeFee","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_posId","type":"uint256"}],"name":"forceClosePosition","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[],"name":"getUSDMPrice","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getVaultUSDBalance","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_operators","type":"address"},{"internalType":"address","name":"_usdm","type":"address"},{"internalType":"address","name":"_musd","type":"address"}],"name":"initialize","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"lastStakedAt","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"lastStakedBlockAt","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_tokenId","type":"uint256"},{"internalType":"bool","name":"_isLong","type":"bool"},{"internalType":"enum OrderType","name":"_orderType","type":"uint8"},{"internalType":"uint256[]","name":"_params","type":"uint256[]"},{"internalType":"address","name":"_refer","type":"address"}],"name":"newPositionOrder","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"uint256","name":"a","type":"uint256"},{"internalType":"uint256","name":"b","type":"uint256"},{"internalType":"uint256","name":"c","type":"uint256"}],"name":"newPositionOrderPacked","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_tokenId","type":"uint256"},{"internalType":"bool","name":"_isLong","type":"bool"},{"internalType":"enum OrderType","name":"_orderType","type":"uint8"},{"internalType":"uint256[]","name":"_params","type":"uint256[]"},{"internalType":"address","name":"_refer","type":"address"},{"internalType":"bool[]","name":"_isTPs","type":"bool[]"},{"internalType":"uint256[]","name":"_prices","type":"uint256[]"},{"internalType":"uint256[]","name":"_amountPercents","type":"uint256[]"}],"name":"newPositionOrderWithTPSL","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[],"name":"nextWithdrawalRequestId","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"operators","outputs":[{"internalType":"contract IOperators","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"platformUsed","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_posId","type":"uint256"},{"internalType":"uint256","name":"_amount","type":"uint256"}],"name":"removeCollateral","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"address","name":"_exploiter","type":"address"}],"name":"seize","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_platform","type":"address"}],"name":"setPlatformUsed","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"contract IERC20Upgradeable","name":"_token","type":"address"}],"name":"setUSDC","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"contract IPriceManager","name":"_priceManager","type":"address"},{"internalType":"contract ISettingsManager","name":"_settingsManager","type":"address"},{"internalType":"contract IPositionVault","name":"_positionVault","type":"address"},{"internalType":"contract IOrderVault","name":"_orderVault","type":"address"},{"internalType":"contract ILiquidateVault","name":"_liquidateVault","type":"address"}],"name":"setVaultSettings","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_account","type":"address"},{"internalType":"address","name":"_token","type":"address"},{"internalType":"uint256","name":"_amount","type":"uint256"}],"name":"stake","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_token","type":"address"},{"internalType":"uint256","name":"_amount","type":"uint256"}],"name":"stakeSelf","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"stakeSelfAllUSDC","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_amount","type":"uint256"}],"name":"stakeSelfUSDC","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_musdAmount","type":"uint256"}],"name":"supplyMusdToVault","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_account","type":"address"},{"internalType":"uint256","name":"_amount","type":"uint256"}],"name":"takeMUSDIn","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_account","type":"address"},{"internalType":"uint256","name":"_amount","type":"uint256"}],"name":"takeMUSDOut","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"totalUSD","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_tokenOut","type":"address"},{"internalType":"uint256","name":"_usdmAmount","type":"uint256"}],"name":"unstake","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"unstakeAllUSDC","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_usdmAmount","type":"uint256"}],"name":"unstakeUSDC","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_token","type":"address"},{"internalType":"uint256","name":"_amount","type":"uint256"}],"name":"withdraw","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"withdrawalRequests","outputs":[{"internalType":"bool","name":"isOpen","type":"bool"},{"internalType":"address","name":"account","type":"address"},{"internalType":"address","name":"token","type":"address"},{"internalType":"uint256","name":"musdAmount","type":"uint256"},{"internalType":"uint256","name":"timestamp","type":"uint256"}],"stateMutability":"view","type":"function"}]
Contract Creation Code
608060405234801561001057600080fd5b506156d280620000216000396000f3fe6080604052600436106102925760003560e01c8063937b25811161015a578063da36992a116100c1578063e673df8a1161007a578063e673df8a146107b5578063eb318887146107d5578063f3fef3a31461081f578063f55f45231461083f578063fb3ee57114610855578063fe9ffb041461087557600080fd5b8063da36992a1461071a578063da9da47a1461072d578063dc509f691461074d578063df33dc161461076d578063df83f61114610780578063e616847f146107a057600080fd5b8063c0c53b8b11610113578063c0c53b8b1461067f578063c2a672e01461069f578063cabf4709146106bf578063cfdcdfc9146106d2578063d66389b8146106e7578063d6dac8ad146106fa57600080fd5b8063937b25811461055a578063a3ae88a0146105e9578063a8f35adf146105ff578063b3e089a21461061f578063bdd056a61461063f578063bf6eac2f1461065f57600080fd5b80633ee7b5b3116101fe5780636a9b1891116101b75780636a9b1891146104a5578063703914dc146104b857806377a46edd146104cd5780637abadb59146104fa5780638340f5491461051a5780638b50fde71461053a57600080fd5b80633ee7b5b31461040c578063444a91e01461042c5780635543576a1461043f57806359dfabd41461045f5780635d54f798146104725780636a26c8861461048557600080fd5b806328da90af1161025057806328da90af146103735780632bc61ec4146103935780632eaff884146103a657806333adf724146103b957806333eba70c146103cc57806333f9c265146103df57600080fd5b80626c09e814610297578063061e56b5146102ac5780630b86d803146102d05780631cc75b88146102e557806321b9b44314610305578063234653e014610325575b600080fd5b6102aa6102a5366004614b4e565b610895565b005b3480156102b857600080fd5b50603b545b6040519081526020015b60405180910390f35b3480156102dc57600080fd5b506102bd610c83565b3480156102f157600080fd5b506102aa610300366004614c37565b610d6a565b34801561031157600080fd5b506102aa610320366004614c37565b610d79565b34801561033157600080fd5b5061035b610340366004614c63565b603f602052600090815260409020546001600160a01b031681565b6040516001600160a01b0390911681526020016102c7565b34801561037f57600080fd5b506102aa61038e366004614c37565b610de9565b6102aa6103a1366004614c87565b610e23565b6102aa6103b4366004614ca0565b61136f565b6102aa6103c7366004614cc2565b6113a4565b6102aa6103da366004614cf4565b6114e3565b3480156103eb57600080fd5b506102bd6103fa366004614c63565b603e6020526000908152604090205481565b34801561041857600080fd5b506102aa610427366004614c87565b6116d7565b6102aa61043a366004614ca0565b6116ef565b34801561044b57600080fd5b506102aa61045a366004614c87565b611743565b6102aa61046d366004614d73565b61175b565b6102aa610480366004614e05565b61185b565b34801561049157600080fd5b506102aa6104a0366004614c87565b6119a9565b6102aa6104b3366004614ca0565b6119bf565b3480156104c457600080fd5b506102aa611af7565b3480156104d957600080fd5b506102bd6104e8366004614c63565b603c6020526000908152604090205481565b34801561050657600080fd5b506102aa610515366004614e52565b611b7e565b34801561052657600080fd5b506102aa610535366004614e70565b611c13565b34801561054657600080fd5b506102aa610555366004614c87565b611fd7565b34801561056657600080fd5b506105b3610575366004614c87565b604160205260009081526040902080546001820154600283015460039093015460ff8316936101009093046001600160a01b03908116939216919085565b6040805195151586526001600160a01b03948516602087015292909316918401919091526060830152608082015260a0016102c7565b3480156105f557600080fd5b506102bd603b5481565b34801561060b57600080fd5b506102aa61061a366004614ca0565b612054565b34801561062b57600080fd5b506102aa61063a366004614c63565b6120a9565b34801561064b57600080fd5b506102aa61065a366004614c87565b6120d7565b34801561066b57600080fd5b506102aa61067a366004614e70565b61211e565b34801561068b57600080fd5b506102aa61069a366004614eb1565b6126e7565b3480156106ab57600080fd5b506102aa6106ba366004614c37565b612882565b6102aa6106cd366004614efc565b612dba565b3480156106de57600080fd5b506102aa612fba565b6102aa6106f5366004614f6d565b61303e565b34801561070657600080fd5b506102aa610715366004614fb4565b61312e565b6102aa610728366004614fe9565b6131d5565b34801561073957600080fd5b506102aa610748366004614c87565b61330c565b34801561075957600080fd5b506102aa610768366004615015565b6133d9565b6102aa61077b366004614fe9565b613630565b34801561078c57600080fd5b506102aa61079b366004615078565b613784565b3480156107ac57600080fd5b506102aa613797565b3480156107c157600080fd5b5060365461035b906001600160a01b031681565b3480156107e157600080fd5b506102aa6107f0366004614c63565b336000908152603f6020526040902080546001600160a01b0319166001600160a01b0392909216919091179055565b34801561082b57600080fd5b506102aa61083a366004614c37565b61381c565b34801561084b57600080fd5b506102bd60405481565b34801561086157600080fd5b506102aa610870366004614c63565b613bc4565b34801561088157600080fd5b506102aa610890366004614c37565b613dd3565b61089d613dde565b6108a5613e38565b60008660038111156108b9576108b961509f565b1415610a0d57603860009054906101000a90046001600160a01b03166001600160a01b03166364c8bb7e6040518163ffffffff1660e01b815260040160206040518083038186803b15801561090d57600080fd5b505afa158015610921573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061094591906150b5565b825161095191906150e4565b603860009054906101000a90046001600160a01b03166001600160a01b031663ce9e80096040518163ffffffff1660e01b815260040160206040518083038186803b15801561099f57600080fd5b505afa1580156109b3573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906109d791906150b5565b6109e19190615103565b3414610a085760405162461bcd60e51b81526004016109ff9061511b565b60405180910390fd5b610ac8565b603860009054906101000a90046001600160a01b03166001600160a01b03166364c8bb7e6040518163ffffffff1660e01b815260040160206040518083038186803b158015610a5b57600080fd5b505afa158015610a6f573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610a9391906150b5565b8251610aa0906001615103565b610aaa91906150e4565b3414610ac85760405162461bcd60e51b81526004016109ff90615152565b610ad0613ef1565b6001600160a01b038416331415610b175760405162461bcd60e51b815260206004820152600b60248201526a2932b332b91032b93937b960a91b60448201526064016109ff565b6033546040516304abc43b60e11b81526001600160a01b0390911690630957887690610b519033908c908c908c908c908c906004016151bc565b600060405180830381600087803b158015610b6b57600080fd5b505af1158015610b7f573d6000803e3d6000fd5b505060345460335460408051630df2cf1760e41b815290516001600160a01b03938416955063a1ccbf6494506001939092169163df2cf17091600480820192602092909190829003018186803b158015610bd857600080fd5b505afa158015610bec573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610c1091906150b5565b610c1a9190615229565b338686866040518663ffffffff1660e01b8152600401610c3e959493929190615240565b600060405180830381600087803b158015610c5857600080fd5b505af1158015610c6c573d6000803e3d6000fd5b50505050610c7960018055565b5050505050505050565b600080603960009054906101000a90046001600160a01b03166001600160a01b03166318160ddd6040518163ffffffff1660e01b815260040160206040518083038186803b158015610cd457600080fd5b505afa158015610ce8573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610d0c91906150b5565b905080610d1d57620186a091505090565b610d346c0c9f2c9cd04674edea40000000826150e4565b603b54610d436012600a6153af565b610d5090620186a06150e4565b610d5a91906150e4565b610d6491906153d1565b91505090565b610d75338383611c13565b5050565b610d81614005565b603a54604051632770a7eb60e21b81526001600160a01b0390911690639dc29fac90610db390859085906004016153e5565b600060405180830381600087803b158015610dcd57600080fd5b505af1158015610de1573d6000803e3d6000fd5b505050505050565b610df1614005565b603a546040516340c10f1960e01b81526001600160a01b03909116906340c10f1990610db390859085906004016153e5565b610e2b613dde565b6001610e3681614076565b60335460405163eb02c30160e01b8152600481018490526000916001600160a01b03169063eb02c301906024016101406040518083038186803b158015610e7c57600080fd5b505afa158015610e90573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610eb49190615414565b60375460608201516040516365fa2f7f60e01b81529293506000926001600160a01b03909216916365fa2f7f91610ef19160040190815260200190565b60206040518083038186803b158015610f0957600080fd5b505afa158015610f1d573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610f4191906150b5565b6038546060840151604080860151610100870151608088015160e08901516101208a015160c08b0151955163d136545b60e01b815260048101979097529315156024870152604486019290925260648501526084840186905260a484015260c483015260e48201529192506000916001600160a01b039091169063d136545b906101040160606040518083038186803b158015610fdd57600080fd5b505afa158015610ff1573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061101591906154b0565b5050603854606085015160405163307726ef60e01b81529293506000926001600160a01b039092169163307726ef916110549160040190815260200190565b60206040518083038186803b15801561106c57600080fd5b505afa158015611080573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906110a491906150b5565b1561113557603854606085015160405163307726ef60e01b81526001600160a01b039092169163307726ef916110e09160040190815260200190565b60206040518083038186803b1580156110f857600080fd5b505afa15801561110c573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061113091906150b5565b6111bb565b603860009054906101000a90046001600160a01b03166001600160a01b0316631c8444d06040518163ffffffff1660e01b815260040160206040518083038186803b15801561118357600080fd5b505afa158015611197573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906111bb91906150b5565b90506000620186a082603b546111d191906150e4565b6111db91906153d1565b905080831361121a5760405162461bcd60e51b815260206004820152600b60248201526a1b9bdd08185b1b1bddd95960aa1b60448201526064016109ff565b603354610100860151604051636d1b4c9560e11b8152600481018a90526024810187905260448101919091526001600160a01b039091169063da36992a90606401600060405180830381600087803b15801561127557600080fd5b505af1158015611289573d6000803e3d6000fd5b505050506000818461129b9190615229565b603a548751604051632770a7eb60e21b81529293506001600160a01b0390911691639dc29fac916112d09185906004016153e5565b600060405180830381600087803b1580156112ea57600080fd5b505af11580156112fe573d6000803e3d6000fd5b5050505080603b60008282546113149190615103565b909155505085516040518281526001600160a01b039091169089907f7e3ad6234556318d663482d0da4392a6898037f43df2a506bc602357af1ff59a9060200160405180910390a35050505050505061136c60018055565b50565b600061137f600160801b846153d1565b90506000611391600160801b856154de565b905061139e8282856131d5565b50505050565b6113ac613dde565b6113b4613e38565b603860009054906101000a90046001600160a01b03166001600160a01b031663ce9e80096040518163ffffffff1660e01b815260040160206040518083038186803b15801561140257600080fd5b505afa158015611416573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061143a91906150b5565b34146114585760405162461bcd60e51b81526004016109ff90615152565b611460613ef1565b6033546040516329e05f7560e21b8152336004820152602481018690526044810185905260648101849052608481018390526001600160a01b039091169063a7817dd49060a4015b600060405180830381600087803b1580156114c257600080fd5b505af11580156114d6573d6000803e3d6000fd5b5050505061139e60018055565b60006114f3600160801b856153d1565b90508160008167ffffffffffffffff811115611511576115116149ca565b60405190808252806020026020018201604052801561153a578160200160208202803683370190505b50905060008267ffffffffffffffff811115611558576115586149ca565b604051908082528060200260200182016040528015611581578160200160208202803683370190505b50905060008367ffffffffffffffff81111561159f5761159f6149ca565b6040519080825280602002602001820160405280156115c8578160200160208202803683370190505b50905060005b848110156116ca57600160801b8888838181106115ed576115ed6154f2565b905060200201356115fe91906153d1565b838281518110611610576116106154f2565b60200260200101818152505060026001607f1b898984818110611635576116356154f2565b9050602002013561164691906153d1565b61165091906154de565b600114848281518110611665576116656154f2565b911515602092830291909101909101526001607f1b88888381811061168c5761168c6154f2565b9050602002013561169d91906154de565b8282815181106116af576116af6154f2565b60209081029190910101526116c381615508565b90506115ce565b50610c798584848461175b565b603d5461136c9033906001600160a01b03168361211e565b60006116ff600160801b846153d1565b90506000611711600160801b856154de565b90506000611723600160801b856153d1565b90506000611735600160801b866154de565b9050610de1848484846113a4565b603d5461136c9033906001600160a01b031683611c13565b611763613dde565b61176b613e38565b8151603860009054906101000a90046001600160a01b03166001600160a01b03166364c8bb7e6040518163ffffffff1660e01b815260040160206040518083038186803b1580156117bb57600080fd5b505afa1580156117cf573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906117f391906150b5565b6117fd91906150e4565b341461181b5760405162461bcd60e51b81526004016109ff90615152565b611823613ef1565b6034546040516328732fd960e21b81526001600160a01b039091169063a1ccbf64906114a89087903390889088908890600401615240565b611863613dde565b61186b613e38565b603860009054906101000a90046001600160a01b03166001600160a01b03166364c8bb7e6040518163ffffffff1660e01b815260040160206040518083038186803b1580156118b957600080fd5b505afa1580156118cd573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906118f191906150b5565b341461190f5760405162461bcd60e51b81526004016109ff90615152565b611917613ef1565b60335460405163475e6d6160e01b8152336004820152821515602482015260448101879052606481018490526084810186905260a481018590526001600160a01b039091169063475e6d619060c4015b600060405180830381600087803b15801561198157600080fd5b505af1158015611995573d6000803e3d6000fd5b505050506119a260018055565b5050505050565b603d5461136c906001600160a01b031682612882565b6119c7613dde565b6119cf613e38565b603860009054906101000a90046001600160a01b03166001600160a01b031663ce9e80096040518163ffffffff1660e01b815260040160206040518083038186803b158015611a1d57600080fd5b505afa158015611a31573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611a5591906150b5565b3414611a735760405162461bcd60e51b81526004016109ff90615152565b611a7b613ef1565b603354604051633f832a5f60e21b81523360048201526024810184905260006044820152606481018390526001600160a01b039091169063fe0ca97c906084015b600060405180830381600087803b158015611ad657600080fd5b505af1158015611aea573d6000803e3d6000fd5b50505050610d7560018055565b603d546040516370a0823160e01b81523360048201819052611b7c9290916001600160a01b039091169081906370a082319060240160206040518083038186803b158015611b4457600080fd5b505afa158015611b58573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061053591906150b5565b565b611b86614005565b8015610d75578115611baf5780603b6000828254611ba49190615103565b90915550610d759050565b80603b541015611bf85760405162461bcd60e51b81526020600482015260146024820152736578636565646564205553444d20626f74746f6d60601b60448201526064016109ff565b80603b6000828254611c0a9190615229565b90915550505050565b611c1b613dde565b611c23613e38565b60385460405163f690a3a360e01b81526001600160a01b0384811660048301529091169063f690a3a39060240160206040518083038186803b158015611c6857600080fd5b505afa158015611c7c573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611ca09190615523565b611ce25760405162461bcd60e51b815260206004820152601360248201527219195c1bdcda5d081b9bdd08185b1b1bddd959606a1b60448201526064016109ff565b60008111611d025760405162461bcd60e51b81526004016109ff90615540565b6001600160a01b0383163314611dcf57603854604051630519e01b60e41b81526001600160a01b0385811660048301523360248301529091169063519e01b09060440160206040518083038186803b158015611d5d57600080fd5b505afa158015611d71573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611d959190615523565b611dcf5760405162461bcd60e51b815260206004820152600b60248201526a139bdd08185b1b1bddd95960aa1b60448201526064016109ff565b611de46001600160a01b038316333084614132565b6037546040516317a3625360e31b81526000916001600160a01b03169063bd1b129890611e1790869086906004016153e5565b60206040518083038186803b158015611e2f57600080fd5b505afa158015611e43573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611e6791906150b5565b6038546040516380352cfd60e01b81526001600160a01b038681166004830152929350600092620186a09216906380352cfd9060240160206040518083038186803b158015611eb557600080fd5b505afa158015611ec9573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611eed91906150b5565b611ef790846150e4565b611f0191906153d1565b9050611f0f8160008061419d565b603a546001600160a01b03166340c10f1986611f2b8486615229565b6040518363ffffffff1660e01b8152600401611f489291906153e5565b600060405180830381600087803b158015611f6257600080fd5b505af1158015611f76573d6000803e3d6000fd5b50505050836001600160a01b0316856001600160a01b03167f5548c837ab068cf56a2c2479df0882a4922fd203edb7517321831d95078c5f6285604051611fbf91815260200190565b60405180910390a35050611fd260018055565b505050565b611fdf613dde565b611fe7613e38565b6034546040516303d8dd0d60e61b81526001600160a01b039091169063f63743409061201990339085906004016153e5565b600060405180830381600087803b15801561203357600080fd5b505af1158015612047573d6000803e3d6000fd5b5050505061136c60018055565b61205c613dde565b612064613e38565b603354604051633f832a5f60e21b81523360048201526024810184905260016044820152606481018390526001600160a01b039091169063fe0ca97c90608401611abc565b60036120b481614076565b50603d80546001600160a01b0319166001600160a01b0392909216919091179055565b608081901c60006120ed6002607f85901c6154de565b600114905060006121026001607f1b856154de565b905081156121145761139e8382612054565b61139e83826119bf565b612126613dde565b61212e613e38565b60385460405163e0c7845560e01b81526001600160a01b0384811660048301529091169063e0c784559060240160206040518083038186803b15801561217357600080fd5b505afa158015612187573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906121ab9190615523565b6121ea5760405162461bcd60e51b815260206004820152601060248201526f1cdd185ada5b99c8191a5cd8589b195960821b60448201526064016109ff565b6000811161220a5760405162461bcd60e51b81526004016109ff90615540565b6001600160a01b03831633146122d757603854604051630519e01b60e41b81526001600160a01b0385811660048301523360248301529091169063519e01b09060440160206040518083038186803b15801561226557600080fd5b505afa158015612279573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061229d9190615523565b6122d75760405162461bcd60e51b815260206004820152600b60248201526a139bdd08185b1b1bddd95960aa1b60448201526064016109ff565b6122ec6001600160a01b038316333084614132565b6037546040516317a3625360e31b81526000916001600160a01b03169063bd1b12989061231f90869086906004016153e5565b60206040518083038186803b15801561233757600080fd5b505afa15801561234b573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061236f91906150b5565b6038546040516385a848ff60e01b81526001600160a01b038681166004830152929350600092620186a09216906385a848ff9060240160206040518083038186803b1580156123bd57600080fd5b505afa1580156123d1573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906123f591906150b5565b6123ff90846150e4565b61240991906153d1565b905060006124178284615229565b9050600080603960009054906101000a90046001600160a01b03166001600160a01b03166318160ddd6040518163ffffffff1660e01b815260040160206040518083038186803b15801561246a57600080fd5b505afa15801561247e573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906124a291906150b5565b9050806124f7576124c3620186a06c0c9f2c9cd04674edea400000006150e4565b6124cf6012600a6153af565b6124dc620186a0866150e4565b6124e691906150e4565b6124f091906153d1565b9150612511565b603b5461250482856150e4565b61250e91906153d1565b91505b603860009054906101000a90046001600160a01b03166001600160a01b0316634f4c04d06040518163ffffffff1660e01b815260040160206040518083038186803b15801561255f57600080fd5b505afa158015612573573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061259791906150b5565b6125a18383615103565b11156125ef5760405162461bcd60e51b815260206004820152601760248201527f6d617820746f74616c207573646d20657863656564656400000000000000000060448201526064016109ff565b6125fb8460008061419d565b82603b600082825461260d9190615103565b90915550506001600160a01b038089166000908152603c60205260409081902042905560395490516340c10f1960e01b81529116906340c10f1990612658908b9086906004016153e5565b600060405180830381600087803b15801561267257600080fd5b505af1158015612686573d6000803e3d6000fd5b5050604080516001600160a01b038b81168252602082018b9052918101869052908b1692507f63602d0ecc7b3a0ef7ff1a116e23056662d64280355ba8031b6d0d767c4b4458915060600160405180910390a25050505050611fd260018055565b600054610100900460ff16158080156127075750600054600160ff909116105b806127215750303b158015612721575060005460ff166001145b6127845760405162461bcd60e51b815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201526d191e481a5b9a5d1a585b1a5e995960921b60648201526084016109ff565b6000805460ff1916600117905580156127a7576000805461ff0019166101001790555b6001600160a01b0384163b6127f25760405162461bcd60e51b81526020600482015260116024820152701bdc195c985d1bdc9cc81a5b9d985b1a59607a1b60448201526064016109ff565b6127fa6146c6565b603680546001600160a01b038087166001600160a01b03199283161790925560398054868416908316179055603a805492851692909116919091179055801561139e576000805461ff0019169055604051600181527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989060200160405180910390a150505050565b61288a613dde565b612892613e38565b603854604051632e79aba560e01b81526001600160a01b03848116600483015290911690632e79aba59060240160206040518083038186803b1580156128d757600080fd5b505afa1580156128eb573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061290f9190615523565b6129505760405162461bcd60e51b81526020600482015260126024820152711d5b9cdd185ada5b99c8191a5cd8589b195960721b60448201526064016109ff565b603954604080516318160ddd60e01b815290516000926001600160a01b0316916318160ddd916004808301926020929190829003018186803b15801561299557600080fd5b505afa1580156129a9573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906129cd91906150b5565b90506000821180156129df5750808211155b612a1e5760405162461bcd60e51b815260206004820152601060248201526f3ab9b236a0b6b7bab73a1032b93937b960811b60448201526064016109ff565b60385460405163cb28bbeb60e01b81523360048201526001600160a01b039091169063cb28bbeb9060240160206040518083038186803b158015612a6157600080fd5b505afa158015612a75573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612a999190615523565b612b815760385460408051633526931560e01b8152905142926001600160a01b0316916335269315916004808301926020929190829003018186803b158015612ae157600080fd5b505afa158015612af5573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612b1991906150b5565b336000908152603c6020526040902054612b339190615103565b1115612b815760405162461bcd60e51b815260206004820181905260248201527f636f6f6c646f776e206475726174696f6e206e6f74207965742070617373656460448201526064016109ff565b603954604051632770a7eb60e21b81526001600160a01b0390911690639dc29fac90612bb390339086906004016153e5565b600060405180830381600087803b158015612bcd57600080fd5b505af1158015612be1573d6000803e3d6000fd5b50505050600081603b5484612bf691906150e4565b612c0091906153d1565b603854604051638113dba560e01b81526001600160a01b038781166004830152929350600092620186a0921690638113dba59060240160206040518083038186803b158015612c4e57600080fd5b505afa158015612c62573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612c8691906150b5565b612c9090846150e4565b612c9a91906153d1565b9050612ca88160008061419d565b81603b6000828254612cba9190615229565b90915550506037546000906001600160a01b03166368ce13d687612cde8587615229565b6040518363ffffffff1660e01b8152600401612cfb9291906153e5565b60206040518083038186803b158015612d1357600080fd5b505afa158015612d27573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612d4b91906150b5565b9050612d616001600160a01b03871633836146f5565b604080516001600160a01b03881681526020810187905290810182905233907f18edd09e80386cd99df397e2e0d87d2bb259423eae08645e776321a36fe680ef9060600160405180910390a250505050610d7560018055565b612dc2613dde565b612dca613e38565b6000836003811115612dde57612dde61509f565b1415612e8d57603860009054906101000a90046001600160a01b03166001600160a01b031663ce9e80096040518163ffffffff1660e01b815260040160206040518083038186803b158015612e3257600080fd5b505afa158015612e46573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612e6a91906150b5565b3414612e885760405162461bcd60e51b81526004016109ff9061511b565b612f31565b603860009054906101000a90046001600160a01b03166001600160a01b03166364c8bb7e6040518163ffffffff1660e01b815260040160206040518083038186803b158015612edb57600080fd5b505afa158015612eef573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612f1391906150b5565b3414612f315760405162461bcd60e51b81526004016109ff90615152565b612f39613ef1565b6001600160a01b038116331415612f805760405162461bcd60e51b815260206004820152600b60248201526a2932b332b91032b93937b960a91b60448201526064016109ff565b6033546040516304abc43b60e11b81526001600160a01b0390911690630957887690611967903390899089908990899089906004016151bc565b603d546039546040516370a0823160e01b8152336004820152611b7c926001600160a01b039081169216906370a082319060240160206040518083038186803b15801561300657600080fd5b505afa15801561301a573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906106ba91906150b5565b613046613dde565b61304e613e38565b603860009054906101000a90046001600160a01b03166001600160a01b03166364c8bb7e6040518163ffffffff1660e01b815260040160206040518083038186803b15801561309c57600080fd5b505afa1580156130b0573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906130d491906150b5565b34146130f25760405162461bcd60e51b81526004016109ff90615152565b6130fa613ef1565b60345460405163860a19f160e01b81526001600160a01b039091169063860a19f190611abc90339086908690600401615565565b613136613e38565b60005b8151811015610d755760345482516001600160a01b039091169063f637434090339085908590811061316d5761316d6154f2565b60200260200101516040518363ffffffff1660e01b81526004016131929291906153e5565b600060405180830381600087803b1580156131ac57600080fd5b505af11580156131c0573d6000803e3d6000fd5b50505050806131ce90615508565b9050613139565b6131dd613dde565b6131e5613e38565b603860009054906101000a90046001600160a01b03166001600160a01b031663ce9e80096040518163ffffffff1660e01b815260040160206040518083038186803b15801561323357600080fd5b505afa158015613247573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061326b91906150b5565b34146132895760405162461bcd60e51b81526004016109ff9061511b565b613291613ef1565b6033546040516329f054e360e11b81526004810183905233602482015260448101859052606481018490526001600160a01b03909116906353e0a9c690608401600060405180830381600087803b1580156132eb57600080fd5b505af11580156132ff573d6000803e3d6000fd5b50505050611fd260018055565b613314613dde565b600361331f81614076565b603a54604051632770a7eb60e21b81526001600160a01b0390911690639dc29fac9061335190339086906004016153e5565b600060405180830381600087803b15801561336b57600080fd5b505af115801561337f573d6000803e3d6000fd5b5050505081603b60008282546133959190615103565b909155505060405182815233907fdb51c893ac5e7277a38c5de5faaac46089227b2ae9076d223b8a7685cd80611c9060200160405180910390a25061136c60018055565b60046133e481614076565b603a54600160a01b900460ff161561342c5760405162461bcd60e51b815260206004820152600b60248201526a1a5b9a5d1a585b1a5e995960aa1b60448201526064016109ff565b6001600160a01b0386163b61347a5760405162461bcd60e51b81526020600482015260146024820152731c1c9a58d953585b9859d95c881a5b9d985b1a5960621b60448201526064016109ff565b6001600160a01b0385163b6134d15760405162461bcd60e51b815260206004820152601760248201527f73657474696e67734d616e6167657220696e76616c696400000000000000000060448201526064016109ff565b6001600160a01b0384163b6135205760405162461bcd60e51b81526020600482015260156024820152741c1bdcda5d1a5bdb95985d5b1d081a5b9d985b1a59605a1b60448201526064016109ff565b6001600160a01b0383163b61356c5760405162461bcd60e51b81526020600482015260126024820152711bdc99195c95985d5b1d081a5b9d985b1a5960721b60448201526064016109ff565b6001600160a01b0382163b6135bc5760405162461bcd60e51b81526020600482015260166024820152751b1a5c5d5a59185d1955985d5b1d081a5b9d985b1a5960521b60448201526064016109ff565b50603780546001600160a01b039687166001600160a01b031991821617909155603880549587169582169590951790945560338054938616938516939093179092556034805491851691841691909117905560358054919093169116179055603a805460ff60a01b1916600160a01b179055565b6000613640600160f01b856153d1565b90506000600160e81b613657600160f01b876154de565b61366191906153d1565b905060006136706080836153d1565b600114905060006136826080846154de565b60038111156136935761369361509f565b60408051600480825260a082019092529192508891600091602082016080803683370190505090506136c9600160801b896153d1565b816000815181106136dc576136dc6154f2565b60209081029190910101526136f5600160801b896154de565b81600181518110613708576137086154f2565b6020908102919091010152613721600160801b886153d1565b81600281518110613734576137346154f2565b602090810291909101015261374d600160801b886154de565b81600381518110613760576137606154f2565b6020026020010181815250506137798685858486612dba565b505050505050505050565b61378c614005565b611fd283838361419d565b603d546040516370a0823160e01b81523360048201819052611b7c9290916001600160a01b039091169081906370a082319060240160206040518083038186803b1580156137e457600080fd5b505afa1580156137f8573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061067a91906150b5565b613824613dde565b61382c613e38565b603854604051633394ce3b60e21b81526001600160a01b0384811660048301529091169063ce5338ec9060240160206040518083038186803b15801561387157600080fd5b505afa158015613885573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906138a99190615523565b6138ec5760405162461bcd60e51b81526020600482015260146024820152731dda5d1a191c985dc81b9bdd08185b1b1bddd95960621b60448201526064016109ff565b6000811161390c5760405162461bcd60e51b81526004016109ff90615540565b60385460405163a9b9e38960e01b81523360048201526001600160a01b039091169063a9b9e3899060240160206040518083038186803b15801561394f57600080fd5b505afa158015613963573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906139879190615523565b156139c55760405162461bcd60e51b815260206004820152600e60248201526d1058d8dbdd5b9d0818985b9b995960921b60448201526064016109ff565b603a54604051632770a7eb60e21b81526001600160a01b0390911690639dc29fac906139f790339085906004016153e5565b600060405180830381600087803b158015613a1157600080fd5b505af1158015613a25573d6000803e3d6000fd5b5050603854604051631ac3ddeb60e01b81526001600160a01b03868116600483015260009450620186a0935090911690631ac3ddeb9060240160206040518083038186803b158015613a7657600080fd5b505afa158015613a8a573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190613aae91906150b5565b613ab890846150e4565b613ac291906153d1565b9050613ad08160008061419d565b6037546000906001600160a01b03166368ce13d685613aef8587615229565b6040518363ffffffff1660e01b8152600401613b0c9291906153e5565b60206040518083038186803b158015613b2457600080fd5b505afa158015613b38573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190613b5c91906150b5565b9050613b726001600160a01b03851633836146f5565b6040805160008152602081018390526001600160a01b0386169133917ffeb2000dca3e617cd6f3a8bbb63014bb54a124aac6ccbf73ee7229b4cd01f120910160405180910390a35050610d7560018055565b613bcc613dde565b6003613bd781614076565b60385460405163a9b9e38960e01b81526001600160a01b0384811660048301529091169063a9b9e3899060240160206040518083038186803b158015613c1c57600080fd5b505afa158015613c30573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190613c549190615523565b613c905760405162461bcd60e51b815260206004820152600d60248201526c3737ba1032bc383637b4ba32b960991b60448201526064016109ff565b603a546040516370a0823160e01b81526001600160a01b03848116600483015260009216906370a082319060240160206040518083038186803b158015613cd657600080fd5b505afa158015613cea573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190613d0e91906150b5565b603a54604051632770a7eb60e21b81529192506001600160a01b031690639dc29fac90613d4190869085906004016153e5565b600060405180830381600087803b158015613d5b57600080fd5b505af1158015613d6f573d6000803e3d6000fd5b5050505080603b6000828254613d859190615103565b90915550506040518181526001600160a01b038416907f4051ba94e08bb094159fc38391422b4b8ccfd2b1f8919c0eb37bb042d4b9cd8e9060200160405180910390a2505061136c60018055565b610d7533838361211e565b60026001541415613e315760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c0060448201526064016109ff565b6002600155565b60385460405163a9b9e38960e01b81523360048201526001600160a01b039091169063a9b9e3899060240160206040518083038186803b158015613e7b57600080fd5b505afa158015613e8f573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190613eb39190615523565b15611b7c5760405162461bcd60e51b815260206004820152600e60248201526d1058d8dbdd5b9d0818985b9b995960921b60448201526064016109ff565b6038546040805163d0fb020360e01b815290516000926001600160a01b03169163d0fb0203916004808301926020929190829003018186803b158015613f3657600080fd5b505afa158015613f4a573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190613f6e9190615595565b6001600160a01b03163460405160006040518083038185875af1925050503d8060008114613fb8576040519150601f19603f3d011682016040523d82523d6000602084013e613fbd565b606091505b505090508061136c5760405162461bcd60e51b815260206004820152600e60248201526d19985a5b1959081d1bc81cd95b9960921b60448201526064016109ff565b60018055565b6033546001600160a01b031633148061402857506035546001600160a01b031633145b8061403d57506034546001600160a01b031633145b611b7c5760405162461bcd60e51b815260206004820152600a60248201526913db9b1e481d985d5b1d60b21b60448201526064016109ff565b60365460405163df07560560e01b815233600482015282916001600160a01b03169063df0756059060240160206040518083038186803b1580156140b957600080fd5b505afa1580156140cd573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906140f191906150b5565b101561136c5760405162461bcd60e51b815260206004820152601060248201526f34b73b30b634b21037b832b930ba37b960811b60448201526064016109ff565b6040516001600160a01b038085166024830152831660448201526064810182905261139e9085906323b872dd60e01b906084015b60408051601f198184030181529190526020810180516001600160e01b03166001600160e01b031990931692909217909152614714565b8215611fd2576001600160a01b038216156143ab5760385460405163594ca01560e01b81526001600160a01b038481166004830152600092839291169063594ca01590602401604080518083038186803b1580156141fa57600080fd5b505afa15801561420e573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061423291906155b2565b9092509050620186a061424583876150e4565b61424f91906153d1565b9150620186a061425f82876150e4565b61426991906153d1565b603a546040516340c10f1960e01b81529192506001600160a01b0316906340c10f199061429c90879086906004016153e5565b600060405180830381600087803b1580156142b657600080fd5b505af11580156142ca573d6000803e3d6000fd5b50505050600081111561433c57603a546040516340c10f1960e01b81526001600160a01b03909116906340c10f199061430990869085906004016153e5565b600060405180830381600087803b15801561432357600080fd5b505af1158015614337573d6000803e3d6000fd5b505050505b6143468183615103565b6143509086615229565b9450826001600160a01b0316846001600160a01b03167f2210da9c25406cac50a7846052db53d49ec84390f83867c61e4091ac87ec939784846040516143a0929190918252602082015260400190565b60405180910390a350505b6001600160a01b03811615614531576001600160a01b038181166000908152603f60205260408082205460385491516319745e3960e11b8152908416600482018190529391909116906332e8bc729060240160206040518083038186803b15801561441557600080fd5b505afa158015614429573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061444d91906150b5565b9050801561452e57620186a061446382876150e4565b61446d91906153d1565b603a546040516340c10f1960e01b81529192506001600160a01b0316906340c10f19906144a090859085906004016153e5565b600060405180830381600087803b1580156144ba57600080fd5b505af11580156144ce573d6000803e3d6000fd5b5050505080856144de9190615229565b9450826001600160a01b0316826001600160a01b03167fa9d92ab9f19faecc65e4b397da6701d094f08143f98b735b7cd6332184bec0f18360405161452591815260200190565b60405180910390a35b50505b6000620186a0603860009054906101000a90046001600160a01b03166001600160a01b031663018f2d826040518163ffffffff1660e01b815260040160206040518083038186803b15801561458557600080fd5b505afa158015614599573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906145bd91906150b5565b6145c790866150e4565b6145d191906153d1565b905080603b60008282546145e59190615103565b9091555050603a546038546040805163d0fb020360e01b815290516001600160a01b03938416936340c10f1993169163d0fb0203916004808301926020929190829003018186803b15801561463957600080fd5b505afa15801561464d573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906146719190615595565b61467b8488615229565b6040518363ffffffff1660e01b81526004016146989291906153e5565b600060405180830381600087803b1580156146b257600080fd5b505af1158015610c79573d6000803e3d6000fd5b600054610100900460ff166146ed5760405162461bcd60e51b81526004016109ff906155d6565b611b7c6147e9565b611fd28363a9059cbb60e01b84846040516024016141669291906153e5565b6000614769826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b03166148109092919063ffffffff16565b905080516000148061478a57508080602001905181019061478a9190615523565b611fd25760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b60648201526084016109ff565b600054610100900460ff16613fff5760405162461bcd60e51b81526004016109ff906155d6565b606061481f8484600085614827565b949350505050565b6060824710156148885760405162461bcd60e51b815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f6044820152651c8818d85b1b60d21b60648201526084016109ff565b600080866001600160a01b031685876040516148a4919061564d565b60006040518083038185875af1925050503d80600081146148e1576040519150601f19603f3d011682016040523d82523d6000602084013e6148e6565b606091505b50915091506148f787838387614902565b979650505050505050565b6060831561496e578251614967576001600160a01b0385163b6149675760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e747261637400000060448201526064016109ff565b508161481f565b61481f83838151156149835781518083602001fd5b8060405162461bcd60e51b81526004016109ff9190615669565b801515811461136c57600080fd5b80356149b68161499d565b919050565b8035600481106149b657600080fd5b634e487b7160e01b600052604160045260246000fd5b604051610140810167ffffffffffffffff81118282101715614a0457614a046149ca565b60405290565b604051601f8201601f1916810167ffffffffffffffff81118282101715614a3357614a336149ca565b604052919050565b600067ffffffffffffffff821115614a5557614a556149ca565b5060051b60200190565b600082601f830112614a7057600080fd5b81356020614a85614a8083614a3b565b614a0a565b82815260059290921b84018101918181019086841115614aa457600080fd5b8286015b84811015614abf5780358352918301918301614aa8565b509695505050505050565b6001600160a01b038116811461136c57600080fd5b80356149b681614aca565b600082601f830112614afb57600080fd5b81356020614b0b614a8083614a3b565b82815260059290921b84018101918181019086841115614b2a57600080fd5b8286015b84811015614abf578035614b418161499d565b8352918301918301614b2e565b600080600080600080600080610100898b031215614b6b57600080fd5b88359750614b7b60208a016149ab565b9650614b8960408a016149bb565b9550606089013567ffffffffffffffff80821115614ba657600080fd5b614bb28c838d01614a5f565b9650614bc060808c01614adf565b955060a08b0135915080821115614bd657600080fd5b614be28c838d01614aea565b945060c08b0135915080821115614bf857600080fd5b614c048c838d01614a5f565b935060e08b0135915080821115614c1a57600080fd5b50614c278b828c01614a5f565b9150509295985092959890939650565b60008060408385031215614c4a57600080fd5b8235614c5581614aca565b946020939093013593505050565b600060208284031215614c7557600080fd5b8135614c8081614aca565b9392505050565b600060208284031215614c9957600080fd5b5035919050565b60008060408385031215614cb357600080fd5b50508035926020909101359150565b60008060008060808587031215614cd857600080fd5b5050823594602084013594506040840135936060013592509050565b600080600060408486031215614d0957600080fd5b83359250602084013567ffffffffffffffff80821115614d2857600080fd5b818601915086601f830112614d3c57600080fd5b813581811115614d4b57600080fd5b8760208260051b8501011115614d6057600080fd5b6020830194508093505050509250925092565b60008060008060808587031215614d8957600080fd5b84359350602085013567ffffffffffffffff80821115614da857600080fd5b614db488838901614aea565b94506040870135915080821115614dca57600080fd5b614dd688838901614a5f565b93506060870135915080821115614dec57600080fd5b50614df987828801614a5f565b91505092959194509250565b600080600080600060a08688031215614e1d57600080fd5b853594506020860135935060408601359250606086013591506080860135614e448161499d565b809150509295509295909350565b60008060408385031215614e6557600080fd5b8235614c558161499d565b600080600060608486031215614e8557600080fd5b8335614e9081614aca565b92506020840135614ea081614aca565b929592945050506040919091013590565b600080600060608486031215614ec657600080fd5b8335614ed181614aca565b92506020840135614ee181614aca565b91506040840135614ef181614aca565b809150509250925092565b600080600080600060a08688031215614f1457600080fd5b853594506020860135614f268161499d565b9350614f34604087016149bb565b9250606086013567ffffffffffffffff811115614f5057600080fd5b614f5c88828901614a5f565b9250506080860135614e4481614aca565b60008060408385031215614f8057600080fd5b82359150602083013567ffffffffffffffff811115614f9e57600080fd5b614faa85828601614a5f565b9150509250929050565b600060208284031215614fc657600080fd5b813567ffffffffffffffff811115614fdd57600080fd5b61481f84828501614a5f565b600080600060608486031215614ffe57600080fd5b505081359360208301359350604090920135919050565b600080600080600060a0868803121561502d57600080fd5b853561503881614aca565b9450602086013561504881614aca565b9350604086013561505881614aca565b9250606086013561506881614aca565b91506080860135614e4481614aca565b60008060006060848603121561508d57600080fd5b833592506020840135614ee181614aca565b634e487b7160e01b600052602160045260246000fd5b6000602082840312156150c757600080fd5b5051919050565b634e487b7160e01b600052601160045260246000fd5b60008160001904831182151516156150fe576150fe6150ce565b500290565b60008219821115615116576151166150ce565b500190565b60208082526019908201527f696e76616c6964206d61726b65744f7264657247617346656500000000000000604082015260600190565b602080825260159082015274696e76616c6964207472696767657247617346656560581b604082015260600190565b600081518084526020808501945080840160005b838110156151b157815187529582019590820190600101615195565b509495945050505050565b6001600160a01b038781168252602082018790528515156040830152600090600486106151f957634e487b7160e01b600052602160045260246000fd5b85606084015260c0608084015261521360c0840186615181565b915080841660a084015250979650505050505050565b60008282101561523b5761523b6150ce565b500390565b8581526001600160a01b03851660208083019190915260a06040830181905285519083018190526000918681019160c0850190845b81811015615293578451151583529383019391830191600101615275565b505084810360608601526152a78188615181565b9250505082810360808401526152bd8185615181565b98975050505050505050565b600181815b808511156153045781600019048211156152ea576152ea6150ce565b808516156152f757918102915b93841c93908002906152ce565b509250929050565b60008261531b575060016153a9565b81615328575060006153a9565b816001811461533e576002811461534857615364565b60019150506153a9565b60ff841115615359576153596150ce565b50506001821b6153a9565b5060208310610133831016604e8410600b8410161715615387575081810a6153a9565b61539183836152c9565b80600019048211156153a5576153a56150ce565b0290505b92915050565b6000614c80838361530c565b634e487b7160e01b600052601260045260246000fd5b6000826153e0576153e06153bb565b500490565b6001600160a01b03929092168252602082015260400190565b80516149b681614aca565b80516149b68161499d565b6000610140828403121561542757600080fd5b61542f6149e0565b615438836153fe565b8152615446602084016153fe565b602082015261545760408401615409565b6040820152606083015160608201526080830151608082015260a083015160a082015260c083015160c082015260e083015160e08201526101008084015181830152506101208084015181830152508091505092915050565b6000806000606084860312156154c557600080fd5b8351925060208401519150604084015190509250925092565b6000826154ed576154ed6153bb565b500690565b634e487b7160e01b600052603260045260246000fd5b600060001982141561551c5761551c6150ce565b5060010190565b60006020828403121561553557600080fd5b8151614c808161499d565b6020808252600b908201526a1e995c9bc8185b5bdd5b9d60aa1b604082015260600190565b60018060a01b038416815282602082015260606040820152600061558c6060830184615181565b95945050505050565b6000602082840312156155a757600080fd5b8151614c8081614aca565b600080604083850312156155c557600080fd5b505080516020909101519092909150565b6020808252602b908201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960408201526a6e697469616c697a696e6760a81b606082015260800190565b60005b8381101561563c578181015183820152602001615624565b8381111561139e5750506000910152565b6000825161565f818460208701615621565b9190910192915050565b6020815260008251806020840152615688816040850160208701615621565b601f01601f1916919091016040019291505056fea2646970667358221220c9fa499dffdb62f0d62ab02d14e44947e6de11c7c6c3160509d112b011514d1964736f6c63430008090033
Deployed Bytecode
0x6080604052600436106102925760003560e01c8063937b25811161015a578063da36992a116100c1578063e673df8a1161007a578063e673df8a146107b5578063eb318887146107d5578063f3fef3a31461081f578063f55f45231461083f578063fb3ee57114610855578063fe9ffb041461087557600080fd5b8063da36992a1461071a578063da9da47a1461072d578063dc509f691461074d578063df33dc161461076d578063df83f61114610780578063e616847f146107a057600080fd5b8063c0c53b8b11610113578063c0c53b8b1461067f578063c2a672e01461069f578063cabf4709146106bf578063cfdcdfc9146106d2578063d66389b8146106e7578063d6dac8ad146106fa57600080fd5b8063937b25811461055a578063a3ae88a0146105e9578063a8f35adf146105ff578063b3e089a21461061f578063bdd056a61461063f578063bf6eac2f1461065f57600080fd5b80633ee7b5b3116101fe5780636a9b1891116101b75780636a9b1891146104a5578063703914dc146104b857806377a46edd146104cd5780637abadb59146104fa5780638340f5491461051a5780638b50fde71461053a57600080fd5b80633ee7b5b31461040c578063444a91e01461042c5780635543576a1461043f57806359dfabd41461045f5780635d54f798146104725780636a26c8861461048557600080fd5b806328da90af1161025057806328da90af146103735780632bc61ec4146103935780632eaff884146103a657806333adf724146103b957806333eba70c146103cc57806333f9c265146103df57600080fd5b80626c09e814610297578063061e56b5146102ac5780630b86d803146102d05780631cc75b88146102e557806321b9b44314610305578063234653e014610325575b600080fd5b6102aa6102a5366004614b4e565b610895565b005b3480156102b857600080fd5b50603b545b6040519081526020015b60405180910390f35b3480156102dc57600080fd5b506102bd610c83565b3480156102f157600080fd5b506102aa610300366004614c37565b610d6a565b34801561031157600080fd5b506102aa610320366004614c37565b610d79565b34801561033157600080fd5b5061035b610340366004614c63565b603f602052600090815260409020546001600160a01b031681565b6040516001600160a01b0390911681526020016102c7565b34801561037f57600080fd5b506102aa61038e366004614c37565b610de9565b6102aa6103a1366004614c87565b610e23565b6102aa6103b4366004614ca0565b61136f565b6102aa6103c7366004614cc2565b6113a4565b6102aa6103da366004614cf4565b6114e3565b3480156103eb57600080fd5b506102bd6103fa366004614c63565b603e6020526000908152604090205481565b34801561041857600080fd5b506102aa610427366004614c87565b6116d7565b6102aa61043a366004614ca0565b6116ef565b34801561044b57600080fd5b506102aa61045a366004614c87565b611743565b6102aa61046d366004614d73565b61175b565b6102aa610480366004614e05565b61185b565b34801561049157600080fd5b506102aa6104a0366004614c87565b6119a9565b6102aa6104b3366004614ca0565b6119bf565b3480156104c457600080fd5b506102aa611af7565b3480156104d957600080fd5b506102bd6104e8366004614c63565b603c6020526000908152604090205481565b34801561050657600080fd5b506102aa610515366004614e52565b611b7e565b34801561052657600080fd5b506102aa610535366004614e70565b611c13565b34801561054657600080fd5b506102aa610555366004614c87565b611fd7565b34801561056657600080fd5b506105b3610575366004614c87565b604160205260009081526040902080546001820154600283015460039093015460ff8316936101009093046001600160a01b03908116939216919085565b6040805195151586526001600160a01b03948516602087015292909316918401919091526060830152608082015260a0016102c7565b3480156105f557600080fd5b506102bd603b5481565b34801561060b57600080fd5b506102aa61061a366004614ca0565b612054565b34801561062b57600080fd5b506102aa61063a366004614c63565b6120a9565b34801561064b57600080fd5b506102aa61065a366004614c87565b6120d7565b34801561066b57600080fd5b506102aa61067a366004614e70565b61211e565b34801561068b57600080fd5b506102aa61069a366004614eb1565b6126e7565b3480156106ab57600080fd5b506102aa6106ba366004614c37565b612882565b6102aa6106cd366004614efc565b612dba565b3480156106de57600080fd5b506102aa612fba565b6102aa6106f5366004614f6d565b61303e565b34801561070657600080fd5b506102aa610715366004614fb4565b61312e565b6102aa610728366004614fe9565b6131d5565b34801561073957600080fd5b506102aa610748366004614c87565b61330c565b34801561075957600080fd5b506102aa610768366004615015565b6133d9565b6102aa61077b366004614fe9565b613630565b34801561078c57600080fd5b506102aa61079b366004615078565b613784565b3480156107ac57600080fd5b506102aa613797565b3480156107c157600080fd5b5060365461035b906001600160a01b031681565b3480156107e157600080fd5b506102aa6107f0366004614c63565b336000908152603f6020526040902080546001600160a01b0319166001600160a01b0392909216919091179055565b34801561082b57600080fd5b506102aa61083a366004614c37565b61381c565b34801561084b57600080fd5b506102bd60405481565b34801561086157600080fd5b506102aa610870366004614c63565b613bc4565b34801561088157600080fd5b506102aa610890366004614c37565b613dd3565b61089d613dde565b6108a5613e38565b60008660038111156108b9576108b961509f565b1415610a0d57603860009054906101000a90046001600160a01b03166001600160a01b03166364c8bb7e6040518163ffffffff1660e01b815260040160206040518083038186803b15801561090d57600080fd5b505afa158015610921573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061094591906150b5565b825161095191906150e4565b603860009054906101000a90046001600160a01b03166001600160a01b031663ce9e80096040518163ffffffff1660e01b815260040160206040518083038186803b15801561099f57600080fd5b505afa1580156109b3573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906109d791906150b5565b6109e19190615103565b3414610a085760405162461bcd60e51b81526004016109ff9061511b565b60405180910390fd5b610ac8565b603860009054906101000a90046001600160a01b03166001600160a01b03166364c8bb7e6040518163ffffffff1660e01b815260040160206040518083038186803b158015610a5b57600080fd5b505afa158015610a6f573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610a9391906150b5565b8251610aa0906001615103565b610aaa91906150e4565b3414610ac85760405162461bcd60e51b81526004016109ff90615152565b610ad0613ef1565b6001600160a01b038416331415610b175760405162461bcd60e51b815260206004820152600b60248201526a2932b332b91032b93937b960a91b60448201526064016109ff565b6033546040516304abc43b60e11b81526001600160a01b0390911690630957887690610b519033908c908c908c908c908c906004016151bc565b600060405180830381600087803b158015610b6b57600080fd5b505af1158015610b7f573d6000803e3d6000fd5b505060345460335460408051630df2cf1760e41b815290516001600160a01b03938416955063a1ccbf6494506001939092169163df2cf17091600480820192602092909190829003018186803b158015610bd857600080fd5b505afa158015610bec573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610c1091906150b5565b610c1a9190615229565b338686866040518663ffffffff1660e01b8152600401610c3e959493929190615240565b600060405180830381600087803b158015610c5857600080fd5b505af1158015610c6c573d6000803e3d6000fd5b50505050610c7960018055565b5050505050505050565b600080603960009054906101000a90046001600160a01b03166001600160a01b03166318160ddd6040518163ffffffff1660e01b815260040160206040518083038186803b158015610cd457600080fd5b505afa158015610ce8573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610d0c91906150b5565b905080610d1d57620186a091505090565b610d346c0c9f2c9cd04674edea40000000826150e4565b603b54610d436012600a6153af565b610d5090620186a06150e4565b610d5a91906150e4565b610d6491906153d1565b91505090565b610d75338383611c13565b5050565b610d81614005565b603a54604051632770a7eb60e21b81526001600160a01b0390911690639dc29fac90610db390859085906004016153e5565b600060405180830381600087803b158015610dcd57600080fd5b505af1158015610de1573d6000803e3d6000fd5b505050505050565b610df1614005565b603a546040516340c10f1960e01b81526001600160a01b03909116906340c10f1990610db390859085906004016153e5565b610e2b613dde565b6001610e3681614076565b60335460405163eb02c30160e01b8152600481018490526000916001600160a01b03169063eb02c301906024016101406040518083038186803b158015610e7c57600080fd5b505afa158015610e90573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610eb49190615414565b60375460608201516040516365fa2f7f60e01b81529293506000926001600160a01b03909216916365fa2f7f91610ef19160040190815260200190565b60206040518083038186803b158015610f0957600080fd5b505afa158015610f1d573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610f4191906150b5565b6038546060840151604080860151610100870151608088015160e08901516101208a015160c08b0151955163d136545b60e01b815260048101979097529315156024870152604486019290925260648501526084840186905260a484015260c483015260e48201529192506000916001600160a01b039091169063d136545b906101040160606040518083038186803b158015610fdd57600080fd5b505afa158015610ff1573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061101591906154b0565b5050603854606085015160405163307726ef60e01b81529293506000926001600160a01b039092169163307726ef916110549160040190815260200190565b60206040518083038186803b15801561106c57600080fd5b505afa158015611080573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906110a491906150b5565b1561113557603854606085015160405163307726ef60e01b81526001600160a01b039092169163307726ef916110e09160040190815260200190565b60206040518083038186803b1580156110f857600080fd5b505afa15801561110c573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061113091906150b5565b6111bb565b603860009054906101000a90046001600160a01b03166001600160a01b0316631c8444d06040518163ffffffff1660e01b815260040160206040518083038186803b15801561118357600080fd5b505afa158015611197573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906111bb91906150b5565b90506000620186a082603b546111d191906150e4565b6111db91906153d1565b905080831361121a5760405162461bcd60e51b815260206004820152600b60248201526a1b9bdd08185b1b1bddd95960aa1b60448201526064016109ff565b603354610100860151604051636d1b4c9560e11b8152600481018a90526024810187905260448101919091526001600160a01b039091169063da36992a90606401600060405180830381600087803b15801561127557600080fd5b505af1158015611289573d6000803e3d6000fd5b505050506000818461129b9190615229565b603a548751604051632770a7eb60e21b81529293506001600160a01b0390911691639dc29fac916112d09185906004016153e5565b600060405180830381600087803b1580156112ea57600080fd5b505af11580156112fe573d6000803e3d6000fd5b5050505080603b60008282546113149190615103565b909155505085516040518281526001600160a01b039091169089907f7e3ad6234556318d663482d0da4392a6898037f43df2a506bc602357af1ff59a9060200160405180910390a35050505050505061136c60018055565b50565b600061137f600160801b846153d1565b90506000611391600160801b856154de565b905061139e8282856131d5565b50505050565b6113ac613dde565b6113b4613e38565b603860009054906101000a90046001600160a01b03166001600160a01b031663ce9e80096040518163ffffffff1660e01b815260040160206040518083038186803b15801561140257600080fd5b505afa158015611416573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061143a91906150b5565b34146114585760405162461bcd60e51b81526004016109ff90615152565b611460613ef1565b6033546040516329e05f7560e21b8152336004820152602481018690526044810185905260648101849052608481018390526001600160a01b039091169063a7817dd49060a4015b600060405180830381600087803b1580156114c257600080fd5b505af11580156114d6573d6000803e3d6000fd5b5050505061139e60018055565b60006114f3600160801b856153d1565b90508160008167ffffffffffffffff811115611511576115116149ca565b60405190808252806020026020018201604052801561153a578160200160208202803683370190505b50905060008267ffffffffffffffff811115611558576115586149ca565b604051908082528060200260200182016040528015611581578160200160208202803683370190505b50905060008367ffffffffffffffff81111561159f5761159f6149ca565b6040519080825280602002602001820160405280156115c8578160200160208202803683370190505b50905060005b848110156116ca57600160801b8888838181106115ed576115ed6154f2565b905060200201356115fe91906153d1565b838281518110611610576116106154f2565b60200260200101818152505060026001607f1b898984818110611635576116356154f2565b9050602002013561164691906153d1565b61165091906154de565b600114848281518110611665576116656154f2565b911515602092830291909101909101526001607f1b88888381811061168c5761168c6154f2565b9050602002013561169d91906154de565b8282815181106116af576116af6154f2565b60209081029190910101526116c381615508565b90506115ce565b50610c798584848461175b565b603d5461136c9033906001600160a01b03168361211e565b60006116ff600160801b846153d1565b90506000611711600160801b856154de565b90506000611723600160801b856153d1565b90506000611735600160801b866154de565b9050610de1848484846113a4565b603d5461136c9033906001600160a01b031683611c13565b611763613dde565b61176b613e38565b8151603860009054906101000a90046001600160a01b03166001600160a01b03166364c8bb7e6040518163ffffffff1660e01b815260040160206040518083038186803b1580156117bb57600080fd5b505afa1580156117cf573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906117f391906150b5565b6117fd91906150e4565b341461181b5760405162461bcd60e51b81526004016109ff90615152565b611823613ef1565b6034546040516328732fd960e21b81526001600160a01b039091169063a1ccbf64906114a89087903390889088908890600401615240565b611863613dde565b61186b613e38565b603860009054906101000a90046001600160a01b03166001600160a01b03166364c8bb7e6040518163ffffffff1660e01b815260040160206040518083038186803b1580156118b957600080fd5b505afa1580156118cd573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906118f191906150b5565b341461190f5760405162461bcd60e51b81526004016109ff90615152565b611917613ef1565b60335460405163475e6d6160e01b8152336004820152821515602482015260448101879052606481018490526084810186905260a481018590526001600160a01b039091169063475e6d619060c4015b600060405180830381600087803b15801561198157600080fd5b505af1158015611995573d6000803e3d6000fd5b505050506119a260018055565b5050505050565b603d5461136c906001600160a01b031682612882565b6119c7613dde565b6119cf613e38565b603860009054906101000a90046001600160a01b03166001600160a01b031663ce9e80096040518163ffffffff1660e01b815260040160206040518083038186803b158015611a1d57600080fd5b505afa158015611a31573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611a5591906150b5565b3414611a735760405162461bcd60e51b81526004016109ff90615152565b611a7b613ef1565b603354604051633f832a5f60e21b81523360048201526024810184905260006044820152606481018390526001600160a01b039091169063fe0ca97c906084015b600060405180830381600087803b158015611ad657600080fd5b505af1158015611aea573d6000803e3d6000fd5b50505050610d7560018055565b603d546040516370a0823160e01b81523360048201819052611b7c9290916001600160a01b039091169081906370a082319060240160206040518083038186803b158015611b4457600080fd5b505afa158015611b58573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061053591906150b5565b565b611b86614005565b8015610d75578115611baf5780603b6000828254611ba49190615103565b90915550610d759050565b80603b541015611bf85760405162461bcd60e51b81526020600482015260146024820152736578636565646564205553444d20626f74746f6d60601b60448201526064016109ff565b80603b6000828254611c0a9190615229565b90915550505050565b611c1b613dde565b611c23613e38565b60385460405163f690a3a360e01b81526001600160a01b0384811660048301529091169063f690a3a39060240160206040518083038186803b158015611c6857600080fd5b505afa158015611c7c573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611ca09190615523565b611ce25760405162461bcd60e51b815260206004820152601360248201527219195c1bdcda5d081b9bdd08185b1b1bddd959606a1b60448201526064016109ff565b60008111611d025760405162461bcd60e51b81526004016109ff90615540565b6001600160a01b0383163314611dcf57603854604051630519e01b60e41b81526001600160a01b0385811660048301523360248301529091169063519e01b09060440160206040518083038186803b158015611d5d57600080fd5b505afa158015611d71573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611d959190615523565b611dcf5760405162461bcd60e51b815260206004820152600b60248201526a139bdd08185b1b1bddd95960aa1b60448201526064016109ff565b611de46001600160a01b038316333084614132565b6037546040516317a3625360e31b81526000916001600160a01b03169063bd1b129890611e1790869086906004016153e5565b60206040518083038186803b158015611e2f57600080fd5b505afa158015611e43573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611e6791906150b5565b6038546040516380352cfd60e01b81526001600160a01b038681166004830152929350600092620186a09216906380352cfd9060240160206040518083038186803b158015611eb557600080fd5b505afa158015611ec9573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611eed91906150b5565b611ef790846150e4565b611f0191906153d1565b9050611f0f8160008061419d565b603a546001600160a01b03166340c10f1986611f2b8486615229565b6040518363ffffffff1660e01b8152600401611f489291906153e5565b600060405180830381600087803b158015611f6257600080fd5b505af1158015611f76573d6000803e3d6000fd5b50505050836001600160a01b0316856001600160a01b03167f5548c837ab068cf56a2c2479df0882a4922fd203edb7517321831d95078c5f6285604051611fbf91815260200190565b60405180910390a35050611fd260018055565b505050565b611fdf613dde565b611fe7613e38565b6034546040516303d8dd0d60e61b81526001600160a01b039091169063f63743409061201990339085906004016153e5565b600060405180830381600087803b15801561203357600080fd5b505af1158015612047573d6000803e3d6000fd5b5050505061136c60018055565b61205c613dde565b612064613e38565b603354604051633f832a5f60e21b81523360048201526024810184905260016044820152606481018390526001600160a01b039091169063fe0ca97c90608401611abc565b60036120b481614076565b50603d80546001600160a01b0319166001600160a01b0392909216919091179055565b608081901c60006120ed6002607f85901c6154de565b600114905060006121026001607f1b856154de565b905081156121145761139e8382612054565b61139e83826119bf565b612126613dde565b61212e613e38565b60385460405163e0c7845560e01b81526001600160a01b0384811660048301529091169063e0c784559060240160206040518083038186803b15801561217357600080fd5b505afa158015612187573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906121ab9190615523565b6121ea5760405162461bcd60e51b815260206004820152601060248201526f1cdd185ada5b99c8191a5cd8589b195960821b60448201526064016109ff565b6000811161220a5760405162461bcd60e51b81526004016109ff90615540565b6001600160a01b03831633146122d757603854604051630519e01b60e41b81526001600160a01b0385811660048301523360248301529091169063519e01b09060440160206040518083038186803b15801561226557600080fd5b505afa158015612279573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061229d9190615523565b6122d75760405162461bcd60e51b815260206004820152600b60248201526a139bdd08185b1b1bddd95960aa1b60448201526064016109ff565b6122ec6001600160a01b038316333084614132565b6037546040516317a3625360e31b81526000916001600160a01b03169063bd1b12989061231f90869086906004016153e5565b60206040518083038186803b15801561233757600080fd5b505afa15801561234b573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061236f91906150b5565b6038546040516385a848ff60e01b81526001600160a01b038681166004830152929350600092620186a09216906385a848ff9060240160206040518083038186803b1580156123bd57600080fd5b505afa1580156123d1573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906123f591906150b5565b6123ff90846150e4565b61240991906153d1565b905060006124178284615229565b9050600080603960009054906101000a90046001600160a01b03166001600160a01b03166318160ddd6040518163ffffffff1660e01b815260040160206040518083038186803b15801561246a57600080fd5b505afa15801561247e573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906124a291906150b5565b9050806124f7576124c3620186a06c0c9f2c9cd04674edea400000006150e4565b6124cf6012600a6153af565b6124dc620186a0866150e4565b6124e691906150e4565b6124f091906153d1565b9150612511565b603b5461250482856150e4565b61250e91906153d1565b91505b603860009054906101000a90046001600160a01b03166001600160a01b0316634f4c04d06040518163ffffffff1660e01b815260040160206040518083038186803b15801561255f57600080fd5b505afa158015612573573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061259791906150b5565b6125a18383615103565b11156125ef5760405162461bcd60e51b815260206004820152601760248201527f6d617820746f74616c207573646d20657863656564656400000000000000000060448201526064016109ff565b6125fb8460008061419d565b82603b600082825461260d9190615103565b90915550506001600160a01b038089166000908152603c60205260409081902042905560395490516340c10f1960e01b81529116906340c10f1990612658908b9086906004016153e5565b600060405180830381600087803b15801561267257600080fd5b505af1158015612686573d6000803e3d6000fd5b5050604080516001600160a01b038b81168252602082018b9052918101869052908b1692507f63602d0ecc7b3a0ef7ff1a116e23056662d64280355ba8031b6d0d767c4b4458915060600160405180910390a25050505050611fd260018055565b600054610100900460ff16158080156127075750600054600160ff909116105b806127215750303b158015612721575060005460ff166001145b6127845760405162461bcd60e51b815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201526d191e481a5b9a5d1a585b1a5e995960921b60648201526084016109ff565b6000805460ff1916600117905580156127a7576000805461ff0019166101001790555b6001600160a01b0384163b6127f25760405162461bcd60e51b81526020600482015260116024820152701bdc195c985d1bdc9cc81a5b9d985b1a59607a1b60448201526064016109ff565b6127fa6146c6565b603680546001600160a01b038087166001600160a01b03199283161790925560398054868416908316179055603a805492851692909116919091179055801561139e576000805461ff0019169055604051600181527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989060200160405180910390a150505050565b61288a613dde565b612892613e38565b603854604051632e79aba560e01b81526001600160a01b03848116600483015290911690632e79aba59060240160206040518083038186803b1580156128d757600080fd5b505afa1580156128eb573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061290f9190615523565b6129505760405162461bcd60e51b81526020600482015260126024820152711d5b9cdd185ada5b99c8191a5cd8589b195960721b60448201526064016109ff565b603954604080516318160ddd60e01b815290516000926001600160a01b0316916318160ddd916004808301926020929190829003018186803b15801561299557600080fd5b505afa1580156129a9573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906129cd91906150b5565b90506000821180156129df5750808211155b612a1e5760405162461bcd60e51b815260206004820152601060248201526f3ab9b236a0b6b7bab73a1032b93937b960811b60448201526064016109ff565b60385460405163cb28bbeb60e01b81523360048201526001600160a01b039091169063cb28bbeb9060240160206040518083038186803b158015612a6157600080fd5b505afa158015612a75573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612a999190615523565b612b815760385460408051633526931560e01b8152905142926001600160a01b0316916335269315916004808301926020929190829003018186803b158015612ae157600080fd5b505afa158015612af5573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612b1991906150b5565b336000908152603c6020526040902054612b339190615103565b1115612b815760405162461bcd60e51b815260206004820181905260248201527f636f6f6c646f776e206475726174696f6e206e6f74207965742070617373656460448201526064016109ff565b603954604051632770a7eb60e21b81526001600160a01b0390911690639dc29fac90612bb390339086906004016153e5565b600060405180830381600087803b158015612bcd57600080fd5b505af1158015612be1573d6000803e3d6000fd5b50505050600081603b5484612bf691906150e4565b612c0091906153d1565b603854604051638113dba560e01b81526001600160a01b038781166004830152929350600092620186a0921690638113dba59060240160206040518083038186803b158015612c4e57600080fd5b505afa158015612c62573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612c8691906150b5565b612c9090846150e4565b612c9a91906153d1565b9050612ca88160008061419d565b81603b6000828254612cba9190615229565b90915550506037546000906001600160a01b03166368ce13d687612cde8587615229565b6040518363ffffffff1660e01b8152600401612cfb9291906153e5565b60206040518083038186803b158015612d1357600080fd5b505afa158015612d27573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612d4b91906150b5565b9050612d616001600160a01b03871633836146f5565b604080516001600160a01b03881681526020810187905290810182905233907f18edd09e80386cd99df397e2e0d87d2bb259423eae08645e776321a36fe680ef9060600160405180910390a250505050610d7560018055565b612dc2613dde565b612dca613e38565b6000836003811115612dde57612dde61509f565b1415612e8d57603860009054906101000a90046001600160a01b03166001600160a01b031663ce9e80096040518163ffffffff1660e01b815260040160206040518083038186803b158015612e3257600080fd5b505afa158015612e46573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612e6a91906150b5565b3414612e885760405162461bcd60e51b81526004016109ff9061511b565b612f31565b603860009054906101000a90046001600160a01b03166001600160a01b03166364c8bb7e6040518163ffffffff1660e01b815260040160206040518083038186803b158015612edb57600080fd5b505afa158015612eef573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612f1391906150b5565b3414612f315760405162461bcd60e51b81526004016109ff90615152565b612f39613ef1565b6001600160a01b038116331415612f805760405162461bcd60e51b815260206004820152600b60248201526a2932b332b91032b93937b960a91b60448201526064016109ff565b6033546040516304abc43b60e11b81526001600160a01b0390911690630957887690611967903390899089908990899089906004016151bc565b603d546039546040516370a0823160e01b8152336004820152611b7c926001600160a01b039081169216906370a082319060240160206040518083038186803b15801561300657600080fd5b505afa15801561301a573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906106ba91906150b5565b613046613dde565b61304e613e38565b603860009054906101000a90046001600160a01b03166001600160a01b03166364c8bb7e6040518163ffffffff1660e01b815260040160206040518083038186803b15801561309c57600080fd5b505afa1580156130b0573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906130d491906150b5565b34146130f25760405162461bcd60e51b81526004016109ff90615152565b6130fa613ef1565b60345460405163860a19f160e01b81526001600160a01b039091169063860a19f190611abc90339086908690600401615565565b613136613e38565b60005b8151811015610d755760345482516001600160a01b039091169063f637434090339085908590811061316d5761316d6154f2565b60200260200101516040518363ffffffff1660e01b81526004016131929291906153e5565b600060405180830381600087803b1580156131ac57600080fd5b505af11580156131c0573d6000803e3d6000fd5b50505050806131ce90615508565b9050613139565b6131dd613dde565b6131e5613e38565b603860009054906101000a90046001600160a01b03166001600160a01b031663ce9e80096040518163ffffffff1660e01b815260040160206040518083038186803b15801561323357600080fd5b505afa158015613247573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061326b91906150b5565b34146132895760405162461bcd60e51b81526004016109ff9061511b565b613291613ef1565b6033546040516329f054e360e11b81526004810183905233602482015260448101859052606481018490526001600160a01b03909116906353e0a9c690608401600060405180830381600087803b1580156132eb57600080fd5b505af11580156132ff573d6000803e3d6000fd5b50505050611fd260018055565b613314613dde565b600361331f81614076565b603a54604051632770a7eb60e21b81526001600160a01b0390911690639dc29fac9061335190339086906004016153e5565b600060405180830381600087803b15801561336b57600080fd5b505af115801561337f573d6000803e3d6000fd5b5050505081603b60008282546133959190615103565b909155505060405182815233907fdb51c893ac5e7277a38c5de5faaac46089227b2ae9076d223b8a7685cd80611c9060200160405180910390a25061136c60018055565b60046133e481614076565b603a54600160a01b900460ff161561342c5760405162461bcd60e51b815260206004820152600b60248201526a1a5b9a5d1a585b1a5e995960aa1b60448201526064016109ff565b6001600160a01b0386163b61347a5760405162461bcd60e51b81526020600482015260146024820152731c1c9a58d953585b9859d95c881a5b9d985b1a5960621b60448201526064016109ff565b6001600160a01b0385163b6134d15760405162461bcd60e51b815260206004820152601760248201527f73657474696e67734d616e6167657220696e76616c696400000000000000000060448201526064016109ff565b6001600160a01b0384163b6135205760405162461bcd60e51b81526020600482015260156024820152741c1bdcda5d1a5bdb95985d5b1d081a5b9d985b1a59605a1b60448201526064016109ff565b6001600160a01b0383163b61356c5760405162461bcd60e51b81526020600482015260126024820152711bdc99195c95985d5b1d081a5b9d985b1a5960721b60448201526064016109ff565b6001600160a01b0382163b6135bc5760405162461bcd60e51b81526020600482015260166024820152751b1a5c5d5a59185d1955985d5b1d081a5b9d985b1a5960521b60448201526064016109ff565b50603780546001600160a01b039687166001600160a01b031991821617909155603880549587169582169590951790945560338054938616938516939093179092556034805491851691841691909117905560358054919093169116179055603a805460ff60a01b1916600160a01b179055565b6000613640600160f01b856153d1565b90506000600160e81b613657600160f01b876154de565b61366191906153d1565b905060006136706080836153d1565b600114905060006136826080846154de565b60038111156136935761369361509f565b60408051600480825260a082019092529192508891600091602082016080803683370190505090506136c9600160801b896153d1565b816000815181106136dc576136dc6154f2565b60209081029190910101526136f5600160801b896154de565b81600181518110613708576137086154f2565b6020908102919091010152613721600160801b886153d1565b81600281518110613734576137346154f2565b602090810291909101015261374d600160801b886154de565b81600381518110613760576137606154f2565b6020026020010181815250506137798685858486612dba565b505050505050505050565b61378c614005565b611fd283838361419d565b603d546040516370a0823160e01b81523360048201819052611b7c9290916001600160a01b039091169081906370a082319060240160206040518083038186803b1580156137e457600080fd5b505afa1580156137f8573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061067a91906150b5565b613824613dde565b61382c613e38565b603854604051633394ce3b60e21b81526001600160a01b0384811660048301529091169063ce5338ec9060240160206040518083038186803b15801561387157600080fd5b505afa158015613885573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906138a99190615523565b6138ec5760405162461bcd60e51b81526020600482015260146024820152731dda5d1a191c985dc81b9bdd08185b1b1bddd95960621b60448201526064016109ff565b6000811161390c5760405162461bcd60e51b81526004016109ff90615540565b60385460405163a9b9e38960e01b81523360048201526001600160a01b039091169063a9b9e3899060240160206040518083038186803b15801561394f57600080fd5b505afa158015613963573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906139879190615523565b156139c55760405162461bcd60e51b815260206004820152600e60248201526d1058d8dbdd5b9d0818985b9b995960921b60448201526064016109ff565b603a54604051632770a7eb60e21b81526001600160a01b0390911690639dc29fac906139f790339085906004016153e5565b600060405180830381600087803b158015613a1157600080fd5b505af1158015613a25573d6000803e3d6000fd5b5050603854604051631ac3ddeb60e01b81526001600160a01b03868116600483015260009450620186a0935090911690631ac3ddeb9060240160206040518083038186803b158015613a7657600080fd5b505afa158015613a8a573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190613aae91906150b5565b613ab890846150e4565b613ac291906153d1565b9050613ad08160008061419d565b6037546000906001600160a01b03166368ce13d685613aef8587615229565b6040518363ffffffff1660e01b8152600401613b0c9291906153e5565b60206040518083038186803b158015613b2457600080fd5b505afa158015613b38573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190613b5c91906150b5565b9050613b726001600160a01b03851633836146f5565b6040805160008152602081018390526001600160a01b0386169133917ffeb2000dca3e617cd6f3a8bbb63014bb54a124aac6ccbf73ee7229b4cd01f120910160405180910390a35050610d7560018055565b613bcc613dde565b6003613bd781614076565b60385460405163a9b9e38960e01b81526001600160a01b0384811660048301529091169063a9b9e3899060240160206040518083038186803b158015613c1c57600080fd5b505afa158015613c30573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190613c549190615523565b613c905760405162461bcd60e51b815260206004820152600d60248201526c3737ba1032bc383637b4ba32b960991b60448201526064016109ff565b603a546040516370a0823160e01b81526001600160a01b03848116600483015260009216906370a082319060240160206040518083038186803b158015613cd657600080fd5b505afa158015613cea573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190613d0e91906150b5565b603a54604051632770a7eb60e21b81529192506001600160a01b031690639dc29fac90613d4190869085906004016153e5565b600060405180830381600087803b158015613d5b57600080fd5b505af1158015613d6f573d6000803e3d6000fd5b5050505080603b6000828254613d859190615103565b90915550506040518181526001600160a01b038416907f4051ba94e08bb094159fc38391422b4b8ccfd2b1f8919c0eb37bb042d4b9cd8e9060200160405180910390a2505061136c60018055565b610d7533838361211e565b60026001541415613e315760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c0060448201526064016109ff565b6002600155565b60385460405163a9b9e38960e01b81523360048201526001600160a01b039091169063a9b9e3899060240160206040518083038186803b158015613e7b57600080fd5b505afa158015613e8f573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190613eb39190615523565b15611b7c5760405162461bcd60e51b815260206004820152600e60248201526d1058d8dbdd5b9d0818985b9b995960921b60448201526064016109ff565b6038546040805163d0fb020360e01b815290516000926001600160a01b03169163d0fb0203916004808301926020929190829003018186803b158015613f3657600080fd5b505afa158015613f4a573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190613f6e9190615595565b6001600160a01b03163460405160006040518083038185875af1925050503d8060008114613fb8576040519150601f19603f3d011682016040523d82523d6000602084013e613fbd565b606091505b505090508061136c5760405162461bcd60e51b815260206004820152600e60248201526d19985a5b1959081d1bc81cd95b9960921b60448201526064016109ff565b60018055565b6033546001600160a01b031633148061402857506035546001600160a01b031633145b8061403d57506034546001600160a01b031633145b611b7c5760405162461bcd60e51b815260206004820152600a60248201526913db9b1e481d985d5b1d60b21b60448201526064016109ff565b60365460405163df07560560e01b815233600482015282916001600160a01b03169063df0756059060240160206040518083038186803b1580156140b957600080fd5b505afa1580156140cd573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906140f191906150b5565b101561136c5760405162461bcd60e51b815260206004820152601060248201526f34b73b30b634b21037b832b930ba37b960811b60448201526064016109ff565b6040516001600160a01b038085166024830152831660448201526064810182905261139e9085906323b872dd60e01b906084015b60408051601f198184030181529190526020810180516001600160e01b03166001600160e01b031990931692909217909152614714565b8215611fd2576001600160a01b038216156143ab5760385460405163594ca01560e01b81526001600160a01b038481166004830152600092839291169063594ca01590602401604080518083038186803b1580156141fa57600080fd5b505afa15801561420e573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061423291906155b2565b9092509050620186a061424583876150e4565b61424f91906153d1565b9150620186a061425f82876150e4565b61426991906153d1565b603a546040516340c10f1960e01b81529192506001600160a01b0316906340c10f199061429c90879086906004016153e5565b600060405180830381600087803b1580156142b657600080fd5b505af11580156142ca573d6000803e3d6000fd5b50505050600081111561433c57603a546040516340c10f1960e01b81526001600160a01b03909116906340c10f199061430990869085906004016153e5565b600060405180830381600087803b15801561432357600080fd5b505af1158015614337573d6000803e3d6000fd5b505050505b6143468183615103565b6143509086615229565b9450826001600160a01b0316846001600160a01b03167f2210da9c25406cac50a7846052db53d49ec84390f83867c61e4091ac87ec939784846040516143a0929190918252602082015260400190565b60405180910390a350505b6001600160a01b03811615614531576001600160a01b038181166000908152603f60205260408082205460385491516319745e3960e11b8152908416600482018190529391909116906332e8bc729060240160206040518083038186803b15801561441557600080fd5b505afa158015614429573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061444d91906150b5565b9050801561452e57620186a061446382876150e4565b61446d91906153d1565b603a546040516340c10f1960e01b81529192506001600160a01b0316906340c10f19906144a090859085906004016153e5565b600060405180830381600087803b1580156144ba57600080fd5b505af11580156144ce573d6000803e3d6000fd5b5050505080856144de9190615229565b9450826001600160a01b0316826001600160a01b03167fa9d92ab9f19faecc65e4b397da6701d094f08143f98b735b7cd6332184bec0f18360405161452591815260200190565b60405180910390a35b50505b6000620186a0603860009054906101000a90046001600160a01b03166001600160a01b031663018f2d826040518163ffffffff1660e01b815260040160206040518083038186803b15801561458557600080fd5b505afa158015614599573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906145bd91906150b5565b6145c790866150e4565b6145d191906153d1565b905080603b60008282546145e59190615103565b9091555050603a546038546040805163d0fb020360e01b815290516001600160a01b03938416936340c10f1993169163d0fb0203916004808301926020929190829003018186803b15801561463957600080fd5b505afa15801561464d573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906146719190615595565b61467b8488615229565b6040518363ffffffff1660e01b81526004016146989291906153e5565b600060405180830381600087803b1580156146b257600080fd5b505af1158015610c79573d6000803e3d6000fd5b600054610100900460ff166146ed5760405162461bcd60e51b81526004016109ff906155d6565b611b7c6147e9565b611fd28363a9059cbb60e01b84846040516024016141669291906153e5565b6000614769826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b03166148109092919063ffffffff16565b905080516000148061478a57508080602001905181019061478a9190615523565b611fd25760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b60648201526084016109ff565b600054610100900460ff16613fff5760405162461bcd60e51b81526004016109ff906155d6565b606061481f8484600085614827565b949350505050565b6060824710156148885760405162461bcd60e51b815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f6044820152651c8818d85b1b60d21b60648201526084016109ff565b600080866001600160a01b031685876040516148a4919061564d565b60006040518083038185875af1925050503d80600081146148e1576040519150601f19603f3d011682016040523d82523d6000602084013e6148e6565b606091505b50915091506148f787838387614902565b979650505050505050565b6060831561496e578251614967576001600160a01b0385163b6149675760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e747261637400000060448201526064016109ff565b508161481f565b61481f83838151156149835781518083602001fd5b8060405162461bcd60e51b81526004016109ff9190615669565b801515811461136c57600080fd5b80356149b68161499d565b919050565b8035600481106149b657600080fd5b634e487b7160e01b600052604160045260246000fd5b604051610140810167ffffffffffffffff81118282101715614a0457614a046149ca565b60405290565b604051601f8201601f1916810167ffffffffffffffff81118282101715614a3357614a336149ca565b604052919050565b600067ffffffffffffffff821115614a5557614a556149ca565b5060051b60200190565b600082601f830112614a7057600080fd5b81356020614a85614a8083614a3b565b614a0a565b82815260059290921b84018101918181019086841115614aa457600080fd5b8286015b84811015614abf5780358352918301918301614aa8565b509695505050505050565b6001600160a01b038116811461136c57600080fd5b80356149b681614aca565b600082601f830112614afb57600080fd5b81356020614b0b614a8083614a3b565b82815260059290921b84018101918181019086841115614b2a57600080fd5b8286015b84811015614abf578035614b418161499d565b8352918301918301614b2e565b600080600080600080600080610100898b031215614b6b57600080fd5b88359750614b7b60208a016149ab565b9650614b8960408a016149bb565b9550606089013567ffffffffffffffff80821115614ba657600080fd5b614bb28c838d01614a5f565b9650614bc060808c01614adf565b955060a08b0135915080821115614bd657600080fd5b614be28c838d01614aea565b945060c08b0135915080821115614bf857600080fd5b614c048c838d01614a5f565b935060e08b0135915080821115614c1a57600080fd5b50614c278b828c01614a5f565b9150509295985092959890939650565b60008060408385031215614c4a57600080fd5b8235614c5581614aca565b946020939093013593505050565b600060208284031215614c7557600080fd5b8135614c8081614aca565b9392505050565b600060208284031215614c9957600080fd5b5035919050565b60008060408385031215614cb357600080fd5b50508035926020909101359150565b60008060008060808587031215614cd857600080fd5b5050823594602084013594506040840135936060013592509050565b600080600060408486031215614d0957600080fd5b83359250602084013567ffffffffffffffff80821115614d2857600080fd5b818601915086601f830112614d3c57600080fd5b813581811115614d4b57600080fd5b8760208260051b8501011115614d6057600080fd5b6020830194508093505050509250925092565b60008060008060808587031215614d8957600080fd5b84359350602085013567ffffffffffffffff80821115614da857600080fd5b614db488838901614aea565b94506040870135915080821115614dca57600080fd5b614dd688838901614a5f565b93506060870135915080821115614dec57600080fd5b50614df987828801614a5f565b91505092959194509250565b600080600080600060a08688031215614e1d57600080fd5b853594506020860135935060408601359250606086013591506080860135614e448161499d565b809150509295509295909350565b60008060408385031215614e6557600080fd5b8235614c558161499d565b600080600060608486031215614e8557600080fd5b8335614e9081614aca565b92506020840135614ea081614aca565b929592945050506040919091013590565b600080600060608486031215614ec657600080fd5b8335614ed181614aca565b92506020840135614ee181614aca565b91506040840135614ef181614aca565b809150509250925092565b600080600080600060a08688031215614f1457600080fd5b853594506020860135614f268161499d565b9350614f34604087016149bb565b9250606086013567ffffffffffffffff811115614f5057600080fd5b614f5c88828901614a5f565b9250506080860135614e4481614aca565b60008060408385031215614f8057600080fd5b82359150602083013567ffffffffffffffff811115614f9e57600080fd5b614faa85828601614a5f565b9150509250929050565b600060208284031215614fc657600080fd5b813567ffffffffffffffff811115614fdd57600080fd5b61481f84828501614a5f565b600080600060608486031215614ffe57600080fd5b505081359360208301359350604090920135919050565b600080600080600060a0868803121561502d57600080fd5b853561503881614aca565b9450602086013561504881614aca565b9350604086013561505881614aca565b9250606086013561506881614aca565b91506080860135614e4481614aca565b60008060006060848603121561508d57600080fd5b833592506020840135614ee181614aca565b634e487b7160e01b600052602160045260246000fd5b6000602082840312156150c757600080fd5b5051919050565b634e487b7160e01b600052601160045260246000fd5b60008160001904831182151516156150fe576150fe6150ce565b500290565b60008219821115615116576151166150ce565b500190565b60208082526019908201527f696e76616c6964206d61726b65744f7264657247617346656500000000000000604082015260600190565b602080825260159082015274696e76616c6964207472696767657247617346656560581b604082015260600190565b600081518084526020808501945080840160005b838110156151b157815187529582019590820190600101615195565b509495945050505050565b6001600160a01b038781168252602082018790528515156040830152600090600486106151f957634e487b7160e01b600052602160045260246000fd5b85606084015260c0608084015261521360c0840186615181565b915080841660a084015250979650505050505050565b60008282101561523b5761523b6150ce565b500390565b8581526001600160a01b03851660208083019190915260a06040830181905285519083018190526000918681019160c0850190845b81811015615293578451151583529383019391830191600101615275565b505084810360608601526152a78188615181565b9250505082810360808401526152bd8185615181565b98975050505050505050565b600181815b808511156153045781600019048211156152ea576152ea6150ce565b808516156152f757918102915b93841c93908002906152ce565b509250929050565b60008261531b575060016153a9565b81615328575060006153a9565b816001811461533e576002811461534857615364565b60019150506153a9565b60ff841115615359576153596150ce565b50506001821b6153a9565b5060208310610133831016604e8410600b8410161715615387575081810a6153a9565b61539183836152c9565b80600019048211156153a5576153a56150ce565b0290505b92915050565b6000614c80838361530c565b634e487b7160e01b600052601260045260246000fd5b6000826153e0576153e06153bb565b500490565b6001600160a01b03929092168252602082015260400190565b80516149b681614aca565b80516149b68161499d565b6000610140828403121561542757600080fd5b61542f6149e0565b615438836153fe565b8152615446602084016153fe565b602082015261545760408401615409565b6040820152606083015160608201526080830151608082015260a083015160a082015260c083015160c082015260e083015160e08201526101008084015181830152506101208084015181830152508091505092915050565b6000806000606084860312156154c557600080fd5b8351925060208401519150604084015190509250925092565b6000826154ed576154ed6153bb565b500690565b634e487b7160e01b600052603260045260246000fd5b600060001982141561551c5761551c6150ce565b5060010190565b60006020828403121561553557600080fd5b8151614c808161499d565b6020808252600b908201526a1e995c9bc8185b5bdd5b9d60aa1b604082015260600190565b60018060a01b038416815282602082015260606040820152600061558c6060830184615181565b95945050505050565b6000602082840312156155a757600080fd5b8151614c8081614aca565b600080604083850312156155c557600080fd5b505080516020909101519092909150565b6020808252602b908201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960408201526a6e697469616c697a696e6760a81b606082015260800190565b60005b8381101561563c578181015183820152602001615624565b8381111561139e5750506000910152565b6000825161565f818460208701615621565b9190910192915050565b6020815260008251806020840152615688816040850160208701615621565b601f01601f1916919091016040019291505056fea2646970667358221220c9fa499dffdb62f0d62ab02d14e44947e6de11c7c6c3160509d112b011514d1964736f6c63430008090033
Loading...
Loading
Loading...
Loading
Multichain Portfolio | 35 Chains
Chain | Token | Portfolio % | Price | Amount | Value |
---|---|---|---|---|---|
BASE | 100.00% | $2,007.49 | 0.0908 | $182.29 |
Loading...
Loading
Loading...
Loading
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.