Source Code
Overview
ETH Balance
0 ETH
Eth Value
$0.00| Transaction Hash |
Method
|
Block
|
From
|
|
To
|
||||
|---|---|---|---|---|---|---|---|---|---|
Latest 1 internal transaction
Advanced mode:
| Parent Transaction Hash | Method | Block |
From
|
|
To
|
||
|---|---|---|---|---|---|---|---|
| - | 13854995 | 1504 days ago | Contract Creation | 0 ETH |
Loading...
Loading
Loading...
Loading
Cross-Chain Transactions
Loading...
Loading
Similar Match Source Code This contract matches the deployed Bytecode of the Source Code for Contract 0x948D33a9...E5b6693e8 The constructor portion of the code might be different and could alter the actual behaviour of the contract
Contract Name:
CreditFilter
Compiler Version
v0.7.6+commit.7338295f
Optimization Enabled:
No with 200 runs
Other Settings:
default evmVersion
Contract Source Code (Solidity Standard Json-Input format)
// SPDX-License-Identifier: BUSL-1.1
// Gearbox Protocol. Generalized leverage for DeFi protocols
// (c) Gearbox Holdings, 2021
pragma solidity ^0.7.4;
pragma abicoder v2;
import {SafeMath} from "@openzeppelin/contracts/math/SafeMath.sol";
import {IERC20} from "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import {EnumerableSet} from "@openzeppelin/contracts/utils/EnumerableSet.sol";
import {PercentageMath} from "../libraries/math/PercentageMath.sol";
import {ICreditManager} from "../interfaces/ICreditManager.sol";
import {ICreditAccount} from "../interfaces/ICreditAccount.sol";
import {IPriceOracle} from "../interfaces/IPriceOracle.sol";
import {ICreditFilter} from "../interfaces/ICreditFilter.sol";
import {IPoolService} from "../interfaces/IPoolService.sol";
import {AddressProvider} from "../core/AddressProvider.sol";
import {ACLTrait} from "../core/ACLTrait.sol";
import {Constants} from "../libraries/helpers/Constants.sol";
import {Errors} from "../libraries/helpers/Errors.sol";
/// @title CreditFilter
/// @notice Implements filter logic for allowed tokens & contract-adapters
/// - Sets/Gets tokens for allowed tokens list
/// - Sets/Gets adapters & allowed contracts
/// - Calculates total value for credit account
/// - Calculates threshold weighted value for credit account
/// - Keeps enabled tokens for credit accounts
///
/// More: https://dev.gearbox.fi/developers/credit/credit-filter
contract CreditFilter is ICreditFilter, ACLTrait {
using SafeMath for uint256;
using EnumerableSet for EnumerableSet.AddressSet;
AddressProvider public addressProvider;
// Address of credit Manager
address public creditManager;
// Allowed tokens list
mapping(address => bool) public override isTokenAllowed;
// Allowed tokens array
address[] public override allowedTokens;
// Allowed contracts list
mapping(address => uint256) public override liquidationThresholds;
// map token address to its mask
mapping(address => uint256) public tokenMasksMap;
// credit account token enables mask. each bit (in order as tokens stored in allowedTokens array) set 1 if token was enable
mapping(address => uint256) public override enabledTokens;
// keeps last block we use fast check. Fast check is not allowed to use more than one time in block
mapping(address => uint256) public fastCheckCounter;
// Allowed contracts array
EnumerableSet.AddressSet private allowedContractsSet;
// Allowed adapters list
mapping(address => bool) public allowedAdapters;
// Mapping from allowed contract to allowed adapters
// If contract is not allowed, contractToAdapter[contract] == address(0)
mapping(address => address) public override contractToAdapter;
// Price oracle - uses in evaluation credit account
address public override priceOracle;
// Underlying token address
address public override underlyingToken;
// Pooll Service address
address public poolService;
// Address of WETH token
address public wethAddress;
// Minimum chi threshold for fast check
uint256 public chiThreshold;
// Maxmimum allowed fast check operations between full health factor checks
uint256 public hfCheckInterval;
// Allowed transfers
mapping(address => mapping(address => bool)) transfersAllowed;
// Allowed plugins
mapping(address => bool) public allowedPlugins;
// Contract version
uint256 public constant version = 1;
/// Checks that sender is connected credit manager
modifier creditManagerOnly {
require(msg.sender == creditManager, Errors.CF_CREDIT_MANAGERS_ONLY); // T:[CF-20]
_;
}
/// Checks that sender is adapter
modifier adapterOnly {
require(allowedAdapters[msg.sender], Errors.CF_ADAPTERS_ONLY); // T:[CF-20]
_;
}
constructor(address _addressProvider, address _underlyingToken)
ACLTrait(_addressProvider)
{
require(
_addressProvider != address(0) && _underlyingToken != address(0),
Errors.ZERO_ADDRESS_IS_NOT_ALLOWED
);
addressProvider = AddressProvider(_addressProvider);
priceOracle = addressProvider.getPriceOracle(); // T:[CF-21]
wethAddress = addressProvider.getWethToken(); // T:[CF-21]
underlyingToken = _underlyingToken; // T:[CF-21]
liquidationThresholds[underlyingToken] = Constants
.UNDERLYING_TOKEN_LIQUIDATION_THRESHOLD; // T:[CF-21]
_allowToken(
underlyingToken,
Constants.UNDERLYING_TOKEN_LIQUIDATION_THRESHOLD
); // T:[CF-8, 21]
_setFastCheckParameters(
Constants.CHI_THRESHOLD,
Constants.HF_CHECK_INTERVAL_DEFAULT
); // T:[CF-21]
allowedPlugins[addressProvider.getWETHGateway()] = true;
}
//
// STATE-CHANGING FUNCTIONS
//
/// @dev Adds token to the list of allowed tokens
/// @param token Address of allowed token
/// @param liquidationThreshold The credit Manager constant showing the maximum allowable ratio of Loan-To-Value for the i-th asset.
function allowToken(address token, uint256 liquidationThreshold)
external
override
configuratorOnly // T:[CF-1]
{
_allowToken(token, liquidationThreshold);
}
function _allowToken(address token, uint256 liquidationThreshold) internal {
require(token != address(0), Errors.ZERO_ADDRESS_IS_NOT_ALLOWED); // T:[CF-2]
require(
liquidationThreshold > 0 &&
liquidationThreshold <= liquidationThresholds[underlyingToken],
Errors.CF_INCORRECT_LIQUIDATION_THRESHOLD
); // T:[CF-3]
require(
tokenMasksMap[token] > 0 || allowedTokens.length < 256,
Errors.CF_TOO_MUCH_ALLOWED_TOKENS
); // T:[CF-5]
// Checks that contract has balanceOf method and it returns uint256
require(IERC20(token).balanceOf(address(this)) >= 0); // T:[CF-11]
// Checks that pair token - underlyingToken has priceFeed
require(
IPriceOracle(priceOracle).getLastPrice(token, underlyingToken) > 0,
Errors.CF_INCORRECT_PRICEFEED
);
// we add allowed tokens to array if it wasn't added before
// T:[CF-6] controls that
if (!isTokenAllowed[token]) {
isTokenAllowed[token] = true; // T:[CF-4]
tokenMasksMap[token] = 1 << allowedTokens.length; // T:[CF-4]
allowedTokens.push(token); // T:[CF-4]
}
liquidationThresholds[token] = liquidationThreshold; // T:[CF-4, 6]
emit TokenAllowed(token, liquidationThreshold); // T:[CF-4]
}
/// @dev Forbid token. To allow token one more time use allowToken function
/// @param token Address of forbidden token
function forbidToken(address token)
external
configuratorOnly // T:[CF-1]
{
isTokenAllowed[token] = false; // T: [CF-35, 36]
emit TokenForbidden(token);
}
/// @dev Adds contract and adapter to the list of allowed contracts
/// if contract exists it updates adapter only
/// @param targetContract Address of allowed contract
/// @param adapter Adapter contract address
function allowContract(address targetContract, address adapter)
external
override
configuratorOnly // T:[CF-1]
{
require(
targetContract != address(0) && adapter != address(0),
Errors.ZERO_ADDRESS_IS_NOT_ALLOWED
); // T:[CF-2]
require(
allowedAdapters[adapter] == false,
Errors.CF_ADAPTER_CAN_BE_USED_ONLY_ONCE
); // ToDo: add check
// Remove previous adapter from allowed list and set up new one
allowedAdapters[contractToAdapter[targetContract]] = false; // T:[CF-10]
allowedAdapters[adapter] = true; // T:[CF-9, 10]
allowedContractsSet.add(targetContract);
contractToAdapter[targetContract] = adapter; // T:[CF-9, 10]
emit ContractAllowed(targetContract, adapter); // T:[CF-12]
}
/// @dev Forbids contract to use with credit manager
/// @param targetContract Address of contract to be forbidden
function forbidContract(address targetContract)
external
override
configuratorOnly // T:[CF-1]
{
require(
targetContract != address(0),
Errors.ZERO_ADDRESS_IS_NOT_ALLOWED
); // T:[CF-2]
require(
allowedContractsSet.remove(targetContract),
Errors.CF_CONTRACT_IS_NOT_IN_ALLOWED_LIST
); // T:[CF-31]
// Remove previous adapter from allowed list
allowedAdapters[contractToAdapter[targetContract]] = false; // T:[CF-32]
// Sets adapter to address(0), which means to forbid it usage
contractToAdapter[targetContract] = address(0); // T:[CF-32]
emit ContractForbidden(targetContract); // T:[CF-32]
}
/// @dev Connects credit manager and checks that it has the same underlying token as pool
function connectCreditManager(address _creditManager)
external
override
configuratorOnly // T:[CF-1]
{
require(
_creditManager != address(0),
Errors.ZERO_ADDRESS_IS_NOT_ALLOWED
);
require(
creditManager == address(0),
Errors.CF_CREDIT_MANAGER_IS_ALREADY_SET
); // T:[CF-9,13]
creditManager = _creditManager; // T:[CF-14]
poolService = ICreditManager(_creditManager).poolService(); // T:[CF-14]
require(
IPoolService(poolService).underlyingToken() == underlyingToken,
Errors.CF_UNDERLYING_TOKEN_FILTER_CONFLICT
); // T:[CF-16]
}
function upgradePriceOracle() external configuratorOnly {
priceOracle = addressProvider.getPriceOracle(); // ToDo:
emit PriceOracleUpdated(priceOracle);
}
/// @dev Checks the financial order and reverts if tokens aren't in list or collateral protection alerts
/// @param creditAccount Address of credit account
/// @param tokenIn Address of token In in swap operation
/// @param tokenOut Address of token Out in swap operation
/// @param amountIn Amount of tokens in
/// @param amountOut Amount of tokens out
function checkCollateralChange(
address creditAccount,
address tokenIn,
address tokenOut,
uint256 amountIn,
uint256 amountOut
)
external
override
adapterOnly // T:[CF-20]
{
_checkAndEnableToken(creditAccount, tokenOut); // T:[CF-22]
// Convert to WETH is more gas efficient and doesn't make difference for ratio
uint256 amountInCollateral = IPriceOracle(priceOracle).convert(
amountIn,
tokenIn,
wethAddress
); // T:[CF-24]
// Convert to WETH is more gas efficient and doesn't make difference for ratio
uint256 amountOutCollateral = IPriceOracle(priceOracle).convert(
amountOut,
tokenOut,
wethAddress
); // T:[CF-24]
_checkCollateral(
creditAccount,
amountInCollateral,
amountOutCollateral
);
}
/// @dev Checks collateral for operation which returns more than 1 token
/// @param creditAccount Address of credit account
/// @param tokenOut Addresses of returned tokens
function checkMultiTokenCollateral(
address creditAccount,
uint256[] memory amountIn,
uint256[] memory amountOut,
address[] memory tokenIn,
address[] memory tokenOut
)
external
override
adapterOnly // T:[CF-20]
{
// Convert to WETH is more gas efficient and doesn't make difference for ratio
uint256 amountInCollateral;
uint256 amountOutCollateral;
require(
amountIn.length == tokenIn.length &&
amountOut.length == tokenOut.length,
Errors.INCORRECT_ARRAY_LENGTH
);
for (uint256 i = 0; i < amountIn.length; i++) {
amountInCollateral = amountInCollateral.add(
IPriceOracle(priceOracle).convert(
amountIn[i],
tokenIn[i],
wethAddress
)
);
}
for (uint256 i = 0; i < amountOut.length; i++) {
_checkAndEnableToken(creditAccount, tokenOut[i]); // T: [CF-33]
amountOutCollateral = amountOutCollateral.add(
IPriceOracle(priceOracle).convert(
amountOut[i],
tokenOut[i],
wethAddress
)
);
}
_checkCollateral(
creditAccount,
amountInCollateral,
amountOutCollateral
); // T: [CF-33]
}
/// @dev Checks health factor after operations
/// @param creditAccount Address of credit account
function _checkCollateral(
address creditAccount,
uint256 collateralIn,
uint256 collateralOut
) internal {
if (
(collateralOut.mul(PercentageMath.PERCENTAGE_FACTOR) >
collateralIn.mul(chiThreshold)) &&
fastCheckCounter[creditAccount] <= hfCheckInterval
) {
fastCheckCounter[creditAccount]++; // T:[CF-25, 33]
} else {
// Require Hf > 1
require(
calcCreditAccountHealthFactor(creditAccount) >=
PercentageMath.PERCENTAGE_FACTOR,
Errors.CF_OPERATION_LOW_HEALTH_FACTOR
); // T:[CF-25, 33, 34]
fastCheckCounter[creditAccount] = 1; // T:[CF-34]
}
}
/// @dev Initializes enabled tokens
function initEnabledTokens(address creditAccount)
external
override
creditManagerOnly // T:[CF-20]
{
// at opening account underlying token is enabled only
enabledTokens[creditAccount] = 1; // T:[CF-19]
fastCheckCounter[creditAccount] = 1; // T:[CF-19]
}
/// @dev Checks that token is in allowed list and updates enabledTokenMask
/// for provided credit account if needed
/// @param creditAccount Address of credit account
/// @param token Address of token to be checked
function checkAndEnableToken(address creditAccount, address token)
external
override
creditManagerOnly // T:[CF-20]
{
_checkAndEnableToken(creditAccount, token); // T:[CF-22, 23]
}
/// @dev Checks that token is in allowed list and updates enabledTokenMask
/// for provided credit account if needed
/// @param creditAccount Address of credit account
/// @param token Address of token to be checked
function _checkAndEnableToken(address creditAccount, address token)
internal
{
revertIfTokenNotAllowed(token); //T:[CF-22, 36]
if (enabledTokens[creditAccount] & tokenMasksMap[token] == 0) {
enabledTokens[creditAccount] =
enabledTokens[creditAccount] |
tokenMasksMap[token];
} // T:[CF-23]
}
/// @dev Sets fast check parameters chi & hfCheckCollateral
/// It reverts if 1 - chi ** hfCheckCollateral > feeLiquidation
function setFastCheckParameters(
uint256 _chiThreshold,
uint256 _hfCheckInterval
)
external
configuratorOnly // T:[CF-1]
{
_setFastCheckParameters(_chiThreshold, _hfCheckInterval);
}
function _setFastCheckParameters(
uint256 _chiThreshold,
uint256 _hfCheckInterval
) internal {
chiThreshold = _chiThreshold; // T:[CF-30]
hfCheckInterval = _hfCheckInterval; // T:[CF-30]
revertIfIncorrectFastCheckParams();
emit NewFastCheckParameters(_chiThreshold, _hfCheckInterval); // T:[CF-30]
}
/// @dev It updates liquidation threshold for underlying token threshold
/// to have enough buffer for liquidation (liquidaion premium + fee liq.)
/// It reverts if that buffer is less with new paremters, or there is any
/// liquidaiton threshold > new LT
function updateUnderlyingTokenLiquidationThreshold()
external
override
creditManagerOnly // T:[CF-20]
{
require(
ICreditManager(creditManager).feeInterest() <
PercentageMath.PERCENTAGE_FACTOR &&
ICreditManager(creditManager).feeLiquidation() <
PercentageMath.PERCENTAGE_FACTOR &&
ICreditManager(creditManager).liquidationDiscount() <
PercentageMath.PERCENTAGE_FACTOR,
Errors.CM_INCORRECT_FEES
); // T:[CM-36]
// Otherwise, new credit account will be immediately liquidated
require(
ICreditManager(creditManager).minHealthFactor() >
PercentageMath.PERCENTAGE_FACTOR,
Errors.CM_MAX_LEVERAGE_IS_TOO_HIGH
); // T:[CM-40]
liquidationThresholds[underlyingToken] = ICreditManager(creditManager)
.liquidationDiscount()
.sub(ICreditManager(creditManager).feeLiquidation()); // T:[CF-38]
for (uint256 i = 1; i < allowedTokens.length; i++) {
require(
liquidationThresholds[allowedTokens[i]] <=
liquidationThresholds[underlyingToken],
Errors.CF_SOME_LIQUIDATION_THRESHOLD_MORE_THAN_NEW_ONE
); // T:[CF-39]
}
revertIfIncorrectFastCheckParams(); // T:[CF-39]
}
/// @dev It checks that 1 - chi ** hfCheckInterval < feeLiquidation
function revertIfIncorrectFastCheckParams() internal view {
// if credit manager is set, we add additional check
if (creditManager != address(0)) {
// computes maximum possible collateral drop between two health factor checks
uint256 maxPossibleDrop = PercentageMath.PERCENTAGE_FACTOR.sub(
calcMaxPossibleDrop(chiThreshold, hfCheckInterval)
); // T:[CF-39]
require(
maxPossibleDrop <
ICreditManager(creditManager).feeLiquidation(),
Errors.CF_FAST_CHECK_NOT_COVERED_COLLATERAL_DROP
); // T:[CF-39]
}
}
// @dev it computes percentage ** times
// @param percentage Percentage in PERCENTAGE FACTOR format
function calcMaxPossibleDrop(uint256 percentage, uint256 times)
public
pure
returns (uint256 value)
{
value = PercentageMath.PERCENTAGE_FACTOR.mul(percentage); // T:[CF-37]
for (uint256 i = 0; i < times.sub(1); i++) {
value = value.mul(percentage).div(PercentageMath.PERCENTAGE_FACTOR); // T:[CF-37]
}
value = value.div(PercentageMath.PERCENTAGE_FACTOR); // T:[CF-37]
}
//
// GETTERS
//
/// @dev Calculates total value for provided address
/// More: https://dev.gearbox.fi/developers/credit/economy#total-value
///
/// @param creditAccount Token creditAccount address
function calcTotalValue(address creditAccount)
external
view
override
returns (uint256 total)
{
uint256 tokenMask;
uint256 eTokens = enabledTokens[creditAccount];
for (uint256 i = 0; i < allowedTokens.length; i++) {
tokenMask = 1 << i; // T:[CF-17]
if (eTokens & tokenMask > 0) {
(, , uint256 tv, ) = getCreditAccountTokenById(
creditAccount,
i
);
total = total.add(tv);
} // T:[CF-17]
}
}
/// @dev Calculates Threshold Weighted Total Value
/// More: https://dev.gearbox.fi/developers/credit/economy#threshold-weighted-value
///
/// @param creditAccount Credit account address
function calcThresholdWeightedValue(address creditAccount)
public
view
override
returns (uint256 total)
{
uint256 tokenMask;
uint256 eTokens = enabledTokens[creditAccount];
for (uint256 i = 0; i < allowedTokens.length; i++) {
tokenMask = 1 << i; // T:[CF-18]
if (eTokens & tokenMask > 0) {
(, , , uint256 twv) = getCreditAccountTokenById(
creditAccount,
i
);
total = total.add(twv);
}
} // T:[CF-18]
return total.div(PercentageMath.PERCENTAGE_FACTOR); // T:[CF-18]
}
/// @dev Returns quantity of tokens in allowed list
function allowedTokensCount() external view override returns (uint256) {
return allowedTokens.length; // T:[CF-4, 6]
}
/// @dev Reverts if token isn't in token allowed list
function revertIfTokenNotAllowed(address token) public view override {
require(isTokenAllowed[token], Errors.CF_TOKEN_IS_NOT_ALLOWED); // T:[CF-7, 36]
}
/// @dev Returns quantity of contracts in allowed list
function allowedContractsCount() external view override returns (uint256) {
return allowedContractsSet.length(); // T:[CF-9]
}
/// @dev Returns allowed contract by index
function allowedContracts(uint256 i)
external
view
override
returns (address)
{
return allowedContractsSet.at(i); // T:[CF-9]
}
/// @dev Returns address & balance of token by the id of allowed token in the list
/// @param creditAccount Credit account address
/// @param id Id of token in allowed list
/// @return token Address of token
/// @return balance Token balance
/// @return tv Balance converted to undelying asset using price oracle
/// @return tvw Balance converted to undelying asset using price oracle multipled with liquidation threshold
function getCreditAccountTokenById(address creditAccount, uint256 id)
public
view
override
returns (
address token,
uint256 balance,
uint256 tv,
uint256 tvw
)
{
token = allowedTokens[id]; // T:[CF-28]
balance = IERC20(token).balanceOf(creditAccount); // T:[CF-28]
// balance ==0 : T: [CF-28]
if (balance > 1) {
tv = IPriceOracle(priceOracle).convert(
balance,
token,
underlyingToken
); // T:[CF-28]
tvw = tv.mul(liquidationThresholds[token]); // T:[CF-28]
}
}
/// @dev Calculates credit account interest accrued
/// More: https://dev.gearbox.fi/developers/credit/economy#interest-rate-accrued
///
/// @param creditAccount Credit account address
function calcCreditAccountAccruedInterest(address creditAccount)
public
view
override
returns (uint256)
{
return
ICreditAccount(creditAccount)
.borrowedAmount()
.mul(IPoolService(poolService).calcLinearCumulative_RAY())
.div(ICreditAccount(creditAccount).cumulativeIndexAtOpen()); // T: [CF-26]
}
/**
* @dev Calculates health factor for the credit account
*
* sum(asset[i] * liquidation threshold[i])
* Hf = --------------------------------------------
* borrowed amount + interest accrued
*
*
* More info: https://dev.gearbox.fi/developers/credit/economy#health-factor
*
* @param creditAccount Credit account address
* @return Health factor in percents (see PERCENTAGE FACTOR in PercentageMath.sol)
*/
function calcCreditAccountHealthFactor(address creditAccount)
public
view
override
returns (uint256)
{
return
calcThresholdWeightedValue(creditAccount)
.mul(PercentageMath.PERCENTAGE_FACTOR)
.div(calcCreditAccountAccruedInterest(creditAccount)); // T:[CF-27]
}
function revertIfCantIncreaseBorrowing(
address creditAccount,
uint256 minHealthFactor
) external view override {
require(
calcCreditAccountHealthFactor(creditAccount) >= minHealthFactor,
Errors.CM_CAN_UPDATE_WITH_SUCH_HEALTH_FACTOR
); // T:[CM-28]
}
function approveAccountTransfers(address from, bool state)
external
override
{
transfersAllowed[from][msg.sender] = state; // T:[CF-43]
emit TransferAccountAllowed(from, msg.sender, state); // T:[CF-43]
}
function allowanceForAccountTransfers(address from, address to)
external
view
override
returns (bool)
{
return transfersAllowed[from][to]; // T:[CF-43]
}
function allowPlugin(address plugin, bool state) external configuratorOnly {
allowedPlugins[plugin] = state;
emit TransferPluginAllowed(plugin, state);
}
function revertIfAccountTransferIsNotAllowed(
address owner,
address newOwner
) external view override {
if (!allowedPlugins[owner] || allowedPlugins[newOwner]) {
require(
transfersAllowed[owner][newOwner],
Errors.CF_TRANSFER_IS_NOT_ALLOWED
); // T:[CF-43, 44]
}
}
}// SPDX-License-Identifier: MIT
pragma solidity >=0.6.0 <0.8.0;
/**
* @dev Wrappers over Solidity's arithmetic operations with added overflow
* checks.
*
* Arithmetic operations in Solidity wrap on overflow. This can easily result
* in bugs, because programmers usually assume that an overflow raises an
* error, which is the standard behavior in high level programming languages.
* `SafeMath` restores this intuition by reverting the transaction when an
* operation overflows.
*
* Using this library instead of the unchecked operations eliminates an entire
* class of bugs, so it's recommended to use it always.
*/
library SafeMath {
/**
* @dev Returns the addition of two unsigned integers, with an overflow flag.
*
* _Available since v3.4._
*/
function tryAdd(uint256 a, uint256 b) internal pure returns (bool, uint256) {
uint256 c = a + b;
if (c < a) return (false, 0);
return (true, c);
}
/**
* @dev Returns the substraction of two unsigned integers, with an overflow flag.
*
* _Available since v3.4._
*/
function trySub(uint256 a, uint256 b) internal pure returns (bool, uint256) {
if (b > a) return (false, 0);
return (true, a - b);
}
/**
* @dev Returns the multiplication of two unsigned integers, with an overflow flag.
*
* _Available since v3.4._
*/
function tryMul(uint256 a, uint256 b) internal pure returns (bool, uint256) {
// Gas optimization: this is cheaper than requiring 'a' not being zero, but the
// benefit is lost if 'b' is also tested.
// See: https://github.com/OpenZeppelin/openzeppelin-contracts/pull/522
if (a == 0) return (true, 0);
uint256 c = a * b;
if (c / a != b) return (false, 0);
return (true, c);
}
/**
* @dev Returns the division of two unsigned integers, with a division by zero flag.
*
* _Available since v3.4._
*/
function tryDiv(uint256 a, uint256 b) internal pure returns (bool, uint256) {
if (b == 0) return (false, 0);
return (true, a / b);
}
/**
* @dev Returns the remainder of dividing two unsigned integers, with a division by zero flag.
*
* _Available since v3.4._
*/
function tryMod(uint256 a, uint256 b) internal pure returns (bool, uint256) {
if (b == 0) return (false, 0);
return (true, a % b);
}
/**
* @dev Returns the addition of two unsigned integers, reverting on
* overflow.
*
* Counterpart to Solidity's `+` operator.
*
* Requirements:
*
* - Addition cannot overflow.
*/
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a, "SafeMath: addition overflow");
return c;
}
/**
* @dev Returns the subtraction of two unsigned integers, reverting on
* overflow (when the result is negative).
*
* Counterpart to Solidity's `-` operator.
*
* Requirements:
*
* - Subtraction cannot overflow.
*/
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
require(b <= a, "SafeMath: subtraction overflow");
return a - b;
}
/**
* @dev Returns the multiplication of two unsigned integers, reverting on
* overflow.
*
* Counterpart to Solidity's `*` operator.
*
* Requirements:
*
* - Multiplication cannot overflow.
*/
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) return 0;
uint256 c = a * b;
require(c / a == b, "SafeMath: multiplication overflow");
return c;
}
/**
* @dev Returns the integer division of two unsigned integers, reverting on
* division by zero. The result is rounded towards zero.
*
* Counterpart to Solidity's `/` operator. Note: this function uses a
* `revert` opcode (which leaves remaining gas untouched) while Solidity
* uses an invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
*
* - The divisor cannot be zero.
*/
function div(uint256 a, uint256 b) internal pure returns (uint256) {
require(b > 0, "SafeMath: division by zero");
return a / b;
}
/**
* @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),
* reverting when dividing by zero.
*
* Counterpart to Solidity's `%` operator. This function uses a `revert`
* opcode (which leaves remaining gas untouched) while Solidity uses an
* invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
*
* - The divisor cannot be zero.
*/
function mod(uint256 a, uint256 b) internal pure returns (uint256) {
require(b > 0, "SafeMath: modulo by zero");
return a % b;
}
/**
* @dev Returns the subtraction of two unsigned integers, reverting with custom message on
* overflow (when the result is negative).
*
* CAUTION: This function is deprecated because it requires allocating memory for the error
* message unnecessarily. For custom revert reasons use {trySub}.
*
* Counterpart to Solidity's `-` operator.
*
* Requirements:
*
* - Subtraction cannot overflow.
*/
function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b <= a, errorMessage);
return a - b;
}
/**
* @dev Returns the integer division of two unsigned integers, reverting with custom message on
* division by zero. The result is rounded towards zero.
*
* CAUTION: This function is deprecated because it requires allocating memory for the error
* message unnecessarily. For custom revert reasons use {tryDiv}.
*
* Counterpart to Solidity's `/` operator. Note: this function uses a
* `revert` opcode (which leaves remaining gas untouched) while Solidity
* uses an invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
*
* - The divisor cannot be zero.
*/
function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b > 0, errorMessage);
return a / b;
}
/**
* @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),
* reverting with custom message when dividing by zero.
*
* CAUTION: This function is deprecated because it requires allocating memory for the error
* message unnecessarily. For custom revert reasons use {tryMod}.
*
* Counterpart to Solidity's `%` operator. This function uses a `revert`
* opcode (which leaves remaining gas untouched) while Solidity uses an
* invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
*
* - The divisor cannot be zero.
*/
function mod(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b > 0, errorMessage);
return a % b;
}
}// SPDX-License-Identifier: MIT
pragma solidity >=0.6.0 <0.8.0;
/**
* @dev Interface of the ERC20 standard as defined in the EIP.
*/
interface IERC20 {
/**
* @dev Returns the amount of tokens in existence.
*/
function totalSupply() external view returns (uint256);
/**
* @dev Returns the amount of tokens owned by `account`.
*/
function balanceOf(address account) external view returns (uint256);
/**
* @dev Moves `amount` tokens from the caller's account to `recipient`.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* Emits a {Transfer} event.
*/
function transfer(address recipient, 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 `sender` to `recipient` 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 sender, address recipient, uint256 amount) external returns (bool);
/**
* @dev Emitted when `value` tokens are moved from one account (`from`) to
* another (`to`).
*
* Note that `value` may be zero.
*/
event Transfer(address indexed from, address indexed to, uint256 value);
/**
* @dev Emitted when the allowance of a `spender` for an `owner` is set by
* a call to {approve}. `value` is the new allowance.
*/
event Approval(address indexed owner, address indexed spender, uint256 value);
}// SPDX-License-Identifier: MIT
pragma solidity >=0.6.0 <0.8.0;
/**
* @dev Library for managing
* https://en.wikipedia.org/wiki/Set_(abstract_data_type)[sets] of primitive
* types.
*
* Sets have the following properties:
*
* - Elements are added, removed, and checked for existence in constant time
* (O(1)).
* - Elements are enumerated in O(n). No guarantees are made on the ordering.
*
* ```
* contract Example {
* // Add the library methods
* using EnumerableSet for EnumerableSet.AddressSet;
*
* // Declare a set state variable
* EnumerableSet.AddressSet private mySet;
* }
* ```
*
* As of v3.3.0, sets of type `bytes32` (`Bytes32Set`), `address` (`AddressSet`)
* and `uint256` (`UintSet`) are supported.
*/
library EnumerableSet {
// To implement this library for multiple types with as little code
// repetition as possible, we write it in terms of a generic Set type with
// bytes32 values.
// The Set implementation uses private functions, and user-facing
// implementations (such as AddressSet) are just wrappers around the
// underlying Set.
// This means that we can only create new EnumerableSets for types that fit
// in bytes32.
struct Set {
// Storage of set values
bytes32[] _values;
// Position of the value in the `values` array, plus 1 because index 0
// means a value is not in the set.
mapping (bytes32 => uint256) _indexes;
}
/**
* @dev Add a value to a set. O(1).
*
* Returns true if the value was added to the set, that is if it was not
* already present.
*/
function _add(Set storage set, bytes32 value) private returns (bool) {
if (!_contains(set, value)) {
set._values.push(value);
// The value is stored at length-1, but we add 1 to all indexes
// and use 0 as a sentinel value
set._indexes[value] = set._values.length;
return true;
} else {
return false;
}
}
/**
* @dev Removes a value from a set. O(1).
*
* Returns true if the value was removed from the set, that is if it was
* present.
*/
function _remove(Set storage set, bytes32 value) private returns (bool) {
// We read and store the value's index to prevent multiple reads from the same storage slot
uint256 valueIndex = set._indexes[value];
if (valueIndex != 0) { // Equivalent to contains(set, value)
// To delete an element from the _values array in O(1), we swap the element to delete with the last one in
// the array, and then remove the last element (sometimes called as 'swap and pop').
// This modifies the order of the array, as noted in {at}.
uint256 toDeleteIndex = valueIndex - 1;
uint256 lastIndex = set._values.length - 1;
// When the value to delete is the last one, the swap operation is unnecessary. However, since this occurs
// so rarely, we still do the swap anyway to avoid the gas cost of adding an 'if' statement.
bytes32 lastvalue = set._values[lastIndex];
// Move the last value to the index where the value to delete is
set._values[toDeleteIndex] = lastvalue;
// Update the index for the moved value
set._indexes[lastvalue] = toDeleteIndex + 1; // All indexes are 1-based
// Delete the slot where the moved value was stored
set._values.pop();
// Delete the index for the deleted slot
delete set._indexes[value];
return true;
} else {
return false;
}
}
/**
* @dev Returns true if the value is in the set. O(1).
*/
function _contains(Set storage set, bytes32 value) private view returns (bool) {
return set._indexes[value] != 0;
}
/**
* @dev Returns the number of values on the set. O(1).
*/
function _length(Set storage set) private view returns (uint256) {
return set._values.length;
}
/**
* @dev Returns the value stored at position `index` in the set. O(1).
*
* Note that there are no guarantees on the ordering of values inside the
* array, and it may change when more values are added or removed.
*
* Requirements:
*
* - `index` must be strictly less than {length}.
*/
function _at(Set storage set, uint256 index) private view returns (bytes32) {
require(set._values.length > index, "EnumerableSet: index out of bounds");
return set._values[index];
}
// Bytes32Set
struct Bytes32Set {
Set _inner;
}
/**
* @dev Add a value to a set. O(1).
*
* Returns true if the value was added to the set, that is if it was not
* already present.
*/
function add(Bytes32Set storage set, bytes32 value) internal returns (bool) {
return _add(set._inner, value);
}
/**
* @dev Removes a value from a set. O(1).
*
* Returns true if the value was removed from the set, that is if it was
* present.
*/
function remove(Bytes32Set storage set, bytes32 value) internal returns (bool) {
return _remove(set._inner, value);
}
/**
* @dev Returns true if the value is in the set. O(1).
*/
function contains(Bytes32Set storage set, bytes32 value) internal view returns (bool) {
return _contains(set._inner, value);
}
/**
* @dev Returns the number of values in the set. O(1).
*/
function length(Bytes32Set storage set) internal view returns (uint256) {
return _length(set._inner);
}
/**
* @dev Returns the value stored at position `index` in the set. O(1).
*
* Note that there are no guarantees on the ordering of values inside the
* array, and it may change when more values are added or removed.
*
* Requirements:
*
* - `index` must be strictly less than {length}.
*/
function at(Bytes32Set storage set, uint256 index) internal view returns (bytes32) {
return _at(set._inner, index);
}
// AddressSet
struct AddressSet {
Set _inner;
}
/**
* @dev Add a value to a set. O(1).
*
* Returns true if the value was added to the set, that is if it was not
* already present.
*/
function add(AddressSet storage set, address value) internal returns (bool) {
return _add(set._inner, bytes32(uint256(uint160(value))));
}
/**
* @dev Removes a value from a set. O(1).
*
* Returns true if the value was removed from the set, that is if it was
* present.
*/
function remove(AddressSet storage set, address value) internal returns (bool) {
return _remove(set._inner, bytes32(uint256(uint160(value))));
}
/**
* @dev Returns true if the value is in the set. O(1).
*/
function contains(AddressSet storage set, address value) internal view returns (bool) {
return _contains(set._inner, bytes32(uint256(uint160(value))));
}
/**
* @dev Returns the number of values in the set. O(1).
*/
function length(AddressSet storage set) internal view returns (uint256) {
return _length(set._inner);
}
/**
* @dev Returns the value stored at position `index` in the set. O(1).
*
* Note that there are no guarantees on the ordering of values inside the
* array, and it may change when more values are added or removed.
*
* Requirements:
*
* - `index` must be strictly less than {length}.
*/
function at(AddressSet storage set, uint256 index) internal view returns (address) {
return address(uint160(uint256(_at(set._inner, index))));
}
// UintSet
struct UintSet {
Set _inner;
}
/**
* @dev Add a value to a set. O(1).
*
* Returns true if the value was added to the set, that is if it was not
* already present.
*/
function add(UintSet storage set, uint256 value) internal returns (bool) {
return _add(set._inner, bytes32(value));
}
/**
* @dev Removes a value from a set. O(1).
*
* Returns true if the value was removed from the set, that is if it was
* present.
*/
function remove(UintSet storage set, uint256 value) internal returns (bool) {
return _remove(set._inner, bytes32(value));
}
/**
* @dev Returns true if the value is in the set. O(1).
*/
function contains(UintSet storage set, uint256 value) internal view returns (bool) {
return _contains(set._inner, bytes32(value));
}
/**
* @dev Returns the number of values on the set. O(1).
*/
function length(UintSet storage set) internal view returns (uint256) {
return _length(set._inner);
}
/**
* @dev Returns the value stored at position `index` in the set. O(1).
*
* Note that there are no guarantees on the ordering of values inside the
* array, and it may change when more values are added or removed.
*
* Requirements:
*
* - `index` must be strictly less than {length}.
*/
function at(UintSet storage set, uint256 index) internal view returns (uint256) {
return uint256(_at(set._inner, index));
}
}// SPDX-License-Identifier: agpl-3.0
pragma solidity ^0.7.4;
import {Errors} from "../helpers/Errors.sol";
/**
* @title PercentageMath library
* @author Aave
* @notice Provides functions to perform percentage calculations
* @dev Percentages are defined by default with 2 decimals of precision (100.00). The precision is indicated by PERCENTAGE_FACTOR
* @dev Operations are rounded half up
**/
library PercentageMath {
uint256 constant PERCENTAGE_FACTOR = 1e4; //percentage plus two decimals
uint256 constant HALF_PERCENT = PERCENTAGE_FACTOR / 2;
/**
* @dev Executes a percentage multiplication
* @param value The value of which the percentage needs to be calculated
* @param percentage The percentage of the value to be calculated
* @return The percentage of value
**/
function percentMul(uint256 value, uint256 percentage)
internal
pure
returns (uint256)
{
if (value == 0 || percentage == 0) {
return 0; // T:[PM-1]
}
require(
value <= (type(uint256).max - HALF_PERCENT) / percentage,
Errors.MATH_MULTIPLICATION_OVERFLOW
); // T:[PM-1]
return (value * percentage + HALF_PERCENT) / PERCENTAGE_FACTOR; // T:[PM-1]
}
/**
* @dev Executes a percentage division
* @param value The value of which the percentage needs to be calculated
* @param percentage The percentage of the value to be calculated
* @return The value divided the percentage
**/
function percentDiv(uint256 value, uint256 percentage)
internal
pure
returns (uint256)
{
require(percentage != 0, Errors.MATH_DIVISION_BY_ZERO); // T:[PM-2]
uint256 halfPercentage = percentage / 2; // T:[PM-2]
require(
value <= (type(uint256).max - halfPercentage) / PERCENTAGE_FACTOR,
Errors.MATH_MULTIPLICATION_OVERFLOW
); // T:[PM-2]
return (value * PERCENTAGE_FACTOR + halfPercentage) / percentage;
}
}// SPDX-License-Identifier: GPL-2.0-or-later
// Gearbox Protocol. Generalized leverage for DeFi protocols
// (c) Gearbox Holdings, 2021
pragma solidity ^0.7.4;
pragma abicoder v2;
import {ICreditFilter} from "../interfaces/ICreditFilter.sol";
import {IAppCreditManager} from "./app/IAppCreditManager.sol";
import {DataTypes} from "../libraries/data/Types.sol";
/// @title Credit Manager interface
/// @notice It encapsulates business logic for managing credit accounts
///
/// More info: https://dev.gearbox.fi/developers/credit/credit_manager
interface ICreditManager is IAppCreditManager {
// Emits each time when the credit account is opened
event OpenCreditAccount(
address indexed sender,
address indexed onBehalfOf,
address indexed creditAccount,
uint256 amount,
uint256 borrowAmount,
uint256 referralCode
);
// Emits each time when the credit account is closed
event CloseCreditAccount(
address indexed owner,
address indexed to,
uint256 remainingFunds
);
// Emits each time when the credit account is liquidated
event LiquidateCreditAccount(
address indexed owner,
address indexed liquidator,
uint256 remainingFunds
);
// Emits each time when borrower increases borrowed amount
event IncreaseBorrowedAmount(address indexed borrower, uint256 amount);
// Emits each time when borrower adds collateral
event AddCollateral(
address indexed onBehalfOf,
address indexed token,
uint256 value
);
// Emits each time when the credit account is repaid
event RepayCreditAccount(address indexed owner, address indexed to);
// Emit each time when financial order is executed
event ExecuteOrder(address indexed borrower, address indexed target);
// Emits each time when new fees are set
event NewParameters(
uint256 minAmount,
uint256 maxAmount,
uint256 maxLeverage,
uint256 feeInterest,
uint256 feeLiquidation,
uint256 liquidationDiscount
);
event TransferAccount(address indexed oldOwner, address indexed newOwner);
//
// CREDIT ACCOUNT MANAGEMENT
//
/**
* @dev Opens credit account and provides credit funds.
* - Opens credit account (take it from account factory)
* - Transfers trader /farmers initial funds to credit account
* - Transfers borrowed leveraged amount from pool (= amount x leverageFactor) calling lendCreditAccount() on connected Pool contract.
* - Emits OpenCreditAccount event
* Function reverts if user has already opened position
*
* More info: https://dev.gearbox.fi/developers/credit/credit_manager#open-credit-account
*
* @param amount Borrowers own funds
* @param onBehalfOf The address that will receive the aTokens, same as msg.sender if the user
* wants to receive them on his own wallet, or a different address if the beneficiary of aTokens
* is a different wallet
* @param leverageFactor Multiplier to borrowers own funds
* @param referralCode Code used to register the integrator originating the operation, for potential rewards.
* 0 if the action is executed directly by the user, without any middle-man
*/
function openCreditAccount(
uint256 amount,
address onBehalfOf,
uint256 leverageFactor,
uint256 referralCode
) external override;
/**
* @dev Closes credit account
* - Swaps all assets to underlying one using default swap protocol
* - Pays borrowed amount + interest accrued + fees back to the pool by calling repayCreditAccount
* - Transfers remaining funds to the trader / farmer
* - Closes the credit account and return it to account factory
* - Emits CloseCreditAccount event
*
* More info: https://dev.gearbox.fi/developers/credit/credit_manager#close-credit-account
*
* @param to Address to send remaining funds
* @param paths Exchange type data which provides paths + amountMinOut
*/
function closeCreditAccount(address to, DataTypes.Exchange[] calldata paths)
external
override;
/**
* @dev Liquidates credit account
* - Transfers discounted total credit account value from liquidators account
* - Pays borrowed funds + interest + fees back to pool, than transfers remaining funds to credit account owner
* - Transfer all assets from credit account to liquidator ("to") account
* - Returns credit account to factory
* - Emits LiquidateCreditAccount event
*
* More info: https://dev.gearbox.fi/developers/credit/credit_manager#liquidate-credit-account
*
* @param borrower Borrower address
* @param to Address to transfer all assets from credit account
* @param force If true, use transfer function for transferring tokens instead of safeTransfer
*/
function liquidateCreditAccount(
address borrower,
address to,
bool force
) external;
/// @dev Repays credit account
/// More info: https://dev.gearbox.fi/developers/credit/credit_manager#repay-credit-account
///
/// @param to Address to send credit account assets
function repayCreditAccount(address to) external override;
/// @dev Repays credit account with ETH. Restricted to be called by WETH Gateway only
///
/// @param borrower Address of borrower
/// @param to Address to send credit account assets
function repayCreditAccountETH(address borrower, address to)
external
returns (uint256);
/// @dev Increases borrowed amount by transferring additional funds from
/// the pool if after that HealthFactor > minHealth
/// More info: https://dev.gearbox.fi/developers/credit/credit_manager#increase-borrowed-amount
///
/// @param amount Amount to increase borrowed amount
function increaseBorrowedAmount(uint256 amount) external override;
/// @dev Adds collateral to borrower's credit account
/// @param onBehalfOf Address of borrower to add funds
/// @param token Token address
/// @param amount Amount to add
function addCollateral(
address onBehalfOf,
address token,
uint256 amount
) external override;
/// @dev Returns true if the borrower has opened a credit account
/// @param borrower Borrower account
function hasOpenedCreditAccount(address borrower)
external
view
override
returns (bool);
/// @dev Calculates Repay amount = borrow amount + interest accrued + fee
///
/// More info: https://dev.gearbox.fi/developers/credit/economy#repay
/// https://dev.gearbox.fi/developers/credit/economy#liquidate
///
/// @param borrower Borrower address
/// @param isLiquidated True if calculated repay amount for liquidator
function calcRepayAmount(address borrower, bool isLiquidated)
external
view
override
returns (uint256);
/// @dev Returns minimal amount for open credit account
function minAmount() external view returns (uint256);
/// @dev Returns maximum amount for open credit account
function maxAmount() external view returns (uint256);
/// @dev Returns maximum leveraged factor allowed for this pool
function maxLeverageFactor() external view returns (uint256);
/// @dev Returns underlying token address
function underlyingToken() external view returns (address);
/// @dev Returns address of connected pool
function poolService() external view returns (address);
/// @dev Returns address of CreditFilter
function creditFilter() external view returns (ICreditFilter);
/// @dev Returns address of CreditFilter
function creditAccounts(address borrower) external view returns (address);
/// @dev Executes filtered order on credit account which is connected with particular borrowers
/// @param borrower Borrower address
/// @param target Target smart-contract
/// @param data Call data for call
function executeOrder(
address borrower,
address target,
bytes memory data
) external returns (bytes memory);
/// @dev Approves token for msg.sender's credit account
function approve(address targetContract, address token) external;
/// @dev Approve tokens for credit accounts. Restricted for adapters only
function provideCreditAccountAllowance(
address creditAccount,
address toContract,
address token
) external;
function transferAccountOwnership(address newOwner) external;
/// @dev Returns address of borrower's credit account and reverts of borrower has no one.
/// @param borrower Borrower address
function getCreditAccountOrRevert(address borrower)
external
view
override
returns (address);
// function feeSuccess() external view returns (uint256);
function feeInterest() external view returns (uint256);
function feeLiquidation() external view returns (uint256);
function liquidationDiscount() external view returns (uint256);
function minHealthFactor() external view returns (uint256);
function defaultSwapContract() external view override returns (address);
}// SPDX-License-Identifier: GPL-2.0-or-later
// Gearbox Protocol. Generalized leverage for DeFi protocols
// (c) Gearbox Holdings, 2021
pragma solidity ^0.7.4;
/// @title Reusable Credit Account interface
/// @notice Implements general credit account:
/// - Keeps token balances
/// - Keeps token balances
/// - Stores general parameters: borrowed amount, cumulative index at open and block when it was initialized
/// - Approves tokens for 3rd party contracts
/// - Transfers assets
/// - Execute financial orders
///
/// More: https://dev.gearbox.fi/developers/creditManager/vanillacreditAccount
interface ICreditAccount {
/// @dev Initializes clone contract
function initialize() external;
/// @dev Connects credit account to credit manager
/// @param _creditManager Credit manager address
function connectTo(
address _creditManager,
uint256 _borrowedAmount,
uint256 _cumulativeIndexAtOpen
) external;
// /// @dev Set general credit account parameters. Restricted to credit managers only
// /// @param _borrowedAmount Amount which pool lent to credit account
// /// @param _cumulativeIndexAtOpen Cumulative index at open. Uses for interest calculation
// function setGenericParameters(
//
// ) external;
/// @dev Updates borrowed amount. Restricted to credit managers only
/// @param _borrowedAmount Amount which pool lent to credit account
function updateParameters(
uint256 _borrowedAmount,
uint256 _cumulativeIndexAtOpen
) external;
/// @dev Approves particular token for swap contract
/// @param token ERC20 token for allowance
/// @param swapContract Swap contract address
function approveToken(address token, address swapContract) external;
/// @dev Cancels allowance for particular contract
/// @param token Address of token for allowance
/// @param targetContract Address of contract to cancel allowance
function cancelAllowance(address token, address targetContract) external;
/// Transfers tokens from credit account to provided address. Restricted for pool calls only
/// @param token Token which should be tranferred from credit account
/// @param to Address of recipient
/// @param amount Amount to be transferred
function safeTransfer(
address token,
address to,
uint256 amount
) external;
/// @dev Returns borrowed amount
function borrowedAmount() external view returns (uint256);
/// @dev Returns cumulative index at time of opening credit account
function cumulativeIndexAtOpen() external view returns (uint256);
/// @dev Returns Block number when it was initialised last time
function since() external view returns (uint256);
/// @dev Address of last connected credit manager
function creditManager() external view returns (address);
/// @dev Address of last connected credit manager
function factory() external view returns (address);
/// @dev Executed financial order on 3rd party service. Restricted for pool calls only
/// @param destination Contract address which should be called
/// @param data Call data which should be sent
function execute(address destination, bytes memory data)
external
returns (bytes memory);
}// SPDX-License-Identifier: GPL-2.0-or-later
// Gearbox Protocol. Generalized leverage for DeFi protocols
// (c) Gearbox Holdings, 2021
pragma solidity ^0.7.4;
/// @title Price oracle interface
interface IPriceOracle {
// Emits each time new configurator is set up
event NewPriceFeed(address indexed token, address indexed priceFeed);
/**
* @dev Sets price feed if it doesn't exists
* If pricefeed exists, it changes nothing
* This logic is done to protect Gearbox from priceOracle attack
* when potential attacker can get access to price oracle, change them to fraud ones
* and then liquidate all funds
* @param token Address of token
* @param priceFeedToken Address of chainlink price feed token => Eth
*/
function addPriceFeed(address token, address priceFeedToken) external;
/**
* @dev Converts one asset into another using rate. Reverts if price feed doesn't exist
*
* @param amount Amount to convert
* @param tokenFrom Token address converts from
* @param tokenTo Token address - converts to
* @return Amount converted to tokenTo asset
*/
function convert(
uint256 amount,
address tokenFrom,
address tokenTo
) external view returns (uint256);
/**
* @dev Gets token rate with 18 decimals. Reverts if priceFeed doesn't exist
*
* @param tokenFrom Converts from token address
* @param tokenTo Converts to token address
* @return Rate in WAD format
*/
function getLastPrice(address tokenFrom, address tokenTo)
external
view
returns (uint256);
}// SPDX-License-Identifier: GPL-2.0-or-later
// Gearbox Protocol. Generalized leverage for DeFi protocols
// (c) Gearbox Holdings, 2021
pragma solidity ^0.7.4;
interface ICreditFilter {
// Emits each time token is allowed or liquidtion threshold changed
event TokenAllowed(address indexed token, uint256 liquidityThreshold);
// Emits each time token is allowed or liquidtion threshold changed
event TokenForbidden(address indexed token);
// Emits each time contract is allowed or adapter changed
event ContractAllowed(address indexed protocol, address indexed adapter);
// Emits each time contract is forbidden
event ContractForbidden(address indexed protocol);
// Emits each time when fast check parameters are updated
event NewFastCheckParameters(uint256 chiThreshold, uint256 fastCheckDelay);
event TransferAccountAllowed(
address indexed from,
address indexed to,
bool state
);
event TransferPluginAllowed(
address indexed pugin,
bool state
);
event PriceOracleUpdated(address indexed newPriceOracle);
//
// STATE-CHANGING FUNCTIONS
//
/// @dev Adds token to the list of allowed tokens
/// @param token Address of allowed token
/// @param liquidationThreshold The constant showing the maximum allowable ratio of Loan-To-Value for the i-th asset.
function allowToken(address token, uint256 liquidationThreshold) external;
/// @dev Adds contract to the list of allowed contracts
/// @param targetContract Address of contract to be allowed
/// @param adapter Adapter contract address
function allowContract(address targetContract, address adapter) external;
/// @dev Forbids contract and removes it from the list of allowed contracts
/// @param targetContract Address of allowed contract
function forbidContract(address targetContract) external;
/// @dev Checks financial order and reverts if tokens aren't in list or collateral protection alerts
/// @param creditAccount Address of credit account
/// @param tokenIn Address of token In in swap operation
/// @param tokenOut Address of token Out in swap operation
/// @param amountIn Amount of tokens in
/// @param amountOut Amount of tokens out
function checkCollateralChange(
address creditAccount,
address tokenIn,
address tokenOut,
uint256 amountIn,
uint256 amountOut
) external;
function checkMultiTokenCollateral(
address creditAccount,
uint256[] memory amountIn,
uint256[] memory amountOut,
address[] memory tokenIn,
address[] memory tokenOut
) external;
/// @dev Connects credit managaer, hecks that all needed price feeds exists and finalize config
function connectCreditManager(address poolService) external;
/// @dev Sets collateral protection for new credit accounts
function initEnabledTokens(address creditAccount) external;
function checkAndEnableToken(address creditAccount, address token) external;
//
// GETTERS
//
/// @dev Returns quantity of contracts in allowed list
function allowedContractsCount() external view returns (uint256);
/// @dev Returns of contract address from the allowed list by its id
function allowedContracts(uint256 id) external view returns (address);
/// @dev Reverts if token isn't in token allowed list
function revertIfTokenNotAllowed(address token) external view;
/// @dev Returns true if token is in allowed list otherwise false
function isTokenAllowed(address token) external view returns (bool);
/// @dev Returns quantity of tokens in allowed list
function allowedTokensCount() external view returns (uint256);
/// @dev Returns of token address from allowed list by its id
function allowedTokens(uint256 id) external view returns (address);
/// @dev Calculates total value for provided address
/// More: https://dev.gearbox.fi/developers/credit/economy#total-value
///
/// @param creditAccount Token creditAccount address
function calcTotalValue(address creditAccount)
external
view
returns (uint256 total);
/// @dev Calculates Threshold Weighted Total Value
/// More: https://dev.gearbox.fi/developers/credit/economy#threshold-weighted-value
///
///@param creditAccount Credit account address
function calcThresholdWeightedValue(address creditAccount)
external
view
returns (uint256 total);
function contractToAdapter(address allowedContract)
external
view
returns (address);
/// @dev Returns address of underlying token
function underlyingToken() external view returns (address);
/// @dev Returns address & balance of token by the id of allowed token in the list
/// @param creditAccount Credit account address
/// @param id Id of token in allowed list
/// @return token Address of token
/// @return balance Token balance
function getCreditAccountTokenById(address creditAccount, uint256 id)
external
view
returns (
address token,
uint256 balance,
uint256 tv,
uint256 twv
);
/**
* @dev Calculates health factor for the credit account
*
* sum(asset[i] * liquidation threshold[i])
* Hf = --------------------------------------------
* borrowed amount + interest accrued
*
*
* More info: https://dev.gearbox.fi/developers/credit/economy#health-factor
*
* @param creditAccount Credit account address
* @return Health factor in percents (see PERCENTAGE FACTOR in PercentageMath.sol)
*/
function calcCreditAccountHealthFactor(address creditAccount)
external
view
returns (uint256);
/// @dev Calculates credit account interest accrued
/// More: https://dev.gearbox.fi/developers/credit/economy#interest-rate-accrued
///
/// @param creditAccount Credit account address
function calcCreditAccountAccruedInterest(address creditAccount)
external
view
returns (uint256);
/// @dev Return enabled tokens - token masks where each bit is "1" is token is enabled
function enabledTokens(address creditAccount)
external
view
returns (uint256);
function liquidationThresholds(address token)
external
view
returns (uint256);
function priceOracle() external view returns (address);
function updateUnderlyingTokenLiquidationThreshold() external;
function revertIfCantIncreaseBorrowing(
address creditAccount,
uint256 minHealthFactor
) external view;
function revertIfAccountTransferIsNotAllowed(
address onwer,
address creditAccount
) external view;
function approveAccountTransfers(address from, bool state) external;
function allowanceForAccountTransfers(address from, address to)
external
view
returns (bool);
}// SPDX-License-Identifier: GPL-2.0-or-later
// Gearbox Protocol. Generalized leverage for DeFi protocols
// (c) Gearbox Holdings, 2021
pragma solidity ^0.7.4;
import {IAppPoolService} from "./app/IAppPoolService.sol";
/// @title Pool Service Interface
/// @notice Implements business logic:
/// - Adding/removing pool liquidity
/// - Managing diesel tokens & diesel rates
/// - Lending/repaying funds to credit Manager
/// More: https://dev.gearbox.fi/developers/pool/abstractpoolservice
interface IPoolService is IAppPoolService {
// Emits each time when LP adds liquidity to the pool
event AddLiquidity(
address indexed sender,
address indexed onBehalfOf,
uint256 amount,
uint256 referralCode
);
// Emits each time when LP removes liquidity to the pool
event RemoveLiquidity(
address indexed sender,
address indexed to,
uint256 amount
);
// Emits each time when Credit Manager borrows money from pool
event Borrow(
address indexed creditManager,
address indexed creditAccount,
uint256 amount
);
// Emits each time when Credit Manager repays money from pool
event Repay(
address indexed creditManager,
uint256 borrowedAmount,
uint256 profit,
uint256 loss
);
// Emits each time when Interest Rate model was changed
event NewInterestRateModel(address indexed newInterestRateModel);
// Emits each time when new credit Manager was connected
event NewCreditManagerConnected(address indexed creditManager);
// Emits each time when borrow forbidden for credit manager
event BorrowForbidden(address indexed creditManager);
// Emits each time when uncovered (non insured) loss accrued
event UncoveredLoss(address indexed creditManager, uint256 loss);
// Emits after expected liquidity limit update
event NewExpectedLiquidityLimit(uint256 newLimit);
// Emits each time when withdraw fee is udpated
event NewWithdrawFee(uint256 fee);
//
// LIQUIDITY MANAGEMENT
//
/**
* @dev Adds liquidity to pool
* - transfers lp tokens to pool
* - mint diesel (LP) tokens and provide them
* @param amount Amount of tokens to be transfer
* @param onBehalfOf The address that will receive the aTokens, same as msg.sender if the user
* wants to receive them on his own wallet, or a different address if the beneficiary of aTokens
* is a different wallet
* @param referralCode Code used to register the integrator originating the operation, for potential rewards.
* 0 if the action is executed directly by the user, without any middle-man
*/
function addLiquidity(
uint256 amount,
address onBehalfOf,
uint256 referralCode
) external override;
/**
* @dev Removes liquidity from pool
* - burns lp's diesel (LP) tokens
* - returns underlying tokens to lp
* @param amount Amount of tokens to be transfer
* @param to Address to transfer liquidity
*/
function removeLiquidity(uint256 amount, address to)
external
override
returns (uint256);
/**
* @dev Transfers money from the pool to credit account
* and updates the pool parameters
* @param borrowedAmount Borrowed amount for credit account
* @param creditAccount Credit account address
*/
function lendCreditAccount(uint256 borrowedAmount, address creditAccount)
external;
/**
* @dev Recalculates total borrowed & borrowRate
* mints/burns diesel tokens
*/
function repayCreditAccount(
uint256 borrowedAmount,
uint256 profit,
uint256 loss
) external;
//
// GETTERS
//
/**
* @return expected pool liquidity
*/
function expectedLiquidity() external view returns (uint256);
/**
* @return expected liquidity limit
*/
function expectedLiquidityLimit() external view returns (uint256);
/**
* @dev Gets available liquidity in the pool (pool balance)
* @return available pool liquidity
*/
function availableLiquidity() external view returns (uint256);
/**
* @dev Calculates interest accrued from the last update using the linear model
*/
function calcLinearCumulative_RAY() external view returns (uint256);
/**
* @dev Calculates borrow rate
* @return borrow rate in RAY format
*/
function borrowAPY_RAY() external view returns (uint256);
/**
* @dev Gets the amount of total borrowed funds
* @return Amount of borrowed funds at current time
*/
function totalBorrowed() external view returns (uint256);
/**
* @return Current diesel rate
**/
function getDieselRate_RAY() external view returns (uint256);
/**
* @dev Underlying token address getter
* @return address of underlying ERC-20 token
*/
function underlyingToken() external view returns (address);
/**
* @dev Diesel(LP) token address getter
* @return address of diesel(LP) ERC-20 token
*/
function dieselToken() external view returns (address);
/**
* @dev Credit Manager address getter
* @return address of Credit Manager contract by id
*/
function creditManagers(uint256 id) external view returns (address);
/**
* @dev Credit Managers quantity
* @return quantity of connected credit Managers
*/
function creditManagersCount() external view returns (uint256);
function creditManagersCanBorrow(address id) external view returns (bool);
function toDiesel(uint256 amount) external view returns (uint256);
function fromDiesel(uint256 amount) external view returns (uint256);
function withdrawFee() external view returns (uint256);
function _timestampLU() external view returns (uint256);
function _cumulativeIndex_RAY() external view returns (uint256);
function calcCumulativeIndexAtBorrowMore(
uint256 amount,
uint256 dAmount,
uint256 cumulativeIndexAtOpen
) external view returns (uint256);
}// SPDX-License-Identifier: BUSL-1.1
// Gearbox Protocol. Generalized leverage for DeFi protocols
// (c) Gearbox Holdings, 2021
pragma solidity ^0.7.4;
import {IAppAddressProvider} from "../interfaces/app/IAppAddressProvider.sol";
import {Ownable} from "@openzeppelin/contracts/access/Ownable.sol";
import {Errors} from "../libraries/helpers/Errors.sol";
/// @title AddressRepository
/// @notice Stores addresses of deployed contracts
contract AddressProvider is Ownable, IAppAddressProvider {
// Mapping which keeps all addresses
mapping(bytes32 => address) public addresses;
// Emits each time when new address is set
event AddressSet(bytes32 indexed service, address indexed newAddress);
// This event is triggered when a call to ClaimTokens succeeds.
event Claimed(uint256 user_id, address account, uint256 amount, bytes32 leaf);
// Repositories & services
bytes32 public constant CONTRACTS_REGISTER = "CONTRACTS_REGISTER";
bytes32 public constant ACL = "ACL";
bytes32 public constant PRICE_ORACLE = "PRICE_ORACLE";
bytes32 public constant ACCOUNT_FACTORY = "ACCOUNT_FACTORY";
bytes32 public constant DATA_COMPRESSOR = "DATA_COMPRESSOR";
bytes32 public constant TREASURY_CONTRACT = "TREASURY_CONTRACT";
bytes32 public constant GEAR_TOKEN = "GEAR_TOKEN";
bytes32 public constant WETH_TOKEN = "WETH_TOKEN";
bytes32 public constant WETH_GATEWAY = "WETH_GATEWAY";
bytes32 public constant LEVERAGED_ACTIONS = "LEVERAGED_ACTIONS";
// Contract version
uint256 public constant version = 1;
constructor() {
// @dev Emits first event for contract discovery
emit AddressSet("ADDRESS_PROVIDER", address(this));
}
/// @return Address of ACL contract
function getACL() external view returns (address) {
return _getAddress(ACL); // T:[AP-3]
}
/// @dev Sets address of ACL contract
/// @param _address Address of ACL contract
function setACL(address _address)
external
onlyOwner // T:[AP-15]
{
_setAddress(ACL, _address); // T:[AP-3]
}
/// @return Address of ContractsRegister
function getContractsRegister() external view returns (address) {
return _getAddress(CONTRACTS_REGISTER); // T:[AP-4]
}
/// @dev Sets address of ContractsRegister
/// @param _address Address of ContractsRegister
function setContractsRegister(address _address)
external
onlyOwner // T:[AP-15]
{
_setAddress(CONTRACTS_REGISTER, _address); // T:[AP-4]
}
/// @return Address of PriceOracle
function getPriceOracle() external view override returns (address) {
return _getAddress(PRICE_ORACLE); // T:[AP-5]
}
/// @dev Sets address of PriceOracle
/// @param _address Address of PriceOracle
function setPriceOracle(address _address)
external
onlyOwner // T:[AP-15]
{
_setAddress(PRICE_ORACLE, _address); // T:[AP-5]
}
/// @return Address of AccountFactory
function getAccountFactory() external view returns (address) {
return _getAddress(ACCOUNT_FACTORY); // T:[AP-6]
}
/// @dev Sets address of AccountFactory
/// @param _address Address of AccountFactory
function setAccountFactory(address _address)
external
onlyOwner // T:[AP-15]
{
_setAddress(ACCOUNT_FACTORY, _address); // T:[AP-7]
}
/// @return Address of AccountFactory
function getDataCompressor() external view override returns (address) {
return _getAddress(DATA_COMPRESSOR); // T:[AP-8]
}
/// @dev Sets address of AccountFactory
/// @param _address Address of AccountFactory
function setDataCompressor(address _address)
external
onlyOwner // T:[AP-15]
{
_setAddress(DATA_COMPRESSOR, _address); // T:[AP-8]
}
/// @return Address of Treasury contract
function getTreasuryContract() external view returns (address) {
return _getAddress(TREASURY_CONTRACT); //T:[AP-11]
}
/// @dev Sets address of Treasury Contract
/// @param _address Address of Treasury Contract
function setTreasuryContract(address _address)
external
onlyOwner // T:[AP-15]
{
_setAddress(TREASURY_CONTRACT, _address); //T:[AP-11]
}
/// @return Address of GEAR token
function getGearToken() external view override returns (address) {
return _getAddress(GEAR_TOKEN); // T:[AP-12]
}
/// @dev Sets address of GEAR token
/// @param _address Address of GEAR token
function setGearToken(address _address)
external
onlyOwner // T:[AP-15]
{
_setAddress(GEAR_TOKEN, _address); // T:[AP-12]
}
/// @return Address of WETH token
function getWethToken() external view override returns (address) {
return _getAddress(WETH_TOKEN); // T:[AP-13]
}
/// @dev Sets address of WETH token
/// @param _address Address of WETH token
function setWethToken(address _address)
external
onlyOwner // T:[AP-15]
{
_setAddress(WETH_TOKEN, _address); // T:[AP-13]
}
/// @return Address of WETH token
function getWETHGateway() external view override returns (address) {
return _getAddress(WETH_GATEWAY); // T:[AP-14]
}
/// @dev Sets address of WETH token
/// @param _address Address of WETH token
function setWETHGateway(address _address)
external
onlyOwner // T:[AP-15]
{
_setAddress(WETH_GATEWAY, _address); // T:[AP-14]
}
/// @return Address of WETH token
function getLeveragedActions() external view override returns (address) {
return _getAddress(LEVERAGED_ACTIONS); // T:[AP-7]
}
/// @dev Sets address of WETH token
/// @param _address Address of WETH token
function setLeveragedActions(address _address)
external
onlyOwner // T:[AP-15]
{
_setAddress(LEVERAGED_ACTIONS, _address); // T:[AP-7]
}
/// @return Address of key, reverts if key doesn't exist
function _getAddress(bytes32 key) internal view returns (address) {
address result = addresses[key];
require(result != address(0), Errors.AS_ADDRESS_NOT_FOUND); // T:[AP-1]
return result; // T:[AP-3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14]
}
/// @dev Sets address to map by its key
/// @param key Key in string format
/// @param value Address
function _setAddress(bytes32 key, address value) internal {
addresses[key] = value; // T:[AP-3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14]
emit AddressSet(key, value); // T:[AP-2]
}
}// SPDX-License-Identifier: BUSL-1.1
// Gearbox Protocol. Generalized leverage for DeFi protocols
// (c) Gearbox Holdings, 2021
pragma solidity ^0.7.4;
import {Pausable} from "@openzeppelin/contracts/utils/Pausable.sol";
import {AddressProvider} from "./AddressProvider.sol";
import {ACL} from "./ACL.sol";
import {Errors} from "../libraries/helpers/Errors.sol";
/// @title ACL Trait
/// @notice Trait which adds acl functions to contract
abstract contract ACLTrait is Pausable {
// ACL contract to check rights
ACL private _acl;
/// @dev constructor
/// @param addressProvider Address of address repository
constructor(address addressProvider) {
require(
addressProvider != address(0),
Errors.ZERO_ADDRESS_IS_NOT_ALLOWED
);
_acl = ACL(AddressProvider(addressProvider).getACL());
}
/// @dev Reverts if msg.sender is not configurator
modifier configuratorOnly() {
require(
_acl.isConfigurator(msg.sender),
Errors.ACL_CALLER_NOT_CONFIGURATOR
); // T:[ACLT-8]
_;
}
///@dev Pause contract
function pause() external {
require(
_acl.isPausableAdmin(msg.sender),
Errors.ACL_CALLER_NOT_PAUSABLE_ADMIN
); // T:[ACLT-1]
_pause();
}
/// @dev Unpause contract
function unpause() external {
require(
_acl.isUnpausableAdmin(msg.sender),
Errors.ACL_CALLER_NOT_PAUSABLE_ADMIN
); // T:[ACLT-1],[ACLT-2]
_unpause();
}
}// SPDX-License-Identifier: GPL-2.0-or-later
// Gearbox Protocol. Generalized leverage for DeFi protocols
// (c) Gearbox Holdings, 2021
pragma solidity ^0.7.4;
import {PercentageMath} from "../math/PercentageMath.sol";
library Constants {
uint256 constant MAX_INT =
0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff;
// 25% of MAX_INT
uint256 constant MAX_INT_4 =
0x3fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff;
// REWARD FOR LEAN DEPLOYMENT MINING
uint256 constant ACCOUNT_CREATION_REWARD = 1e5;
uint256 constant DEPLOYMENT_COST = 1e17;
// FEE = 10%
uint256 constant FEE_INTEREST = 1000; // 10%
// FEE + LIQUIDATION_FEE 2%
uint256 constant FEE_LIQUIDATION = 200;
// Liquidation premium 5%
uint256 constant LIQUIDATION_DISCOUNTED_SUM = 9500;
// 100% - LIQUIDATION_FEE - LIQUIDATION_PREMIUM
uint256 constant UNDERLYING_TOKEN_LIQUIDATION_THRESHOLD =
LIQUIDATION_DISCOUNTED_SUM - FEE_LIQUIDATION;
// Seconds in a year
uint256 constant SECONDS_PER_YEAR = 365 days;
uint256 constant SECONDS_PER_ONE_AND_HALF_YEAR = SECONDS_PER_YEAR * 3 /2;
// 1e18
uint256 constant RAY = 1e27;
uint256 constant WAD = 1e18;
// OPERATIONS
uint8 constant OPERATION_CLOSURE = 1;
uint8 constant OPERATION_REPAY = 2;
uint8 constant OPERATION_LIQUIDATION = 3;
// Decimals for leverage, so x4 = 4*LEVERAGE_DECIMALS for openCreditAccount function
uint8 constant LEVERAGE_DECIMALS = 100;
// Maximum withdraw fee for pool in percentage math format. 100 = 1%
uint8 constant MAX_WITHDRAW_FEE = 100;
uint256 constant CHI_THRESHOLD = 9950;
uint256 constant HF_CHECK_INTERVAL_DEFAULT = 4;
uint256 constant NO_SWAP = 0;
uint256 constant UNISWAP_V2 = 1;
uint256 constant UNISWAP_V3 = 2;
uint256 constant CURVE_V1 = 3;
uint256 constant LP_YEARN = 4;
uint256 constant EXACT_INPUT = 1;
uint256 constant EXACT_OUTPUT = 2;
}// SPDX-License-Identifier: GPL-2.0-or-later
// Gearbox Protocol. Generalized leverage for DeFi protocols
// (c) Gearbox Holdings, 2021
pragma solidity ^0.7.4;
/// @title Errors library
library Errors {
//
// COMMON
//
string public constant ZERO_ADDRESS_IS_NOT_ALLOWED = "Z0";
string public constant NOT_IMPLEMENTED = "NI";
string public constant INCORRECT_PATH_LENGTH = "PL";
string public constant INCORRECT_ARRAY_LENGTH = "CR";
string public constant REGISTERED_CREDIT_ACCOUNT_MANAGERS_ONLY = "CP";
string public constant REGISTERED_POOLS_ONLY = "RP";
string public constant INCORRECT_PARAMETER = "IP";
//
// MATH
//
string public constant MATH_MULTIPLICATION_OVERFLOW = "M1";
string public constant MATH_ADDITION_OVERFLOW = "M2";
string public constant MATH_DIVISION_BY_ZERO = "M3";
//
// POOL
//
string public constant POOL_CONNECTED_CREDIT_MANAGERS_ONLY = "PS0";
string public constant POOL_INCOMPATIBLE_CREDIT_ACCOUNT_MANAGER = "PS1";
string public constant POOL_MORE_THAN_EXPECTED_LIQUIDITY_LIMIT = "PS2";
string public constant POOL_INCORRECT_WITHDRAW_FEE = "PS3";
string public constant POOL_CANT_ADD_CREDIT_MANAGER_TWICE = "PS4";
//
// CREDIT MANAGER
//
string public constant CM_NO_OPEN_ACCOUNT = "CM1";
string
public constant CM_ZERO_ADDRESS_OR_USER_HAVE_ALREADY_OPEN_CREDIT_ACCOUNT =
"CM2";
string public constant CM_INCORRECT_AMOUNT = "CM3";
string public constant CM_CAN_LIQUIDATE_WITH_SUCH_HEALTH_FACTOR = "CM4";
string public constant CM_CAN_UPDATE_WITH_SUCH_HEALTH_FACTOR = "CM5";
string public constant CM_WETH_GATEWAY_ONLY = "CM6";
string public constant CM_INCORRECT_PARAMS = "CM7";
string public constant CM_INCORRECT_FEES = "CM8";
string public constant CM_MAX_LEVERAGE_IS_TOO_HIGH = "CM9";
string public constant CM_CANT_CLOSE_WITH_LOSS = "CMA";
string public constant CM_TARGET_CONTRACT_iS_NOT_ALLOWED = "CMB";
string public constant CM_TRANSFER_FAILED = "CMC";
string public constant CM_INCORRECT_NEW_OWNER = "CME";
//
// ACCOUNT FACTORY
//
string public constant AF_CANT_CLOSE_CREDIT_ACCOUNT_IN_THE_SAME_BLOCK =
"AF1";
string public constant AF_MINING_IS_FINISHED = "AF2";
string public constant AF_CREDIT_ACCOUNT_NOT_IN_STOCK = "AF3";
string public constant AF_EXTERNAL_ACCOUNTS_ARE_FORBIDDEN = "AF4";
//
// ADDRESS PROVIDER
//
string public constant AS_ADDRESS_NOT_FOUND = "AP1";
//
// CONTRACTS REGISTER
//
string public constant CR_POOL_ALREADY_ADDED = "CR1";
string public constant CR_CREDIT_MANAGER_ALREADY_ADDED = "CR2";
//
// CREDIT_FILTER
//
string public constant CF_UNDERLYING_TOKEN_FILTER_CONFLICT = "CF0";
string public constant CF_INCORRECT_LIQUIDATION_THRESHOLD = "CF1";
string public constant CF_TOKEN_IS_NOT_ALLOWED = "CF2";
string public constant CF_CREDIT_MANAGERS_ONLY = "CF3";
string public constant CF_ADAPTERS_ONLY = "CF4";
string public constant CF_OPERATION_LOW_HEALTH_FACTOR = "CF5";
string public constant CF_TOO_MUCH_ALLOWED_TOKENS = "CF6";
string public constant CF_INCORRECT_CHI_THRESHOLD = "CF7";
string public constant CF_INCORRECT_FAST_CHECK = "CF8";
string public constant CF_NON_TOKEN_CONTRACT = "CF9";
string public constant CF_CONTRACT_IS_NOT_IN_ALLOWED_LIST = "CFA";
string public constant CF_FAST_CHECK_NOT_COVERED_COLLATERAL_DROP = "CFB";
string public constant CF_SOME_LIQUIDATION_THRESHOLD_MORE_THAN_NEW_ONE =
"CFC";
string public constant CF_ADAPTER_CAN_BE_USED_ONLY_ONCE = "CFD";
string public constant CF_INCORRECT_PRICEFEED = "CFE";
string public constant CF_TRANSFER_IS_NOT_ALLOWED = "CFF";
string public constant CF_CREDIT_MANAGER_IS_ALREADY_SET = "CFG";
//
// CREDIT ACCOUNT
//
string public constant CA_CONNECTED_CREDIT_MANAGER_ONLY = "CA1";
string public constant CA_FACTORY_ONLY = "CA2";
//
// PRICE ORACLE
//
string public constant PO_PRICE_FEED_DOESNT_EXIST = "PO0";
string public constant PO_TOKENS_WITH_DECIMALS_MORE_18_ISNT_ALLOWED = "PO1";
string public constant PO_AGGREGATOR_DECIMALS_SHOULD_BE_18 = "PO2";
//
// ACL
//
string public constant ACL_CALLER_NOT_PAUSABLE_ADMIN = "ACL1";
string public constant ACL_CALLER_NOT_CONFIGURATOR = "ACL2";
//
// WETH GATEWAY
//
string public constant WG_DESTINATION_IS_NOT_WETH_COMPATIBLE = "WG1";
string public constant WG_RECEIVE_IS_NOT_ALLOWED = "WG2";
string public constant WG_NOT_ENOUGH_FUNDS = "WG3";
//
// LEVERAGED ACTIONS
//
string public constant LA_INCORRECT_VALUE = "LA1";
string public constant LA_HAS_VALUE_WITH_TOKEN_TRANSFER = "LA2";
string public constant LA_UNKNOWN_SWAP_INTERFACE = "LA3";
string public constant LA_UNKNOWN_LP_INTERFACE = "LA4";
string public constant LA_LOWER_THAN_AMOUNT_MIN = "LA5";
string public constant LA_TOKEN_OUT_IS_NOT_COLLATERAL = "LA6";
//
// YEARN PRICE FEED
//
string public constant YPF_PRICE_PER_SHARE_OUT_OF_RANGE = "YP1";
string public constant YPF_INCORRECT_LIMITER_PARAMETERS = "YP2";
//
// TOKEN DISTRIBUTOR
//
string public constant TD_WALLET_IS_ALREADY_CONNECTED_TO_VC = "TD1";
string public constant TD_INCORRECT_WEIGHTS = "TD2";
string public constant TD_NON_ZERO_BALANCE_AFTER_DISTRIBUTION = "TD3";
string public constant TD_CONTRIBUTOR_IS_NOT_REGISTERED = "TD4";
}// SPDX-License-Identifier: GPL-2.0-or-later
// Gearbox Protocol. Generalized leverage for DeFi protocols
// (c) Gearbox Holdings, 2021
pragma solidity ^0.7.4;
pragma abicoder v2;
import {DataTypes} from "../../libraries/data/Types.sol";
/// @title Optimised for front-end credit Manager interface
/// @notice It's optimised for light-weight abi
interface IAppCreditManager {
function openCreditAccount(
uint256 amount,
address onBehalfOf,
uint256 leverageFactor,
uint256 referralCode
) external;
function closeCreditAccount(address to, DataTypes.Exchange[] calldata paths)
external;
function repayCreditAccount(address to) external;
function increaseBorrowedAmount(uint256 amount) external;
function addCollateral(
address onBehalfOf,
address token,
uint256 amount
) external;
function calcRepayAmount(address borrower, bool isLiquidated)
external
view
returns (uint256);
function getCreditAccountOrRevert(address borrower)
external
view
returns (address);
function hasOpenedCreditAccount(address borrower)
external
view
returns (bool);
function defaultSwapContract() external view returns (address);
}// SPDX-License-Identifier: GPL-2.0-or-later
// Gearbox Protocol. Generalized leverage for DeFi protocols
// (c) Gearbox Holdings, 2021
pragma solidity ^0.7.4;
/// @title DataType library
/// @notice Contains data types used in data compressor.
library DataTypes {
struct Exchange {
address[] path;
uint256 amountOutMin;
}
struct TokenBalance {
address token;
uint256 balance;
bool isAllowed;
}
struct ContractAdapter {
address allowedContract;
address adapter;
}
struct CreditAccountData {
address addr;
address borrower;
bool inUse;
address creditManager;
address underlyingToken;
uint256 borrowedAmountPlusInterest;
uint256 totalValue;
uint256 healthFactor;
uint256 borrowRate;
TokenBalance[] balances;
}
struct CreditAccountDataExtended {
address addr;
address borrower;
bool inUse;
address creditManager;
address underlyingToken;
uint256 borrowedAmountPlusInterest;
uint256 totalValue;
uint256 healthFactor;
uint256 borrowRate;
TokenBalance[] balances;
uint256 repayAmount;
uint256 liquidationAmount;
bool canBeClosed;
uint256 borrowedAmount;
uint256 cumulativeIndexAtOpen;
uint256 since;
}
struct CreditManagerData {
address addr;
bool hasAccount;
address underlyingToken;
bool isWETH;
bool canBorrow;
uint256 borrowRate;
uint256 minAmount;
uint256 maxAmount;
uint256 maxLeverageFactor;
uint256 availableLiquidity;
address[] allowedTokens;
ContractAdapter[] adapters;
}
struct PoolData {
address addr;
bool isWETH;
address underlyingToken;
address dieselToken;
uint256 linearCumulativeIndex;
uint256 availableLiquidity;
uint256 expectedLiquidity;
uint256 expectedLiquidityLimit;
uint256 totalBorrowed;
uint256 depositAPY_RAY;
uint256 borrowAPY_RAY;
uint256 dieselRate_RAY;
uint256 withdrawFee;
uint256 cumulativeIndex_RAY;
uint256 timestampLU;
}
struct TokenInfo {
address addr;
string symbol;
uint8 decimals;
}
struct AddressProviderData {
address contractRegister;
address acl;
address priceOracle;
address traderAccountFactory;
address dataCompressor;
address farmingFactory;
address accountMiner;
address treasuryContract;
address gearToken;
address wethToken;
address wethGateway;
}
struct MiningApproval {
address token;
address swapContract;
}
}// SPDX-License-Identifier: GPL-2.0-or-later
// Gearbox Protocol. Generalized leverage for DeFi protocols
// (c) Gearbox Holdings, 2021
pragma solidity ^0.7.4;
/// @title POptimised for front-end Pool Service Interface
interface IAppPoolService {
function addLiquidity(
uint256 amount,
address onBehalfOf,
uint256 referralCode
) external;
function removeLiquidity(uint256 amount, address to) external returns(uint256);
}// SPDX-License-Identifier: GPL-2.0-or-later
// Gearbox Protocol. Generalized leverage for DeFi protocols
// (c) Gearbox Holdings, 2021
pragma solidity ^0.7.4;
/// @title Optimised for front-end Address Provider interface
interface IAppAddressProvider {
function getDataCompressor() external view returns (address);
function getGearToken() external view returns (address);
function getWethToken() external view returns (address);
function getWETHGateway() external view returns (address);
function getPriceOracle() external view returns (address);
function getLeveragedActions() external view returns (address);
}// SPDX-License-Identifier: MIT
pragma solidity >=0.6.0 <0.8.0;
import "../utils/Context.sol";
/**
* @dev Contract module which provides a basic access control mechanism, where
* there is an account (an owner) that can be granted exclusive access to
* specific functions.
*
* By default, the owner account will be the one that deploys the contract. This
* can later be changed with {transferOwnership}.
*
* This module is used through inheritance. It will make available the modifier
* `onlyOwner`, which can be applied to your functions to restrict their use to
* the owner.
*/
abstract contract Ownable is Context {
address private _owner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
/**
* @dev Initializes the contract setting the deployer as the initial owner.
*/
constructor () internal {
address msgSender = _msgSender();
_owner = msgSender;
emit OwnershipTransferred(address(0), msgSender);
}
/**
* @dev Returns the address of the current owner.
*/
function owner() public view virtual returns (address) {
return _owner;
}
/**
* @dev Throws if called by any account other than the owner.
*/
modifier onlyOwner() {
require(owner() == _msgSender(), "Ownable: caller is not the owner");
_;
}
/**
* @dev Leaves the contract without owner. It will not be possible to call
* `onlyOwner` functions anymore. Can only be called by the current owner.
*
* NOTE: Renouncing ownership will leave the contract without an owner,
* thereby removing any functionality that is only available to the owner.
*/
function renounceOwnership() public virtual onlyOwner {
emit OwnershipTransferred(_owner, address(0));
_owner = address(0);
}
/**
* @dev Transfers ownership of the contract to a new account (`newOwner`).
* Can only be called by the current owner.
*/
function transferOwnership(address newOwner) public virtual onlyOwner {
require(newOwner != address(0), "Ownable: new owner is the zero address");
emit OwnershipTransferred(_owner, newOwner);
_owner = newOwner;
}
}// SPDX-License-Identifier: MIT
pragma solidity >=0.6.0 <0.8.0;
/*
* @dev Provides information about the current execution context, including the
* sender of the transaction and its data. While these are generally available
* via msg.sender and msg.data, they should not be accessed in such a direct
* manner, since when dealing with GSN meta-transactions the account sending and
* paying for execution may not be the actual sender (as far as an application
* is concerned).
*
* This contract is only required for intermediate, library-like contracts.
*/
abstract contract Context {
function _msgSender() internal view virtual returns (address payable) {
return msg.sender;
}
function _msgData() internal view virtual returns (bytes memory) {
this; // silence state mutability warning without generating bytecode - see https://github.com/ethereum/solidity/issues/2691
return msg.data;
}
}// SPDX-License-Identifier: MIT
pragma solidity >=0.6.0 <0.8.0;
import "./Context.sol";
/**
* @dev Contract module which allows children to implement an emergency stop
* mechanism that can be triggered by an authorized account.
*
* This module is used through inheritance. It will make available the
* modifiers `whenNotPaused` and `whenPaused`, which can be applied to
* the functions of your contract. Note that they will not be pausable by
* simply including this module, only once the modifiers are put in place.
*/
abstract contract Pausable is Context {
/**
* @dev Emitted when the pause is triggered by `account`.
*/
event Paused(address account);
/**
* @dev Emitted when the pause is lifted by `account`.
*/
event Unpaused(address account);
bool private _paused;
/**
* @dev Initializes the contract in unpaused state.
*/
constructor () internal {
_paused = false;
}
/**
* @dev Returns true if the contract is paused, and false otherwise.
*/
function paused() public view virtual returns (bool) {
return _paused;
}
/**
* @dev Modifier to make a function callable only when the contract is not paused.
*
* Requirements:
*
* - The contract must not be paused.
*/
modifier whenNotPaused() {
require(!paused(), "Pausable: paused");
_;
}
/**
* @dev Modifier to make a function callable only when the contract is paused.
*
* Requirements:
*
* - The contract must be paused.
*/
modifier whenPaused() {
require(paused(), "Pausable: not paused");
_;
}
/**
* @dev Triggers stopped state.
*
* Requirements:
*
* - The contract must not be paused.
*/
function _pause() internal virtual whenNotPaused {
_paused = true;
emit Paused(_msgSender());
}
/**
* @dev Returns to normal state.
*
* Requirements:
*
* - The contract must be paused.
*/
function _unpause() internal virtual whenPaused {
_paused = false;
emit Unpaused(_msgSender());
}
}// SPDX-License-Identifier: BUSL-1.1
// Gearbox Protocol. Generalized leverage for DeFi protocols
// (c) Gearbox Holdings, 2021
pragma solidity ^0.7.4;
import {Ownable} from "@openzeppelin/contracts/access/Ownable.sol";
import {Errors} from "../libraries/helpers/Errors.sol";
/// @title ACL keeps admins addresses
/// More info: https://dev.gearbox.fi/security/roles
contract ACL is Ownable {
mapping(address => bool) public pausableAdminSet;
mapping(address => bool) public unpausableAdminSet;
// Contract version
uint256 public constant version = 1;
// emits each time when new pausable admin added
event PausableAdminAdded(address indexed newAdmin);
// emits each time when pausable admin removed
event PausableAdminRemoved(address indexed admin);
// emits each time when new unpausable admin added
event UnpausableAdminAdded(address indexed newAdmin);
// emits each times when unpausable admin removed
event UnpausableAdminRemoved(address indexed admin);
/// @dev Adds pausable admin address
/// @param newAdmin Address of new pausable admin
function addPausableAdmin(address newAdmin)
external
onlyOwner // T:[ACL-1]
{
pausableAdminSet[newAdmin] = true; // T:[ACL-2]
emit PausableAdminAdded(newAdmin); // T:[ACL-2]
}
/// @dev Removes pausable admin
/// @param admin Address of admin which should be removed
function removePausableAdmin(address admin)
external
onlyOwner // T:[ACL-1]
{
pausableAdminSet[admin] = false; // T:[ACL-3]
emit PausableAdminRemoved(admin); // T:[ACL-3]
}
/// @dev Returns true if the address is pausable admin and false if not
function isPausableAdmin(address addr) external view returns (bool) {
return pausableAdminSet[addr]; // T:[ACL-2,3]
}
/// @dev Adds unpausable admin address to the list
/// @param newAdmin Address of new unpausable admin
function addUnpausableAdmin(address newAdmin)
external
onlyOwner // T:[ACL-1]
{
unpausableAdminSet[newAdmin] = true; // T:[ACL-4]
emit UnpausableAdminAdded(newAdmin); // T:[ACL-4]
}
/// @dev Removes unpausable admin
/// @param admin Address of admin to be removed
function removeUnpausableAdmin(address admin)
external
onlyOwner // T:[ACL-1]
{
unpausableAdminSet[admin] = false; // T:[ACL-5]
emit UnpausableAdminRemoved(admin); // T:[ACL-5]
}
/// @dev Returns true if the address is unpausable admin and false if not
function isUnpausableAdmin(address addr) external view returns (bool) {
return unpausableAdminSet[addr]; // T:[ACL-4,5]
}
/// @dev Returns true if addr has configurator rights
function isConfigurator(address account) external view returns (bool) {
return account == owner(); // T:[ACL-6]
}
}{
"optimizer": {
"enabled": false,
"runs": 200
},
"outputSelection": {
"*": {
"*": [
"evm.bytecode",
"evm.deployedBytecode",
"devdoc",
"userdoc",
"metadata",
"abi"
]
}
},
"libraries": {}
}Contract Security Audit
- No Contract Security Audit Submitted- Submit Audit Here
Contract ABI
API[{"inputs":[{"internalType":"address","name":"_addressProvider","type":"address"},{"internalType":"address","name":"_underlyingToken","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"protocol","type":"address"},{"indexed":true,"internalType":"address","name":"adapter","type":"address"}],"name":"ContractAllowed","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"protocol","type":"address"}],"name":"ContractForbidden","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"chiThreshold","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"fastCheckDelay","type":"uint256"}],"name":"NewFastCheckParameters","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"account","type":"address"}],"name":"Paused","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"newPriceOracle","type":"address"}],"name":"PriceOracleUpdated","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"token","type":"address"},{"indexed":false,"internalType":"uint256","name":"liquidityThreshold","type":"uint256"}],"name":"TokenAllowed","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"token","type":"address"}],"name":"TokenForbidden","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"from","type":"address"},{"indexed":true,"internalType":"address","name":"to","type":"address"},{"indexed":false,"internalType":"bool","name":"state","type":"bool"}],"name":"TransferAccountAllowed","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"pugin","type":"address"},{"indexed":false,"internalType":"bool","name":"state","type":"bool"}],"name":"TransferPluginAllowed","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"account","type":"address"}],"name":"Unpaused","type":"event"},{"inputs":[],"name":"addressProvider","outputs":[{"internalType":"contract AddressProvider","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"targetContract","type":"address"},{"internalType":"address","name":"adapter","type":"address"}],"name":"allowContract","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"plugin","type":"address"},{"internalType":"bool","name":"state","type":"bool"}],"name":"allowPlugin","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"token","type":"address"},{"internalType":"uint256","name":"liquidationThreshold","type":"uint256"}],"name":"allowToken","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"from","type":"address"},{"internalType":"address","name":"to","type":"address"}],"name":"allowanceForAccountTransfers","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"allowedAdapters","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"i","type":"uint256"}],"name":"allowedContracts","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"allowedContractsCount","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"allowedPlugins","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"allowedTokens","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"allowedTokensCount","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"from","type":"address"},{"internalType":"bool","name":"state","type":"bool"}],"name":"approveAccountTransfers","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"creditAccount","type":"address"}],"name":"calcCreditAccountAccruedInterest","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"creditAccount","type":"address"}],"name":"calcCreditAccountHealthFactor","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"percentage","type":"uint256"},{"internalType":"uint256","name":"times","type":"uint256"}],"name":"calcMaxPossibleDrop","outputs":[{"internalType":"uint256","name":"value","type":"uint256"}],"stateMutability":"pure","type":"function"},{"inputs":[{"internalType":"address","name":"creditAccount","type":"address"}],"name":"calcThresholdWeightedValue","outputs":[{"internalType":"uint256","name":"total","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"creditAccount","type":"address"}],"name":"calcTotalValue","outputs":[{"internalType":"uint256","name":"total","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"creditAccount","type":"address"},{"internalType":"address","name":"token","type":"address"}],"name":"checkAndEnableToken","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"creditAccount","type":"address"},{"internalType":"address","name":"tokenIn","type":"address"},{"internalType":"address","name":"tokenOut","type":"address"},{"internalType":"uint256","name":"amountIn","type":"uint256"},{"internalType":"uint256","name":"amountOut","type":"uint256"}],"name":"checkCollateralChange","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"creditAccount","type":"address"},{"internalType":"uint256[]","name":"amountIn","type":"uint256[]"},{"internalType":"uint256[]","name":"amountOut","type":"uint256[]"},{"internalType":"address[]","name":"tokenIn","type":"address[]"},{"internalType":"address[]","name":"tokenOut","type":"address[]"}],"name":"checkMultiTokenCollateral","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"chiThreshold","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_creditManager","type":"address"}],"name":"connectCreditManager","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"contractToAdapter","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"creditManager","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"enabledTokens","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"fastCheckCounter","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"targetContract","type":"address"}],"name":"forbidContract","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"token","type":"address"}],"name":"forbidToken","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"creditAccount","type":"address"},{"internalType":"uint256","name":"id","type":"uint256"}],"name":"getCreditAccountTokenById","outputs":[{"internalType":"address","name":"token","type":"address"},{"internalType":"uint256","name":"balance","type":"uint256"},{"internalType":"uint256","name":"tv","type":"uint256"},{"internalType":"uint256","name":"tvw","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"hfCheckInterval","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"creditAccount","type":"address"}],"name":"initEnabledTokens","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"isTokenAllowed","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"liquidationThresholds","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"pause","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"paused","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"poolService","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"priceOracle","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"owner","type":"address"},{"internalType":"address","name":"newOwner","type":"address"}],"name":"revertIfAccountTransferIsNotAllowed","outputs":[],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"creditAccount","type":"address"},{"internalType":"uint256","name":"minHealthFactor","type":"uint256"}],"name":"revertIfCantIncreaseBorrowing","outputs":[],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"token","type":"address"}],"name":"revertIfTokenNotAllowed","outputs":[],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_chiThreshold","type":"uint256"},{"internalType":"uint256","name":"_hfCheckInterval","type":"uint256"}],"name":"setFastCheckParameters","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"tokenMasksMap","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"underlyingToken","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"unpause","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"updateUnderlyingTokenLiquidationThreshold","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"upgradePriceOracle","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"version","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"wethAddress","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"}]Contract Creation Code
0x60806040523480156200001157600080fd5b506040516200721138038062007211833981810160405281019062000037919062001213565b8160008060006101000a81548160ff021916908315150217905550600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1614156040518060400160405280600281526020017f5a300000000000000000000000000000000000000000000000000000000000008152509062000163576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825283818151815260200191508051906020019080838360005b83811015620001275780820151818401526020810190506200010a565b50505050905090810190601f168015620001555780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b508073ffffffffffffffffffffffffffffffffffffffff1663087376956040518163ffffffff1660e01b815260040160206040518083038186803b158015620001ab57600080fd5b505afa158015620001c0573d6000803e3d6000fd5b505050506040513d6020811015620001d757600080fd5b8101908080519060200190929190505050600060016101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614158015620002945750600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1614155b6040518060400160405280600281526020017f5a30000000000000000000000000000000000000000000000000000000000000815250906200030e576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016200030591906200132d565b60405180910390fd5b5081600160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663fca513a86040518163ffffffff1660e01b815260040160206040518083038186803b158015620003b957600080fd5b505afa158015620003ce573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190620003f49190620011e7565b600d60006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16634c252f916040518163ffffffff1660e01b815260040160206040518083038186803b1580156200049d57600080fd5b505afa158015620004b2573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190620004d89190620011e7565b601060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555080600e60006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555060c861251c0360056000600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550620005fd600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1660c861251c036200071560201b60201c565b620006126126de600462000d6160201b60201c565b600160146000600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166377532ed96040518163ffffffff1660e01b815260040160206040518083038186803b1580156200068157600080fd5b505afa15801562000696573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190620006bc9190620011e7565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff021916908315150217905550505062001470565b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614156040518060400160405280600281526020017f5a3000000000000000000000000000000000000000000000000000000000000081525090620007c0576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401620007b791906200132d565b60405180910390fd5b5060008111801562000833575060056000600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020548111155b6040518060400160405280600381526020017f434631000000000000000000000000000000000000000000000000000000000081525090620008ad576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401620008a491906200132d565b60405180910390fd5b506000600660008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020541180620009035750610100600480549050105b6040518060400160405280600381526020017f4346360000000000000000000000000000000000000000000000000000000000815250906200097d576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016200097491906200132d565b60405180910390fd5b5060008273ffffffffffffffffffffffffffffffffffffffff166370a08231306040518263ffffffff1660e01b8152600401620009bb9190620012e3565b60206040518083038186803b158015620009d457600080fd5b505afa158015620009e9573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019062000a0f919062001254565b101562000a1b57600080fd5b6000600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663743b908684600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff166040518363ffffffff1660e01b815260040162000a9e92919062001300565b60206040518083038186803b15801562000ab757600080fd5b505afa15801562000acc573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019062000af2919062001254565b116040518060400160405280600381526020017f43464500000000000000000000000000000000000000000000000000000000008152509062000b6d576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040162000b6491906200132d565b60405180910390fd5b50600360008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1662000cc9576001600360008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055506004805490506001901b600660008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506004829080600181540180825580915050600190039060005260206000200160009091909190916101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055505b80600560008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff167fa52fb6bfa514a4ddcb31de40a5f6c20d767db1f921a8b7747973d93dc5da7a028260405162000d55919062001351565b60405180910390a25050565b816011819055508060128190555062000d7f62000dbe60201b60201c565b7f727652fff0946c19c233fd3eab5fc03db9e9fdd907e902d9136c2a9cac47101c828260405162000db29291906200136e565b60405180910390a15050565b600073ffffffffffffffffffffffffffffffffffffffff16600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161462000f6d57600062000e4862000e3160115460125462000f6f60201b60201c565b6127106200101f60201b620043661790919060201c565b9050600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16633915ffaa6040518163ffffffff1660e01b815260040160206040518083038186803b15801562000eb357600080fd5b505afa15801562000ec8573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019062000eee919062001254565b81106040518060400160405280600381526020017f43464200000000000000000000000000000000000000000000000000000000008152509062000f6a576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040162000f6191906200132d565b60405180910390fd5b50505b565b600062000f8d83612710620010a360201b620043e91790919060201c565b905060005b62000fad6001846200101f60201b620043661790919060201c565b81101562000ffa5762000fea61271062000fd68685620010a360201b620043e91790919060201c565b6200112e60201b6200446f1790919060201c565b9150808060010191505062000f92565b5062001017612710826200112e60201b6200446f1790919060201c565b905092915050565b60008282111562001098576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601e8152602001807f536166654d6174683a207375627472616374696f6e206f766572666c6f77000081525060200191505060405180910390fd5b818303905092915050565b600080831415620010b8576000905062001128565b6000828402905082848281620010ca57fe5b041462001123576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526021815260200180620071f06021913960400191505060405180910390fd5b809150505b92915050565b6000808211620011a6576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601a8152602001807f536166654d6174683a206469766973696f6e206279207a65726f00000000000081525060200191505060405180910390fd5b818381620011b057fe5b04905092915050565b600081519050620011ca816200143c565b92915050565b600081519050620011e18162001456565b92915050565b600060208284031215620011fa57600080fd5b60006200120a84828501620011b9565b91505092915050565b600080604083850312156200122757600080fd5b60006200123785828601620011b9565b92505060206200124a85828601620011b9565b9150509250929050565b6000602082840312156200126757600080fd5b60006200127784828501620011d0565b91505092915050565b6200128b81620013b7565b82525050565b60006200129e826200139b565b620012aa8185620013a6565b9350620012bc818560208601620013f5565b620012c7816200142b565b840191505092915050565b620012dd81620013eb565b82525050565b6000602082019050620012fa600083018462001280565b92915050565b600060408201905062001317600083018562001280565b62001326602083018462001280565b9392505050565b6000602082019050818103600083015262001349818462001291565b905092915050565b6000602082019050620013686000830184620012d2565b92915050565b6000604082019050620013856000830185620012d2565b620013946020830184620012d2565b9392505050565b600081519050919050565b600082825260208201905092915050565b6000620013c482620013cb565b9050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b60005b8381101562001415578082015181840152602081019050620013f8565b8381111562001425576000848401525b50505050565b6000601f19601f8301169050919050565b6200144781620013b7565b81146200145357600080fd5b50565b6200146181620013eb565b81146200146d57600080fd5b50565b615d7080620014806000396000f3fe608060405234801561001057600080fd5b50600436106102a05760003560e01c80635f598edd11610167578063b451cecc116100ce578063e54fe9c811610087578063e54fe9c814610838578063e6dee2cc14610854578063f0527ac614610872578063f67c5bd01461087c578063f9eaee0d146108ac578063fdd57645146108dc576102a0565b8063b451cecc14610752578063c12c21c014610782578063c7de38a6146107a0578063cf33d955146107d0578063dfd59465146107ec578063e1c8ef0d1461081c576102a0565b80638456cb59116101205780638456cb591461067d57806390b1300a14610687578063a147c6c6146106b7578063a5757517146106d3578063af0a6502146106ef578063b3c6194314610722576102a0565b80635f598edd146105ad57806362061c6d146105dd57806378327438146105f95780637bccacee146106295780637dd0ba82146106455780637e4a686314610661576102a0565b80634cba294a1161020b57806354fd4d50116101c457806354fd4d50146104d7578063570a7af2146104f55780635a29be45146105135780635c975abb146105435780635e5f2e26146105615780635f27212a14610591576102a0565b80634cba294a146104035780634f0e0ef3146104335780635094cb4f1461045157806350e036ff1461048157806351e3f1601461049f57806352438e54146104bb576102a0565b80633192195c1161025d5780633192195c146103555780633b00ae70146103855780633bdfe4f5146103a15780633f4ba83a146103d157806340631828146103db57806347dedfc9146103e5576102a0565b806320a05ff7146102a557806324147708146102c35780632495a599146102df5780632630c12f146102fd5780632954018c1461031b5780632e2986dd14610339575b600080fd5b6102ad61090c565b6040516102ba9190615ae0565b60405180910390f35b6102dd60048036038101906102d891906156a8565b610919565b005b6102e7610b58565b6040516102f491906159ff565b60405180910390f35b610305610b7e565b60405161031291906159ff565b60405180910390f35b610323610ba4565b6040516103309190615aa3565b60405180910390f35b610353600480360381019061034e9190615884565b610bca565b005b61036f600480360381019061036a91906156a8565b610e14565b60405161037c9190615ae0565b60405180910390f35b61039f600480360381019061039a91906156fa565b610fdb565b005b6103bb60048036038101906103b691906156a8565b611189565b6040516103c89190615a88565b60405180910390f35b6103d96111a9565b005b6103e3611354565b005b6103ed611ae2565b6040516103fa9190615ae0565b60405180910390f35b61041d600480360381019061041891906156a8565b611ae8565b60405161042a9190615ae0565b60405180910390f35b61043b611b00565b60405161044891906159ff565b60405180910390f35b61046b600480360381019061046691906158fc565b611b26565b60405161047891906159ff565b60405180910390f35b610489611b43565b6040516104969190615ae0565b60405180910390f35b6104b960048036038101906104b491906156fa565b611b54565b005b6104d560048036038101906104d091906156a8565b611c2b565b005b6104df61207d565b6040516104ec9190615ae0565b60405180910390f35b6104fd612082565b60405161050a91906159ff565b60405180910390f35b61052d600480360381019061052891906156fa565b6120a8565b60405161053a9190615a88565b60405180910390f35b61054b61213c565b6040516105589190615a88565b60405180910390f35b61057b600480360381019061057691906158fc565b612152565b60405161058891906159ff565b60405180910390f35b6105ab60048036038101906105a69190615884565b612191565b005b6105c760048036038101906105c291906156a8565b61228e565b6040516105d49190615a88565b60405180910390f35b6105f760048036038101906105f2919061594e565b6122ae565b005b610613600480360381019061060e91906156a8565b61245d565b6040516106209190615ae0565b60405180910390f35b610643600480360381019061063e91906156fa565b612475565b005b61065f600480360381019061065a91906156a8565b6129c4565b005b61067b600480360381019061067691906157ad565b612a8c565b005b610685612e59565b005b6106a1600480360381019061069c91906156a8565b613004565b6040516106ae9190615ae0565b60405180910390f35b6106d160048036038101906106cc91906158c0565b6130c1565b005b6106ed60048036038101906106e891906158c0565b613270565b005b610709600480360381019061070491906158c0565b6132f8565b6040516107199493929190615a43565b60405180910390f35b61073c6004803603810190610737919061594e565b6134fd565b6040516107499190615ae0565b60405180910390f35b61076c600480360381019061076791906156a8565b613588565b6040516107799190615ae0565b60405180910390f35b61078a6135a0565b60405161079791906159ff565b60405180910390f35b6107ba60048036038101906107b591906156a8565b6135c6565b6040516107c79190615ae0565b60405180910390f35b6107ea60048036038101906107e591906156a8565b61366c565b005b610806600480360381019061080191906156a8565b613bea565b6040516108139190615ae0565b60405180910390f35b61083660048036038101906108319190615736565b613c2a565b005b610852600480360381019061084d91906156a8565b613eb7565b005b61085c61400d565b6040516108699190615ae0565b60405180910390f35b61087a614013565b005b610896600480360381019061089191906156a8565b6142fb565b6040516108a39190615ae0565b60405180910390f35b6108c660048036038101906108c191906156a8565b614313565b6040516108d39190615a88565b60405180910390f35b6108f660048036038101906108f191906156a8565b614333565b60405161090391906159ff565b60405180910390f35b6000600480549050905090565b600060019054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16635f259aba336040518263ffffffff1660e01b8152600401808273ffffffffffffffffffffffffffffffffffffffff16815260200191505060206040518083038186803b1580156109a257600080fd5b505afa1580156109b6573d6000803e3d6000fd5b505050506040513d60208110156109cc57600080fd5b81019080805190602001909291905050506040518060400160405280600481526020017f41434c320000000000000000000000000000000000000000000000000000000081525090610ab9576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825283818151815260200191508051906020019080838360005b83811015610a7e578082015181840152602081019050610a63565b50505050905090810190601f168015610aab5780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b506000600360008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055508073ffffffffffffffffffffffffffffffffffffffff167ff17b849746e74d7186170c9553d4bbf60b4f8bb1ed81fe50c099b934fb078f0560405160405180910390a250565b600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b600060019054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16635f259aba336040518263ffffffff1660e01b8152600401808273ffffffffffffffffffffffffffffffffffffffff16815260200191505060206040518083038186803b158015610c5357600080fd5b505afa158015610c67573d6000803e3d6000fd5b505050506040513d6020811015610c7d57600080fd5b81019080805190602001909291905050506040518060400160405280600481526020017f41434c320000000000000000000000000000000000000000000000000000000081525090610d6a576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825283818151815260200191508051906020019080838360005b83811015610d2f578082015181840152602081019050610d14565b50505050905090810190601f168015610d5c5780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b5080601460008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055508173ffffffffffffffffffffffffffffffffffffffff167fc7d2592986c53f858769b011e8ce6298936f8609789988e9f5ad4f0a2079889782604051610e089190615a88565b60405180910390a25050565b6000610fd48273ffffffffffffffffffffffffffffffffffffffff166317d11a156040518163ffffffff1660e01b815260040160206040518083038186803b158015610e5f57600080fd5b505afa158015610e73573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e979190615925565b610fc6600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16630fce70fb6040518163ffffffff1660e01b815260040160206040518083038186803b158015610f0257600080fd5b505afa158015610f16573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610f3a9190615925565b8573ffffffffffffffffffffffffffffffffffffffff16631afbb7a46040518163ffffffff1660e01b815260040160206040518083038186803b158015610f8057600080fd5b505afa158015610f94573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610fb89190615925565b6143e990919063ffffffff16565b61446f90919063ffffffff16565b9050919050565b601460008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16158061107d5750601460008273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff165b1561118557601360008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff166040518060400160405280600381526020017f434646000000000000000000000000000000000000000000000000000000000081525090611183576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161117a9190615abe565b60405180910390fd5b505b5050565b600b6020528060005260406000206000915054906101000a900460ff1681565b600060019054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663d4eb5db0336040518263ffffffff1660e01b8152600401808273ffffffffffffffffffffffffffffffffffffffff16815260200191505060206040518083038186803b15801561123257600080fd5b505afa158015611246573d6000803e3d6000fd5b505050506040513d602081101561125c57600080fd5b81019080805190602001909291905050506040518060400160405280600481526020017f41434c310000000000000000000000000000000000000000000000000000000081525090611349576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825283818151815260200191508051906020019080838360005b8381101561130e5780820151818401526020810190506112f3565b50505050905090810190601f16801561133b5780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b506113526144f8565b565b600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16146040518060400160405280600381526020017f43463300000000000000000000000000000000000000000000000000000000008152509061141c576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016114139190615abe565b60405180910390fd5b50612710600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16635e0b63d36040518163ffffffff1660e01b815260040160206040518083038186803b15801561148857600080fd5b505afa15801561149c573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906114c09190615925565b10801561156d5750612710600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16633915ffaa6040518163ffffffff1660e01b815260040160206040518083038186803b15801561153357600080fd5b505afa158015611547573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061156b9190615925565b105b80156116195750612710600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16638053fcbe6040518163ffffffff1660e01b815260040160206040518083038186803b1580156115df57600080fd5b505afa1580156115f3573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906116179190615925565b105b6040518060400160405280600381526020017f434d38000000000000000000000000000000000000000000000000000000000081525090611690576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016116879190615abe565b60405180910390fd5b50612710600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663e1b4264c6040518163ffffffff1660e01b815260040160206040518083038186803b1580156116fc57600080fd5b505afa158015611710573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906117349190615925565b116040518060400160405280600381526020017f434d390000000000000000000000000000000000000000000000000000000000815250906117ac576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016117a39190615abe565b60405180910390fd5b506118fe600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16633915ffaa6040518163ffffffff1660e01b815260040160206040518083038186803b15801561181857600080fd5b505afa15801561182c573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906118509190615925565b600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16638053fcbe6040518163ffffffff1660e01b815260040160206040518083038186803b1580156118b857600080fd5b505afa1580156118cc573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906118f09190615925565b61436690919063ffffffff16565b60056000600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506000600190505b600480549050811015611ad75760056000600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205460056000600484815481106119ea57fe5b9060005260206000200160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205411156040518060400160405280600381526020017f434643000000000000000000000000000000000000000000000000000000000081525090611ac9576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611ac09190615abe565b60405180910390fd5b50808060010191505061196a565b50611ae06145e2565b565b60115481565b60086020528060005260406000206000915090505481565b601060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6000611b3c82600961477c90919063ffffffff16565b9050919050565b6000611b4f6009614796565b905090565b600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16146040518060400160405280600381526020017f434633000000000000000000000000000000000000000000000000000000000081525090611c1c576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611c139190615abe565b60405180910390fd5b50611c2782826147ab565b5050565b600060019054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16635f259aba336040518263ffffffff1660e01b8152600401808273ffffffffffffffffffffffffffffffffffffffff16815260200191505060206040518083038186803b158015611cb457600080fd5b505afa158015611cc8573d6000803e3d6000fd5b505050506040513d6020811015611cde57600080fd5b81019080805190602001909291905050506040518060400160405280600481526020017f41434c320000000000000000000000000000000000000000000000000000000081525090611dcb576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825283818151815260200191508051906020019080838360005b83811015611d90578082015181840152602081019050611d75565b50505050905090810190601f168015611dbd5780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b50600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1614156040518060400160405280600281526020017f5a3000000000000000000000000000000000000000000000000000000000000081525090611e74576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611e6b9190615abe565b60405180910390fd5b50611e8981600961490690919063ffffffff16565b6040518060400160405280600381526020017f434641000000000000000000000000000000000000000000000000000000000081525090611f00576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611ef79190615abe565b60405180910390fd5b506000600b6000600c60008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055506000600c60008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055508073ffffffffffffffffffffffffffffffffffffffff167fab9f405bf0c19b97f65a7031634db41569cd2f0e0376a610a1e977f9ab22b58f60405160405180910390a250565b600181565b600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6000601360008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16905092915050565b60008060009054906101000a900460ff16905090565b6004818154811061216257600080fd5b906000526020600020016000915054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b80601360008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055503373ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff167f9b3258bc4904fd6426b99843e206c6c7cdb1fd0f040121c25b71dafbb3851ee0836040516122829190615a88565b60405180910390a35050565b60146020528060005260406000206000915054906101000a900460ff1681565b600060019054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16635f259aba336040518263ffffffff1660e01b8152600401808273ffffffffffffffffffffffffffffffffffffffff16815260200191505060206040518083038186803b15801561233757600080fd5b505afa15801561234b573d6000803e3d6000fd5b505050506040513d602081101561236157600080fd5b81019080805190602001909291905050506040518060400160405280600481526020017f41434c32000000000000000000000000000000000000000000000000000000008152509061244e576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825283818151815260200191508051906020019080838360005b838110156124135780820151818401526020810190506123f8565b50505050905090810190601f1680156124405780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b506124598282614936565b5050565b60056020528060005260406000206000915090505481565b600060019054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16635f259aba336040518263ffffffff1660e01b8152600401808273ffffffffffffffffffffffffffffffffffffffff16815260200191505060206040518083038186803b1580156124fe57600080fd5b505afa158015612512573d6000803e3d6000fd5b505050506040513d602081101561252857600080fd5b81019080805190602001909291905050506040518060400160405280600481526020017f41434c320000000000000000000000000000000000000000000000000000000081525090612615576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825283818151815260200191508051906020019080838360005b838110156125da5780820151818401526020810190506125bf565b50505050905090810190601f1680156126075780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b50600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff16141580156126805750600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1614155b6040518060400160405280600281526020017f5a30000000000000000000000000000000000000000000000000000000000000815250906126f7576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016126ee9190615abe565b60405180910390fd5b5060001515600b60008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161515146040518060400160405280600381526020017f4346440000000000000000000000000000000000000000000000000000000000815250906127c3576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016127ba9190615abe565b60405180910390fd5b506000600b6000600c60008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055506001600b60008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055506128e782600961498990919063ffffffff16565b5080600c60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055508073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff167f4bcbefaef68b99503d502f5a6abe7bca2b183ab8ac55457013c77d084ebd130560405160405180910390a35050565b600360008273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff166040518060400160405280600381526020017f434632000000000000000000000000000000000000000000000000000000000081525090612a88576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401612a7f9190615abe565b60405180910390fd5b5050565b600b60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff166040518060400160405280600381526020017f434634000000000000000000000000000000000000000000000000000000000081525090612b50576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401612b479190615abe565b60405180910390fd5b5060008083518651148015612b66575082518551145b6040518060400160405280600281526020017f435200000000000000000000000000000000000000000000000000000000000081525090612bdd576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401612bd49190615abe565b60405180910390fd5b5060005b8651811015612d0257612cf3600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663b66102df898481518110612c3757fe5b6020026020010151888581518110612c4b57fe5b6020026020010151601060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff166040518463ffffffff1660e01b8152600401612c9493929190615afb565b60206040518083038186803b158015612cac57600080fd5b505afa158015612cc0573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612ce49190615925565b846149b990919063ffffffff16565b92508080600101915050612be1565b5060005b8551811015612e4457612d2c88858381518110612d1f57fe5b60200260200101516147ab565b612e35600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663b66102df888481518110612d7957fe5b6020026020010151878581518110612d8d57fe5b6020026020010151601060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff166040518463ffffffff1660e01b8152600401612dd693929190615afb565b60206040518083038186803b158015612dee57600080fd5b505afa158015612e02573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612e269190615925565b836149b990919063ffffffff16565b91508080600101915050612d06565b50612e50878383614a41565b50505050505050565b600060019054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16633a41ec64336040518263ffffffff1660e01b8152600401808273ffffffffffffffffffffffffffffffffffffffff16815260200191505060206040518083038186803b158015612ee257600080fd5b505afa158015612ef6573d6000803e3d6000fd5b505050506040513d6020811015612f0c57600080fd5b81019080805190602001909291905050506040518060400160405280600481526020017f41434c310000000000000000000000000000000000000000000000000000000081525090612ff9576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825283818151815260200191508051906020019080838360005b83811015612fbe578082015181840152602081019050612fa3565b50505050905090810190601f168015612feb5780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b50613002614be3565b565b6000806000600760008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905060005b6004805490508110156130a257806001901b92506000838316111561309557600061307986836132f8565b935050505061309181866149b990919063ffffffff16565b9450505b808060010191505061304e565b506130b86127108461446f90919063ffffffff16565b92505050919050565b600060019054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16635f259aba336040518263ffffffff1660e01b8152600401808273ffffffffffffffffffffffffffffffffffffffff16815260200191505060206040518083038186803b15801561314a57600080fd5b505afa15801561315e573d6000803e3d6000fd5b505050506040513d602081101561317457600080fd5b81019080805190602001909291905050506040518060400160405280600481526020017f41434c320000000000000000000000000000000000000000000000000000000081525090613261576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825283818151815260200191508051906020019080838360005b8381101561322657808201518184015260208101905061320b565b50505050905090810190601f1680156132535780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b5061326c8282614cce565b5050565b8061327a83613bea565b10156040518060400160405280600381526020017f434d350000000000000000000000000000000000000000000000000000000000815250906132f3576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016132ea9190615abe565b60405180910390fd5b505050565b6000806000806004858154811061330b57fe5b9060005260206000200160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1693508373ffffffffffffffffffffffffffffffffffffffff166370a08231876040518263ffffffff1660e01b815260040161337191906159ff565b60206040518083038186803b15801561338957600080fd5b505afa15801561339d573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906133c19190615925565b925060018311156134f457600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663b66102df8486600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff166040518463ffffffff1660e01b815260040161344d93929190615afb565b60206040518083038186803b15801561346557600080fd5b505afa158015613479573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061349d9190615925565b91506134f1600560008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054836143e990919063ffffffff16565b90505b92959194509250565b6000613514836127106143e990919063ffffffff16565b905060005b61352d60018461436690919063ffffffff16565b81101561356a5761355b61271061354d86856143e990919063ffffffff16565b61446f90919063ffffffff16565b91508080600101915050613519565b506135806127108261446f90919063ffffffff16565b905092915050565b60076020528060005260406000206000915090505481565b600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6000806000600760008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905060005b60048054905081101561366457806001901b92506000838316111561365757600061363b86836132f8565b509250505061365381866149b990919063ffffffff16565b9450505b8080600101915050613610565b505050919050565b600060019054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16635f259aba336040518263ffffffff1660e01b8152600401808273ffffffffffffffffffffffffffffffffffffffff16815260200191505060206040518083038186803b1580156136f557600080fd5b505afa158015613709573d6000803e3d6000fd5b505050506040513d602081101561371f57600080fd5b81019080805190602001909291905050506040518060400160405280600481526020017f41434c32000000000000000000000000000000000000000000000000000000008152509061380c576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825283818151815260200191508051906020019080838360005b838110156137d15780820151818401526020810190506137b6565b50505050905090810190601f1680156137fe5780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b50600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1614156040518060400160405280600281526020017f5a30000000000000000000000000000000000000000000000000000000000000815250906138b5576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016138ac9190615abe565b60405180910390fd5b50600073ffffffffffffffffffffffffffffffffffffffff16600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146040518060400160405280600381526020017f43464700000000000000000000000000000000000000000000000000000000008152509061397f576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016139769190615abe565b60405180910390fd5b5080600260006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055508073ffffffffffffffffffffffffffffffffffffffff1663570a7af26040518163ffffffff1660e01b815260040160206040518083038186803b158015613a0757600080fd5b505afa158015613a1b573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190613a3f91906156d1565b600f60006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16632495a5996040518163ffffffff1660e01b815260040160206040518083038186803b158015613b2057600080fd5b505afa158015613b34573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190613b5891906156d1565b73ffffffffffffffffffffffffffffffffffffffff16146040518060400160405280600381526020017f434630000000000000000000000000000000000000000000000000000000000081525090613be6576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401613bdd9190615abe565b60405180910390fd5b5050565b6000613c23613bf883610e14565b613c15612710613c0786613004565b6143e990919063ffffffff16565b61446f90919063ffffffff16565b9050919050565b600b60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff166040518060400160405280600381526020017f434634000000000000000000000000000000000000000000000000000000000081525090613cee576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401613ce59190615abe565b60405180910390fd5b50613cf985846147ab565b6000600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663b66102df8487601060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff166040518463ffffffff1660e01b8152600401613d7c93929190615afb565b60206040518083038186803b158015613d9457600080fd5b505afa158015613da8573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190613dcc9190615925565b90506000600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663b66102df8487601060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff166040518463ffffffff1660e01b8152600401613e5193929190615afb565b60206040518083038186803b158015613e6957600080fd5b505afa158015613e7d573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190613ea19190615925565b9050613eae878383614a41565b50505050505050565b600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16146040518060400160405280600381526020017f434633000000000000000000000000000000000000000000000000000000000081525090613f7f576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401613f769190615abe565b60405180910390fd5b506001600760008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506001600860008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555050565b60125481565b600060019054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16635f259aba336040518263ffffffff1660e01b8152600401808273ffffffffffffffffffffffffffffffffffffffff16815260200191505060206040518083038186803b15801561409c57600080fd5b505afa1580156140b0573d6000803e3d6000fd5b505050506040513d60208110156140c657600080fd5b81019080805190602001909291905050506040518060400160405280600481526020017f41434c3200000000000000000000000000000000000000000000000000000000815250906141b3576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825283818151815260200191508051906020019080838360005b8381101561417857808201518184015260208101905061415d565b50505050905090810190601f1680156141a55780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b50600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663fca513a86040518163ffffffff1660e01b815260040160206040518083038186803b15801561421c57600080fd5b505afa158015614230573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061425491906156d1565b600d60006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167fefe8ab924ca486283a79dc604baa67add51afb82af1db8ac386ebbba643cdffd60405160405180910390a2565b60066020528060005260406000206000915090505481565b60036020528060005260406000206000915054906101000a900460ff1681565b600c6020528060005260406000206000915054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6000828211156143de576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601e8152602001807f536166654d6174683a207375627472616374696f6e206f766572666c6f77000081525060200191505060405180910390fd5b818303905092915050565b6000808314156143fc5760009050614469565b600082840290508284828161440d57fe5b0414614464576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526021815260200180615d1a6021913960400191505060405180910390fd5b809150505b92915050565b60008082116144e6576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601a8152602001807f536166654d6174683a206469766973696f6e206279207a65726f00000000000081525060200191505060405180910390fd5b8183816144ef57fe5b04905092915050565b61450061213c565b614572576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260148152602001807f5061757361626c653a206e6f742070617573656400000000000000000000000081525060200191505060405180910390fd5b60008060006101000a81548160ff0219169083151502179055507f5db9ee0a495bf2e6ff9c91a7834c1ba4fdd244a5e8aa4e537bd38aeae4b073aa6145b56152fc565b604051808273ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390a1565b600073ffffffffffffffffffffffffffffffffffffffff16600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161461477a57600061465c61464b6011546012546134fd565b61271061436690919063ffffffff16565b9050600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16633915ffaa6040518163ffffffff1660e01b815260040160206040518083038186803b1580156146c657600080fd5b505afa1580156146da573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906146fe9190615925565b81106040518060400160405280600381526020017f434642000000000000000000000000000000000000000000000000000000000081525090614777576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161476e9190615abe565b60405180910390fd5b50505b565b600061478b8360000183615304565b60001c905092915050565b60006147a482600001615387565b9050919050565b6147b4816129c4565b6000600660008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054600760008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205416141561490257600660008273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054600760008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205417600760008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b5050565b600061492e836000018373ffffffffffffffffffffffffffffffffffffffff1660001b615398565b905092915050565b816011819055508060128190555061494c6145e2565b7f727652fff0946c19c233fd3eab5fc03db9e9fdd907e902d9136c2a9cac47101c828260405161497d929190615b32565b60405180910390a15050565b60006149b1836000018373ffffffffffffffffffffffffffffffffffffffff1660001b615480565b905092915050565b600080828401905083811015614a37576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601b8152602001807f536166654d6174683a206164646974696f6e206f766572666c6f77000000000081525060200191505060405180910390fd5b8091505092915050565b614a56601154836143e990919063ffffffff16565b614a6b612710836143e990919063ffffffff16565b118015614ab95750601254600860008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205411155b15614b1257600860008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008154809291906001019190505550614bde565b612710614b1e84613bea565b10156040518060400160405280600381526020017f434635000000000000000000000000000000000000000000000000000000000081525090614b97576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401614b8e9190615abe565b60405180910390fd5b506001600860008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b505050565b614beb61213c565b15614c5e576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260108152602001807f5061757361626c653a207061757365640000000000000000000000000000000081525060200191505060405180910390fd5b60016000806101000a81548160ff0219169083151502179055507f62e78cea01bee320cd4e420270b5ea74000d11b0c9f74754ebdbfc544b05a258614ca16152fc565b604051808273ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390a1565b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614156040518060400160405280600281526020017f5a3000000000000000000000000000000000000000000000000000000000000081525090614d76576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401614d6d9190615abe565b60405180910390fd5b50600081118015614de8575060056000600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020548111155b6040518060400160405280600381526020017f434631000000000000000000000000000000000000000000000000000000000081525090614e5f576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401614e569190615abe565b60405180910390fd5b506000600660008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020541180614eb45750610100600480549050105b6040518060400160405280600381526020017f434636000000000000000000000000000000000000000000000000000000000081525090614f2b576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401614f229190615abe565b60405180910390fd5b5060008273ffffffffffffffffffffffffffffffffffffffff166370a08231306040518263ffffffff1660e01b8152600401614f6791906159ff565b60206040518083038186803b158015614f7f57600080fd5b505afa158015614f93573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190614fb79190615925565b1015614fc257600080fd5b6000600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663743b908684600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff166040518363ffffffff1660e01b8152600401615043929190615a1a565b60206040518083038186803b15801561505b57600080fd5b505afa15801561506f573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906150939190615925565b116040518060400160405280600381526020017f43464500000000000000000000000000000000000000000000000000000000008152509061510b576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016151029190615abe565b60405180910390fd5b50600360008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16615266576001600360008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055506004805490506001901b600660008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506004829080600181540180825580915050600190039060005260206000200160009091909190916101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055505b80600560008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff167fa52fb6bfa514a4ddcb31de40a5f6c20d767db1f921a8b7747973d93dc5da7a02826040516152f09190615ae0565b60405180910390a25050565b600033905090565b600081836000018054905011615365576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526022815260200180615cf86022913960400191505060405180910390fd5b82600001828154811061537457fe5b9060005260206000200154905092915050565b600081600001805490509050919050565b6000808360010160008481526020019081526020016000205490506000811461547457600060018203905060006001866000018054905003905060008660000182815481106153e357fe5b906000526020600020015490508087600001848154811061540057fe5b906000526020600020018190555060018301876001016000838152602001908152602001600020819055508660000180548061543857fe5b6001900381819060005260206000200160009055905586600101600087815260200190815260200160002060009055600194505050505061547a565b60009150505b92915050565b600061548c83836154f0565b6154e55782600001829080600181540180825580915050600190039060005260206000200160009091909190915055826000018054905083600101600084815260200190815260200160002081905550600190506154ea565b600090505b92915050565b600080836001016000848152602001908152602001600020541415905092915050565b600061552661552184615b8c565b615b5b565b9050808382526020820190508285602086028201111561554557600080fd5b60005b85811015615575578161555b88826155eb565b845260208401935060208301925050600181019050615548565b5050509392505050565b600061559261558d84615bb8565b615b5b565b905080838252602082019050828560208602820111156155b157600080fd5b60005b858110156155e157816155c7888261567e565b8452602084019350602083019250506001810190506155b4565b5050509392505050565b6000813590506155fa81615cb2565b92915050565b60008151905061560f81615cb2565b92915050565b600082601f83011261562657600080fd5b8135615636848260208601615513565b91505092915050565b600082601f83011261565057600080fd5b813561566084826020860161557f565b91505092915050565b60008135905061567881615cc9565b92915050565b60008135905061568d81615ce0565b92915050565b6000815190506156a281615ce0565b92915050565b6000602082840312156156ba57600080fd5b60006156c8848285016155eb565b91505092915050565b6000602082840312156156e357600080fd5b60006156f184828501615600565b91505092915050565b6000806040838503121561570d57600080fd5b600061571b858286016155eb565b925050602061572c858286016155eb565b9150509250929050565b600080600080600060a0868803121561574e57600080fd5b600061575c888289016155eb565b955050602061576d888289016155eb565b945050604061577e888289016155eb565b935050606061578f8882890161567e565b92505060806157a08882890161567e565b9150509295509295909350565b600080600080600060a086880312156157c557600080fd5b60006157d3888289016155eb565b955050602086013567ffffffffffffffff8111156157f057600080fd5b6157fc8882890161563f565b945050604086013567ffffffffffffffff81111561581957600080fd5b6158258882890161563f565b935050606086013567ffffffffffffffff81111561584257600080fd5b61584e88828901615615565b925050608086013567ffffffffffffffff81111561586b57600080fd5b61587788828901615615565b9150509295509295909350565b6000806040838503121561589757600080fd5b60006158a5858286016155eb565b92505060206158b685828601615669565b9150509250929050565b600080604083850312156158d357600080fd5b60006158e1858286016155eb565b92505060206158f28582860161567e565b9150509250929050565b60006020828403121561590e57600080fd5b600061591c8482850161567e565b91505092915050565b60006020828403121561593757600080fd5b600061594584828501615693565b91505092915050565b6000806040838503121561596157600080fd5b600061596f8582860161567e565b92505060206159808582860161567e565b9150509250929050565b61599381615c00565b82525050565b6159a281615c12565b82525050565b6159b181615c48565b82525050565b60006159c282615be4565b6159cc8185615bef565b93506159dc818560208601615c6c565b6159e581615ca1565b840191505092915050565b6159f981615c3e565b82525050565b6000602082019050615a14600083018461598a565b92915050565b6000604082019050615a2f600083018561598a565b615a3c602083018461598a565b9392505050565b6000608082019050615a58600083018761598a565b615a6560208301866159f0565b615a7260408301856159f0565b615a7f60608301846159f0565b95945050505050565b6000602082019050615a9d6000830184615999565b92915050565b6000602082019050615ab860008301846159a8565b92915050565b60006020820190508181036000830152615ad881846159b7565b905092915050565b6000602082019050615af560008301846159f0565b92915050565b6000606082019050615b1060008301866159f0565b615b1d602083018561598a565b615b2a604083018461598a565b949350505050565b6000604082019050615b4760008301856159f0565b615b5460208301846159f0565b9392505050565b6000604051905081810181811067ffffffffffffffff82111715615b8257615b81615c9f565b5b8060405250919050565b600067ffffffffffffffff821115615ba757615ba6615c9f565b5b602082029050602081019050919050565b600067ffffffffffffffff821115615bd357615bd2615c9f565b5b602082029050602081019050919050565b600081519050919050565b600082825260208201905092915050565b6000615c0b82615c1e565b9050919050565b60008115159050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b6000615c5382615c5a565b9050919050565b6000615c6582615c1e565b9050919050565b60005b83811015615c8a578082015181840152602081019050615c6f565b83811115615c99576000848401525b50505050565bfe5b6000601f19601f8301169050919050565b615cbb81615c00565b8114615cc657600080fd5b50565b615cd281615c12565b8114615cdd57600080fd5b50565b615ce981615c3e565b8114615cf457600080fd5b5056fe456e756d657261626c655365743a20696e646578206f7574206f6620626f756e6473536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f77a2646970667358221220028a4f708f68c0c3408d97335159caf12fa6f6717c381978b6354c913bc0e4c464736f6c63430007060033536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f77000000000000000000000000cf64698aff7e5f27a11dff868af228653ba53be00000000000000000000000002260fac5e5542a773aa44fbcfedf7c193bc2c599
Deployed Bytecode
0x608060405234801561001057600080fd5b50600436106102a05760003560e01c80635f598edd11610167578063b451cecc116100ce578063e54fe9c811610087578063e54fe9c814610838578063e6dee2cc14610854578063f0527ac614610872578063f67c5bd01461087c578063f9eaee0d146108ac578063fdd57645146108dc576102a0565b8063b451cecc14610752578063c12c21c014610782578063c7de38a6146107a0578063cf33d955146107d0578063dfd59465146107ec578063e1c8ef0d1461081c576102a0565b80638456cb59116101205780638456cb591461067d57806390b1300a14610687578063a147c6c6146106b7578063a5757517146106d3578063af0a6502146106ef578063b3c6194314610722576102a0565b80635f598edd146105ad57806362061c6d146105dd57806378327438146105f95780637bccacee146106295780637dd0ba82146106455780637e4a686314610661576102a0565b80634cba294a1161020b57806354fd4d50116101c457806354fd4d50146104d7578063570a7af2146104f55780635a29be45146105135780635c975abb146105435780635e5f2e26146105615780635f27212a14610591576102a0565b80634cba294a146104035780634f0e0ef3146104335780635094cb4f1461045157806350e036ff1461048157806351e3f1601461049f57806352438e54146104bb576102a0565b80633192195c1161025d5780633192195c146103555780633b00ae70146103855780633bdfe4f5146103a15780633f4ba83a146103d157806340631828146103db57806347dedfc9146103e5576102a0565b806320a05ff7146102a557806324147708146102c35780632495a599146102df5780632630c12f146102fd5780632954018c1461031b5780632e2986dd14610339575b600080fd5b6102ad61090c565b6040516102ba9190615ae0565b60405180910390f35b6102dd60048036038101906102d891906156a8565b610919565b005b6102e7610b58565b6040516102f491906159ff565b60405180910390f35b610305610b7e565b60405161031291906159ff565b60405180910390f35b610323610ba4565b6040516103309190615aa3565b60405180910390f35b610353600480360381019061034e9190615884565b610bca565b005b61036f600480360381019061036a91906156a8565b610e14565b60405161037c9190615ae0565b60405180910390f35b61039f600480360381019061039a91906156fa565b610fdb565b005b6103bb60048036038101906103b691906156a8565b611189565b6040516103c89190615a88565b60405180910390f35b6103d96111a9565b005b6103e3611354565b005b6103ed611ae2565b6040516103fa9190615ae0565b60405180910390f35b61041d600480360381019061041891906156a8565b611ae8565b60405161042a9190615ae0565b60405180910390f35b61043b611b00565b60405161044891906159ff565b60405180910390f35b61046b600480360381019061046691906158fc565b611b26565b60405161047891906159ff565b60405180910390f35b610489611b43565b6040516104969190615ae0565b60405180910390f35b6104b960048036038101906104b491906156fa565b611b54565b005b6104d560048036038101906104d091906156a8565b611c2b565b005b6104df61207d565b6040516104ec9190615ae0565b60405180910390f35b6104fd612082565b60405161050a91906159ff565b60405180910390f35b61052d600480360381019061052891906156fa565b6120a8565b60405161053a9190615a88565b60405180910390f35b61054b61213c565b6040516105589190615a88565b60405180910390f35b61057b600480360381019061057691906158fc565b612152565b60405161058891906159ff565b60405180910390f35b6105ab60048036038101906105a69190615884565b612191565b005b6105c760048036038101906105c291906156a8565b61228e565b6040516105d49190615a88565b60405180910390f35b6105f760048036038101906105f2919061594e565b6122ae565b005b610613600480360381019061060e91906156a8565b61245d565b6040516106209190615ae0565b60405180910390f35b610643600480360381019061063e91906156fa565b612475565b005b61065f600480360381019061065a91906156a8565b6129c4565b005b61067b600480360381019061067691906157ad565b612a8c565b005b610685612e59565b005b6106a1600480360381019061069c91906156a8565b613004565b6040516106ae9190615ae0565b60405180910390f35b6106d160048036038101906106cc91906158c0565b6130c1565b005b6106ed60048036038101906106e891906158c0565b613270565b005b610709600480360381019061070491906158c0565b6132f8565b6040516107199493929190615a43565b60405180910390f35b61073c6004803603810190610737919061594e565b6134fd565b6040516107499190615ae0565b60405180910390f35b61076c600480360381019061076791906156a8565b613588565b6040516107799190615ae0565b60405180910390f35b61078a6135a0565b60405161079791906159ff565b60405180910390f35b6107ba60048036038101906107b591906156a8565b6135c6565b6040516107c79190615ae0565b60405180910390f35b6107ea60048036038101906107e591906156a8565b61366c565b005b610806600480360381019061080191906156a8565b613bea565b6040516108139190615ae0565b60405180910390f35b61083660048036038101906108319190615736565b613c2a565b005b610852600480360381019061084d91906156a8565b613eb7565b005b61085c61400d565b6040516108699190615ae0565b60405180910390f35b61087a614013565b005b610896600480360381019061089191906156a8565b6142fb565b6040516108a39190615ae0565b60405180910390f35b6108c660048036038101906108c191906156a8565b614313565b6040516108d39190615a88565b60405180910390f35b6108f660048036038101906108f191906156a8565b614333565b60405161090391906159ff565b60405180910390f35b6000600480549050905090565b600060019054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16635f259aba336040518263ffffffff1660e01b8152600401808273ffffffffffffffffffffffffffffffffffffffff16815260200191505060206040518083038186803b1580156109a257600080fd5b505afa1580156109b6573d6000803e3d6000fd5b505050506040513d60208110156109cc57600080fd5b81019080805190602001909291905050506040518060400160405280600481526020017f41434c320000000000000000000000000000000000000000000000000000000081525090610ab9576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825283818151815260200191508051906020019080838360005b83811015610a7e578082015181840152602081019050610a63565b50505050905090810190601f168015610aab5780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b506000600360008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055508073ffffffffffffffffffffffffffffffffffffffff167ff17b849746e74d7186170c9553d4bbf60b4f8bb1ed81fe50c099b934fb078f0560405160405180910390a250565b600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b600060019054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16635f259aba336040518263ffffffff1660e01b8152600401808273ffffffffffffffffffffffffffffffffffffffff16815260200191505060206040518083038186803b158015610c5357600080fd5b505afa158015610c67573d6000803e3d6000fd5b505050506040513d6020811015610c7d57600080fd5b81019080805190602001909291905050506040518060400160405280600481526020017f41434c320000000000000000000000000000000000000000000000000000000081525090610d6a576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825283818151815260200191508051906020019080838360005b83811015610d2f578082015181840152602081019050610d14565b50505050905090810190601f168015610d5c5780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b5080601460008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055508173ffffffffffffffffffffffffffffffffffffffff167fc7d2592986c53f858769b011e8ce6298936f8609789988e9f5ad4f0a2079889782604051610e089190615a88565b60405180910390a25050565b6000610fd48273ffffffffffffffffffffffffffffffffffffffff166317d11a156040518163ffffffff1660e01b815260040160206040518083038186803b158015610e5f57600080fd5b505afa158015610e73573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e979190615925565b610fc6600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16630fce70fb6040518163ffffffff1660e01b815260040160206040518083038186803b158015610f0257600080fd5b505afa158015610f16573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610f3a9190615925565b8573ffffffffffffffffffffffffffffffffffffffff16631afbb7a46040518163ffffffff1660e01b815260040160206040518083038186803b158015610f8057600080fd5b505afa158015610f94573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610fb89190615925565b6143e990919063ffffffff16565b61446f90919063ffffffff16565b9050919050565b601460008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16158061107d5750601460008273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff165b1561118557601360008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff166040518060400160405280600381526020017f434646000000000000000000000000000000000000000000000000000000000081525090611183576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161117a9190615abe565b60405180910390fd5b505b5050565b600b6020528060005260406000206000915054906101000a900460ff1681565b600060019054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663d4eb5db0336040518263ffffffff1660e01b8152600401808273ffffffffffffffffffffffffffffffffffffffff16815260200191505060206040518083038186803b15801561123257600080fd5b505afa158015611246573d6000803e3d6000fd5b505050506040513d602081101561125c57600080fd5b81019080805190602001909291905050506040518060400160405280600481526020017f41434c310000000000000000000000000000000000000000000000000000000081525090611349576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825283818151815260200191508051906020019080838360005b8381101561130e5780820151818401526020810190506112f3565b50505050905090810190601f16801561133b5780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b506113526144f8565b565b600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16146040518060400160405280600381526020017f43463300000000000000000000000000000000000000000000000000000000008152509061141c576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016114139190615abe565b60405180910390fd5b50612710600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16635e0b63d36040518163ffffffff1660e01b815260040160206040518083038186803b15801561148857600080fd5b505afa15801561149c573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906114c09190615925565b10801561156d5750612710600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16633915ffaa6040518163ffffffff1660e01b815260040160206040518083038186803b15801561153357600080fd5b505afa158015611547573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061156b9190615925565b105b80156116195750612710600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16638053fcbe6040518163ffffffff1660e01b815260040160206040518083038186803b1580156115df57600080fd5b505afa1580156115f3573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906116179190615925565b105b6040518060400160405280600381526020017f434d38000000000000000000000000000000000000000000000000000000000081525090611690576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016116879190615abe565b60405180910390fd5b50612710600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663e1b4264c6040518163ffffffff1660e01b815260040160206040518083038186803b1580156116fc57600080fd5b505afa158015611710573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906117349190615925565b116040518060400160405280600381526020017f434d390000000000000000000000000000000000000000000000000000000000815250906117ac576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016117a39190615abe565b60405180910390fd5b506118fe600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16633915ffaa6040518163ffffffff1660e01b815260040160206040518083038186803b15801561181857600080fd5b505afa15801561182c573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906118509190615925565b600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16638053fcbe6040518163ffffffff1660e01b815260040160206040518083038186803b1580156118b857600080fd5b505afa1580156118cc573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906118f09190615925565b61436690919063ffffffff16565b60056000600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506000600190505b600480549050811015611ad75760056000600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205460056000600484815481106119ea57fe5b9060005260206000200160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205411156040518060400160405280600381526020017f434643000000000000000000000000000000000000000000000000000000000081525090611ac9576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611ac09190615abe565b60405180910390fd5b50808060010191505061196a565b50611ae06145e2565b565b60115481565b60086020528060005260406000206000915090505481565b601060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6000611b3c82600961477c90919063ffffffff16565b9050919050565b6000611b4f6009614796565b905090565b600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16146040518060400160405280600381526020017f434633000000000000000000000000000000000000000000000000000000000081525090611c1c576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611c139190615abe565b60405180910390fd5b50611c2782826147ab565b5050565b600060019054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16635f259aba336040518263ffffffff1660e01b8152600401808273ffffffffffffffffffffffffffffffffffffffff16815260200191505060206040518083038186803b158015611cb457600080fd5b505afa158015611cc8573d6000803e3d6000fd5b505050506040513d6020811015611cde57600080fd5b81019080805190602001909291905050506040518060400160405280600481526020017f41434c320000000000000000000000000000000000000000000000000000000081525090611dcb576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825283818151815260200191508051906020019080838360005b83811015611d90578082015181840152602081019050611d75565b50505050905090810190601f168015611dbd5780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b50600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1614156040518060400160405280600281526020017f5a3000000000000000000000000000000000000000000000000000000000000081525090611e74576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611e6b9190615abe565b60405180910390fd5b50611e8981600961490690919063ffffffff16565b6040518060400160405280600381526020017f434641000000000000000000000000000000000000000000000000000000000081525090611f00576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611ef79190615abe565b60405180910390fd5b506000600b6000600c60008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055506000600c60008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055508073ffffffffffffffffffffffffffffffffffffffff167fab9f405bf0c19b97f65a7031634db41569cd2f0e0376a610a1e977f9ab22b58f60405160405180910390a250565b600181565b600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6000601360008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16905092915050565b60008060009054906101000a900460ff16905090565b6004818154811061216257600080fd5b906000526020600020016000915054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b80601360008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055503373ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff167f9b3258bc4904fd6426b99843e206c6c7cdb1fd0f040121c25b71dafbb3851ee0836040516122829190615a88565b60405180910390a35050565b60146020528060005260406000206000915054906101000a900460ff1681565b600060019054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16635f259aba336040518263ffffffff1660e01b8152600401808273ffffffffffffffffffffffffffffffffffffffff16815260200191505060206040518083038186803b15801561233757600080fd5b505afa15801561234b573d6000803e3d6000fd5b505050506040513d602081101561236157600080fd5b81019080805190602001909291905050506040518060400160405280600481526020017f41434c32000000000000000000000000000000000000000000000000000000008152509061244e576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825283818151815260200191508051906020019080838360005b838110156124135780820151818401526020810190506123f8565b50505050905090810190601f1680156124405780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b506124598282614936565b5050565b60056020528060005260406000206000915090505481565b600060019054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16635f259aba336040518263ffffffff1660e01b8152600401808273ffffffffffffffffffffffffffffffffffffffff16815260200191505060206040518083038186803b1580156124fe57600080fd5b505afa158015612512573d6000803e3d6000fd5b505050506040513d602081101561252857600080fd5b81019080805190602001909291905050506040518060400160405280600481526020017f41434c320000000000000000000000000000000000000000000000000000000081525090612615576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825283818151815260200191508051906020019080838360005b838110156125da5780820151818401526020810190506125bf565b50505050905090810190601f1680156126075780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b50600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff16141580156126805750600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1614155b6040518060400160405280600281526020017f5a30000000000000000000000000000000000000000000000000000000000000815250906126f7576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016126ee9190615abe565b60405180910390fd5b5060001515600b60008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161515146040518060400160405280600381526020017f4346440000000000000000000000000000000000000000000000000000000000815250906127c3576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016127ba9190615abe565b60405180910390fd5b506000600b6000600c60008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055506001600b60008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055506128e782600961498990919063ffffffff16565b5080600c60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055508073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff167f4bcbefaef68b99503d502f5a6abe7bca2b183ab8ac55457013c77d084ebd130560405160405180910390a35050565b600360008273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff166040518060400160405280600381526020017f434632000000000000000000000000000000000000000000000000000000000081525090612a88576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401612a7f9190615abe565b60405180910390fd5b5050565b600b60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff166040518060400160405280600381526020017f434634000000000000000000000000000000000000000000000000000000000081525090612b50576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401612b479190615abe565b60405180910390fd5b5060008083518651148015612b66575082518551145b6040518060400160405280600281526020017f435200000000000000000000000000000000000000000000000000000000000081525090612bdd576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401612bd49190615abe565b60405180910390fd5b5060005b8651811015612d0257612cf3600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663b66102df898481518110612c3757fe5b6020026020010151888581518110612c4b57fe5b6020026020010151601060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff166040518463ffffffff1660e01b8152600401612c9493929190615afb565b60206040518083038186803b158015612cac57600080fd5b505afa158015612cc0573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612ce49190615925565b846149b990919063ffffffff16565b92508080600101915050612be1565b5060005b8551811015612e4457612d2c88858381518110612d1f57fe5b60200260200101516147ab565b612e35600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663b66102df888481518110612d7957fe5b6020026020010151878581518110612d8d57fe5b6020026020010151601060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff166040518463ffffffff1660e01b8152600401612dd693929190615afb565b60206040518083038186803b158015612dee57600080fd5b505afa158015612e02573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612e269190615925565b836149b990919063ffffffff16565b91508080600101915050612d06565b50612e50878383614a41565b50505050505050565b600060019054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16633a41ec64336040518263ffffffff1660e01b8152600401808273ffffffffffffffffffffffffffffffffffffffff16815260200191505060206040518083038186803b158015612ee257600080fd5b505afa158015612ef6573d6000803e3d6000fd5b505050506040513d6020811015612f0c57600080fd5b81019080805190602001909291905050506040518060400160405280600481526020017f41434c310000000000000000000000000000000000000000000000000000000081525090612ff9576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825283818151815260200191508051906020019080838360005b83811015612fbe578082015181840152602081019050612fa3565b50505050905090810190601f168015612feb5780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b50613002614be3565b565b6000806000600760008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905060005b6004805490508110156130a257806001901b92506000838316111561309557600061307986836132f8565b935050505061309181866149b990919063ffffffff16565b9450505b808060010191505061304e565b506130b86127108461446f90919063ffffffff16565b92505050919050565b600060019054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16635f259aba336040518263ffffffff1660e01b8152600401808273ffffffffffffffffffffffffffffffffffffffff16815260200191505060206040518083038186803b15801561314a57600080fd5b505afa15801561315e573d6000803e3d6000fd5b505050506040513d602081101561317457600080fd5b81019080805190602001909291905050506040518060400160405280600481526020017f41434c320000000000000000000000000000000000000000000000000000000081525090613261576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825283818151815260200191508051906020019080838360005b8381101561322657808201518184015260208101905061320b565b50505050905090810190601f1680156132535780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b5061326c8282614cce565b5050565b8061327a83613bea565b10156040518060400160405280600381526020017f434d350000000000000000000000000000000000000000000000000000000000815250906132f3576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016132ea9190615abe565b60405180910390fd5b505050565b6000806000806004858154811061330b57fe5b9060005260206000200160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1693508373ffffffffffffffffffffffffffffffffffffffff166370a08231876040518263ffffffff1660e01b815260040161337191906159ff565b60206040518083038186803b15801561338957600080fd5b505afa15801561339d573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906133c19190615925565b925060018311156134f457600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663b66102df8486600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff166040518463ffffffff1660e01b815260040161344d93929190615afb565b60206040518083038186803b15801561346557600080fd5b505afa158015613479573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061349d9190615925565b91506134f1600560008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054836143e990919063ffffffff16565b90505b92959194509250565b6000613514836127106143e990919063ffffffff16565b905060005b61352d60018461436690919063ffffffff16565b81101561356a5761355b61271061354d86856143e990919063ffffffff16565b61446f90919063ffffffff16565b91508080600101915050613519565b506135806127108261446f90919063ffffffff16565b905092915050565b60076020528060005260406000206000915090505481565b600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6000806000600760008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905060005b60048054905081101561366457806001901b92506000838316111561365757600061363b86836132f8565b509250505061365381866149b990919063ffffffff16565b9450505b8080600101915050613610565b505050919050565b600060019054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16635f259aba336040518263ffffffff1660e01b8152600401808273ffffffffffffffffffffffffffffffffffffffff16815260200191505060206040518083038186803b1580156136f557600080fd5b505afa158015613709573d6000803e3d6000fd5b505050506040513d602081101561371f57600080fd5b81019080805190602001909291905050506040518060400160405280600481526020017f41434c32000000000000000000000000000000000000000000000000000000008152509061380c576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825283818151815260200191508051906020019080838360005b838110156137d15780820151818401526020810190506137b6565b50505050905090810190601f1680156137fe5780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b50600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1614156040518060400160405280600281526020017f5a30000000000000000000000000000000000000000000000000000000000000815250906138b5576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016138ac9190615abe565b60405180910390fd5b50600073ffffffffffffffffffffffffffffffffffffffff16600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146040518060400160405280600381526020017f43464700000000000000000000000000000000000000000000000000000000008152509061397f576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016139769190615abe565b60405180910390fd5b5080600260006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055508073ffffffffffffffffffffffffffffffffffffffff1663570a7af26040518163ffffffff1660e01b815260040160206040518083038186803b158015613a0757600080fd5b505afa158015613a1b573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190613a3f91906156d1565b600f60006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16632495a5996040518163ffffffff1660e01b815260040160206040518083038186803b158015613b2057600080fd5b505afa158015613b34573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190613b5891906156d1565b73ffffffffffffffffffffffffffffffffffffffff16146040518060400160405280600381526020017f434630000000000000000000000000000000000000000000000000000000000081525090613be6576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401613bdd9190615abe565b60405180910390fd5b5050565b6000613c23613bf883610e14565b613c15612710613c0786613004565b6143e990919063ffffffff16565b61446f90919063ffffffff16565b9050919050565b600b60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff166040518060400160405280600381526020017f434634000000000000000000000000000000000000000000000000000000000081525090613cee576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401613ce59190615abe565b60405180910390fd5b50613cf985846147ab565b6000600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663b66102df8487601060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff166040518463ffffffff1660e01b8152600401613d7c93929190615afb565b60206040518083038186803b158015613d9457600080fd5b505afa158015613da8573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190613dcc9190615925565b90506000600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663b66102df8487601060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff166040518463ffffffff1660e01b8152600401613e5193929190615afb565b60206040518083038186803b158015613e6957600080fd5b505afa158015613e7d573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190613ea19190615925565b9050613eae878383614a41565b50505050505050565b600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16146040518060400160405280600381526020017f434633000000000000000000000000000000000000000000000000000000000081525090613f7f576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401613f769190615abe565b60405180910390fd5b506001600760008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506001600860008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555050565b60125481565b600060019054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16635f259aba336040518263ffffffff1660e01b8152600401808273ffffffffffffffffffffffffffffffffffffffff16815260200191505060206040518083038186803b15801561409c57600080fd5b505afa1580156140b0573d6000803e3d6000fd5b505050506040513d60208110156140c657600080fd5b81019080805190602001909291905050506040518060400160405280600481526020017f41434c3200000000000000000000000000000000000000000000000000000000815250906141b3576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825283818151815260200191508051906020019080838360005b8381101561417857808201518184015260208101905061415d565b50505050905090810190601f1680156141a55780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b50600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663fca513a86040518163ffffffff1660e01b815260040160206040518083038186803b15801561421c57600080fd5b505afa158015614230573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061425491906156d1565b600d60006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167fefe8ab924ca486283a79dc604baa67add51afb82af1db8ac386ebbba643cdffd60405160405180910390a2565b60066020528060005260406000206000915090505481565b60036020528060005260406000206000915054906101000a900460ff1681565b600c6020528060005260406000206000915054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6000828211156143de576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601e8152602001807f536166654d6174683a207375627472616374696f6e206f766572666c6f77000081525060200191505060405180910390fd5b818303905092915050565b6000808314156143fc5760009050614469565b600082840290508284828161440d57fe5b0414614464576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526021815260200180615d1a6021913960400191505060405180910390fd5b809150505b92915050565b60008082116144e6576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601a8152602001807f536166654d6174683a206469766973696f6e206279207a65726f00000000000081525060200191505060405180910390fd5b8183816144ef57fe5b04905092915050565b61450061213c565b614572576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260148152602001807f5061757361626c653a206e6f742070617573656400000000000000000000000081525060200191505060405180910390fd5b60008060006101000a81548160ff0219169083151502179055507f5db9ee0a495bf2e6ff9c91a7834c1ba4fdd244a5e8aa4e537bd38aeae4b073aa6145b56152fc565b604051808273ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390a1565b600073ffffffffffffffffffffffffffffffffffffffff16600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161461477a57600061465c61464b6011546012546134fd565b61271061436690919063ffffffff16565b9050600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16633915ffaa6040518163ffffffff1660e01b815260040160206040518083038186803b1580156146c657600080fd5b505afa1580156146da573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906146fe9190615925565b81106040518060400160405280600381526020017f434642000000000000000000000000000000000000000000000000000000000081525090614777576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161476e9190615abe565b60405180910390fd5b50505b565b600061478b8360000183615304565b60001c905092915050565b60006147a482600001615387565b9050919050565b6147b4816129c4565b6000600660008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054600760008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205416141561490257600660008273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054600760008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205417600760008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b5050565b600061492e836000018373ffffffffffffffffffffffffffffffffffffffff1660001b615398565b905092915050565b816011819055508060128190555061494c6145e2565b7f727652fff0946c19c233fd3eab5fc03db9e9fdd907e902d9136c2a9cac47101c828260405161497d929190615b32565b60405180910390a15050565b60006149b1836000018373ffffffffffffffffffffffffffffffffffffffff1660001b615480565b905092915050565b600080828401905083811015614a37576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601b8152602001807f536166654d6174683a206164646974696f6e206f766572666c6f77000000000081525060200191505060405180910390fd5b8091505092915050565b614a56601154836143e990919063ffffffff16565b614a6b612710836143e990919063ffffffff16565b118015614ab95750601254600860008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205411155b15614b1257600860008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008154809291906001019190505550614bde565b612710614b1e84613bea565b10156040518060400160405280600381526020017f434635000000000000000000000000000000000000000000000000000000000081525090614b97576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401614b8e9190615abe565b60405180910390fd5b506001600860008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b505050565b614beb61213c565b15614c5e576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260108152602001807f5061757361626c653a207061757365640000000000000000000000000000000081525060200191505060405180910390fd5b60016000806101000a81548160ff0219169083151502179055507f62e78cea01bee320cd4e420270b5ea74000d11b0c9f74754ebdbfc544b05a258614ca16152fc565b604051808273ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390a1565b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614156040518060400160405280600281526020017f5a3000000000000000000000000000000000000000000000000000000000000081525090614d76576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401614d6d9190615abe565b60405180910390fd5b50600081118015614de8575060056000600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020548111155b6040518060400160405280600381526020017f434631000000000000000000000000000000000000000000000000000000000081525090614e5f576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401614e569190615abe565b60405180910390fd5b506000600660008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020541180614eb45750610100600480549050105b6040518060400160405280600381526020017f434636000000000000000000000000000000000000000000000000000000000081525090614f2b576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401614f229190615abe565b60405180910390fd5b5060008273ffffffffffffffffffffffffffffffffffffffff166370a08231306040518263ffffffff1660e01b8152600401614f6791906159ff565b60206040518083038186803b158015614f7f57600080fd5b505afa158015614f93573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190614fb79190615925565b1015614fc257600080fd5b6000600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663743b908684600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff166040518363ffffffff1660e01b8152600401615043929190615a1a565b60206040518083038186803b15801561505b57600080fd5b505afa15801561506f573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906150939190615925565b116040518060400160405280600381526020017f43464500000000000000000000000000000000000000000000000000000000008152509061510b576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016151029190615abe565b60405180910390fd5b50600360008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16615266576001600360008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055506004805490506001901b600660008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506004829080600181540180825580915050600190039060005260206000200160009091909190916101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055505b80600560008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff167fa52fb6bfa514a4ddcb31de40a5f6c20d767db1f921a8b7747973d93dc5da7a02826040516152f09190615ae0565b60405180910390a25050565b600033905090565b600081836000018054905011615365576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526022815260200180615cf86022913960400191505060405180910390fd5b82600001828154811061537457fe5b9060005260206000200154905092915050565b600081600001805490509050919050565b6000808360010160008481526020019081526020016000205490506000811461547457600060018203905060006001866000018054905003905060008660000182815481106153e357fe5b906000526020600020015490508087600001848154811061540057fe5b906000526020600020018190555060018301876001016000838152602001908152602001600020819055508660000180548061543857fe5b6001900381819060005260206000200160009055905586600101600087815260200190815260200160002060009055600194505050505061547a565b60009150505b92915050565b600061548c83836154f0565b6154e55782600001829080600181540180825580915050600190039060005260206000200160009091909190915055826000018054905083600101600084815260200190815260200160002081905550600190506154ea565b600090505b92915050565b600080836001016000848152602001908152602001600020541415905092915050565b600061552661552184615b8c565b615b5b565b9050808382526020820190508285602086028201111561554557600080fd5b60005b85811015615575578161555b88826155eb565b845260208401935060208301925050600181019050615548565b5050509392505050565b600061559261558d84615bb8565b615b5b565b905080838252602082019050828560208602820111156155b157600080fd5b60005b858110156155e157816155c7888261567e565b8452602084019350602083019250506001810190506155b4565b5050509392505050565b6000813590506155fa81615cb2565b92915050565b60008151905061560f81615cb2565b92915050565b600082601f83011261562657600080fd5b8135615636848260208601615513565b91505092915050565b600082601f83011261565057600080fd5b813561566084826020860161557f565b91505092915050565b60008135905061567881615cc9565b92915050565b60008135905061568d81615ce0565b92915050565b6000815190506156a281615ce0565b92915050565b6000602082840312156156ba57600080fd5b60006156c8848285016155eb565b91505092915050565b6000602082840312156156e357600080fd5b60006156f184828501615600565b91505092915050565b6000806040838503121561570d57600080fd5b600061571b858286016155eb565b925050602061572c858286016155eb565b9150509250929050565b600080600080600060a0868803121561574e57600080fd5b600061575c888289016155eb565b955050602061576d888289016155eb565b945050604061577e888289016155eb565b935050606061578f8882890161567e565b92505060806157a08882890161567e565b9150509295509295909350565b600080600080600060a086880312156157c557600080fd5b60006157d3888289016155eb565b955050602086013567ffffffffffffffff8111156157f057600080fd5b6157fc8882890161563f565b945050604086013567ffffffffffffffff81111561581957600080fd5b6158258882890161563f565b935050606086013567ffffffffffffffff81111561584257600080fd5b61584e88828901615615565b925050608086013567ffffffffffffffff81111561586b57600080fd5b61587788828901615615565b9150509295509295909350565b6000806040838503121561589757600080fd5b60006158a5858286016155eb565b92505060206158b685828601615669565b9150509250929050565b600080604083850312156158d357600080fd5b60006158e1858286016155eb565b92505060206158f28582860161567e565b9150509250929050565b60006020828403121561590e57600080fd5b600061591c8482850161567e565b91505092915050565b60006020828403121561593757600080fd5b600061594584828501615693565b91505092915050565b6000806040838503121561596157600080fd5b600061596f8582860161567e565b92505060206159808582860161567e565b9150509250929050565b61599381615c00565b82525050565b6159a281615c12565b82525050565b6159b181615c48565b82525050565b60006159c282615be4565b6159cc8185615bef565b93506159dc818560208601615c6c565b6159e581615ca1565b840191505092915050565b6159f981615c3e565b82525050565b6000602082019050615a14600083018461598a565b92915050565b6000604082019050615a2f600083018561598a565b615a3c602083018461598a565b9392505050565b6000608082019050615a58600083018761598a565b615a6560208301866159f0565b615a7260408301856159f0565b615a7f60608301846159f0565b95945050505050565b6000602082019050615a9d6000830184615999565b92915050565b6000602082019050615ab860008301846159a8565b92915050565b60006020820190508181036000830152615ad881846159b7565b905092915050565b6000602082019050615af560008301846159f0565b92915050565b6000606082019050615b1060008301866159f0565b615b1d602083018561598a565b615b2a604083018461598a565b949350505050565b6000604082019050615b4760008301856159f0565b615b5460208301846159f0565b9392505050565b6000604051905081810181811067ffffffffffffffff82111715615b8257615b81615c9f565b5b8060405250919050565b600067ffffffffffffffff821115615ba757615ba6615c9f565b5b602082029050602081019050919050565b600067ffffffffffffffff821115615bd357615bd2615c9f565b5b602082029050602081019050919050565b600081519050919050565b600082825260208201905092915050565b6000615c0b82615c1e565b9050919050565b60008115159050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b6000615c5382615c5a565b9050919050565b6000615c6582615c1e565b9050919050565b60005b83811015615c8a578082015181840152602081019050615c6f565b83811115615c99576000848401525b50505050565bfe5b6000601f19601f8301169050919050565b615cbb81615c00565b8114615cc657600080fd5b50565b615cd281615c12565b8114615cdd57600080fd5b50565b615ce981615c3e565b8114615cf457600080fd5b5056fe456e756d657261626c655365743a20696e646578206f7574206f6620626f756e6473536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f77a2646970667358221220028a4f708f68c0c3408d97335159caf12fa6f6717c381978b6354c913bc0e4c464736f6c63430007060033
Loading...
Loading
Loading...
Loading
Net Worth in USD
$0.00
Net Worth in ETH
0
Multichain Portfolio | 34 Chains
| Chain | Token | Portfolio % | Price | Amount | Value |
|---|
Loading...
Loading
Loading...
Loading
Loading...
Loading
[ Download: CSV Export ]
A contract address hosts a smart contract, which is a set of code stored on the blockchain that runs when predetermined conditions are met. Learn more about addresses in our Knowledge Base.