From edf97a504616608532b5fcc8e265420e5be501ce Mon Sep 17 00:00:00 2001 From: Pablo Veyrat <50438397+sogipec@users.noreply.github.com> Date: Fri, 25 Nov 2022 09:55:30 +0100 Subject: [PATCH] No dust deployment (#178) * last upgradeability tests * borrowing module no dust deployments --- deploy/merkleRewardManager.ts | 61 - deploy/merkleRootDistributor.ts | 46 - .../VaultManagerNoDust_Implementation.json | 1810 ++++++++++++++++ .../dc345d3eed7216da5bac40699a727ed4.json | 124 ++ .../VaultManagerNoDust_Implementation.json | 1810 ++++++++++++++++ .../dc345d3eed7216da5bac40699a727ed4.json | 124 ++ .../VaultManagerNoDust_Implementation.json | 1810 ++++++++++++++++ .../dc345d3eed7216da5bac40699a727ed4.json | 124 ++ .../VaultManagerNoDust_Implementation.json | 105 +- ...VaultManagerNoDust_MAI_Implementation.json | 1832 +++++++++++++++++ .../dc345d3eed7216da5bac40699a727ed4.json | 124 ++ scripts/mainnet-fork/upgradeVaultManager.ts | 3 +- scripts/upgradeability.ts | 6 +- 13 files changed, 7810 insertions(+), 169 deletions(-) delete mode 100644 deploy/merkleRewardManager.ts delete mode 100644 deploy/merkleRootDistributor.ts create mode 100644 deployments/arbitrum/VaultManagerNoDust_Implementation.json create mode 100644 deployments/arbitrum/solcInputs/dc345d3eed7216da5bac40699a727ed4.json create mode 100644 deployments/mainnet/VaultManagerNoDust_Implementation.json create mode 100644 deployments/mainnet/solcInputs/dc345d3eed7216da5bac40699a727ed4.json create mode 100644 deployments/optimism/VaultManagerNoDust_Implementation.json create mode 100644 deployments/optimism/solcInputs/dc345d3eed7216da5bac40699a727ed4.json create mode 100644 deployments/polygon/VaultManagerNoDust_MAI_Implementation.json create mode 100644 deployments/polygon/solcInputs/dc345d3eed7216da5bac40699a727ed4.json diff --git a/deploy/merkleRewardManager.ts b/deploy/merkleRewardManager.ts deleted file mode 100644 index 47200f77..00000000 --- a/deploy/merkleRewardManager.ts +++ /dev/null @@ -1,61 +0,0 @@ -import { ChainId, CONTRACTS_ADDRESSES } from '@angleprotocol/sdk'; -import { DeployFunction } from 'hardhat-deploy/types'; -import yargs from 'yargs'; - -import { MerkleRewardManager__factory } from '../typechain'; -import { parseAmount } from '../utils/bignumber'; -const argv = yargs.env('').boolean('ci').parseSync(); - -const func: DeployFunction = async ({ deployments, ethers, network }) => { - const { deploy } = deployments; - const { deployer } = await ethers.getNamedSigners(); - - let proxyAdmin: string; - let coreBorrow: string; - let distributor: string; - - if (!network.live) { - // If we're in mainnet fork, we're using the `ProxyAdmin` address from mainnet - proxyAdmin = CONTRACTS_ADDRESSES[ChainId.MAINNET].ProxyAdmin!; - coreBorrow = CONTRACTS_ADDRESSES[ChainId.MAINNET].CoreBorrow!; - distributor = CONTRACTS_ADDRESSES[ChainId.MAINNET].MerkleRootDistributor!; - } else { - // Otherwise, we're using the proxy admin address from the desired network - proxyAdmin = CONTRACTS_ADDRESSES[network.config.chainId as ChainId].ProxyAdmin!; - coreBorrow = CONTRACTS_ADDRESSES[network.config.chainId as ChainId].CoreBorrow!; - distributor = CONTRACTS_ADDRESSES[network.config.chainId as ChainId].MerkleRootDistributor!; - } - - console.log('Now deploying MerkleRewardManager'); - console.log('Starting with the implementation'); - // TODO change implementation depending on deployment - const merkleRewardManagerImplementation = await deploy('MerkleRewardManager_TestImplementation', { - contract: 'MerkleRewardManagerPolygon', - from: deployer.address, - args: [], - log: !argv.ci, - }); - - console.log( - `Successfully deployed the implementation for MerkleRewardManager at ${merkleRewardManagerImplementation.address}\n`, - ); - - const initializeData = MerkleRewardManager__factory.createInterface().encodeFunctionData('initialize', [ - coreBorrow, - distributor, - parseAmount.gwei('0.01'), - ]); - - console.log('Now deploying the Proxy'); - console.log(`Proxy admin: ${proxyAdmin}`); - const merkleRewardManager = await deploy('MerkleRewardManagerTest', { - contract: 'TransparentUpgradeableProxy', - from: deployer.address, - args: [merkleRewardManagerImplementation.address, proxyAdmin, initializeData], - }); - - console.log(`Successfully deployed MerkleRewardManager at the address ${merkleRewardManager.address}\n`); -}; - -func.tags = ['merkleRewardManager']; -export default func; diff --git a/deploy/merkleRootDistributor.ts b/deploy/merkleRootDistributor.ts deleted file mode 100644 index d330b1eb..00000000 --- a/deploy/merkleRootDistributor.ts +++ /dev/null @@ -1,46 +0,0 @@ -import { ChainId, CONTRACTS_ADDRESSES } from '@angleprotocol/sdk'; -import { DeployFunction } from 'hardhat-deploy/types'; - -import { MerkleRootDistributor__factory } from '../typechain'; - -const func: DeployFunction = async ({ deployments, ethers, network }) => { - const { deploy } = deployments; - const { deployer } = await ethers.getNamedSigners(); - let proxyAdmin: string; - - if (!network.live) { - // If we're in mainnet fork, we're using the `ProxyAdmin` address from mainnet - proxyAdmin = CONTRACTS_ADDRESSES[ChainId.MAINNET].ProxyAdmin!; - } else { - // Otherwise, we're using the proxy admin address from the desired network - proxyAdmin = CONTRACTS_ADDRESSES[network.config.chainId as ChainId].ProxyAdmin!; - } - - console.log('Now deploying MerkleRootDistributor'); - console.log('Starting with the implementation'); - const merkleRootDistributorImplementation = await deploy('MerkleRootDistributor_Implementation', { - contract: 'MerkleRootDistributor', - from: deployer.address, - }); - - console.log( - `Successfully deployed the implementation for MerkleRootDistributor at ${merkleRootDistributorImplementation.address}\n`, - ); - - const initializeData = MerkleRootDistributor__factory.createInterface().encodeFunctionData('initialize', [ - CONTRACTS_ADDRESSES[ChainId.MAINNET].agEUR.Treasury as string, - ]); - - console.log('Now deploying the Proxy'); - console.log(`Proxy admin: ${proxyAdmin}`); - const merkleRootDistributor = await deploy('MerkleRootDistributor', { - contract: 'TransparentUpgradeableProxy', - from: deployer.address, - args: [merkleRootDistributorImplementation.address, proxyAdmin, initializeData], - }); - - console.log(`Successfully deployed MerkleRootDistributor at the address ${merkleRootDistributor.address}\n`); -}; - -func.tags = ['merkleRootDistributor']; -export default func; diff --git a/deployments/arbitrum/VaultManagerNoDust_Implementation.json b/deployments/arbitrum/VaultManagerNoDust_Implementation.json new file mode 100644 index 00000000..a9e5c52f --- /dev/null +++ b/deployments/arbitrum/VaultManagerNoDust_Implementation.json @@ -0,0 +1,1810 @@ +{ + "address": "0x92d84b0687361cd0753E95f5A8746fbaf42E9135", + "abi": [ + { + "inputs": [], + "name": "ApprovalToCaller", + "type": "error" + }, + { + "inputs": [], + "name": "ApprovalToOwner", + "type": "error" + }, + { + "inputs": [], + "name": "DebtCeilingExceeded", + "type": "error" + }, + { + "inputs": [], + "name": "DustyLeftoverAmount", + "type": "error" + }, + { + "inputs": [], + "name": "ExpiredDeadline", + "type": "error" + }, + { + "inputs": [], + "name": "HealthyVault", + "type": "error" + }, + { + "inputs": [], + "name": "IncompatibleLengths", + "type": "error" + }, + { + "inputs": [], + "name": "InsolventVault", + "type": "error" + }, + { + "inputs": [], + "name": "InvalidParameterType", + "type": "error" + }, + { + "inputs": [], + "name": "InvalidParameterValue", + "type": "error" + }, + { + "inputs": [], + "name": "InvalidSetOfParameters", + "type": "error" + }, + { + "inputs": [], + "name": "InvalidSignature", + "type": "error" + }, + { + "inputs": [], + "name": "InvalidTreasury", + "type": "error" + }, + { + "inputs": [], + "name": "NonERC721Receiver", + "type": "error" + }, + { + "inputs": [], + "name": "NonexistentVault", + "type": "error" + }, + { + "inputs": [], + "name": "NotApproved", + "type": "error" + }, + { + "inputs": [], + "name": "NotGovernor", + "type": "error" + }, + { + "inputs": [], + "name": "NotGovernorOrGuardian", + "type": "error" + }, + { + "inputs": [], + "name": "NotTreasury", + "type": "error" + }, + { + "inputs": [], + "name": "NotVaultManager", + "type": "error" + }, + { + "inputs": [], + "name": "NotWhitelisted", + "type": "error" + }, + { + "inputs": [], + "name": "Paused", + "type": "error" + }, + { + "inputs": [], + "name": "TooHighParameterValue", + "type": "error" + }, + { + "inputs": [], + "name": "TooSmallParameterValue", + "type": "error" + }, + { + "inputs": [], + "name": "ZeroAddress", + "type": "error" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint256", + "name": "surplusEndValue", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "badDebtEndValue", + "type": "uint256" + } + ], + "name": "AccruedToTreasury", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "owner", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "approved", + "type": "address" + }, + { + "indexed": true, + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + } + ], + "name": "Approval", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "owner", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "operator", + "type": "address" + }, + { + "indexed": false, + "internalType": "bool", + "name": "approved", + "type": "bool" + } + ], + "name": "ApprovalForAll", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint256", + "name": "vaultID", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "collateralAmount", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint8", + "name": "isIncrease", + "type": "uint8" + } + ], + "name": "CollateralAmountUpdated", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint256", + "name": "debtCeiling", + "type": "uint256" + } + ], + "name": "DebtCeilingUpdated", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint256", + "name": "srcVaultID", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "dstVaultID", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "address", + "name": "dstVaultManager", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "DebtTransferred", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint64", + "name": "param", + "type": "uint64" + }, + { + "indexed": false, + "internalType": "bytes32", + "name": "what", + "type": "bytes32" + } + ], + "name": "FiledUint64", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint8", + "name": "version", + "type": "uint8" + } + ], + "name": "Initialized", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint256", + "name": "value", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "timestamp", + "type": "uint256" + } + ], + "name": "InterestAccumulatorUpdated", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint256", + "name": "vaultID", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "internalAmount", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint8", + "name": "isIncrease", + "type": "uint8" + } + ], + "name": "InternalDebtUpdated", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint256[]", + "name": "vaultIDs", + "type": "uint256[]" + } + ], + "name": "LiquidatedVaults", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "_veBoostProxy", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256[]", + "name": "xBoost", + "type": "uint256[]" + }, + { + "indexed": false, + "internalType": "uint256[]", + "name": "yBoost", + "type": "uint256[]" + } + ], + "name": "LiquidationBoostParametersUpdated", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "from", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "to", + "type": "address" + }, + { + "indexed": true, + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + } + ], + "name": "Transfer", + "type": "event" + }, + { + "inputs": [], + "name": "BASE_INTEREST", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "BASE_PARAMS", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "DOMAIN_SEPARATOR", + "outputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "HALF_BASE_INTEREST", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "accrueInterestToTreasury", + "outputs": [ + { + "internalType": "uint256", + "name": "surplusValue", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "badDebtValue", + "type": "uint256" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "enum ActionType[]", + "name": "actions", + "type": "uint8[]" + }, + { + "internalType": "bytes[]", + "name": "datas", + "type": "bytes[]" + }, + { + "internalType": "address", + "name": "from", + "type": "address" + }, + { + "internalType": "address", + "name": "to", + "type": "address" + } + ], + "name": "angle", + "outputs": [ + { + "components": [ + { + "internalType": "uint256", + "name": "stablecoinAmountToGive", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "stablecoinAmountToReceive", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "collateralAmountToGive", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "collateralAmountToReceive", + "type": "uint256" + } + ], + "internalType": "struct PaymentData", + "name": "", + "type": "tuple" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "enum ActionType[]", + "name": "actions", + "type": "uint8[]" + }, + { + "internalType": "bytes[]", + "name": "datas", + "type": "bytes[]" + }, + { + "internalType": "address", + "name": "from", + "type": "address" + }, + { + "internalType": "address", + "name": "to", + "type": "address" + }, + { + "internalType": "address", + "name": "who", + "type": "address" + }, + { + "internalType": "bytes", + "name": "repayData", + "type": "bytes" + } + ], + "name": "angle", + "outputs": [ + { + "components": [ + { + "internalType": "uint256", + "name": "stablecoinAmountToGive", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "stablecoinAmountToReceive", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "collateralAmountToGive", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "collateralAmountToReceive", + "type": "uint256" + } + ], + "internalType": "struct PaymentData", + "name": "paymentData", + "type": "tuple" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "to", + "type": "address" + }, + { + "internalType": "uint256", + "name": "vaultID", + "type": "uint256" + } + ], + "name": "approve", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "badDebt", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "owner", + "type": "address" + } + ], + "name": "balanceOf", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "borrowFee", + "outputs": [ + { + "internalType": "uint64", + "name": "", + "type": "uint64" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "vaultID", + "type": "uint256" + }, + { + "internalType": "address", + "name": "liquidator", + "type": "address" + } + ], + "name": "checkLiquidation", + "outputs": [ + { + "components": [ + { + "internalType": "uint256", + "name": "maxStablecoinAmountToRepay", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "maxCollateralAmountGiven", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "thresholdRepayAmount", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "discount", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "currentDebt", + "type": "uint256" + } + ], + "internalType": "struct LiquidationOpportunity", + "name": "liqOpp", + "type": "tuple" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "collateral", + "outputs": [ + { + "internalType": "contract IERC20", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "collateralFactor", + "outputs": [ + { + "internalType": "uint64", + "name": "", + "type": "uint64" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "toVault", + "type": "address" + } + ], + "name": "createVault", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "debtCeiling", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "dust", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "vaultID", + "type": "uint256" + } + ], + "name": "getApproved", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "vaultID", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "stablecoinAmount", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "senderBorrowFee", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "senderRepayFee", + "type": "uint256" + } + ], + "name": "getDebtOut", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "getTotalDebt", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "vaultID", + "type": "uint256" + } + ], + "name": "getVaultDebt", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "contract ITreasury", + "name": "_treasury", + "type": "address" + }, + { + "internalType": "contract IERC20", + "name": "_collateral", + "type": "address" + }, + { + "internalType": "contract IOracle", + "name": "_oracle", + "type": "address" + }, + { + "components": [ + { + "internalType": "uint256", + "name": "debtCeiling", + "type": "uint256" + }, + { + "internalType": "uint64", + "name": "collateralFactor", + "type": "uint64" + }, + { + "internalType": "uint64", + "name": "targetHealthFactor", + "type": "uint64" + }, + { + "internalType": "uint64", + "name": "interestRate", + "type": "uint64" + }, + { + "internalType": "uint64", + "name": "liquidationSurcharge", + "type": "uint64" + }, + { + "internalType": "uint64", + "name": "maxLiquidationDiscount", + "type": "uint64" + }, + { + "internalType": "bool", + "name": "whitelistingActivated", + "type": "bool" + }, + { + "internalType": "uint256", + "name": "baseBoost", + "type": "uint256" + } + ], + "internalType": "struct VaultParameters", + "name": "params", + "type": "tuple" + }, + { + "internalType": "string", + "name": "_symbol", + "type": "string" + } + ], + "name": "initialize", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "interestAccumulator", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "interestRate", + "outputs": [ + { + "internalType": "uint64", + "name": "", + "type": "uint64" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "owner", + "type": "address" + }, + { + "internalType": "address", + "name": "operator", + "type": "address" + } + ], + "name": "isApprovedForAll", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "spender", + "type": "address" + }, + { + "internalType": "uint256", + "name": "vaultID", + "type": "uint256" + } + ], + "name": "isApprovedOrOwner", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "name": "isWhitelisted", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "lastInterestAccumulatorUpdated", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256[]", + "name": "vaultIDs", + "type": "uint256[]" + }, + { + "internalType": "uint256[]", + "name": "amounts", + "type": "uint256[]" + }, + { + "internalType": "address", + "name": "from", + "type": "address" + }, + { + "internalType": "address", + "name": "to", + "type": "address" + }, + { + "internalType": "address", + "name": "who", + "type": "address" + }, + { + "internalType": "bytes", + "name": "data", + "type": "bytes" + } + ], + "name": "liquidate", + "outputs": [ + { + "components": [ + { + "internalType": "uint256", + "name": "stablecoinAmountToReceive", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "collateralAmountToGive", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "badDebtFromLiquidation", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "oracleValue", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "newInterestAccumulator", + "type": "uint256" + } + ], + "internalType": "struct LiquidatorData", + "name": "liqData", + "type": "tuple" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256[]", + "name": "vaultIDs", + "type": "uint256[]" + }, + { + "internalType": "uint256[]", + "name": "amounts", + "type": "uint256[]" + }, + { + "internalType": "address", + "name": "from", + "type": "address" + }, + { + "internalType": "address", + "name": "to", + "type": "address" + } + ], + "name": "liquidate", + "outputs": [ + { + "components": [ + { + "internalType": "uint256", + "name": "stablecoinAmountToReceive", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "collateralAmountToGive", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "badDebtFromLiquidation", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "oracleValue", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "newInterestAccumulator", + "type": "uint256" + } + ], + "internalType": "struct LiquidatorData", + "name": "", + "type": "tuple" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "liquidationSurcharge", + "outputs": [ + { + "internalType": "uint64", + "name": "", + "type": "uint64" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "maxLiquidationDiscount", + "outputs": [ + { + "internalType": "uint64", + "name": "", + "type": "uint64" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "name", + "outputs": [ + { + "internalType": "string", + "name": "", + "type": "string" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "owner", + "type": "address" + } + ], + "name": "nonces", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "oracle", + "outputs": [ + { + "internalType": "contract IOracle", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "vaultID", + "type": "uint256" + } + ], + "name": "ownerOf", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "paused", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "owner", + "type": "address" + }, + { + "internalType": "address", + "name": "spender", + "type": "address" + }, + { + "internalType": "bool", + "name": "approved", + "type": "bool" + }, + { + "internalType": "uint256", + "name": "deadline", + "type": "uint256" + }, + { + "internalType": "uint8", + "name": "v", + "type": "uint8" + }, + { + "internalType": "bytes32", + "name": "r", + "type": "bytes32" + }, + { + "internalType": "bytes32", + "name": "s", + "type": "bytes32" + } + ], + "name": "permit", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "repayFee", + "outputs": [ + { + "internalType": "uint64", + "name": "", + "type": "uint64" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "from", + "type": "address" + }, + { + "internalType": "address", + "name": "to", + "type": "address" + }, + { + "internalType": "uint256", + "name": "vaultID", + "type": "uint256" + } + ], + "name": "safeTransferFrom", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "from", + "type": "address" + }, + { + "internalType": "address", + "name": "to", + "type": "address" + }, + { + "internalType": "uint256", + "name": "vaultID", + "type": "uint256" + }, + { + "internalType": "bytes", + "name": "_data", + "type": "bytes" + } + ], + "name": "safeTransferFrom", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "operator", + "type": "address" + }, + { + "internalType": "bool", + "name": "approved", + "type": "bool" + } + ], + "name": "setApprovalForAll", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "string", + "name": "baseURI_", + "type": "string" + } + ], + "name": "setBaseURI", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "_debtCeiling", + "type": "uint256" + } + ], + "name": "setDebtCeiling", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "_dust", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "dustCollateral_", + "type": "uint256" + } + ], + "name": "setDusts", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_veBoostProxy", + "type": "address" + }, + { + "internalType": "uint256[]", + "name": "xBoost", + "type": "uint256[]" + }, + { + "internalType": "uint256[]", + "name": "yBoost", + "type": "uint256[]" + } + ], + "name": "setLiquidationBoostParameters", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_oracle", + "type": "address" + } + ], + "name": "setOracle", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_treasury", + "type": "address" + } + ], + "name": "setTreasury", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint64", + "name": "param", + "type": "uint64" + }, + { + "internalType": "bytes32", + "name": "what", + "type": "bytes32" + } + ], + "name": "setUint64", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "stablecoin", + "outputs": [ + { + "internalType": "contract IAgToken", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes4", + "name": "interfaceId", + "type": "bytes4" + } + ], + "name": "supportsInterface", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "pure", + "type": "function" + }, + { + "inputs": [], + "name": "surplus", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "symbol", + "outputs": [ + { + "internalType": "string", + "name": "", + "type": "string" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "targetHealthFactor", + "outputs": [ + { + "internalType": "uint64", + "name": "", + "type": "uint64" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "togglePause", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "target", + "type": "address" + } + ], + "name": "toggleWhitelist", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "vaultID", + "type": "uint256" + } + ], + "name": "tokenURI", + "outputs": [ + { + "internalType": "string", + "name": "", + "type": "string" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "totalNormalizedDebt", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "from", + "type": "address" + }, + { + "internalType": "address", + "name": "to", + "type": "address" + }, + { + "internalType": "uint256", + "name": "vaultID", + "type": "uint256" + } + ], + "name": "transferFrom", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "treasury", + "outputs": [ + { + "internalType": "contract ITreasury", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "name": "vaultData", + "outputs": [ + { + "internalType": "uint256", + "name": "collateralAmount", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "normalizedDebt", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "vaultIDCount", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "veBoostProxy", + "outputs": [ + { + "internalType": "contract IVeBoostProxy", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "whitelistingActivated", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "name": "xLiquidationBoost", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "name": "yLiquidationBoost", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + } + ], + "transactionHash": "0xb51ab957b0af94878906fa7844743326fba1002bb04ef3b99e95658a9d75dbb0", + "receipt": { + "to": null, + "from": "0xfdA462548Ce04282f4B6D6619823a7C64Fdc0185", + "contractAddress": "0x92d84b0687361cd0753E95f5A8746fbaf42E9135", + "transactionIndex": 1, + "gasUsed": "16851444", + "logsBloom": "0x00000000000000000000000000000080000000000000080000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000080000000000000000000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000000040000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "blockHash": "0x3bf4c5cbba0e7e514bba701d8cfaea77449ea3f40b433c5d5b0e27a6f4387fee", + "transactionHash": "0xb51ab957b0af94878906fa7844743326fba1002bb04ef3b99e95658a9d75dbb0", + "logs": [ + { + "transactionIndex": 1, + "blockNumber": 40902604, + "transactionHash": "0xb51ab957b0af94878906fa7844743326fba1002bb04ef3b99e95658a9d75dbb0", + "address": "0x92d84b0687361cd0753E95f5A8746fbaf42E9135", + "topics": [ + "0x7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb3847402498" + ], + "data": "0x0000000000000000000000000000000000000000000000000000000000000001", + "logIndex": 0, + "blockHash": "0x3bf4c5cbba0e7e514bba701d8cfaea77449ea3f40b433c5d5b0e27a6f4387fee" + } + ], + "blockNumber": 40902604, + "cumulativeGasUsed": "16851444", + "status": 1, + "byzantium": true + }, + "args": [], + "numDeployments": 1, + "solcInputHash": "dc345d3eed7216da5bac40699a727ed4", + "metadata": "{\"compiler\":{\"version\":\"0.8.12+commit.f00d7308\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[],\"name\":\"ApprovalToCaller\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"ApprovalToOwner\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"DebtCeilingExceeded\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"DustyLeftoverAmount\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"ExpiredDeadline\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"HealthyVault\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"IncompatibleLengths\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"InsolventVault\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"InvalidParameterType\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"InvalidParameterValue\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"InvalidSetOfParameters\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"InvalidSignature\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"InvalidTreasury\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"NonERC721Receiver\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"NonexistentVault\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"NotApproved\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"NotGovernor\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"NotGovernorOrGuardian\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"NotTreasury\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"NotVaultManager\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"NotWhitelisted\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"Paused\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"TooHighParameterValue\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"TooSmallParameterValue\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"ZeroAddress\",\"type\":\"error\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"surplusEndValue\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"badDebtEndValue\",\"type\":\"uint256\"}],\"name\":\"AccruedToTreasury\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"owner\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"approved\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"tokenId\",\"type\":\"uint256\"}],\"name\":\"Approval\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"owner\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"operator\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"bool\",\"name\":\"approved\",\"type\":\"bool\"}],\"name\":\"ApprovalForAll\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"vaultID\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"collateralAmount\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint8\",\"name\":\"isIncrease\",\"type\":\"uint8\"}],\"name\":\"CollateralAmountUpdated\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"debtCeiling\",\"type\":\"uint256\"}],\"name\":\"DebtCeilingUpdated\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"srcVaultID\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"dstVaultID\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"dstVaultManager\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"DebtTransferred\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint64\",\"name\":\"param\",\"type\":\"uint64\"},{\"indexed\":false,\"internalType\":\"bytes32\",\"name\":\"what\",\"type\":\"bytes32\"}],\"name\":\"FiledUint64\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint8\",\"name\":\"version\",\"type\":\"uint8\"}],\"name\":\"Initialized\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"value\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"timestamp\",\"type\":\"uint256\"}],\"name\":\"InterestAccumulatorUpdated\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"vaultID\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"internalAmount\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint8\",\"name\":\"isIncrease\",\"type\":\"uint8\"}],\"name\":\"InternalDebtUpdated\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256[]\",\"name\":\"vaultIDs\",\"type\":\"uint256[]\"}],\"name\":\"LiquidatedVaults\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"_veBoostProxy\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256[]\",\"name\":\"xBoost\",\"type\":\"uint256[]\"},{\"indexed\":false,\"internalType\":\"uint256[]\",\"name\":\"yBoost\",\"type\":\"uint256[]\"}],\"name\":\"LiquidationBoostParametersUpdated\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"from\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"to\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"tokenId\",\"type\":\"uint256\"}],\"name\":\"Transfer\",\"type\":\"event\"},{\"inputs\":[],\"name\":\"BASE_INTEREST\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"BASE_PARAMS\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"DOMAIN_SEPARATOR\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"HALF_BASE_INTEREST\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"accrueInterestToTreasury\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"surplusValue\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"badDebtValue\",\"type\":\"uint256\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"enum ActionType[]\",\"name\":\"actions\",\"type\":\"uint8[]\"},{\"internalType\":\"bytes[]\",\"name\":\"datas\",\"type\":\"bytes[]\"},{\"internalType\":\"address\",\"name\":\"from\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"to\",\"type\":\"address\"}],\"name\":\"angle\",\"outputs\":[{\"components\":[{\"internalType\":\"uint256\",\"name\":\"stablecoinAmountToGive\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"stablecoinAmountToReceive\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"collateralAmountToGive\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"collateralAmountToReceive\",\"type\":\"uint256\"}],\"internalType\":\"struct PaymentData\",\"name\":\"\",\"type\":\"tuple\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"enum ActionType[]\",\"name\":\"actions\",\"type\":\"uint8[]\"},{\"internalType\":\"bytes[]\",\"name\":\"datas\",\"type\":\"bytes[]\"},{\"internalType\":\"address\",\"name\":\"from\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"to\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"who\",\"type\":\"address\"},{\"internalType\":\"bytes\",\"name\":\"repayData\",\"type\":\"bytes\"}],\"name\":\"angle\",\"outputs\":[{\"components\":[{\"internalType\":\"uint256\",\"name\":\"stablecoinAmountToGive\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"stablecoinAmountToReceive\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"collateralAmountToGive\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"collateralAmountToReceive\",\"type\":\"uint256\"}],\"internalType\":\"struct PaymentData\",\"name\":\"paymentData\",\"type\":\"tuple\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"to\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"vaultID\",\"type\":\"uint256\"}],\"name\":\"approve\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"badDebt\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"owner\",\"type\":\"address\"}],\"name\":\"balanceOf\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"borrowFee\",\"outputs\":[{\"internalType\":\"uint64\",\"name\":\"\",\"type\":\"uint64\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"vaultID\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"liquidator\",\"type\":\"address\"}],\"name\":\"checkLiquidation\",\"outputs\":[{\"components\":[{\"internalType\":\"uint256\",\"name\":\"maxStablecoinAmountToRepay\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"maxCollateralAmountGiven\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"thresholdRepayAmount\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"discount\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"currentDebt\",\"type\":\"uint256\"}],\"internalType\":\"struct LiquidationOpportunity\",\"name\":\"liqOpp\",\"type\":\"tuple\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"collateral\",\"outputs\":[{\"internalType\":\"contract IERC20\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"collateralFactor\",\"outputs\":[{\"internalType\":\"uint64\",\"name\":\"\",\"type\":\"uint64\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"toVault\",\"type\":\"address\"}],\"name\":\"createVault\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"debtCeiling\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"dust\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"vaultID\",\"type\":\"uint256\"}],\"name\":\"getApproved\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"vaultID\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"stablecoinAmount\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"senderBorrowFee\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"senderRepayFee\",\"type\":\"uint256\"}],\"name\":\"getDebtOut\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"getTotalDebt\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"vaultID\",\"type\":\"uint256\"}],\"name\":\"getVaultDebt\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"contract ITreasury\",\"name\":\"_treasury\",\"type\":\"address\"},{\"internalType\":\"contract IERC20\",\"name\":\"_collateral\",\"type\":\"address\"},{\"internalType\":\"contract IOracle\",\"name\":\"_oracle\",\"type\":\"address\"},{\"components\":[{\"internalType\":\"uint256\",\"name\":\"debtCeiling\",\"type\":\"uint256\"},{\"internalType\":\"uint64\",\"name\":\"collateralFactor\",\"type\":\"uint64\"},{\"internalType\":\"uint64\",\"name\":\"targetHealthFactor\",\"type\":\"uint64\"},{\"internalType\":\"uint64\",\"name\":\"interestRate\",\"type\":\"uint64\"},{\"internalType\":\"uint64\",\"name\":\"liquidationSurcharge\",\"type\":\"uint64\"},{\"internalType\":\"uint64\",\"name\":\"maxLiquidationDiscount\",\"type\":\"uint64\"},{\"internalType\":\"bool\",\"name\":\"whitelistingActivated\",\"type\":\"bool\"},{\"internalType\":\"uint256\",\"name\":\"baseBoost\",\"type\":\"uint256\"}],\"internalType\":\"struct VaultParameters\",\"name\":\"params\",\"type\":\"tuple\"},{\"internalType\":\"string\",\"name\":\"_symbol\",\"type\":\"string\"}],\"name\":\"initialize\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"interestAccumulator\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"interestRate\",\"outputs\":[{\"internalType\":\"uint64\",\"name\":\"\",\"type\":\"uint64\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"owner\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"operator\",\"type\":\"address\"}],\"name\":\"isApprovedForAll\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"spender\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"vaultID\",\"type\":\"uint256\"}],\"name\":\"isApprovedOrOwner\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"name\":\"isWhitelisted\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"lastInterestAccumulatorUpdated\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256[]\",\"name\":\"vaultIDs\",\"type\":\"uint256[]\"},{\"internalType\":\"uint256[]\",\"name\":\"amounts\",\"type\":\"uint256[]\"},{\"internalType\":\"address\",\"name\":\"from\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"to\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"who\",\"type\":\"address\"},{\"internalType\":\"bytes\",\"name\":\"data\",\"type\":\"bytes\"}],\"name\":\"liquidate\",\"outputs\":[{\"components\":[{\"internalType\":\"uint256\",\"name\":\"stablecoinAmountToReceive\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"collateralAmountToGive\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"badDebtFromLiquidation\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"oracleValue\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"newInterestAccumulator\",\"type\":\"uint256\"}],\"internalType\":\"struct LiquidatorData\",\"name\":\"liqData\",\"type\":\"tuple\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256[]\",\"name\":\"vaultIDs\",\"type\":\"uint256[]\"},{\"internalType\":\"uint256[]\",\"name\":\"amounts\",\"type\":\"uint256[]\"},{\"internalType\":\"address\",\"name\":\"from\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"to\",\"type\":\"address\"}],\"name\":\"liquidate\",\"outputs\":[{\"components\":[{\"internalType\":\"uint256\",\"name\":\"stablecoinAmountToReceive\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"collateralAmountToGive\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"badDebtFromLiquidation\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"oracleValue\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"newInterestAccumulator\",\"type\":\"uint256\"}],\"internalType\":\"struct LiquidatorData\",\"name\":\"\",\"type\":\"tuple\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"liquidationSurcharge\",\"outputs\":[{\"internalType\":\"uint64\",\"name\":\"\",\"type\":\"uint64\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"maxLiquidationDiscount\",\"outputs\":[{\"internalType\":\"uint64\",\"name\":\"\",\"type\":\"uint64\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"name\",\"outputs\":[{\"internalType\":\"string\",\"name\":\"\",\"type\":\"string\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"owner\",\"type\":\"address\"}],\"name\":\"nonces\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"oracle\",\"outputs\":[{\"internalType\":\"contract IOracle\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"vaultID\",\"type\":\"uint256\"}],\"name\":\"ownerOf\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"paused\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"owner\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"spender\",\"type\":\"address\"},{\"internalType\":\"bool\",\"name\":\"approved\",\"type\":\"bool\"},{\"internalType\":\"uint256\",\"name\":\"deadline\",\"type\":\"uint256\"},{\"internalType\":\"uint8\",\"name\":\"v\",\"type\":\"uint8\"},{\"internalType\":\"bytes32\",\"name\":\"r\",\"type\":\"bytes32\"},{\"internalType\":\"bytes32\",\"name\":\"s\",\"type\":\"bytes32\"}],\"name\":\"permit\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"repayFee\",\"outputs\":[{\"internalType\":\"uint64\",\"name\":\"\",\"type\":\"uint64\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"from\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"to\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"vaultID\",\"type\":\"uint256\"}],\"name\":\"safeTransferFrom\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"from\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"to\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"vaultID\",\"type\":\"uint256\"},{\"internalType\":\"bytes\",\"name\":\"_data\",\"type\":\"bytes\"}],\"name\":\"safeTransferFrom\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"operator\",\"type\":\"address\"},{\"internalType\":\"bool\",\"name\":\"approved\",\"type\":\"bool\"}],\"name\":\"setApprovalForAll\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"string\",\"name\":\"baseURI_\",\"type\":\"string\"}],\"name\":\"setBaseURI\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_debtCeiling\",\"type\":\"uint256\"}],\"name\":\"setDebtCeiling\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_dust\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"dustCollateral_\",\"type\":\"uint256\"}],\"name\":\"setDusts\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_veBoostProxy\",\"type\":\"address\"},{\"internalType\":\"uint256[]\",\"name\":\"xBoost\",\"type\":\"uint256[]\"},{\"internalType\":\"uint256[]\",\"name\":\"yBoost\",\"type\":\"uint256[]\"}],\"name\":\"setLiquidationBoostParameters\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_oracle\",\"type\":\"address\"}],\"name\":\"setOracle\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_treasury\",\"type\":\"address\"}],\"name\":\"setTreasury\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint64\",\"name\":\"param\",\"type\":\"uint64\"},{\"internalType\":\"bytes32\",\"name\":\"what\",\"type\":\"bytes32\"}],\"name\":\"setUint64\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"stablecoin\",\"outputs\":[{\"internalType\":\"contract IAgToken\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes4\",\"name\":\"interfaceId\",\"type\":\"bytes4\"}],\"name\":\"supportsInterface\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"pure\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"surplus\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"symbol\",\"outputs\":[{\"internalType\":\"string\",\"name\":\"\",\"type\":\"string\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"targetHealthFactor\",\"outputs\":[{\"internalType\":\"uint64\",\"name\":\"\",\"type\":\"uint64\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"togglePause\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"target\",\"type\":\"address\"}],\"name\":\"toggleWhitelist\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"vaultID\",\"type\":\"uint256\"}],\"name\":\"tokenURI\",\"outputs\":[{\"internalType\":\"string\",\"name\":\"\",\"type\":\"string\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"totalNormalizedDebt\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"from\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"to\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"vaultID\",\"type\":\"uint256\"}],\"name\":\"transferFrom\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"treasury\",\"outputs\":[{\"internalType\":\"contract ITreasury\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"name\":\"vaultData\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"collateralAmount\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"normalizedDebt\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"vaultIDCount\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"veBoostProxy\",\"outputs\":[{\"internalType\":\"contract IVeBoostProxy\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"whitelistingActivated\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"name\":\"xLiquidationBoost\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"name\":\"yLiquidationBoost\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"}],\"devdoc\":{\"author\":\"Angle Labs, Inc.\",\"kind\":\"dev\",\"methods\":{\"accrueInterestToTreasury()\":{\"details\":\"`surplus` and `badDebt` should be reset to 0 once their current value have been given to the `treasury` contract\",\"returns\":{\"badDebtValue\":\"Value of the bad debt communicated to the `Treasury`\",\"surplusValue\":\"Value of the surplus communicated to the `Treasury`\"}},\"angle(uint8[],bytes[],address,address,address,bytes)\":{\"details\":\"This function is optimized to reduce gas cost due to payment from or to the user and that expensive calls or computations (like `oracleValue`) are done only onceWhen specifying `vaultID` in `data`, it is important to know that if you specify `vaultID = 0`, it will simply use the latest `vaultID`. This is the default behavior, and unless you're engaging into some complex protocol actions it is encouraged to use `vaultID = 0` only when the first action of the batch is `createVault`\",\"params\":{\"actions\":\"Set of actions to perform\",\"datas\":\"Data to be decoded for each action: it can include like the `vaultID` or the `stablecoinAmount` to borrow\",\"from\":\"Address from which stablecoins will be taken if one action includes burning stablecoins. This address should either be the `msg.sender` or be approved by the latter\",\"repayData\":\"Data to pass to the repayment contract in case of\",\"to\":\"Address to which stablecoins and/or collateral will be sent in case of\",\"who\":\"Address of the contract to handle in case of repayment of stablecoins from received collateral\"},\"returns\":{\"paymentData\":\"Struct containing the accounting changes from the protocol's perspective (like how much of collateral or how much has been received). Note that the values in the struct are not aggregated and you could have in the output a positive amount of stablecoins to receive as well as a positive amount of stablecoins to give\"}},\"approve(address,uint256)\":{\"details\":\"Gives permission to `to` to transfer `tokenId` token to another account. The approval is cleared when the token is transferred. Only a single account can be approved at a time, so approving the zero address clears previous approvals. Requirements: - The caller must own the token or be an approved operator. - `tokenId` must exist. Emits an {Approval} event.\"},\"balanceOf(address)\":{\"details\":\"Returns the number of tokens in ``owner``'s account.\"},\"checkLiquidation(uint256,address)\":{\"details\":\"This function will revert if it's called on a vault that does not exist\",\"params\":{\"liquidator\":\"Address of the liquidator which will be performing the liquidation\",\"vaultID\":\"ID of the vault to check\"},\"returns\":{\"liqOpp\":\"Description of the opportunity of liquidation\"}},\"createVault(address)\":{\"details\":\"This function just creates the vault without doing any collateral or\",\"params\":{\"toVault\":\"Address for which the va\"},\"returns\":{\"_0\":\"vaultID ID of the vault created\"}},\"getApproved(uint256)\":{\"details\":\"Returns the account approved for `tokenId` token. Requirements: - `tokenId` must exist.\"},\"getDebtOut(uint256,uint256,uint256,uint256)\":{\"details\":\"This function can only be called from a vaultManager registered in the same Treasury\",\"params\":{\"amountStablecoins\":\"Amount of stablecoins to remove from the debt: this amount is to be converted to an internal debt amount\",\"senderBorrowFee\":\"Borrowing fees from the contract which requested this: this is to make sure that people are not arbitraging difference in minting fees\",\"senderRepayFee\":\"Repay fees from the contract which requested this: this is to make sure that people are not arbitraging differences in repay fees\",\"vaultID\":\"ID of the vault to remove debt from\"}},\"getTotalDebt()\":{\"returns\":{\"_0\":\"Total debt across all vaults, taking into account the interest accumulated over time\"}},\"getVaultDebt(uint256)\":{\"params\":{\"vaultID\":\"ID of the vault to check\"},\"returns\":{\"_0\":\"Debt of the vault\"}},\"initialize(address,address,address,(uint256,uint64,uint64,uint64,uint64,uint64,bool,uint256),string)\":{\"details\":\"The parameters and the oracle are the only elements which could be modified once the contract has been initializedFor the contract to be fully initialized, governance needs to set the parameters for the liquidation boost\",\"params\":{\"_collateral\":\"Collateral supported by this contract\",\"_oracle\":\"Oracle contract used\",\"_symbol\":\"Symbol used to define the `VaultManager` name and symbol\",\"_treasury\":\"Treasury address handling the contract\"}},\"isApprovedForAll(address,address)\":{\"details\":\"Returns if the `operator` is allowed to manage all of the assets of `owner`. See {setApprovalForAll}\"},\"isApprovedOrOwner(address,uint256)\":{\"params\":{\"spender\":\"Address for which vault ownership should be checked\",\"vaultID\":\"ID of the vault to check\"},\"returns\":{\"_0\":\"Whether the `spender` address owns or is approved for `vaultID`\"}},\"liquidate(uint256[],uint256[],address,address)\":{\"details\":\"This function is a simplified wrapper of the function below. It is built to remove for liquidators the need to specify a `who` and a `data` parameter\"},\"liquidate(uint256[],uint256[],address,address,address,bytes)\":{\"details\":\"This function will revert if it's called on a vault that cannot be liquidated or that does not exist\",\"params\":{\"amounts\":\"Amount of stablecoin to bring for the liquidation of each vault\",\"data\":\"Data to pass to the repayment contract in case of. If empty, liquidators simply have to bring the exact amount of stablecoins to get the discounted collateral. If not, it is used by the repayment contract to swap a portion or all of the collateral received to stablecoins to be sent to the `from` address. More details in the `_handleRepay` function\",\"from\":\"Address from which the stablecoins for the liquidation should be taken: this address should be the `msg.sender` or have received an approval\",\"to\":\"Address to which discounted collateral should be sent\",\"vaultIDs\":\"List of the vaults to liquidate\",\"who\":\"Address of the contract to handle repayment of stablecoins from received collateral\"},\"returns\":{\"liqData\":\"Data about the liquidation process for the liquidator to track everything that has been going on (like how much stablecoins have been repaid, how much collateral has been received)\"}},\"ownerOf(uint256)\":{\"details\":\"Returns the owner of the `tokenId` token. Requirements: - `tokenId` must exist.\"},\"permit(address,address,bool,uint256,uint8,bytes32,bytes32)\":{\"details\":\"The `v`, `r`, and `s` parameters are used as signature data\",\"params\":{\"approved\":\"Whether to give or revoke the approval\",\"deadline\":\"Deadline parameter for the signature to be valid\",\"owner\":\"Address signing the permit and giving (or revoking) its approval for all the controlled vaults\",\"spender\":\"Address to give approval to\"}},\"safeTransferFrom(address,address,uint256)\":{\"details\":\"Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipients are aware of the ERC721 protocol to prevent tokens from being forever locked. Requirements: - `from` cannot be the zero address. - `to` cannot be the zero address. - `tokenId` token must exist and be owned by `from`. - If the caller is not `from`, it must have been allowed to move this token by either {approve} or {setApprovalForAll}. - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer. Emits a {Transfer} event.\"},\"safeTransferFrom(address,address,uint256,bytes)\":{\"details\":\"Safely transfers `tokenId` token from `from` to `to`. Requirements: - `from` cannot be the zero address. - `to` cannot be the zero address. - `tokenId` token must exist and be owned by `from`. - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}. - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer. Emits a {Transfer} event.\"},\"setApprovalForAll(address,bool)\":{\"details\":\"Approve or remove `operator` as an operator for the caller. Operators can call {transferFrom} or {safeTransferFrom} for any token owned by the caller. Requirements: - The `operator` cannot be the caller. Emits an {ApprovalForAll} event.\"},\"setDebtCeiling(uint256)\":{\"details\":\"`debtCeiling` should not be bigger than `type(uint256).max / 10**27` otherwise there could be overflows\",\"params\":{\"_debtCeiling\":\"New value for `debtCeiling`\"}},\"setDusts(uint256,uint256)\":{\"details\":\"dustCollateral_ is in stable value\",\"params\":{\"_dust\":\"New minimum debt allowed\",\"dustCollateral_\":\"New minimum collateral allowed in a vault after a liquidation\"}},\"setLiquidationBoostParameters(address,uint256[],uint256[])\":{\"details\":\"There are 2 modes: When boost is enabled, `xBoost` and `yBoost` should have a length of 2, but if they have a higher length contract will still work as expected. Contract will also work as expected if their length differ When boost is disabled, `_veBoostProxy` needs to be zero address and `yBoost[0]` is the base boost\",\"params\":{\"_veBoostProxy\":\"Address which queries veANGLE balances and adjusted balances from delegation\",\"xBoost\":\"Threshold values of veANGLE adjusted balances\",\"yBoost\":\"Values of the liquidation boost at the threshold values of x\"}},\"setOracle(address)\":{\"params\":{\"_oracle\":\"Reference to the oracle contract\"}},\"setTreasury(address)\":{\"details\":\"All required checks when setting up a treasury contract are performed in the contract calling this function\",\"params\":{\"_treasury\":\"New treasury contract\"}},\"setUint64(uint64,bytes32)\":{\"details\":\"This function performs the required checks when updating a parameterWhen setting parameters governance or the guardian should make sure that when `HF < CF/((1-surcharge)(1-discount))` and hence when liquidating a vault is going to decrease its health factor, `discount = max discount`. Otherwise, it may be profitable for the liquidator to liquidate in multiple times: as it will decrease the HF and therefore increase the discount between each time\",\"params\":{\"param\":\"Value for the parameter\",\"what\":\"Parameter to change\"}},\"supportsInterface(bytes4)\":{\"details\":\"Returns true if this contract implements the interface defined by `interfaceId`. See the corresponding https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section] to learn more about how these ids are created. This function call must use less than 30 000 gas.\"},\"toggleWhitelist(address)\":{\"details\":\"If the `target` address is the zero address then this function toggles whitelisting for all addresses\",\"params\":{\"target\":\"Address to toggle\"}},\"tokenURI(uint256)\":{\"details\":\"Returns the Uniform Resource Identifier (URI) for `tokenId` token.\"},\"transferFrom(address,address,uint256)\":{\"details\":\"Transfers `tokenId` token from `from` to `to`. WARNING: Usage of this method is discouraged, use {safeTransferFrom} whenever possible. Requirements: - `from` cannot be the zero address. - `to` cannot be the zero address. - `tokenId` token must be owned by `from`. - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}. Emits a {Transfer} event.\"}},\"title\":\"VaultManagerLiquidationBoost\",\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{\"BASE_INTEREST()\":{\"notice\":\"Base used for interest rate computation\"},\"BASE_PARAMS()\":{\"notice\":\"Base used for parameter computation: almost all the parameters of this contract are set in `BASE_PARAMS`\"},\"DOMAIN_SEPARATOR()\":{\"notice\":\"Returns the domain separator for the current chain.\"},\"HALF_BASE_INTEREST()\":{\"notice\":\"Used for interest rate computation\"},\"accrueInterestToTreasury()\":{\"notice\":\"Accrues interest accumulated across all vaults to the surplus and sends the surplus to the treasury\"},\"angle(uint8[],bytes[],address,address)\":{\"notice\":\"This function is a wrapper built on top of the function above. It enables users to interact with the contract without having to provide `who` and `repayData` parameters\"},\"angle(uint8[],bytes[],address,address,address,bytes)\":{\"notice\":\"Allows composability between calls to the different entry points of this module. Any user calling this function can perform any of the allowed actions in the order of their choice\"},\"badDebt()\":{\"notice\":\"Bad debt made from liquidated vaults which ended up having no collateral and a positive amount of stablecoins\"},\"borrowFee()\":{\"notice\":\"Upfront fee taken when borrowing stablecoins: this fee is optional and should in practice not be used\"},\"checkLiquidation(uint256,address)\":{\"notice\":\"Checks whether a given vault is liquidable and if yes gives information regarding its liquidation\"},\"collateral()\":{\"notice\":\"Reference to the collateral handled by this `VaultManager`\"},\"collateralFactor()\":{\"notice\":\"Encodes the maximum ratio stablecoin/collateral a vault can have before being liquidated. It's what determines the minimum collateral ratio of a position\"},\"createVault(address)\":{\"notice\":\"Creates a vault\"},\"debtCeiling()\":{\"notice\":\"Maximum amount of stablecoins that can be issued with this contract (in `BASE_TOKENS`). This parameter should not be bigger than `type(uint256).max / BASE_INTEREST` otherwise there may be some overflows in the `increaseDebt` function\"},\"dust()\":{\"notice\":\"Minimum amount of debt a vault can have, expressed in `BASE_TOKENS` that is to say the base of the agTokens\"},\"getDebtOut(uint256,uint256,uint256,uint256)\":{\"notice\":\"Removes debt from a vault after being requested to do so by another `VaultManager` contract\"},\"getTotalDebt()\":{\"notice\":\"Gets the total debt across all vaults\"},\"getVaultDebt(uint256)\":{\"notice\":\"Gets the current debt of a vault\"},\"initialize(address,address,address,(uint256,uint64,uint64,uint64,uint64,uint64,bool,uint256),string)\":{\"notice\":\"Initializes the `VaultManager` contract\"},\"interestAccumulator()\":{\"notice\":\"The `interestAccumulator` variable keeps track of the interest that should accrue to the protocol. The stored value is not necessarily the true value: this one is recomputed every time an action takes place within the protocol. It is in base `BASE_INTEREST`\"},\"interestRate()\":{\"notice\":\"Per second interest taken to borrowers taking agToken loans. Contrarily to other parameters, it is set in `BASE_INTEREST` that is to say in base 10**27\"},\"isApprovedOrOwner(address,uint256)\":{\"notice\":\"Checks whether a given address is approved for a vault or owns this vault\"},\"isWhitelisted(address)\":{\"notice\":\"Maps an address to 1 if it's whitelisted and can open or own a vault\"},\"lastInterestAccumulatorUpdated()\":{\"notice\":\"Timestamp at which the `interestAccumulator` was updated\"},\"liquidate(uint256[],uint256[],address,address)\":{\"notice\":\"Liquidates an ensemble of vaults specified by their IDs\"},\"liquidate(uint256[],uint256[],address,address,address,bytes)\":{\"notice\":\"Liquidates an ensemble of vaults specified by their IDs\"},\"liquidationSurcharge()\":{\"notice\":\"Fee taken by the protocol during a liquidation. Technically, this value is not the fee per se, it's 1 - fee. For instance for a 2% fee, `liquidationSurcharge` should be 98%\"},\"maxLiquidationDiscount()\":{\"notice\":\"Maximum discount given to liquidators\"},\"nonces(address)\":{\"notice\":\"Returns the current nonce for an `owner` address\"},\"oracle()\":{\"notice\":\"Oracle contract to get access to the price of the collateral with respect to the stablecoin\"},\"paused()\":{\"notice\":\"Whether the contract is paused or not\"},\"permit(address,address,bool,uint256,uint8,bytes32,bytes32)\":{\"notice\":\"Allows an address to give or revoke approval for all its vaults to another address\"},\"repayFee()\":{\"notice\":\"Upfront fee taken when repaying stablecoins: this fee is optional as well. It should be smaller than the liquidation surcharge (cf below) to avoid exploits where people voluntarily get liquidated at a 0 discount to pay smaller repaying fees\"},\"setBaseURI(string)\":{\"notice\":\"Changes the ERC721 metadata URI\"},\"setDebtCeiling(uint256)\":{\"notice\":\"Sets `debtCeiling`\"},\"setDusts(uint256,uint256)\":{\"notice\":\"Sets the dust variables\"},\"setLiquidationBoostParameters(address,uint256[],uint256[])\":{\"notice\":\"Sets the parameters for the liquidation booster which encodes the slope of the discount\"},\"setOracle(address)\":{\"notice\":\"Changes the reference to the oracle contract used to get the price of the oracle\"},\"setTreasury(address)\":{\"notice\":\"Sets the treasury contract\"},\"setUint64(uint64,bytes32)\":{\"notice\":\"Sets parameters encoded as uint64\"},\"stablecoin()\":{\"notice\":\"Stablecoin handled by this contract. Another `VaultManager` contract could have the same rights as this `VaultManager` on the stablecoin contract\"},\"surplus()\":{\"notice\":\"Surplus accumulated by the contract: surplus is always in stablecoins, and is then reset when the value is communicated to the treasury contract\"},\"targetHealthFactor()\":{\"notice\":\"Maximum Health factor at which a vault can end up after a liquidation (unless it's fully liquidated)\"},\"togglePause()\":{\"notice\":\"Pauses external permissionless functions of the contract\"},\"toggleWhitelist(address)\":{\"notice\":\"Changes the whitelisting of an address\"},\"totalNormalizedDebt()\":{\"notice\":\"Total normalized amount of stablecoins borrowed, not taking into account the potential bad debt accumulated This value is expressed in the base of Angle stablecoins (`BASE_TOKENS = 10**18`)\"},\"treasury()\":{\"notice\":\"Reference to the `treasury` contract handling this `VaultManager`\"},\"vaultData(uint256)\":{\"notice\":\"Maps a `vaultID` to its data (namely collateral amount and normalized debt)\"},\"vaultIDCount()\":{\"notice\":\"ID of the last vault created. The `vaultIDCount` variables serves as a counter to generate a unique `vaultID` for each vault: it is like `tokenID` in basic ERC721 contracts\"},\"veBoostProxy()\":{\"notice\":\"Reference to the contract which computes adjusted veANGLE balances for liquidators boosts\"},\"whitelistingActivated()\":{\"notice\":\"Whether whitelisting is required to own a vault or not\"},\"xLiquidationBoost(uint256)\":{\"notice\":\"Threshold veANGLE balance values for the computation of the boost for liquidators: the length of this array should normally be 2. The base of the x-values in this array should be `BASE_TOKENS`\"},\"yLiquidationBoost(uint256)\":{\"notice\":\"Values of the liquidation boost at the threshold values of x\"}},\"notice\":\"Liquidation discount depending also on the liquidator veANGLE balance\",\"version\":1}},\"settings\":{\"compilationTarget\":{\"contracts/vaultManager/VaultManagerLiquidationBoost.sol\":\"VaultManagerLiquidationBoost\"},\"evmVersion\":\"london\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\"},\"optimizer\":{\"enabled\":true,\"runs\":1},\"remappings\":[]},\"sources\":{\"@openzeppelin/contracts-upgradeable/interfaces/IERC721MetadataUpgradeable.sol\":{\"keccak256\":\"0xc0e1ac396ac591a4c38ddcdd220321128eb94424d73e41a573cf58d5c643af38\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://2bd729caa85e0c3740b2d3a28a91fac0fd1ef66e0907145005a37f1927ae7a22\",\"dweb:/ipfs/QmcfVoLnE2PZj3U6KbACk6ykqE5WXuAM3hsXLJxC2sxZGt\"]},\"@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol\":{\"keccak256\":\"0x0203dcadc5737d9ef2c211d6fa15d18ebc3b30dfa51903b64870b01a062b0b4e\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://6eb2fd1e9894dbe778f4b8131adecebe570689e63cf892f4e21257bfe1252497\",\"dweb:/ipfs/QmXgUGNfZvrn6N2miv3nooSs7Jm34A41qz94fu2GtDFcx8\"]},\"@openzeppelin/contracts-upgradeable/security/ReentrancyGuardUpgradeable.sol\":{\"keccak256\":\"0x8cc03c5ac17e8a7396e487cda41fc1f1dfdb91db7d528e6da84bee3b6dd7e167\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://607818f1b44548c2d8268176f73cdb290e1faed971b1061930d92698366e2a11\",\"dweb:/ipfs/QmQibMe3r5no95b6q7isGT5R75V8xSofWEDLXzp95b7LgZ\"]},\"@openzeppelin/contracts-upgradeable/token/ERC20/IERC20Upgradeable.sol\":{\"keccak256\":\"0x4e733d3164f73f461eaf9d8087a7ad1ea180bdc8ba0d3d61b0e1ae16d8e63dff\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://75b47c3aeca7b66ea6752f8be020ec5c1c502de6ec9065272dae23d3a52196e2\",\"dweb:/ipfs/QmUebPMHv16tYKFh5BmBQkMfRFb5b8UZ2RgVwdjxCeufVF\"]},\"@openzeppelin/contracts-upgradeable/token/ERC20/extensions/draft-IERC20PermitUpgradeable.sol\":{\"keccak256\":\"0xcc70d8e2281fb3ff69e8ab242500f10142cd0a7fa8dd9e45882be270d4d09024\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://17a4063bc918df0f7bb9cbf04c6f0bb4977afab3f2fc212bc138a178312a221d\",\"dweb:/ipfs/QmZMdvsHP5mDEAAdrK4bNeNh47TfmSFgN9qEBFTbie7zmm\"]},\"@openzeppelin/contracts-upgradeable/token/ERC721/IERC721ReceiverUpgradeable.sol\":{\"keccak256\":\"0xbb2ed8106d94aeae6858e2551a1e7174df73994b77b13ebd120ccaaef80155f5\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://8bc3c6a456dba727d8dd9fd33420febede490abb49a07469f61d2a3ace66a95a\",\"dweb:/ipfs/QmVAWtEVj7K5AbvgJa9Dz22KiDq9eoptCjnVZqsTMtKXyd\"]},\"@openzeppelin/contracts-upgradeable/token/ERC721/IERC721Upgradeable.sol\":{\"keccak256\":\"0x016298e66a5810253c6c905e61966bb31c8775c3f3517bf946ff56ee31d6c005\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://1723de5ae414f210db039b19e6487c19c2d643483c9be7c445cf481a80c199d2\",\"dweb:/ipfs/QmcBLbmPdZsNngYhA1KDadNUqQZoGACytFWuUH74RC4AXC\"]},\"@openzeppelin/contracts-upgradeable/token/ERC721/extensions/IERC721MetadataUpgradeable.sol\":{\"keccak256\":\"0x95a471796eb5f030fdc438660bebec121ad5d063763e64d92376ffb4b5ce8b70\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://4ffbd627e6958983d288801acdedbf3491ee0ebf1a430338bce47c96481ce9e3\",\"dweb:/ipfs/QmUM1vpmNgBV34sYf946SthDJNGhwwqjoRggmj4TUUQmdB\"]},\"@openzeppelin/contracts-upgradeable/utils/AddressUpgradeable.sol\":{\"keccak256\":\"0x611aa3f23e59cfdd1863c536776407b3e33d695152a266fa7cfb34440a29a8a3\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://9b4b2110b7f2b3eb32951bc08046fa90feccffa594e1176cb91cdfb0e94726b4\",\"dweb:/ipfs/QmSxLwYjicf9zWFuieRc8WQwE4FisA1Um5jp1iSa731TGt\"]},\"@openzeppelin/contracts-upgradeable/utils/introspection/IERC165Upgradeable.sol\":{\"keccak256\":\"0xc6cef87559d0aeffdf0a99803de655938a7779ec0a3cd5d4383483ad85565a09\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://92ad7e572cf44e6b4b37631b44b62f9eb9fb1cf14d9ce51c1504d5dc7ccaf758\",\"dweb:/ipfs/QmcnbqX85tsWnUXPmtuPLE4SczME2sJaTfmqEFkuAJvWhy\"]},\"@openzeppelin/contracts/interfaces/IERC721Metadata.sol\":{\"keccak256\":\"0x1e88abdf82fcbbf98f97be17ea56c924376350637896bc37366ec9f89b7c2628\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://c8eb8afc411b87c9718cfe5c68669d5210d7012a96890c520c0fc321f74f0992\",\"dweb:/ipfs/Qmcr74gEtRpWER5qjFN86AKUep66pGuzp9WDYueaNtt97n\"]},\"@openzeppelin/contracts/token/ERC20/IERC20.sol\":{\"keccak256\":\"0x9750c6b834f7b43000631af5cc30001c5f547b3ceb3635488f140f60e897ea6b\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://5a7d5b1ef5d8d5889ad2ed89d8619c09383b80b72ab226e0fe7bde1636481e34\",\"dweb:/ipfs/QmebXWgtEfumQGBdVeM6c71McLixYXQP5Bk6kKXuoY4Bmr\"]},\"@openzeppelin/contracts/token/ERC20/extensions/IERC20Metadata.sol\":{\"keccak256\":\"0x8de418a5503946cabe331f35fe242d3201a73f67f77aaeb7110acb1f30423aca\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://5a376d3dda2cb70536c0a45c208b29b34ac560c4cb4f513a42079f96ba47d2dd\",\"dweb:/ipfs/QmZQg6gn1sUpM8wHzwNvSnihumUCAhxD119MpXeKp8B9s8\"]},\"@openzeppelin/contracts/token/ERC20/extensions/draft-IERC20Permit.sol\":{\"keccak256\":\"0xf41ca991f30855bf80ffd11e9347856a517b977f0a6c2d52e6421a99b7840329\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://b2717fd2bdac99daa960a6de500754ea1b932093c946388c381da48658234b95\",\"dweb:/ipfs/QmP6QVMn6UeA3ByahyJbYQr5M6coHKBKsf3ySZSfbyA8R7\"]},\"@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol\":{\"keccak256\":\"0x032807210d1d7d218963d7355d62e021a84bf1b3339f4f50be2f63b53cccaf29\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://11756f42121f6541a35a8339ea899ee7514cfaa2e6d740625fcc844419296aa6\",\"dweb:/ipfs/QmekMuk6BY4DAjzeXr4MSbKdgoqqsZnA8JPtuyWc6CwXHf\"]},\"@openzeppelin/contracts/token/ERC721/IERC721.sol\":{\"keccak256\":\"0xed6a749c5373af398105ce6ee3ac4763aa450ea7285d268c85d9eeca809cdb1f\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://20a97f891d06f0fe91560ea1a142aaa26fdd22bed1b51606b7d48f670deeb50f\",\"dweb:/ipfs/QmTbCtZKChpaX5H2iRiTDMcSz29GSLCpTCDgJpcMR4wg8x\"]},\"@openzeppelin/contracts/token/ERC721/extensions/IERC721Metadata.sol\":{\"keccak256\":\"0x75b829ff2f26c14355d1cba20e16fe7b29ca58eb5fef665ede48bc0f9c6c74b9\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://a0a107160525724f9e1bbbab031defc2f298296dd9e331f16a6f7130cec32146\",\"dweb:/ipfs/QmemujxSd7gX8A9M8UwmNbz4Ms3U9FG9QfudUgxwvTmPWf\"]},\"@openzeppelin/contracts/utils/Address.sol\":{\"keccak256\":\"0xd6153ce99bcdcce22b124f755e72553295be6abcd63804cfdffceb188b8bef10\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://35c47bece3c03caaa07fab37dd2bb3413bfbca20db7bd9895024390e0a469487\",\"dweb:/ipfs/QmPGWT2x3QHcKxqe6gRmAkdakhbaRgx3DLzcakHz5M4eXG\"]},\"@openzeppelin/contracts/utils/introspection/IERC165.sol\":{\"keccak256\":\"0x447a5f3ddc18419d41ff92b3773fb86471b1db25773e07f877f548918a185bf1\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://be161e54f24e5c6fae81a12db1a8ae87bc5ae1b0ddc805d82a1440a68455088f\",\"dweb:/ipfs/QmP7C3CHdY9urF4dEMb9wmsp1wMxHF6nhA2yQE5SKiPAdy\"]},\"contracts/interfaces/IAgToken.sol\":{\"keccak256\":\"0x6dd62e6c5de3b2e6e7d08694c7b97bd7bdaa7dd53be12a7c2d8c279398b78d39\",\"license\":\"GPL-3.0\",\"urls\":[\"bzz-raw://6ea7608c4787711ccd11c0fc67c1c4997936d818ee59695624cd53493c2b703e\",\"dweb:/ipfs/QmRrhdCX6PXXMsBbJHE9GQ9kY1JHwZztttDoUHUsFW7tgE\"]},\"contracts/interfaces/ICoreBorrow.sol\":{\"keccak256\":\"0x10249210cbf522775f040baf981d7d037472168ce2746d87473ac7c29a34e62e\",\"license\":\"GPL-3.0\",\"urls\":[\"bzz-raw://5662508bcc221233db54b5b311c4e371bd8616b3c5c3572ae207c04060758b67\",\"dweb:/ipfs/QmZCQVyMFbWkBZJnwwB3vxLZkvSXGxEg3Hu1UFJQfpV9fi\"]},\"contracts/interfaces/IFlashAngle.sol\":{\"keccak256\":\"0x39b0097f695b9e934bccdc72676c91513f1077cc5d0fd151908fd25a7c5cfbe4\",\"license\":\"GPL-3.0\",\"urls\":[\"bzz-raw://5b0f3c3581f390b0242d8252a4a215dd04b4c5b74e1efb7396bbba72c3922a02\",\"dweb:/ipfs/Qmc7BxyifSkpKtneN2gMsKkworGPDwVfBdT2t66iGMDerm\"]},\"contracts/interfaces/IOracle.sol\":{\"keccak256\":\"0x94f9c32fbf4f360175d595122686d494a107e9dcbcb8b0b8850edd976204c387\",\"license\":\"GPL-3.0\",\"urls\":[\"bzz-raw://0a77c7a25e729bbf2d0c61f66680b6c9cdb29481fd876268e92aca52ac698fe4\",\"dweb:/ipfs/QmUcraMPnHBgokvPaXuyuVjsKmDJVEwVMfeqXqrMAEwwYp\"]},\"contracts/interfaces/ISwapper.sol\":{\"keccak256\":\"0x2c18883cbff92d1e558e670480f5e2f517bce8c95c202cc3f6602ac276222609\",\"license\":\"GPL-3.0\",\"urls\":[\"bzz-raw://948ebdaf95b08d6617f490aa0651a90d8cc3ef3d4c0b9edc3a50e4fe6df73013\",\"dweb:/ipfs/QmejFnT3zzN2StAUnVDHS62iFxZ4e5ZQBTQ3kghDPXRR9g\"]},\"contracts/interfaces/ITreasury.sol\":{\"keccak256\":\"0x624733dae1bfb98721ba994573aed10997f7448c893b791ed985300531c361fd\",\"license\":\"GPL-3.0\",\"urls\":[\"bzz-raw://8ef7cfe9121192bc39d0906c1585c288f1302237fdf8c0a1575395233d25b90a\",\"dweb:/ipfs/QmWCUt4VTope9mFQd1opjom4CnGpdV4yiG3AQpNkeAgsRp\"]},\"contracts/interfaces/IVaultManager.sol\":{\"keccak256\":\"0x9d2dca11dba2fa9d646ccf88b3c0929d7601de925f1a6270f9ef2bef9390e6e4\",\"license\":\"GPL-3.0\",\"urls\":[\"bzz-raw://8b4991cb79afa8a717f66e4d9ef0c92a619574706affd2462c2b48937ca3585e\",\"dweb:/ipfs/QmWAxyT7jJkuQeFdvQmLVjZbBpEHhZbtfyhijXaqHEdumW\"]},\"contracts/interfaces/external/IERC1271.sol\":{\"keccak256\":\"0x6887d50d488064e481dfba3a9c54c049430b1ffc0a5536387fa89ff5133e6479\",\"license\":\"GPL-2.0-or-later\",\"urls\":[\"bzz-raw://0b080810d65481a97abbb7306b31ed944cd01dd19cb27a7a8e779f81bd9b6d11\",\"dweb:/ipfs/QmZUoJgs3JxAeki6CkbFD8uxBypipefhMS8uuVkQcxnsug\"]},\"contracts/interfaces/governance/IVeBoostProxy.sol\":{\"keccak256\":\"0xce73b8dcafcfaba4d01216f02f49930c078617e11223290004c6f662fc900d6b\",\"license\":\"GPL-3.0\",\"urls\":[\"bzz-raw://eb1eec1ea1c000dc07fa89e4f5f8e7009c1777a03960d7e02dcf3fa6f1630333\",\"dweb:/ipfs/QmbMqqz6nBHQmY57EqfhQA5Ep8WVnQSjaejW79XWtowHzv\"]},\"contracts/vaultManager/VaultManager.sol\":{\"keccak256\":\"0x18cbfb818323a0e40f52aaefc1b940d4e11068f7dd5ceee9a5dc93f2efd9070b\",\"license\":\"GPL-3.0\",\"urls\":[\"bzz-raw://d9b13e669a257ef484528dcc7b0a55fb8885ceb8d3b5d70daa351ab14e01c9c2\",\"dweb:/ipfs/QmNe92AaSvMpYFp9ZwBYBmQAU3wKXYEXD38Xxex1pyevKK\"]},\"contracts/vaultManager/VaultManagerERC721.sol\":{\"keccak256\":\"0x9bb1a6093dc753bd8341e8257a895e764d2e02fccdb8a8b2da44f5268857611a\",\"license\":\"GPL-3.0\",\"urls\":[\"bzz-raw://cd915bd744a2aec9a5da0deec58b4ecec6033cb21aee3e21608e09b57a8ec54c\",\"dweb:/ipfs/QmNtfQsXo5YAz5igsKqHno3bKuk8vVUejK7gEEL9hx8MtF\"]},\"contracts/vaultManager/VaultManagerLiquidationBoost.sol\":{\"keccak256\":\"0xbe2a172d8bd96149ac6bd0113644d59337a40c99b8e9eff0a6393efc3ae8de81\",\"license\":\"GPL-3.0\",\"urls\":[\"bzz-raw://e114f045f071084f504b96d28796d391867346a95cf9004b3f47e10ce906bee1\",\"dweb:/ipfs/QmXSW6XnDTpCredi8KEjwNgntPL6kRPb1mMX5YF9QgHiXQ\"]},\"contracts/vaultManager/VaultManagerPermit.sol\":{\"keccak256\":\"0x1303785eb96597effcbf7d7969be0c5c40c0c7d5a5c6b5b2f7eb20325f07e61f\",\"license\":\"GPL-3.0\",\"urls\":[\"bzz-raw://e9c853c15dc80a49de107cb02788b55006a0797f4ac6c003ea7db2dc62b80ea5\",\"dweb:/ipfs/QmT1XyC5L8u95fYti9DnGTXsyWCQLBcvqGoEKmDazf8pog\"]},\"contracts/vaultManager/VaultManagerStorage.sol\":{\"keccak256\":\"0x612208b1e1f538968d270671f67d1e0e54183872d8a18ddb0f4d0ab3985e8bf3\",\"license\":\"GPL-3.0\",\"urls\":[\"bzz-raw://e78aaffe7506abe8ea1f1568e0f19091703bdd1a264ae59496415a4f53e76dcb\",\"dweb:/ipfs/QmSgEJaWmsRMwxuwviZuKM4s4BLCBfYAtHN6ak2PuAJLPc\"]}},\"version\":1}", + "bytecode": "0x60806040523480156200001157600080fd5b50600054610100900460ff1615808015620000335750600054600160ff909116105b8062000063575062000050306200013d60201b620033591760201c565b15801562000063575060005460ff166001145b620000cb5760405162461bcd60e51b815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201526d191e481a5b9a5d1a585b1a5e995960921b606482015260840160405180910390fd5b6000805460ff191660011790558015620000ef576000805461ff0019166101001790555b801562000136576000805461ff0019169055604051600181527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989060200160405180910390a15b506200014c565b6001600160a01b03163b151590565b615f2c806200015c6000396000f3fe608060405234801561001057600080fd5b50600436106102f65760003560e01c8063010db195146102fb57806301ffc9a71461032457806306fdde0314610347578063081812fc1461035c578063087a60071461036f578063095ea7b3146103865780630e198f221461039b57806313888565146103a457806323b872dd146103ad578063254cf439146103c0578063307439af146103f257806334ce998a1461041257806335836f151461041a5780633644e5151461042d57806339393ac91461043557806339eb4dc6146104485780633ae2325f1461045c5780633af32abf1461046f5780633c2e941b1461048f57806342842e0e14610498578063430c2081146104ab5780634f7e43df146104be57806355f804b3146104d85780635b84d88a146104eb5780635c975abb146104fe57806361d027b3146105125780636352211e1461052557806370a0823114610538578063741075431461054b5780637aacfffa1461055e5780637adbf9731461059a5780637c0f59f4146105ad5780637c3a00fd146105c75780637dc0d1d0146105da5780637e53bd97146105ed5780637e56d47c146106005780637ecebe0014610613578063835986b41461063c57806389050f1d1461064f57806395d89b41146106615780639a3b6f2f146106695780639f48118f146106af578063a22cb465146106ba578063af2c8c2e146106cd578063b1511cc9146106d6578063b4bd6f46146106e9578063b88d4fde146106fc578063bbcac5571461070f578063c4ae316814610718578063c66d8b0114610720578063c87b56dd1461073a578063d8dfeb451461074d578063d9b1cb5b14610760578063de1f776514610773578063de8fc69814610785578063df011c4114610798578063e182b883146107ab578063e1c84ea4146107be578063e626648a146107c7578063e985e9c5146107e1578063e9cbd822146107f4578063f0f4426014610807578063f51cc7dd1461081a578063fad9aba31461082d578063fc29b02114610836578063fd527cf814610849575b600080fd5b60375461030e906001600160a01b031681565b60405161031b9190614ee0565b60405180910390f35b610337610332366004614f0a565b610851565b604051901515815260200161031b565b61034f6108be565b60405161031b9190614f7f565b61030e61036a366004614f92565b61094c565b610378603f5481565b60405190815260200161031b565b610399610394366004614fc0565b61097d565b005b610378603e5481565b61037860415481565b6103996103bb366004614fec565b610a0a565b603c546103da90600160401b90046001600160401b031681565b6040516001600160401b03909116815260200161031b565b61040561040036600461502d565b610a45565b60405161031b919061505d565b610378610af7565b610378610428366004614f92565b610b29565b610378610b65565b610399610443366004615096565b610b6f565b603d5461033790600160c01b900460ff1681565b61037861046a366004614f92565b610c6f565b61037861047d366004615096565b60446020526000908152604090205481565b61037860455481565b6103996104a6366004614fec565b610c90565b6103376104b9366004614fc0565b610cab565b603d546103da90600160801b90046001600160401b031681565b6103996104e6366004615168565b610cb7565b6103996104f936600461519c565b610d5c565b603d5461033790600160c81b900460ff1681565b60335461030e906001600160a01b031681565b61030e610533366004614f92565b610df5565b610378610546366004615096565b610e00565b6103996105593660046151d5565b610e45565b61058561056c366004614f92565b6043602052600090815260409020805460019091015482565b6040805192835260208301919091520161031b565b6103996105a8366004615096565b611211565b603c546103da90600160c01b90046001600160401b031681565b603d546103da906001600160401b031681565b60365461030e906001600160a01b031681565b6103996105fb36600461527f565b611358565b61040561060e3660046152f4565b611549565b610378610621366004615096565b6001600160a01b03166000908152607f602052604090205490565b61039961064a3660046153b8565b611af6565b610378676765c793fa10079d601a1b81565b61034f611cae565b61067c6106773660046154d2565b611cbb565b60405161031b91908151815260208083015190820152604080830151908201526060918201519181019190915260800190565b610378633b9aca0081565b6103996106c8366004615568565b611cf0565b61037860405481565b6103996106e4366004614f92565b611cfb565b6103786106f7366004615096565b611dc4565b61039961070a366004615596565b611e00565b61037860425481565b610399611e3d565b603d546103da90600160401b90046001600160401b031681565b61034f610748366004614f92565b611eec565b60345461030e906001600160a01b031681565b61039961076e366004615601565b612041565b610378676765c793fa10079d601b1b81565b61067c610793366004615695565b6125ec565b603c546103da906001600160401b031681565b6103786107b9366004614f92565b612e73565b61037860395481565b603c546103da90600160801b90046001600160401b031681565b6103376107ef3660046156f3565b612e83565b60355461030e906001600160a01b031681565b610399610815366004615096565b612eb1565b610399610828366004615730565b612f51565b61037860b45481565b6104056108443660046157aa565b613210565b61058561323a565b60006001600160e01b03198216635b5e139f60e01b148061088257506001600160e01b031982166380ac58cd60e01b145b8061089d57506001600160e01b0319821663430c208160e01b145b806108b857506001600160e01b031982166301ffc9a760e01b145b92915050565b607d80546108cb90615806565b80601f01602080910402602001604051908101604052809291908181526020018280546108f790615806565b80156109445780601f1061091957610100808354040283529160200191610944565b820191906000526020600020905b81548152906001019060200180831161092757829003601f168201915b505050505081565b600061095782613368565b6109745760405163062a39dd60e11b815260040160405180910390fd5b6108b882613385565b6000610988826133a0565b9050806001600160a01b0316836001600160a01b031614156109bd576040516349fa8bc360e11b815260040160405180910390fd5b336001600160a01b038216148015906109dd57506109db8133612e83565b155b156109fb5760405163c19f17a960e01b815260040160405180910390fd5b610a0583836133d6565b505050565b3381610a168282613444565b610a335760405163c19f17a960e01b815260040160405180910390fd5b610a3e8585856134c2565b5050505050565b610a4d614db6565b60008381526043602090815260409182902082518084018452815481526001909101548183015260365483516315f789a960e21b81529351610af094929387936001600160a01b03909316926357de26a492600480830193928290030181865afa158015610abf573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610ae3919061583b565b610aeb6135e9565b61377e565b9392505050565b6000676765c793fa10079d601b1b610b0d6135e9565b604054610b1a919061586a565b610b24919061589f565b905090565b6000676765c793fa10079d601b1b610b3f6135e9565b600084815260436020526040902060010154610b5b919061586a565b6108b8919061589f565b6000610b24613ad0565b603354604051631c86b03760e31b81526001600160a01b039091169063e43581b890610b9f903390600401614ee0565b602060405180830381865afa158015610bbc573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610be091906158b3565b610bfd57604051633b8d9d7560e21b815260040160405180910390fd5b6001600160a01b03811615610c4c576001600160a01b038116600090815260446020526040902054610c309060016158d0565b6001600160a01b03821660009081526044602052604090205550565b603d805460ff60c01b198116600160c01b9182900460ff16159091021790555b50565b603b8181548110610c7f57600080fd5b600091825260209091200154905081565b610a0583838360405180602001604052806000815250611e00565b6000610af08383613444565b60335460405163521d4de960e01b81526001600160a01b039091169063521d4de990610ce7903390600401614ee0565b602060405180830381865afa158015610d04573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610d2891906158b3565b610d4557604051632678482f60e21b815260040160405180910390fd5b8051610d58906046906020840190614de5565b5050565b603354604051631c86b03760e31b81526001600160a01b039091169063e43581b890610d8c903390600401614ee0565b602060405180830381865afa158015610da9573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610dcd91906158b3565b610dea57604051633b8d9d7560e21b815260040160405180910390fd5b60b49190915560b555565b60006108b8826133a0565b60006001600160a01b038216610e295760405163d92e233d60e01b815260040160405180910390fd5b506001600160a01b031660009081526048602052604090205490565b60335460405163521d4de960e01b81526001600160a01b039091169063521d4de990610e75903390600401614ee0565b602060405180830381865afa158015610e92573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610eb691906158b3565b610ed357604051632678482f60e21b815260040160405180910390fd5b806121a360f11b1415610f3757603d546001600160401b03600160401b90910481169083161115610f1757604051637650e96360e11b815260040160405180910390fd5b603c80546001600160401b0319166001600160401b0384161790556111ca565b80622a242360e91b1415610f9c57633b9aca00826001600160401b03161015610f735760405163da6a17b960e01b815260040160405180910390fd5b603c8054600160401b600160801b031916600160401b6001600160401b038516021790556111ca565b8061212360f11b141561100057633b9aca00826001600160401b03161115610fd757604051637650e96360e11b815260040160405180910390fd5b603c8054600160801b600160c01b031916600160801b6001600160401b038516021790556111ca565b8061292360f11b141561107d57603d54633b9aca009061103090600160401b90046001600160401b0316846158e7565b6001600160401b0316111561105857604051637650e96360e11b815260040160405180910390fd5b603c80546001600160c01b0316600160c01b6001600160401b038516021790556111ca565b806124a960f11b14156110b357611092613b3c565b50603d80546001600160401b0319166001600160401b0384161790556111ca565b80614c5360f01b141561114c57603c546001600160401b03808416911611806111055750603c54633b9aca00906110fa90600160c01b90046001600160401b0316846158e7565b6001600160401b0316115b156111235760405163180d062b60e31b815260040160405180910390fd5b603d8054600160401b600160801b031916600160401b6001600160401b038516021790556111ca565b806213531160ea1b14156111b157633b9aca00826001600160401b0316111561118857604051637650e96360e11b815260040160405180910390fd5b603d8054600160801b600160c01b031916600160801b6001600160401b038516021790556111ca565b60405163e1daa9cf60e01b815260040160405180910390fd5b604080516001600160401b0384168152602081018390527f13b367dac93b85d1ed9b3d8961d8b48e1a677c9800bb1613b4b0416b2d5b61d091015b60405180910390a15050565b603354604051631c86b03760e31b81526001600160a01b039091169063e43581b890611241903390600401614ee0565b602060405180830381865afa15801561125e573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061128291906158b3565b61129f57604051633b8d9d7560e21b815260040160405180910390fd5b603354604080516361d027b360e01b815290516001600160a01b03928316928416916361d027b39160048083019260209291908290030181865afa1580156112eb573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061130f9190615912565b6001600160a01b031614611336576040516302979eb960e31b815260040160405180910390fd5b603680546001600160a01b0319166001600160a01b0392909216919091179055565b60335460405163521d4de960e01b81526001600160a01b039091169063521d4de990611388903390600401614ee0565b602060405180830381865afa1580156113a5573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906113c991906158b3565b6113e657604051632678482f60e21b815260040160405180910390fd5b805182511415806114115750806000815181106114055761140561592f565b60200260200101516000145b806114a057506001600160a01b038316158015906114a057508160008151811061143d5761143d61592f565b6020026020010151826001815181106114585761145861592f565b60200260200101511115806114a057508060008151811061147b5761147b61592f565b6020026020010151816001815181106114965761149661592f565b6020026020010151105b156114be57604051631746545d60e11b815260040160405180910390fd5b603780546001600160a01b0319166001600160a01b03851617905581516114ec90603a906020850190614e69565b50805161150090603b906020840190614e69565b50826001600160a01b03167feb74d4d9fea592587c926aeb35eb6a7893fb28db0c1c8eb2eb3c586e7164b76c838360405161153c929190615980565b60405180910390a2505050565b611551614db6565b603d54600160c81b900460ff161561157c576040516313d0ff5960e31b815260040160405180910390fd5b600260015414156115a85760405162461bcd60e51b815260040161159f906159a5565b60405180910390fd5b600260015586518651811415806115bd575080155b156115db576040516346282e8d60e01b815260040160405180910390fd5b603660009054906101000a90046001600160a01b03166001600160a01b03166357de26a46040518163ffffffff1660e01b8152600401602060405180830381865afa15801561162e573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611652919061583b565b606083015261165f613b3c565b60808301526040517f965a177723c641ee49150b583a0b9ad4730bb20d3474e00ae5a65e777c00d67b90611694908a906159dc565b60405180910390a160005b81811015611a66576000604360008b84815181106116bf576116bf61592f565b60200260200101518152602001908152602001600020604051806040016040529081600082015481526020016001820154815250509050600061170c82338760600151886080015161377e565b90508060400151600014158015611740575080604001518a84815181106117355761173561592f565b602002602001015110155b80611767575080600001518a848151811061175d5761175d61592f565b6020026020010151115b156117905780600001518a84815181106117835761178361592f565b6020026020010181815250505b6000856060015182606001516117a6919061586a565b603854633b9aca008d87815181106117c0576117c061592f565b60200260200101516117d2919061586a565b6117dc919061586a565b6117e6919061589f565b90506118148c85815181106117fd576117fd61592f565b60200260200101518285600001511115610c6c5750565b8251811061194a575081516020830151604080546000906118369084906158d0565b92505081905550604360008d86815181106118535761185361592f565b60209081029190910181015182528101919091526040016000908120818155600101819055603d548c51633b9aca0091600160401b90046001600160401b0316908e90889081106118a6576118a661592f565b60200260200101516118b8919061586a565b6118c2919061589f565b9050826080015181106118d65760006118e6565b8083608001516118e691906158d0565b876040018181516118f791906159ef565b905250508b51600080516020615e97833981519152908d908690811061191f5761191f61592f565b60200260200101518460200151600060405161193d93929190615a07565b60405180910390a1611a0b565b80604360008e87815181106119615761196161592f565b60200260200101518152602001908152602001600020600001600082825461198991906158d0565b92505081905550611a098c85815181106119a5576119a561592f565b6020026020010151633b9aca00603d60089054906101000a90046001600160401b03166001600160401b03168e88815181106119e3576119e361592f565b60200260200101516119f5919061586a565b6119ff919061589f565b8860800151613bdd565b505b8086602001818151611a1d91906159ef565b9052508a518b9085908110611a3457611a3461592f565b602002602001015186600001818151611a4d91906159ef565b905250611a5f9250839150615a209050565b905061169f565b50603d54633b9aca0090611a8a90600160401b90046001600160401b0316826158d0565b8351611a96919061586a565b611aa0919061589f565b60416000828254611ab191906159ef565b9091555050604082015160428054600090611acd9084906159ef565b909155505060208201518251611ae7919088888888613d0c565b50600180559695505050505050565b603d54600160c81b900460ff1615611b21576040516313d0ff5960e31b815260040160405180910390fd5b6033546040516333b52a9f60e11b81526001600160a01b039091169063676a553e90611b51903390600401614ee0565b602060405180830381865afa158015611b6e573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611b9291906158b3565b611baf5760405163027f480760e01b815260040160405180910390fd5b603c54600090600160c01b90046001600160401b0316821015611bed57603c54611bea908390600160c01b90046001600160401b03166158d0565b90505b603c54600090600160801b90046001600160401b0316841115611c2a57603c54611c2790600160801b90046001600160401b0316856158d0565b90505b6000611c3b6002633b9aca00615b1f565b611c4983633b9aca006158d0565b611c5785633b9aca006158d0565b611c61908961586a565b611c6b919061586a565b611c75919061589f565b9050611c8181876158d0565b60416000828254611c9291906159ef565b90915550611ca4905087826000613bdd565b5050505050505050565b607e80546108cb90615806565b611cc3614ea3565b60408051600080825260208201909252611ce5918791879187918791906125ec565b90505b949350505050565b610d58338383613e16565b60335460405163521d4de960e01b81526001600160a01b039091169063521d4de990611d2b903390600401614ee0565b602060405180830381865afa158015611d48573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611d6c91906158b3565b611d8957604051632678482f60e21b815260040160405180910390fd5b60398190556040518181527fdd63b3dcdbebad734892f7c7a26d0f647fbc7eec973e0775f5229018ac4ab47a9060200160405180910390a150565b603d54600090600160c81b900460ff1615611df2576040516313d0ff5960e31b815260040160405180910390fd5b6108b882613ecc565b919050565b3382611e0c8282613444565b611e295760405163c19f17a960e01b815260040160405180910390fd5b611e3586868686613ffa565b505050505050565b60335460405163521d4de960e01b81526001600160a01b039091169063521d4de990611e6d903390600401614ee0565b602060405180830381865afa158015611e8a573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611eae91906158b3565b611ecb57604051632678482f60e21b815260040160405180910390fd5b603d805460ff60c81b198116600160c81b9182900460ff1615909102179055565b6060611ef782613368565b611f145760405163062a39dd60e11b815260040160405180910390fd5b8160005b8115611f3b57611f2781615a20565b9050611f34600a8361589f565b9150611f18565b6000816001600160401b03811115611f5557611f556150b3565b6040519080825280601f01601f191660200182016040528015611f7f576020820181803683370190505b5090505b8415611fea57611f946001836158d0565b9150611fa1600a86615b2e565b611fac9060306159ef565b60f81b818381518110611fc157611fc161592f565b60200101906001600160f81b031916908160001a905350611fe3600a8661589f565b9450611f83565b60468054611ff790615806565b151590506120145760405180602001604052806000815250612038565b604681604051602001612028929190615b5e565b6040516020818303038152906040525b95945050505050565b600054610100900460ff16158080156120615750600054600160ff909116105b80612082575061207030613359565b158015612082575060005460ff166001145b6120e55760405162461bcd60e51b815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201526d191e481a5b9a5d1a585b1a5e995960921b606482015260840161159f565b6000805460ff191660011790558015612108576000805461ff0019166101001790555b856001600160a01b0316846001600160a01b03166361d027b36040518163ffffffff1660e01b8152600401602060405180830381865afa158015612150573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906121749190615912565b6001600160a01b03161461219b576040516302979eb960e31b815260040160405180910390fd5b603380546001600160a01b038089166001600160a01b0319928316179092556034805492881692909116821790556040805163313ce56760e01b8152905163313ce567916004808201926020929091908290030181865afa158015612204573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906122289190615bfc565b61223390600a615b1f565b603881905550856001600160a01b031663e9cbd8226040518163ffffffff1660e01b8152600401602060405180830381865afa158015612277573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061229b9190615912565b603580546001600160a01b03199081166001600160a01b0393841617909155603680549091169186169190911790556040516000906122de908490602001615c19565b60408051601f19818403018152919052805190915061230490607d906020840190614de5565b5061230e81614034565b8260405160200161231f9190615c60565b604051602081830303815290604052607e9080519060200190612343929190614de5565b50676765c793fa10079d601b1b603f5542603e5561236760a0850160808601615c8a565b6001600160401b03166123806040860160208701615c8a565b6001600160401b031611806123b05750633b9aca006123a560a0860160808701615c8a565b6001600160401b0316115b806123d657506123c66060850160408601615c8a565b6001600160401b0316633b9aca00115b806123fd5750633b9aca006123f160c0860160a08701615c8a565b6001600160401b031610155b8061240a575060e0840135155b1561242857604051631746545d60e11b815260040160405180910390fd5b833560395561243d6040850160208601615c8a565b603c80546001600160401b0319166001600160401b039290921691909117905561246d6060850160408601615c8a565b603c80546001600160401b0392909216600160401b02600160401b600160801b03199092169190911790556124a86080850160608601615c8a565b603d80546001600160401b0319166001600160401b03929092169190911790556124d860a0850160808601615c8a565b603d80546001600160401b0392909216600160401b02600160401b600160801b031990921691909117905561251360c0850160a08601615c8a565b603d80546001600160401b0392909216600160801b02600160801b600160c01b031990921691909117905561254e60e0850160c08601615ca5565b603d8054911515600160c01b0260ff60c01b19909216919091179055604080516020810190915260e0850135815261258a90603b906001614e69565b5050603d805460ff60c81b1916600160c81b1790558015611e35576000805461ff0019169055604051600181527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989060200160405180910390a1505050505050565b6125f4614ea3565b603d54600160c81b900460ff161561261f576040516313d0ff5960e31b815260040160405180910390fd5b600260015414156126425760405162461bcd60e51b815260040161159f906159a5565b60026001558551875114158061265757508651155b15612675576040516346282e8d60e01b815260040160405180910390fd5b6000806000806000805b8c51811015612bdc5760008d828151811061269c5761269c61592f565b60200260200101519050600060078111156126b9576126b9615cc2565b8160078111156126cb576126cb615cc2565b141561270c576127068d83815181106126e6576126e661592f565b60200260200101518060200190518101906127019190615912565b613ecc565b50612bcb565b600281600781111561272057612720615cc2565b1415612786578c82815181106127385761273861592f565b60200260200101518060200190518101906127539190615cd8565b95509250826127625760455492505b61276c838661410a565b848860600181815161277e91906159ef565b905250612bcb565b600781600781111561279a5761279a615cc2565b14156128735760008060008f85815181106127b7576127b761592f565b60200260200101518060200190518101906127d29190615cfc565b60345460405163d505accf60e01b81526001600160a01b038089166004830152306024830152604482018890526064820187905260ff8616608483015260a4820185905260c48201849052969f50939d50939b509497509550929350169063d505accf9060e401600060405180830381600087803b15801561285357600080fd5b505af1158015612867573d6000803e3d6000fd5b50505050505050612bcb565b8661288357612880613b3c565b96505b600481600781111561289757612897615cc2565b1415612963578c82815181106128af576128af61592f565b60200260200101518060200190518101906128ca9190615cd8565b94509250826128d95760455492505b6128e4838589613bdd565b603c5490945060009061290b90600160c01b90046001600160401b0316633b9aca006158d0565b612919633b9aca008761586a565b612923919061589f565b905061292f85826158d0565b6041600082825461294091906159ef565b92505081905550808960200181815161295991906159ef565b905250612bcb9050565b856129e257603660009054906101000a90046001600160a01b03166001600160a01b03166357de26a46040518163ffffffff1660e01b8152600401602060405180830381865afa1580156129bb573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906129df919061583b565b95505b60018160078111156129f6576129f6615cc2565b1415612a72578c8281518110612a0e57612a0e61592f565b6020026020010151806020019051810190612a29919061583b565b925082612a365760455492505b612a41838789614176565b80965081955050508488604001818151612a5b91906159ef565b90525060208801805185919061277e9083906159ef565b6003816007811115612a8657612a86615cc2565b1415612ae6578c8281518110612a9e57612a9e61592f565b6020026020010151806020019051810190612ab99190615cd8565b9550925082612ac85760455492505b612ad48386888a614296565b848860400181815161277e91906159ef565b6005816007811115612afa57612afa615cc2565b1415612b5c578c8281518110612b1257612b1261592f565b6020026020010151806020019051810190612b2d9190615cd8565b9450925082612b3c5760455492505b612b488385888a614370565b9350838860000181815161277e91906159ef565b6006816007811115612b7057612b70615cc2565b1415612bcb576000808e8481518110612b8b57612b8b61592f565b6020026020010151806020019051810190612ba69190615d4f565b98509196509250905084612bba5760455494505b612bc8858383898c8e61440b565b50505b50612bd581615a20565b905061267f565b508551602087015110612cd35785516020870151600091612bfc916158d0565b90508660600151876040015110612c3357612c2e87606001518860400151612c2491906158d0565b828d8d8d8d613d0c565b612ccd565b8015612ca057603554604051630d43af8160e21b81526001600160a01b039091169063350ebe0490612c6d9084908f903390600401615d8d565b600060405180830381600087803b158015612c8757600080fd5b505af1158015612c9b573d6000803e3d6000fd5b505050505b612ccd333089604001518a60600151612cb991906158d0565b6034546001600160a01b0316929190614547565b50612e5f565b60208601518651600091612ce6916158d0565b6035546040516340c10f1960e01b81529192506001600160a01b0316906340c10f1990612d19908d908590600401615dac565b600060405180830381600087803b158015612d3357600080fd5b505af1158015612d47573d6000803e3d6000fd5b50505050866060015187604001511115612d8b57612d868a88606001518960400151612d7391906158d0565b6034546001600160a01b031691906145b2565b612e5d565b600087604001518860600151612da191906158d0565b90508015612e5b57885115612e4357896001600160a01b031663a5d4096b603560009054906101000a90046001600160a01b0316603460009054906101000a90046001600160a01b03163385878f6040518763ffffffff1660e01b8152600401612e1096959493929190615dc5565b600060405180830381600087803b158015612e2a57600080fd5b505af1158015612e3e573d6000803e3d6000fd5b505050505b603454612e5b906001600160a01b0316333084614547565b505b505b505060018055509198975050505050505050565b603a8181548110610c7f57600080fd5b6001600160a01b039182166000908152604a6020908152604080832093909416825291909152205460011490565b6033546001600160a01b03163314612edc5760405163b90cdbb160e01b815260040160405180910390fd5b603380546001600160a01b0319166001600160a01b0383811691909117909155603654604051630787a21360e51b815291169063f0f4426090612f23908490600401614ee0565b600060405180830381600087803b158015612f3d57600080fd5b505af1158015610a3e573d6000803e3d6000fd5b83421115612f725760405163f87d927160e01b815260040160405180910390fd5b6fa2a8918ca85bafe22016d0b997e4df60600160ff1b03811180612fa957508260ff16601b14158015612fa957508260ff16601c14155b15612fc757604051638baa579f60e01b815260040160405180910390fd5b6000612fd1613ad0565b608254898989612fe08d6145d1565b6040805160208101969096526001600160a01b03948516908601529290911660608401521515608083015260a082015260c0810187905260e0016040516020818303038152906040528051906020012060405160200161305792919061190160f01b81526002810192909252602282015260420190565b604051602081830303815290604052805190602001209050613081886001600160a01b0316613359565b1561315d57604080516020810185905280820184905260f886901b6001600160f81b0319166060820152815160418183030181526061820192839052630b135d3f60e11b9092526001600160a01b038a1691631626ba7e916130e7918591606501615e07565b602060405180830381865afa158015613104573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906131289190615e20565b6001600160e01b031916631626ba7e60e01b1461315857604051638baa579f60e01b815260040160405180910390fd5b613205565b6040805160008082526020820180845284905260ff871692820192909252606081018590526080810184905260019060a0016020604051602081039080840390855afa1580156131b1573d6000803e3d6000fd5b505050602060405103519050886001600160a01b0316816001600160a01b03161415806131e557506001600160a01b038116155b1561320357604051638baa579f60e01b815260040160405180910390fd5b505b611ca4888888613e16565b613218614db6565b60408051600080825260208201909252611ce591879187918791879190611549565b60335460009081906001600160a01b0316331461326a5760405163b90cdbb160e01b815260040160405180910390fd5b613272613b3c565b50506041805460428054600093849055929055915080821061330b5761329881836158d0565b6035546033546040516340c10f1960e01b8152929450600093506001600160a01b03918216926340c10f19926132d49216908690600401615dac565b600060405180830381600087803b1580156132ee57600080fd5b505af1158015613302573d6000803e3d6000fd5b5050505061331c565b61331582826158d0565b9050600091505b60408051838152602081018390527ffeb12225c131aab793a00c5239afb778932d170fa28ce6e9d23703e4bd892121910160405180910390a19091565b6001600160a01b03163b151590565b6000908152604760205260409020546001600160a01b0316151590565b6000908152604960205260409020546001600160a01b031690565b6000818152604760205260409020546001600160a01b031680611dfb5760405163062a39dd60e11b815260040160405180910390fd5b600081815260496020526040902080546001600160a01b0319166001600160a01b038416908117909155819061340b826133a0565b6001600160a01b03167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92560405160405180910390a45050565b600080613450836133a0565b9050806001600160a01b0316846001600160a01b0316148061348b5750836001600160a01b031661348084613385565b6001600160a01b0316145b80611ce857506001600160a01b038082166000908152604a6020908152604080832093881683529290522054600114949350505050565b826001600160a01b03166134d5826133a0565b6001600160a01b0316146134fc5760405163c19f17a960e01b815260040160405180910390fd5b6001600160a01b0382166135235760405163d92e233d60e01b815260040160405180910390fd5b603d54600160c01b900460ff16801561355557506001600160a01b038216600090815260446020526040902054600114155b1561357357604051630b094f2760e31b815260040160405180910390fd5b61357e6000826133d6565b6001600160a01b038084166000818152604860209081526040808320805460001901905593861680835284832080546001019055858352604790915283822080546001600160a01b03191682179055925184939291600080516020615ed783398151915291a4505050565b600080603e54426135fa91906158d0565b603d549091506001600160401b0316811580613614575080155b1561362357603f549250505090565b60006136306001846158d0565b905060006002841161364357600061364e565b61364e6002856158d0565b90506000676765c793fa10079d601b1b676765c793fa10079d601a1b613674868061586a565b61367e91906159ef565b613688919061589f565b90506000676765c793fa10079d601b1b676765c793fa10079d601a1b6136ae878561586a565b6136b891906159ef565b6136c2919061589f565b905060006002836136d3878a61586a565b6136dd919061586a565b6136e7919061589f565b90506000600683866136f9898c61586a565b613703919061586a565b61370d919061586a565b613717919061589f565b9050676765c793fa10079d601b1b81836137318b8b61586a565b61374690676765c793fa10079d601b1b6159ef565b61375091906159ef565b61375a91906159ef565b603f54613767919061586a565b613771919061589f565b9850505050505050505090565b613786614db6565b6000806000613796888787614615565b925092509250633b9aca0083106137c0576040516315fe9b6160e21b815260040160405180910390fd5b6000633b9aca006137d185826158d0565b6137da8a61469e565b6137e4919061586a565b6137ee919061589f565b603d54909150600160801b90046001600160401b031681101561381e5761381981633b9aca006158d0565b61383f565b603d5461383f90600160801b90046001600160401b0316633b9aca006158d0565b603d54909150600160401b90046001600160401b03166000806138676002633b9aca00615b1f565b603c5461387d91906001600160401b031661586a565b83613888868a61586a565b613892919061586a565b10613a1b57603c546001600160401b03166138b26002633b9aca00615b1f565b6138bc919061586a565b603c5485906138db90600160401b90046001600160401b03168661586a565b6138e5919061586a565b6138ef91906158d0565b603c548590633b9aca009061390d906001600160401b03168961586a565b603c5461392b908b90600160401b90046001600160401b031661586a565b61393591906158d0565b61393f919061586a565b613949919061586a565b613953919061589f565b9150633b9aca0060b454613967919061586a565b613971848461586a565b61397b91906159ef565b613989633b9aca008861586a565b11613a16576139a3676765c793fa10079d601b1b8461586a565b633b9aca008a8e602001516139b8919061586a565b6139c2919061586a565b6139cc919061589f565b6139d79060016159ef565b915060b454861115613a125782633b9aca0060b454886139f791906158d0565b613a01919061586a565b613a0b919061589f565b9050613a7e565b5060015b613a7e565b603854613a2c90633b9aca0061586a565b8c518b90613a3b90879061586a565b613a45919061586a565b613a4f919061589f565b613a5a9060016159ef565b915060b554851115613a7a57633b9aca008460b554876139f791906158d0565b5060015b818852613a8b848b61586a565b603854613a9c633b9aca008561586a565b613aa6919061586a565b613ab0919061589f565b602089015260408801525050606085015250608083015250949350505050565b60808054608154604080517f8b73c3c69bb8fe3d512ecc4cf759cc79239f7b179b0ffacaa9a75d522b39400f602082015290810192909252606082015246918101919091523060a082015260009060c00160405160208183030381529060405280519060200120905090565b6000613b466135e9565b90506000676765c793fa10079d601b1b603f5483613b6491906158d0565b604054613b71919061586a565b613b7b919061589f565b90508060416000828254613b8f91906159ef565b9091555050603f82905542603e8190556040805184815260208101929092527fd1fa8ba00a3bf20274346919dce0de62d2a140af2c71fe7e29fa6472eea3bb9d910160405180910390a15090565b600081613bef57613bec613b3c565b91505b60008481526043602052604081206001015490676765c793fa10079d601b1b613c18858461586a565b613c22919061589f565b9050808510613c3357935080613c56565b83613c49676765c793fa10079d601b1b8761586a565b613c53919061589f565b90505b613c6081836158d0565b91508060406000828254613c7491906158d0565b90915550508115801590613ca95750676765c793fa10079d601b1b60b454613c9c919061586a565b613ca6858461586a565b11155b15613cc75760405163228af07f60e21b815260040160405180910390fd5b60008681526043602052604080822060010184905551600080516020615e9783398151915291613cfa9189918591615a07565b60405180910390a15092949350505050565b8515613d2957603454613d29906001600160a01b031684886145b2565b8415611e3557805115613da85760345460355460405163a5d4096b60e01b81526001600160a01b038086169363a5d4096b93613d759391831692169089908b908d908990600401615dc5565b600060405180830381600087803b158015613d8f57600080fd5b505af1158015613da3573d6000803e3d6000fd5b505050505b603554604051630d43af8160e21b81526001600160a01b039091169063350ebe0490613ddc90889088903390600401615d8d565b600060405180830381600087803b158015613df657600080fd5b505af1158015613e0a573d6000803e3d6000fd5b50505050505050505050565b826001600160a01b0316826001600160a01b03161415613e49576040516320c5195360e21b815260040160405180910390fd5b600081613e57576000613e5a565b60015b6001600160a01b038581166000818152604a602090815260408083209489168084529482529182902060ff959095169485905590518615158152939450919290917f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c31910160405180910390a350505050565b603d54600090600160c01b900460ff168015613f1b57506001600160a01b0382166000908152604460205260409020546001141580613f1b575033600090815260446020526040902054600114155b15613f3957604051630b094f2760e31b815260040160405180910390fd5b6001600160a01b038216613f605760405163d92e233d60e01b815260040160405180910390fd5b5060458054600101908190556001600160a01b038216600081815260486020908152604080832080546001019055848352604790915280822080546001600160a01b031916841790555183929190600080516020615ed7833981519152908290a4613fdd60008383604051806020016040528060008152506148cd565b611dfb576040516320149b4360e21b815260040160405180910390fd5b6140058484846134c2565b614011848484846148cd565b61402e576040516320149b4360e21b815260040160405180910390fd5b50505050565b600054610100900460ff1661409f5760405162461bcd60e51b815260206004820152602b60248201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960448201526a6e697469616c697a696e6760a81b606482015260840161159f565b7f3f43a9c6bafb5c7aab4e0cfe239dc5d4c15caf0381c6104188191f78a6640bd860825580516020918201206080556040805180820190915260018152603160f81b9101527fc89efdaa54c0f20c7adf612882df0950f5a951637e0307cdcb4c672f298b8bc6608155565b61411382613368565b6141305760405163062a39dd60e11b815260040160405180910390fd5b6000828152604360205260408120805483929061414e9084906159ef565b9091555050604051600080516020615eb7833981519152906112059084908490600190615a07565b60008033856141858282613444565b6141a25760405163c19f17a960e01b815260040160405180910390fd5b6000878152604360209081526040808320815180830190925280548252600101549181019190915290806141d7838a8a614615565b5091509150633b9aca00821161420057604051631527804d60e31b815260040160405180910390fd5b82602001516040600082825461421691906158d0565b9091555061422590508a6149d0565b603c5460009061424990600160c01b90046001600160401b0316633b9aca006158d0565b614257633b9aca008461586a565b614261919061589f565b905061426d82826158d0565b6041600082825461427e91906159ef565b90915550509251929a92995091975050505050505050565b33846142a28282613444565b6142bf5760405163c19f17a960e01b815260040160405180910390fd5b600086815260436020526040812080548792906142dd9084906158d0565b909155505060008681526043602090815260408083208151808301909252805482526001015491810191909152614315908686614615565b50509050633b9aca00811161433d57604051631527804d60e31b815260040160405180910390fd5b600080516020615eb78339815191528787600060405161435f93929190615a07565b60405180910390a150505050505050565b6000338561437e8282613444565b61439b5760405163c19f17a960e01b815260040160405180910390fd5b6143a787878787614a4f565b603c54909650600090633b9aca00906143d1908990600160801b90046001600160401b031661586a565b6143db919061589f565b905080604160008282546143ef91906159ef565b909155506143ff905081886158d0565b98975050505050505050565b33866144178282613444565b6144345760405163c19f17a960e01b815260040160405180910390fd5b60408051898152602081018890526001600160a01b038916818301526060810187905290517fddd3b70af631334f7552aadb582ed091018e62e103fa8b150ca66cc700d4dac69181900360800190a161448f88868686614a4f565b94506001600160a01b0387163014156144b3576144ad868685613bdd565b50611ca4565b603c546040516320d661ad60e21b815260048101889052602481018790526001600160401b03600160801b830481166044830152600160c01b90920490911660648201526001600160a01b0388169063835986b490608401600060405180830381600087803b15801561452557600080fd5b505af1158015614539573d6000803e3d6000fd5b505050505050505050505050565b6040516001600160a01b038085166024830152831660448201526064810182905261402e9085906323b872dd60e01b906084015b60408051601f198184030181529190526020810180516001600160e01b03166001600160e01b031990931692909217909152614be2565b610a058363a9059cbb60e01b848460405160240161457b929190615dac565b6001600160a01b0381166000908152607f60205260409020546145f58160016159ef565b6001600160a01b039092166000908152607f602052604090209190915590565b6000806000676765c793fa10079d601b1b848760200151614636919061586a565b614640919061589f565b9150603854858760000151614655919061586a565b61465f919061589f565b905081614670576000199250614695565b603c548290614688906001600160401b03168361586a565b614692919061589f565b92505b93509350939050565b6037546000906001600160a01b03166146d757603b6000815481106146c5576146c561592f565b90600052602060002001549050919050565b603754604051635dfba04560e11b81526000916001600160a01b03169063bbf7408a90614708908690600401614ee0565b602060405180830381865afa158015614725573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190614749919061583b565b9050603a60018154811061475f5761475f61592f565b9060005260206000200154811061479757603b6001815481106147845761478461592f565b9060005260206000200154915050919050565b603a6000815481106147ab576147ab61592f565b906000526020600020015481116147d057603b6000815481106147845761478461592f565b603a6000815481106147e4576147e461592f565b9060005260206000200154603a6001815481106148035761480361592f565b906000526020600020015461481891906158d0565b603a60008154811061482c5761482c61592f565b90600052602060002001548261484291906158d0565b603b6000815481106148565761485661592f565b9060005260206000200154603b6001815481106148755761487561592f565b906000526020600020015461488a91906158d0565b614894919061586a565b61489e919061589f565b603b6000815481106148b2576148b261592f565b9060005260206000200154610af091906159ef565b50919050565b60006148e1846001600160a01b0316613359565b156149c857604051630a85bd0160e11b81526001600160a01b0385169063150b7a0290614918903390899088908890600401615e3d565b6020604051808303816000875af1925050508015614953575060408051601f3d908101601f1916820190925261495091810190615e20565b60015b6149ae573d808015614981576040519150601f19603f3d011682016040523d82523d6000602084013e614986565b606091505b5080516149a6576040516320149b4360e21b815260040160405180910390fd5b805181602001fd5b6001600160e01b031916630a85bd0160e11b149050611ce8565b506001611ce8565b60006149db826133a0565b90506149e86000836133d6565b6001600160a01b038116600081815260486020908152604080832080546000190190558583526047825280832080546001600160a01b0319169055604390915280822082815560010182905551849290600080516020615ed7833981519152908390a45050565b60008082614a68676765c793fa10079d601b1b8761586a565b614a72919061589f565b600087815260436020526040902060010154909150614aad5760b4548511614aad5760405163228af07f60e21b815260040160405180910390fd5b60008681526043602052604081206001018054839290614ace9084906159ef565b925050819055508060406000828254614ae791906159ef565b9091555050603954614b0590676765c793fa10079d601b1b9061586a565b83604054614b13919061586a565b1115614b32576040516371239a6160e11b815260040160405180910390fd5b60008681526043602090815260408083208151808301909252805482526001015491810191909152614b65908686614615565b50509050633b9aca008111614b8d57604051631527804d60e31b815260040160405180910390fd5b600080516020615e9783398151915287836001604051614baf93929190615a07565b60405180910390a1676765c793fa10079d601b1b614bcd858461586a565b614bd7919061589f565b979650505050505050565b6000614c37826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b0316614cb49092919063ffffffff16565b805190915015610a055780806020019051810190614c5591906158b3565b610a055760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b606482015260840161159f565b6060611ce8848460008585614cc885613359565b614d145760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e7472616374000000604482015260640161159f565b600080866001600160a01b03168587604051614d309190615e7a565b60006040518083038185875af1925050503d8060008114614d6d576040519150601f19603f3d011682016040523d82523d6000602084013e614d72565b606091505b5091509150614bd782828660608315614d8c575081610af0565b825115614d9c5782518084602001fd5b8160405162461bcd60e51b815260040161159f9190614f7f565b6040518060a0016040528060008152602001600081526020016000815260200160008152602001600081525090565b828054614df190615806565b90600052602060002090601f016020900481019282614e135760008555614e59565b82601f10614e2c57805160ff1916838001178555614e59565b82800160010185558215614e59579182015b82811115614e59578251825591602001919060010190614e3e565b50614e65929150614ecb565b5090565b828054828255906000526020600020908101928215614e595791602002820182811115614e59578251825591602001919060010190614e3e565b6040518060800160405280600081526020016000815260200160008152602001600081525090565b5b80821115614e655760008155600101614ecc565b6001600160a01b0391909116815260200190565b6001600160e01b031981168114610c6c57600080fd5b600060208284031215614f1c57600080fd5b8135610af081614ef4565b60005b83811015614f42578181015183820152602001614f2a565b8381111561402e5750506000910152565b60008151808452614f6b816020860160208601614f27565b601f01601f19169290920160200192915050565b602081526000610af06020830184614f53565b600060208284031215614fa457600080fd5b5035919050565b6001600160a01b0381168114610c6c57600080fd5b60008060408385031215614fd357600080fd5b8235614fde81614fab565b946020939093013593505050565b60008060006060848603121561500157600080fd5b833561500c81614fab565b9250602084013561501c81614fab565b929592945050506040919091013590565b6000806040838503121561504057600080fd5b82359150602083013561505281614fab565b809150509250929050565b60a081016108b8828480518252602081015160208301526040810151604083015260608101516060830152608081015160808301525050565b6000602082840312156150a857600080fd5b8135610af081614fab565b634e487b7160e01b600052604160045260246000fd5b604051601f8201601f191681016001600160401b03811182821017156150f1576150f16150b3565b604052919050565b600082601f83011261510a57600080fd5b81356001600160401b03811115615123576151236150b3565b615136601f8201601f19166020016150c9565b81815284602083860101111561514b57600080fd5b816020850160208301376000918101602001919091529392505050565b60006020828403121561517a57600080fd5b81356001600160401b0381111561519057600080fd5b611ce8848285016150f9565b600080604083850312156151af57600080fd5b50508035926020909101359150565b80356001600160401b0381168114611dfb57600080fd5b600080604083850312156151e857600080fd5b614fde836151be565b60006001600160401b0382111561520a5761520a6150b3565b5060051b60200190565b600082601f83011261522557600080fd5b8135602061523a615235836151f1565b6150c9565b82815260059290921b8401810191818101908684111561525957600080fd5b8286015b84811015615274578035835291830191830161525d565b509695505050505050565b60008060006060848603121561529457600080fd5b833561529f81614fab565b925060208401356001600160401b03808211156152bb57600080fd5b6152c787838801615214565b935060408601359150808211156152dd57600080fd5b506152ea86828701615214565b9150509250925092565b60008060008060008060c0878903121561530d57600080fd5b86356001600160401b038082111561532457600080fd5b6153308a838b01615214565b9750602089013591508082111561534657600080fd5b6153528a838b01615214565b96506040890135915061536482614fab565b90945060608801359061537682614fab565b90935060808801359061538882614fab565b90925060a0880135908082111561539e57600080fd5b506153ab89828a016150f9565b9150509295509295509295565b600080600080608085870312156153ce57600080fd5b5050823594602084013594506040840135936060013592509050565b600082601f8301126153fb57600080fd5b8135602061540b615235836151f1565b82815260059290921b8401810191818101908684111561542a57600080fd5b8286015b84811015615274578035600881106154465760008081fd5b835291830191830161542e565b600082601f83011261546457600080fd5b81356020615474615235836151f1565b82815260059290921b8401810191818101908684111561549357600080fd5b8286015b848110156152745780356001600160401b038111156154b65760008081fd5b6154c48986838b01016150f9565b845250918301918301615497565b600080600080608085870312156154e857600080fd5b84356001600160401b03808211156154ff57600080fd5b61550b888389016153ea565b9550602087013591508082111561552157600080fd5b5061552e87828801615453565b935050604085013561553f81614fab565b9150606085013561554f81614fab565b939692955090935050565b8015158114610c6c57600080fd5b6000806040838503121561557b57600080fd5b823561558681614fab565b915060208301356150528161555a565b600080600080608085870312156155ac57600080fd5b84356155b781614fab565b935060208501356155c781614fab565b92506040850135915060608501356001600160401b038111156155e957600080fd5b6155f5878288016150f9565b91505092959194509250565b600080600080600085870361018081121561561b57600080fd5b863561562681614fab565b9550602087013561563681614fab565b9450604087013561564681614fab565b9350610100605f198201121561565b57600080fd5b506060860191506101608601356001600160401b0381111561567c57600080fd5b615688888289016150f9565b9150509295509295909350565b60008060008060008060c087890312156156ae57600080fd5b86356001600160401b03808211156156c557600080fd5b6156d18a838b016153ea565b975060208901359150808211156156e757600080fd5b6153528a838b01615453565b6000806040838503121561570657600080fd5b823561571181614fab565b9150602083013561505281614fab565b60ff81168114610c6c57600080fd5b600080600080600080600060e0888a03121561574b57600080fd5b873561575681614fab565b9650602088013561576681614fab565b955060408801356157768161555a565b945060608801359350608088013561578d81615721565b9699959850939692959460a0840135945060c09093013592915050565b600080600080608085870312156157c057600080fd5b84356001600160401b03808211156157d757600080fd5b6157e388838901615214565b955060208701359150808211156157f957600080fd5b5061552e87828801615214565b600181811c9082168061581a57607f821691505b602082108114156148c757634e487b7160e01b600052602260045260246000fd5b60006020828403121561584d57600080fd5b5051919050565b634e487b7160e01b600052601160045260246000fd5b600081600019048311821515161561588457615884615854565b500290565b634e487b7160e01b600052601260045260246000fd5b6000826158ae576158ae615889565b500490565b6000602082840312156158c557600080fd5b8151610af08161555a565b6000828210156158e2576158e2615854565b500390565b60006001600160401b0382811684821680830382111561590957615909615854565b01949350505050565b60006020828403121561592457600080fd5b8151610af081614fab565b634e487b7160e01b600052603260045260246000fd5b600081518084526020808501945080840160005b8381101561597557815187529582019590820190600101615959565b509495945050505050565b6040815260006159936040830185615945565b82810360208401526120388185615945565b6020808252601f908201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c00604082015260600190565b602081526000610af06020830184615945565b60008219821115615a0257615a02615854565b500190565b928352602083019190915260ff16604082015260600190565b6000600019821415615a3457615a34615854565b5060010190565b600181815b80851115615a76578160001904821115615a5c57615a5c615854565b80851615615a6957918102915b93841c9390800290615a40565b509250929050565b600082615a8d575060016108b8565b81615a9a575060006108b8565b8160018114615ab05760028114615aba57615ad6565b60019150506108b8565b60ff841115615acb57615acb615854565b50506001821b6108b8565b5060208310610133831016604e8410600b8410161715615af9575081810a6108b8565b615b038383615a3b565b8060001904821115615b1757615b17615854565b029392505050565b6000610af060ff841683615a7e565b600082615b3d57615b3d615889565b500690565b60008151615b54818560208601614f27565b9290920192915050565b600080845481600182811c915080831680615b7a57607f831692505b6020808410821415615b9a57634e487b7160e01b86526022600452602486fd5b818015615bae5760018114615bbf57615bec565b60ff19861689528489019650615bec565b60008b81526020902060005b86811015615be45781548b820152908501908301615bcb565b505084890196505b5050505050506120388185615b42565b600060208284031215615c0e57600080fd5b8151610af081615721565b6e020b733b63290283937ba37b1b7b61608d1b815260008251615c4381600f850160208701614f27565b650815985d5b1d60d21b600f939091019283015250601501919050565b60008251615c72818460208701614f27565b650b5d985d5b1d60d21b920191825250600601919050565b600060208284031215615c9c57600080fd5b610af0826151be565b600060208284031215615cb757600080fd5b8135610af08161555a565b634e487b7160e01b600052602160045260246000fd5b60008060408385031215615ceb57600080fd5b505080516020909101519092909150565b60008060008060008060c08789031215615d1557600080fd5b8651615d2081614fab565b6020880151604089015160608a015160808b015160a0909b0151939c929b509099909850965090945092505050565b60008060008060808587031215615d6557600080fd5b845193506020850151615d7781614fab565b6040860151606090960151949790965092505050565b9283526001600160a01b03918216602084015216604082015260600190565b6001600160a01b03929092168252602082015260400190565b6001600160a01b038781168252868116602083015285166040820152606081018490526080810183905260c060a082018190526000906143ff90830184614f53565b828152604060208201526000611ce86040830184614f53565b600060208284031215615e3257600080fd5b8151610af081614ef4565b6001600160a01b0385811682528416602082015260408101839052608060608201819052600090615e7090830184614f53565b9695505050505050565b60008251615e8c818460208701614f27565b919091019291505056fe70cf49afe7355562d5b022e594790f22b71ad8cc7eec902fa5feac7c67f71091722cb71fa87c947148cefc06dd890af5802a6a00207c5ddecf1191bf71ce3cd4ddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3efa264697066735822122004adf5a8fe3c52a612a81111fd6100f9eeb84fbeb3cfcc411a5bf2e9a14a72cb64736f6c634300080c0033", + "deployedBytecode": "0x608060405234801561001057600080fd5b50600436106102f65760003560e01c8063010db195146102fb57806301ffc9a71461032457806306fdde0314610347578063081812fc1461035c578063087a60071461036f578063095ea7b3146103865780630e198f221461039b57806313888565146103a457806323b872dd146103ad578063254cf439146103c0578063307439af146103f257806334ce998a1461041257806335836f151461041a5780633644e5151461042d57806339393ac91461043557806339eb4dc6146104485780633ae2325f1461045c5780633af32abf1461046f5780633c2e941b1461048f57806342842e0e14610498578063430c2081146104ab5780634f7e43df146104be57806355f804b3146104d85780635b84d88a146104eb5780635c975abb146104fe57806361d027b3146105125780636352211e1461052557806370a0823114610538578063741075431461054b5780637aacfffa1461055e5780637adbf9731461059a5780637c0f59f4146105ad5780637c3a00fd146105c75780637dc0d1d0146105da5780637e53bd97146105ed5780637e56d47c146106005780637ecebe0014610613578063835986b41461063c57806389050f1d1461064f57806395d89b41146106615780639a3b6f2f146106695780639f48118f146106af578063a22cb465146106ba578063af2c8c2e146106cd578063b1511cc9146106d6578063b4bd6f46146106e9578063b88d4fde146106fc578063bbcac5571461070f578063c4ae316814610718578063c66d8b0114610720578063c87b56dd1461073a578063d8dfeb451461074d578063d9b1cb5b14610760578063de1f776514610773578063de8fc69814610785578063df011c4114610798578063e182b883146107ab578063e1c84ea4146107be578063e626648a146107c7578063e985e9c5146107e1578063e9cbd822146107f4578063f0f4426014610807578063f51cc7dd1461081a578063fad9aba31461082d578063fc29b02114610836578063fd527cf814610849575b600080fd5b60375461030e906001600160a01b031681565b60405161031b9190614ee0565b60405180910390f35b610337610332366004614f0a565b610851565b604051901515815260200161031b565b61034f6108be565b60405161031b9190614f7f565b61030e61036a366004614f92565b61094c565b610378603f5481565b60405190815260200161031b565b610399610394366004614fc0565b61097d565b005b610378603e5481565b61037860415481565b6103996103bb366004614fec565b610a0a565b603c546103da90600160401b90046001600160401b031681565b6040516001600160401b03909116815260200161031b565b61040561040036600461502d565b610a45565b60405161031b919061505d565b610378610af7565b610378610428366004614f92565b610b29565b610378610b65565b610399610443366004615096565b610b6f565b603d5461033790600160c01b900460ff1681565b61037861046a366004614f92565b610c6f565b61037861047d366004615096565b60446020526000908152604090205481565b61037860455481565b6103996104a6366004614fec565b610c90565b6103376104b9366004614fc0565b610cab565b603d546103da90600160801b90046001600160401b031681565b6103996104e6366004615168565b610cb7565b6103996104f936600461519c565b610d5c565b603d5461033790600160c81b900460ff1681565b60335461030e906001600160a01b031681565b61030e610533366004614f92565b610df5565b610378610546366004615096565b610e00565b6103996105593660046151d5565b610e45565b61058561056c366004614f92565b6043602052600090815260409020805460019091015482565b6040805192835260208301919091520161031b565b6103996105a8366004615096565b611211565b603c546103da90600160c01b90046001600160401b031681565b603d546103da906001600160401b031681565b60365461030e906001600160a01b031681565b6103996105fb36600461527f565b611358565b61040561060e3660046152f4565b611549565b610378610621366004615096565b6001600160a01b03166000908152607f602052604090205490565b61039961064a3660046153b8565b611af6565b610378676765c793fa10079d601a1b81565b61034f611cae565b61067c6106773660046154d2565b611cbb565b60405161031b91908151815260208083015190820152604080830151908201526060918201519181019190915260800190565b610378633b9aca0081565b6103996106c8366004615568565b611cf0565b61037860405481565b6103996106e4366004614f92565b611cfb565b6103786106f7366004615096565b611dc4565b61039961070a366004615596565b611e00565b61037860425481565b610399611e3d565b603d546103da90600160401b90046001600160401b031681565b61034f610748366004614f92565b611eec565b60345461030e906001600160a01b031681565b61039961076e366004615601565b612041565b610378676765c793fa10079d601b1b81565b61067c610793366004615695565b6125ec565b603c546103da906001600160401b031681565b6103786107b9366004614f92565b612e73565b61037860395481565b603c546103da90600160801b90046001600160401b031681565b6103376107ef3660046156f3565b612e83565b60355461030e906001600160a01b031681565b610399610815366004615096565b612eb1565b610399610828366004615730565b612f51565b61037860b45481565b6104056108443660046157aa565b613210565b61058561323a565b60006001600160e01b03198216635b5e139f60e01b148061088257506001600160e01b031982166380ac58cd60e01b145b8061089d57506001600160e01b0319821663430c208160e01b145b806108b857506001600160e01b031982166301ffc9a760e01b145b92915050565b607d80546108cb90615806565b80601f01602080910402602001604051908101604052809291908181526020018280546108f790615806565b80156109445780601f1061091957610100808354040283529160200191610944565b820191906000526020600020905b81548152906001019060200180831161092757829003601f168201915b505050505081565b600061095782613368565b6109745760405163062a39dd60e11b815260040160405180910390fd5b6108b882613385565b6000610988826133a0565b9050806001600160a01b0316836001600160a01b031614156109bd576040516349fa8bc360e11b815260040160405180910390fd5b336001600160a01b038216148015906109dd57506109db8133612e83565b155b156109fb5760405163c19f17a960e01b815260040160405180910390fd5b610a0583836133d6565b505050565b3381610a168282613444565b610a335760405163c19f17a960e01b815260040160405180910390fd5b610a3e8585856134c2565b5050505050565b610a4d614db6565b60008381526043602090815260409182902082518084018452815481526001909101548183015260365483516315f789a960e21b81529351610af094929387936001600160a01b03909316926357de26a492600480830193928290030181865afa158015610abf573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610ae3919061583b565b610aeb6135e9565b61377e565b9392505050565b6000676765c793fa10079d601b1b610b0d6135e9565b604054610b1a919061586a565b610b24919061589f565b905090565b6000676765c793fa10079d601b1b610b3f6135e9565b600084815260436020526040902060010154610b5b919061586a565b6108b8919061589f565b6000610b24613ad0565b603354604051631c86b03760e31b81526001600160a01b039091169063e43581b890610b9f903390600401614ee0565b602060405180830381865afa158015610bbc573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610be091906158b3565b610bfd57604051633b8d9d7560e21b815260040160405180910390fd5b6001600160a01b03811615610c4c576001600160a01b038116600090815260446020526040902054610c309060016158d0565b6001600160a01b03821660009081526044602052604090205550565b603d805460ff60c01b198116600160c01b9182900460ff16159091021790555b50565b603b8181548110610c7f57600080fd5b600091825260209091200154905081565b610a0583838360405180602001604052806000815250611e00565b6000610af08383613444565b60335460405163521d4de960e01b81526001600160a01b039091169063521d4de990610ce7903390600401614ee0565b602060405180830381865afa158015610d04573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610d2891906158b3565b610d4557604051632678482f60e21b815260040160405180910390fd5b8051610d58906046906020840190614de5565b5050565b603354604051631c86b03760e31b81526001600160a01b039091169063e43581b890610d8c903390600401614ee0565b602060405180830381865afa158015610da9573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610dcd91906158b3565b610dea57604051633b8d9d7560e21b815260040160405180910390fd5b60b49190915560b555565b60006108b8826133a0565b60006001600160a01b038216610e295760405163d92e233d60e01b815260040160405180910390fd5b506001600160a01b031660009081526048602052604090205490565b60335460405163521d4de960e01b81526001600160a01b039091169063521d4de990610e75903390600401614ee0565b602060405180830381865afa158015610e92573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610eb691906158b3565b610ed357604051632678482f60e21b815260040160405180910390fd5b806121a360f11b1415610f3757603d546001600160401b03600160401b90910481169083161115610f1757604051637650e96360e11b815260040160405180910390fd5b603c80546001600160401b0319166001600160401b0384161790556111ca565b80622a242360e91b1415610f9c57633b9aca00826001600160401b03161015610f735760405163da6a17b960e01b815260040160405180910390fd5b603c8054600160401b600160801b031916600160401b6001600160401b038516021790556111ca565b8061212360f11b141561100057633b9aca00826001600160401b03161115610fd757604051637650e96360e11b815260040160405180910390fd5b603c8054600160801b600160c01b031916600160801b6001600160401b038516021790556111ca565b8061292360f11b141561107d57603d54633b9aca009061103090600160401b90046001600160401b0316846158e7565b6001600160401b0316111561105857604051637650e96360e11b815260040160405180910390fd5b603c80546001600160c01b0316600160c01b6001600160401b038516021790556111ca565b806124a960f11b14156110b357611092613b3c565b50603d80546001600160401b0319166001600160401b0384161790556111ca565b80614c5360f01b141561114c57603c546001600160401b03808416911611806111055750603c54633b9aca00906110fa90600160c01b90046001600160401b0316846158e7565b6001600160401b0316115b156111235760405163180d062b60e31b815260040160405180910390fd5b603d8054600160401b600160801b031916600160401b6001600160401b038516021790556111ca565b806213531160ea1b14156111b157633b9aca00826001600160401b0316111561118857604051637650e96360e11b815260040160405180910390fd5b603d8054600160801b600160c01b031916600160801b6001600160401b038516021790556111ca565b60405163e1daa9cf60e01b815260040160405180910390fd5b604080516001600160401b0384168152602081018390527f13b367dac93b85d1ed9b3d8961d8b48e1a677c9800bb1613b4b0416b2d5b61d091015b60405180910390a15050565b603354604051631c86b03760e31b81526001600160a01b039091169063e43581b890611241903390600401614ee0565b602060405180830381865afa15801561125e573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061128291906158b3565b61129f57604051633b8d9d7560e21b815260040160405180910390fd5b603354604080516361d027b360e01b815290516001600160a01b03928316928416916361d027b39160048083019260209291908290030181865afa1580156112eb573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061130f9190615912565b6001600160a01b031614611336576040516302979eb960e31b815260040160405180910390fd5b603680546001600160a01b0319166001600160a01b0392909216919091179055565b60335460405163521d4de960e01b81526001600160a01b039091169063521d4de990611388903390600401614ee0565b602060405180830381865afa1580156113a5573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906113c991906158b3565b6113e657604051632678482f60e21b815260040160405180910390fd5b805182511415806114115750806000815181106114055761140561592f565b60200260200101516000145b806114a057506001600160a01b038316158015906114a057508160008151811061143d5761143d61592f565b6020026020010151826001815181106114585761145861592f565b60200260200101511115806114a057508060008151811061147b5761147b61592f565b6020026020010151816001815181106114965761149661592f565b6020026020010151105b156114be57604051631746545d60e11b815260040160405180910390fd5b603780546001600160a01b0319166001600160a01b03851617905581516114ec90603a906020850190614e69565b50805161150090603b906020840190614e69565b50826001600160a01b03167feb74d4d9fea592587c926aeb35eb6a7893fb28db0c1c8eb2eb3c586e7164b76c838360405161153c929190615980565b60405180910390a2505050565b611551614db6565b603d54600160c81b900460ff161561157c576040516313d0ff5960e31b815260040160405180910390fd5b600260015414156115a85760405162461bcd60e51b815260040161159f906159a5565b60405180910390fd5b600260015586518651811415806115bd575080155b156115db576040516346282e8d60e01b815260040160405180910390fd5b603660009054906101000a90046001600160a01b03166001600160a01b03166357de26a46040518163ffffffff1660e01b8152600401602060405180830381865afa15801561162e573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611652919061583b565b606083015261165f613b3c565b60808301526040517f965a177723c641ee49150b583a0b9ad4730bb20d3474e00ae5a65e777c00d67b90611694908a906159dc565b60405180910390a160005b81811015611a66576000604360008b84815181106116bf576116bf61592f565b60200260200101518152602001908152602001600020604051806040016040529081600082015481526020016001820154815250509050600061170c82338760600151886080015161377e565b90508060400151600014158015611740575080604001518a84815181106117355761173561592f565b602002602001015110155b80611767575080600001518a848151811061175d5761175d61592f565b6020026020010151115b156117905780600001518a84815181106117835761178361592f565b6020026020010181815250505b6000856060015182606001516117a6919061586a565b603854633b9aca008d87815181106117c0576117c061592f565b60200260200101516117d2919061586a565b6117dc919061586a565b6117e6919061589f565b90506118148c85815181106117fd576117fd61592f565b60200260200101518285600001511115610c6c5750565b8251811061194a575081516020830151604080546000906118369084906158d0565b92505081905550604360008d86815181106118535761185361592f565b60209081029190910181015182528101919091526040016000908120818155600101819055603d548c51633b9aca0091600160401b90046001600160401b0316908e90889081106118a6576118a661592f565b60200260200101516118b8919061586a565b6118c2919061589f565b9050826080015181106118d65760006118e6565b8083608001516118e691906158d0565b876040018181516118f791906159ef565b905250508b51600080516020615e97833981519152908d908690811061191f5761191f61592f565b60200260200101518460200151600060405161193d93929190615a07565b60405180910390a1611a0b565b80604360008e87815181106119615761196161592f565b60200260200101518152602001908152602001600020600001600082825461198991906158d0565b92505081905550611a098c85815181106119a5576119a561592f565b6020026020010151633b9aca00603d60089054906101000a90046001600160401b03166001600160401b03168e88815181106119e3576119e361592f565b60200260200101516119f5919061586a565b6119ff919061589f565b8860800151613bdd565b505b8086602001818151611a1d91906159ef565b9052508a518b9085908110611a3457611a3461592f565b602002602001015186600001818151611a4d91906159ef565b905250611a5f9250839150615a209050565b905061169f565b50603d54633b9aca0090611a8a90600160401b90046001600160401b0316826158d0565b8351611a96919061586a565b611aa0919061589f565b60416000828254611ab191906159ef565b9091555050604082015160428054600090611acd9084906159ef565b909155505060208201518251611ae7919088888888613d0c565b50600180559695505050505050565b603d54600160c81b900460ff1615611b21576040516313d0ff5960e31b815260040160405180910390fd5b6033546040516333b52a9f60e11b81526001600160a01b039091169063676a553e90611b51903390600401614ee0565b602060405180830381865afa158015611b6e573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611b9291906158b3565b611baf5760405163027f480760e01b815260040160405180910390fd5b603c54600090600160c01b90046001600160401b0316821015611bed57603c54611bea908390600160c01b90046001600160401b03166158d0565b90505b603c54600090600160801b90046001600160401b0316841115611c2a57603c54611c2790600160801b90046001600160401b0316856158d0565b90505b6000611c3b6002633b9aca00615b1f565b611c4983633b9aca006158d0565b611c5785633b9aca006158d0565b611c61908961586a565b611c6b919061586a565b611c75919061589f565b9050611c8181876158d0565b60416000828254611c9291906159ef565b90915550611ca4905087826000613bdd565b5050505050505050565b607e80546108cb90615806565b611cc3614ea3565b60408051600080825260208201909252611ce5918791879187918791906125ec565b90505b949350505050565b610d58338383613e16565b60335460405163521d4de960e01b81526001600160a01b039091169063521d4de990611d2b903390600401614ee0565b602060405180830381865afa158015611d48573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611d6c91906158b3565b611d8957604051632678482f60e21b815260040160405180910390fd5b60398190556040518181527fdd63b3dcdbebad734892f7c7a26d0f647fbc7eec973e0775f5229018ac4ab47a9060200160405180910390a150565b603d54600090600160c81b900460ff1615611df2576040516313d0ff5960e31b815260040160405180910390fd5b6108b882613ecc565b919050565b3382611e0c8282613444565b611e295760405163c19f17a960e01b815260040160405180910390fd5b611e3586868686613ffa565b505050505050565b60335460405163521d4de960e01b81526001600160a01b039091169063521d4de990611e6d903390600401614ee0565b602060405180830381865afa158015611e8a573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611eae91906158b3565b611ecb57604051632678482f60e21b815260040160405180910390fd5b603d805460ff60c81b198116600160c81b9182900460ff1615909102179055565b6060611ef782613368565b611f145760405163062a39dd60e11b815260040160405180910390fd5b8160005b8115611f3b57611f2781615a20565b9050611f34600a8361589f565b9150611f18565b6000816001600160401b03811115611f5557611f556150b3565b6040519080825280601f01601f191660200182016040528015611f7f576020820181803683370190505b5090505b8415611fea57611f946001836158d0565b9150611fa1600a86615b2e565b611fac9060306159ef565b60f81b818381518110611fc157611fc161592f565b60200101906001600160f81b031916908160001a905350611fe3600a8661589f565b9450611f83565b60468054611ff790615806565b151590506120145760405180602001604052806000815250612038565b604681604051602001612028929190615b5e565b6040516020818303038152906040525b95945050505050565b600054610100900460ff16158080156120615750600054600160ff909116105b80612082575061207030613359565b158015612082575060005460ff166001145b6120e55760405162461bcd60e51b815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201526d191e481a5b9a5d1a585b1a5e995960921b606482015260840161159f565b6000805460ff191660011790558015612108576000805461ff0019166101001790555b856001600160a01b0316846001600160a01b03166361d027b36040518163ffffffff1660e01b8152600401602060405180830381865afa158015612150573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906121749190615912565b6001600160a01b03161461219b576040516302979eb960e31b815260040160405180910390fd5b603380546001600160a01b038089166001600160a01b0319928316179092556034805492881692909116821790556040805163313ce56760e01b8152905163313ce567916004808201926020929091908290030181865afa158015612204573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906122289190615bfc565b61223390600a615b1f565b603881905550856001600160a01b031663e9cbd8226040518163ffffffff1660e01b8152600401602060405180830381865afa158015612277573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061229b9190615912565b603580546001600160a01b03199081166001600160a01b0393841617909155603680549091169186169190911790556040516000906122de908490602001615c19565b60408051601f19818403018152919052805190915061230490607d906020840190614de5565b5061230e81614034565b8260405160200161231f9190615c60565b604051602081830303815290604052607e9080519060200190612343929190614de5565b50676765c793fa10079d601b1b603f5542603e5561236760a0850160808601615c8a565b6001600160401b03166123806040860160208701615c8a565b6001600160401b031611806123b05750633b9aca006123a560a0860160808701615c8a565b6001600160401b0316115b806123d657506123c66060850160408601615c8a565b6001600160401b0316633b9aca00115b806123fd5750633b9aca006123f160c0860160a08701615c8a565b6001600160401b031610155b8061240a575060e0840135155b1561242857604051631746545d60e11b815260040160405180910390fd5b833560395561243d6040850160208601615c8a565b603c80546001600160401b0319166001600160401b039290921691909117905561246d6060850160408601615c8a565b603c80546001600160401b0392909216600160401b02600160401b600160801b03199092169190911790556124a86080850160608601615c8a565b603d80546001600160401b0319166001600160401b03929092169190911790556124d860a0850160808601615c8a565b603d80546001600160401b0392909216600160401b02600160401b600160801b031990921691909117905561251360c0850160a08601615c8a565b603d80546001600160401b0392909216600160801b02600160801b600160c01b031990921691909117905561254e60e0850160c08601615ca5565b603d8054911515600160c01b0260ff60c01b19909216919091179055604080516020810190915260e0850135815261258a90603b906001614e69565b5050603d805460ff60c81b1916600160c81b1790558015611e35576000805461ff0019169055604051600181527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989060200160405180910390a1505050505050565b6125f4614ea3565b603d54600160c81b900460ff161561261f576040516313d0ff5960e31b815260040160405180910390fd5b600260015414156126425760405162461bcd60e51b815260040161159f906159a5565b60026001558551875114158061265757508651155b15612675576040516346282e8d60e01b815260040160405180910390fd5b6000806000806000805b8c51811015612bdc5760008d828151811061269c5761269c61592f565b60200260200101519050600060078111156126b9576126b9615cc2565b8160078111156126cb576126cb615cc2565b141561270c576127068d83815181106126e6576126e661592f565b60200260200101518060200190518101906127019190615912565b613ecc565b50612bcb565b600281600781111561272057612720615cc2565b1415612786578c82815181106127385761273861592f565b60200260200101518060200190518101906127539190615cd8565b95509250826127625760455492505b61276c838661410a565b848860600181815161277e91906159ef565b905250612bcb565b600781600781111561279a5761279a615cc2565b14156128735760008060008f85815181106127b7576127b761592f565b60200260200101518060200190518101906127d29190615cfc565b60345460405163d505accf60e01b81526001600160a01b038089166004830152306024830152604482018890526064820187905260ff8616608483015260a4820185905260c48201849052969f50939d50939b509497509550929350169063d505accf9060e401600060405180830381600087803b15801561285357600080fd5b505af1158015612867573d6000803e3d6000fd5b50505050505050612bcb565b8661288357612880613b3c565b96505b600481600781111561289757612897615cc2565b1415612963578c82815181106128af576128af61592f565b60200260200101518060200190518101906128ca9190615cd8565b94509250826128d95760455492505b6128e4838589613bdd565b603c5490945060009061290b90600160c01b90046001600160401b0316633b9aca006158d0565b612919633b9aca008761586a565b612923919061589f565b905061292f85826158d0565b6041600082825461294091906159ef565b92505081905550808960200181815161295991906159ef565b905250612bcb9050565b856129e257603660009054906101000a90046001600160a01b03166001600160a01b03166357de26a46040518163ffffffff1660e01b8152600401602060405180830381865afa1580156129bb573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906129df919061583b565b95505b60018160078111156129f6576129f6615cc2565b1415612a72578c8281518110612a0e57612a0e61592f565b6020026020010151806020019051810190612a29919061583b565b925082612a365760455492505b612a41838789614176565b80965081955050508488604001818151612a5b91906159ef565b90525060208801805185919061277e9083906159ef565b6003816007811115612a8657612a86615cc2565b1415612ae6578c8281518110612a9e57612a9e61592f565b6020026020010151806020019051810190612ab99190615cd8565b9550925082612ac85760455492505b612ad48386888a614296565b848860400181815161277e91906159ef565b6005816007811115612afa57612afa615cc2565b1415612b5c578c8281518110612b1257612b1261592f565b6020026020010151806020019051810190612b2d9190615cd8565b9450925082612b3c5760455492505b612b488385888a614370565b9350838860000181815161277e91906159ef565b6006816007811115612b7057612b70615cc2565b1415612bcb576000808e8481518110612b8b57612b8b61592f565b6020026020010151806020019051810190612ba69190615d4f565b98509196509250905084612bba5760455494505b612bc8858383898c8e61440b565b50505b50612bd581615a20565b905061267f565b508551602087015110612cd35785516020870151600091612bfc916158d0565b90508660600151876040015110612c3357612c2e87606001518860400151612c2491906158d0565b828d8d8d8d613d0c565b612ccd565b8015612ca057603554604051630d43af8160e21b81526001600160a01b039091169063350ebe0490612c6d9084908f903390600401615d8d565b600060405180830381600087803b158015612c8757600080fd5b505af1158015612c9b573d6000803e3d6000fd5b505050505b612ccd333089604001518a60600151612cb991906158d0565b6034546001600160a01b0316929190614547565b50612e5f565b60208601518651600091612ce6916158d0565b6035546040516340c10f1960e01b81529192506001600160a01b0316906340c10f1990612d19908d908590600401615dac565b600060405180830381600087803b158015612d3357600080fd5b505af1158015612d47573d6000803e3d6000fd5b50505050866060015187604001511115612d8b57612d868a88606001518960400151612d7391906158d0565b6034546001600160a01b031691906145b2565b612e5d565b600087604001518860600151612da191906158d0565b90508015612e5b57885115612e4357896001600160a01b031663a5d4096b603560009054906101000a90046001600160a01b0316603460009054906101000a90046001600160a01b03163385878f6040518763ffffffff1660e01b8152600401612e1096959493929190615dc5565b600060405180830381600087803b158015612e2a57600080fd5b505af1158015612e3e573d6000803e3d6000fd5b505050505b603454612e5b906001600160a01b0316333084614547565b505b505b505060018055509198975050505050505050565b603a8181548110610c7f57600080fd5b6001600160a01b039182166000908152604a6020908152604080832093909416825291909152205460011490565b6033546001600160a01b03163314612edc5760405163b90cdbb160e01b815260040160405180910390fd5b603380546001600160a01b0319166001600160a01b0383811691909117909155603654604051630787a21360e51b815291169063f0f4426090612f23908490600401614ee0565b600060405180830381600087803b158015612f3d57600080fd5b505af1158015610a3e573d6000803e3d6000fd5b83421115612f725760405163f87d927160e01b815260040160405180910390fd5b6fa2a8918ca85bafe22016d0b997e4df60600160ff1b03811180612fa957508260ff16601b14158015612fa957508260ff16601c14155b15612fc757604051638baa579f60e01b815260040160405180910390fd5b6000612fd1613ad0565b608254898989612fe08d6145d1565b6040805160208101969096526001600160a01b03948516908601529290911660608401521515608083015260a082015260c0810187905260e0016040516020818303038152906040528051906020012060405160200161305792919061190160f01b81526002810192909252602282015260420190565b604051602081830303815290604052805190602001209050613081886001600160a01b0316613359565b1561315d57604080516020810185905280820184905260f886901b6001600160f81b0319166060820152815160418183030181526061820192839052630b135d3f60e11b9092526001600160a01b038a1691631626ba7e916130e7918591606501615e07565b602060405180830381865afa158015613104573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906131289190615e20565b6001600160e01b031916631626ba7e60e01b1461315857604051638baa579f60e01b815260040160405180910390fd5b613205565b6040805160008082526020820180845284905260ff871692820192909252606081018590526080810184905260019060a0016020604051602081039080840390855afa1580156131b1573d6000803e3d6000fd5b505050602060405103519050886001600160a01b0316816001600160a01b03161415806131e557506001600160a01b038116155b1561320357604051638baa579f60e01b815260040160405180910390fd5b505b611ca4888888613e16565b613218614db6565b60408051600080825260208201909252611ce591879187918791879190611549565b60335460009081906001600160a01b0316331461326a5760405163b90cdbb160e01b815260040160405180910390fd5b613272613b3c565b50506041805460428054600093849055929055915080821061330b5761329881836158d0565b6035546033546040516340c10f1960e01b8152929450600093506001600160a01b03918216926340c10f19926132d49216908690600401615dac565b600060405180830381600087803b1580156132ee57600080fd5b505af1158015613302573d6000803e3d6000fd5b5050505061331c565b61331582826158d0565b9050600091505b60408051838152602081018390527ffeb12225c131aab793a00c5239afb778932d170fa28ce6e9d23703e4bd892121910160405180910390a19091565b6001600160a01b03163b151590565b6000908152604760205260409020546001600160a01b0316151590565b6000908152604960205260409020546001600160a01b031690565b6000818152604760205260409020546001600160a01b031680611dfb5760405163062a39dd60e11b815260040160405180910390fd5b600081815260496020526040902080546001600160a01b0319166001600160a01b038416908117909155819061340b826133a0565b6001600160a01b03167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92560405160405180910390a45050565b600080613450836133a0565b9050806001600160a01b0316846001600160a01b0316148061348b5750836001600160a01b031661348084613385565b6001600160a01b0316145b80611ce857506001600160a01b038082166000908152604a6020908152604080832093881683529290522054600114949350505050565b826001600160a01b03166134d5826133a0565b6001600160a01b0316146134fc5760405163c19f17a960e01b815260040160405180910390fd5b6001600160a01b0382166135235760405163d92e233d60e01b815260040160405180910390fd5b603d54600160c01b900460ff16801561355557506001600160a01b038216600090815260446020526040902054600114155b1561357357604051630b094f2760e31b815260040160405180910390fd5b61357e6000826133d6565b6001600160a01b038084166000818152604860209081526040808320805460001901905593861680835284832080546001019055858352604790915283822080546001600160a01b03191682179055925184939291600080516020615ed783398151915291a4505050565b600080603e54426135fa91906158d0565b603d549091506001600160401b0316811580613614575080155b1561362357603f549250505090565b60006136306001846158d0565b905060006002841161364357600061364e565b61364e6002856158d0565b90506000676765c793fa10079d601b1b676765c793fa10079d601a1b613674868061586a565b61367e91906159ef565b613688919061589f565b90506000676765c793fa10079d601b1b676765c793fa10079d601a1b6136ae878561586a565b6136b891906159ef565b6136c2919061589f565b905060006002836136d3878a61586a565b6136dd919061586a565b6136e7919061589f565b90506000600683866136f9898c61586a565b613703919061586a565b61370d919061586a565b613717919061589f565b9050676765c793fa10079d601b1b81836137318b8b61586a565b61374690676765c793fa10079d601b1b6159ef565b61375091906159ef565b61375a91906159ef565b603f54613767919061586a565b613771919061589f565b9850505050505050505090565b613786614db6565b6000806000613796888787614615565b925092509250633b9aca0083106137c0576040516315fe9b6160e21b815260040160405180910390fd5b6000633b9aca006137d185826158d0565b6137da8a61469e565b6137e4919061586a565b6137ee919061589f565b603d54909150600160801b90046001600160401b031681101561381e5761381981633b9aca006158d0565b61383f565b603d5461383f90600160801b90046001600160401b0316633b9aca006158d0565b603d54909150600160401b90046001600160401b03166000806138676002633b9aca00615b1f565b603c5461387d91906001600160401b031661586a565b83613888868a61586a565b613892919061586a565b10613a1b57603c546001600160401b03166138b26002633b9aca00615b1f565b6138bc919061586a565b603c5485906138db90600160401b90046001600160401b03168661586a565b6138e5919061586a565b6138ef91906158d0565b603c548590633b9aca009061390d906001600160401b03168961586a565b603c5461392b908b90600160401b90046001600160401b031661586a565b61393591906158d0565b61393f919061586a565b613949919061586a565b613953919061589f565b9150633b9aca0060b454613967919061586a565b613971848461586a565b61397b91906159ef565b613989633b9aca008861586a565b11613a16576139a3676765c793fa10079d601b1b8461586a565b633b9aca008a8e602001516139b8919061586a565b6139c2919061586a565b6139cc919061589f565b6139d79060016159ef565b915060b454861115613a125782633b9aca0060b454886139f791906158d0565b613a01919061586a565b613a0b919061589f565b9050613a7e565b5060015b613a7e565b603854613a2c90633b9aca0061586a565b8c518b90613a3b90879061586a565b613a45919061586a565b613a4f919061589f565b613a5a9060016159ef565b915060b554851115613a7a57633b9aca008460b554876139f791906158d0565b5060015b818852613a8b848b61586a565b603854613a9c633b9aca008561586a565b613aa6919061586a565b613ab0919061589f565b602089015260408801525050606085015250608083015250949350505050565b60808054608154604080517f8b73c3c69bb8fe3d512ecc4cf759cc79239f7b179b0ffacaa9a75d522b39400f602082015290810192909252606082015246918101919091523060a082015260009060c00160405160208183030381529060405280519060200120905090565b6000613b466135e9565b90506000676765c793fa10079d601b1b603f5483613b6491906158d0565b604054613b71919061586a565b613b7b919061589f565b90508060416000828254613b8f91906159ef565b9091555050603f82905542603e8190556040805184815260208101929092527fd1fa8ba00a3bf20274346919dce0de62d2a140af2c71fe7e29fa6472eea3bb9d910160405180910390a15090565b600081613bef57613bec613b3c565b91505b60008481526043602052604081206001015490676765c793fa10079d601b1b613c18858461586a565b613c22919061589f565b9050808510613c3357935080613c56565b83613c49676765c793fa10079d601b1b8761586a565b613c53919061589f565b90505b613c6081836158d0565b91508060406000828254613c7491906158d0565b90915550508115801590613ca95750676765c793fa10079d601b1b60b454613c9c919061586a565b613ca6858461586a565b11155b15613cc75760405163228af07f60e21b815260040160405180910390fd5b60008681526043602052604080822060010184905551600080516020615e9783398151915291613cfa9189918591615a07565b60405180910390a15092949350505050565b8515613d2957603454613d29906001600160a01b031684886145b2565b8415611e3557805115613da85760345460355460405163a5d4096b60e01b81526001600160a01b038086169363a5d4096b93613d759391831692169089908b908d908990600401615dc5565b600060405180830381600087803b158015613d8f57600080fd5b505af1158015613da3573d6000803e3d6000fd5b505050505b603554604051630d43af8160e21b81526001600160a01b039091169063350ebe0490613ddc90889088903390600401615d8d565b600060405180830381600087803b158015613df657600080fd5b505af1158015613e0a573d6000803e3d6000fd5b50505050505050505050565b826001600160a01b0316826001600160a01b03161415613e49576040516320c5195360e21b815260040160405180910390fd5b600081613e57576000613e5a565b60015b6001600160a01b038581166000818152604a602090815260408083209489168084529482529182902060ff959095169485905590518615158152939450919290917f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c31910160405180910390a350505050565b603d54600090600160c01b900460ff168015613f1b57506001600160a01b0382166000908152604460205260409020546001141580613f1b575033600090815260446020526040902054600114155b15613f3957604051630b094f2760e31b815260040160405180910390fd5b6001600160a01b038216613f605760405163d92e233d60e01b815260040160405180910390fd5b5060458054600101908190556001600160a01b038216600081815260486020908152604080832080546001019055848352604790915280822080546001600160a01b031916841790555183929190600080516020615ed7833981519152908290a4613fdd60008383604051806020016040528060008152506148cd565b611dfb576040516320149b4360e21b815260040160405180910390fd5b6140058484846134c2565b614011848484846148cd565b61402e576040516320149b4360e21b815260040160405180910390fd5b50505050565b600054610100900460ff1661409f5760405162461bcd60e51b815260206004820152602b60248201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960448201526a6e697469616c697a696e6760a81b606482015260840161159f565b7f3f43a9c6bafb5c7aab4e0cfe239dc5d4c15caf0381c6104188191f78a6640bd860825580516020918201206080556040805180820190915260018152603160f81b9101527fc89efdaa54c0f20c7adf612882df0950f5a951637e0307cdcb4c672f298b8bc6608155565b61411382613368565b6141305760405163062a39dd60e11b815260040160405180910390fd5b6000828152604360205260408120805483929061414e9084906159ef565b9091555050604051600080516020615eb7833981519152906112059084908490600190615a07565b60008033856141858282613444565b6141a25760405163c19f17a960e01b815260040160405180910390fd5b6000878152604360209081526040808320815180830190925280548252600101549181019190915290806141d7838a8a614615565b5091509150633b9aca00821161420057604051631527804d60e31b815260040160405180910390fd5b82602001516040600082825461421691906158d0565b9091555061422590508a6149d0565b603c5460009061424990600160c01b90046001600160401b0316633b9aca006158d0565b614257633b9aca008461586a565b614261919061589f565b905061426d82826158d0565b6041600082825461427e91906159ef565b90915550509251929a92995091975050505050505050565b33846142a28282613444565b6142bf5760405163c19f17a960e01b815260040160405180910390fd5b600086815260436020526040812080548792906142dd9084906158d0565b909155505060008681526043602090815260408083208151808301909252805482526001015491810191909152614315908686614615565b50509050633b9aca00811161433d57604051631527804d60e31b815260040160405180910390fd5b600080516020615eb78339815191528787600060405161435f93929190615a07565b60405180910390a150505050505050565b6000338561437e8282613444565b61439b5760405163c19f17a960e01b815260040160405180910390fd5b6143a787878787614a4f565b603c54909650600090633b9aca00906143d1908990600160801b90046001600160401b031661586a565b6143db919061589f565b905080604160008282546143ef91906159ef565b909155506143ff905081886158d0565b98975050505050505050565b33866144178282613444565b6144345760405163c19f17a960e01b815260040160405180910390fd5b60408051898152602081018890526001600160a01b038916818301526060810187905290517fddd3b70af631334f7552aadb582ed091018e62e103fa8b150ca66cc700d4dac69181900360800190a161448f88868686614a4f565b94506001600160a01b0387163014156144b3576144ad868685613bdd565b50611ca4565b603c546040516320d661ad60e21b815260048101889052602481018790526001600160401b03600160801b830481166044830152600160c01b90920490911660648201526001600160a01b0388169063835986b490608401600060405180830381600087803b15801561452557600080fd5b505af1158015614539573d6000803e3d6000fd5b505050505050505050505050565b6040516001600160a01b038085166024830152831660448201526064810182905261402e9085906323b872dd60e01b906084015b60408051601f198184030181529190526020810180516001600160e01b03166001600160e01b031990931692909217909152614be2565b610a058363a9059cbb60e01b848460405160240161457b929190615dac565b6001600160a01b0381166000908152607f60205260409020546145f58160016159ef565b6001600160a01b039092166000908152607f602052604090209190915590565b6000806000676765c793fa10079d601b1b848760200151614636919061586a565b614640919061589f565b9150603854858760000151614655919061586a565b61465f919061589f565b905081614670576000199250614695565b603c548290614688906001600160401b03168361586a565b614692919061589f565b92505b93509350939050565b6037546000906001600160a01b03166146d757603b6000815481106146c5576146c561592f565b90600052602060002001549050919050565b603754604051635dfba04560e11b81526000916001600160a01b03169063bbf7408a90614708908690600401614ee0565b602060405180830381865afa158015614725573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190614749919061583b565b9050603a60018154811061475f5761475f61592f565b9060005260206000200154811061479757603b6001815481106147845761478461592f565b9060005260206000200154915050919050565b603a6000815481106147ab576147ab61592f565b906000526020600020015481116147d057603b6000815481106147845761478461592f565b603a6000815481106147e4576147e461592f565b9060005260206000200154603a6001815481106148035761480361592f565b906000526020600020015461481891906158d0565b603a60008154811061482c5761482c61592f565b90600052602060002001548261484291906158d0565b603b6000815481106148565761485661592f565b9060005260206000200154603b6001815481106148755761487561592f565b906000526020600020015461488a91906158d0565b614894919061586a565b61489e919061589f565b603b6000815481106148b2576148b261592f565b9060005260206000200154610af091906159ef565b50919050565b60006148e1846001600160a01b0316613359565b156149c857604051630a85bd0160e11b81526001600160a01b0385169063150b7a0290614918903390899088908890600401615e3d565b6020604051808303816000875af1925050508015614953575060408051601f3d908101601f1916820190925261495091810190615e20565b60015b6149ae573d808015614981576040519150601f19603f3d011682016040523d82523d6000602084013e614986565b606091505b5080516149a6576040516320149b4360e21b815260040160405180910390fd5b805181602001fd5b6001600160e01b031916630a85bd0160e11b149050611ce8565b506001611ce8565b60006149db826133a0565b90506149e86000836133d6565b6001600160a01b038116600081815260486020908152604080832080546000190190558583526047825280832080546001600160a01b0319169055604390915280822082815560010182905551849290600080516020615ed7833981519152908390a45050565b60008082614a68676765c793fa10079d601b1b8761586a565b614a72919061589f565b600087815260436020526040902060010154909150614aad5760b4548511614aad5760405163228af07f60e21b815260040160405180910390fd5b60008681526043602052604081206001018054839290614ace9084906159ef565b925050819055508060406000828254614ae791906159ef565b9091555050603954614b0590676765c793fa10079d601b1b9061586a565b83604054614b13919061586a565b1115614b32576040516371239a6160e11b815260040160405180910390fd5b60008681526043602090815260408083208151808301909252805482526001015491810191909152614b65908686614615565b50509050633b9aca008111614b8d57604051631527804d60e31b815260040160405180910390fd5b600080516020615e9783398151915287836001604051614baf93929190615a07565b60405180910390a1676765c793fa10079d601b1b614bcd858461586a565b614bd7919061589f565b979650505050505050565b6000614c37826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b0316614cb49092919063ffffffff16565b805190915015610a055780806020019051810190614c5591906158b3565b610a055760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b606482015260840161159f565b6060611ce8848460008585614cc885613359565b614d145760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e7472616374000000604482015260640161159f565b600080866001600160a01b03168587604051614d309190615e7a565b60006040518083038185875af1925050503d8060008114614d6d576040519150601f19603f3d011682016040523d82523d6000602084013e614d72565b606091505b5091509150614bd782828660608315614d8c575081610af0565b825115614d9c5782518084602001fd5b8160405162461bcd60e51b815260040161159f9190614f7f565b6040518060a0016040528060008152602001600081526020016000815260200160008152602001600081525090565b828054614df190615806565b90600052602060002090601f016020900481019282614e135760008555614e59565b82601f10614e2c57805160ff1916838001178555614e59565b82800160010185558215614e59579182015b82811115614e59578251825591602001919060010190614e3e565b50614e65929150614ecb565b5090565b828054828255906000526020600020908101928215614e595791602002820182811115614e59578251825591602001919060010190614e3e565b6040518060800160405280600081526020016000815260200160008152602001600081525090565b5b80821115614e655760008155600101614ecc565b6001600160a01b0391909116815260200190565b6001600160e01b031981168114610c6c57600080fd5b600060208284031215614f1c57600080fd5b8135610af081614ef4565b60005b83811015614f42578181015183820152602001614f2a565b8381111561402e5750506000910152565b60008151808452614f6b816020860160208601614f27565b601f01601f19169290920160200192915050565b602081526000610af06020830184614f53565b600060208284031215614fa457600080fd5b5035919050565b6001600160a01b0381168114610c6c57600080fd5b60008060408385031215614fd357600080fd5b8235614fde81614fab565b946020939093013593505050565b60008060006060848603121561500157600080fd5b833561500c81614fab565b9250602084013561501c81614fab565b929592945050506040919091013590565b6000806040838503121561504057600080fd5b82359150602083013561505281614fab565b809150509250929050565b60a081016108b8828480518252602081015160208301526040810151604083015260608101516060830152608081015160808301525050565b6000602082840312156150a857600080fd5b8135610af081614fab565b634e487b7160e01b600052604160045260246000fd5b604051601f8201601f191681016001600160401b03811182821017156150f1576150f16150b3565b604052919050565b600082601f83011261510a57600080fd5b81356001600160401b03811115615123576151236150b3565b615136601f8201601f19166020016150c9565b81815284602083860101111561514b57600080fd5b816020850160208301376000918101602001919091529392505050565b60006020828403121561517a57600080fd5b81356001600160401b0381111561519057600080fd5b611ce8848285016150f9565b600080604083850312156151af57600080fd5b50508035926020909101359150565b80356001600160401b0381168114611dfb57600080fd5b600080604083850312156151e857600080fd5b614fde836151be565b60006001600160401b0382111561520a5761520a6150b3565b5060051b60200190565b600082601f83011261522557600080fd5b8135602061523a615235836151f1565b6150c9565b82815260059290921b8401810191818101908684111561525957600080fd5b8286015b84811015615274578035835291830191830161525d565b509695505050505050565b60008060006060848603121561529457600080fd5b833561529f81614fab565b925060208401356001600160401b03808211156152bb57600080fd5b6152c787838801615214565b935060408601359150808211156152dd57600080fd5b506152ea86828701615214565b9150509250925092565b60008060008060008060c0878903121561530d57600080fd5b86356001600160401b038082111561532457600080fd5b6153308a838b01615214565b9750602089013591508082111561534657600080fd5b6153528a838b01615214565b96506040890135915061536482614fab565b90945060608801359061537682614fab565b90935060808801359061538882614fab565b90925060a0880135908082111561539e57600080fd5b506153ab89828a016150f9565b9150509295509295509295565b600080600080608085870312156153ce57600080fd5b5050823594602084013594506040840135936060013592509050565b600082601f8301126153fb57600080fd5b8135602061540b615235836151f1565b82815260059290921b8401810191818101908684111561542a57600080fd5b8286015b84811015615274578035600881106154465760008081fd5b835291830191830161542e565b600082601f83011261546457600080fd5b81356020615474615235836151f1565b82815260059290921b8401810191818101908684111561549357600080fd5b8286015b848110156152745780356001600160401b038111156154b65760008081fd5b6154c48986838b01016150f9565b845250918301918301615497565b600080600080608085870312156154e857600080fd5b84356001600160401b03808211156154ff57600080fd5b61550b888389016153ea565b9550602087013591508082111561552157600080fd5b5061552e87828801615453565b935050604085013561553f81614fab565b9150606085013561554f81614fab565b939692955090935050565b8015158114610c6c57600080fd5b6000806040838503121561557b57600080fd5b823561558681614fab565b915060208301356150528161555a565b600080600080608085870312156155ac57600080fd5b84356155b781614fab565b935060208501356155c781614fab565b92506040850135915060608501356001600160401b038111156155e957600080fd5b6155f5878288016150f9565b91505092959194509250565b600080600080600085870361018081121561561b57600080fd5b863561562681614fab565b9550602087013561563681614fab565b9450604087013561564681614fab565b9350610100605f198201121561565b57600080fd5b506060860191506101608601356001600160401b0381111561567c57600080fd5b615688888289016150f9565b9150509295509295909350565b60008060008060008060c087890312156156ae57600080fd5b86356001600160401b03808211156156c557600080fd5b6156d18a838b016153ea565b975060208901359150808211156156e757600080fd5b6153528a838b01615453565b6000806040838503121561570657600080fd5b823561571181614fab565b9150602083013561505281614fab565b60ff81168114610c6c57600080fd5b600080600080600080600060e0888a03121561574b57600080fd5b873561575681614fab565b9650602088013561576681614fab565b955060408801356157768161555a565b945060608801359350608088013561578d81615721565b9699959850939692959460a0840135945060c09093013592915050565b600080600080608085870312156157c057600080fd5b84356001600160401b03808211156157d757600080fd5b6157e388838901615214565b955060208701359150808211156157f957600080fd5b5061552e87828801615214565b600181811c9082168061581a57607f821691505b602082108114156148c757634e487b7160e01b600052602260045260246000fd5b60006020828403121561584d57600080fd5b5051919050565b634e487b7160e01b600052601160045260246000fd5b600081600019048311821515161561588457615884615854565b500290565b634e487b7160e01b600052601260045260246000fd5b6000826158ae576158ae615889565b500490565b6000602082840312156158c557600080fd5b8151610af08161555a565b6000828210156158e2576158e2615854565b500390565b60006001600160401b0382811684821680830382111561590957615909615854565b01949350505050565b60006020828403121561592457600080fd5b8151610af081614fab565b634e487b7160e01b600052603260045260246000fd5b600081518084526020808501945080840160005b8381101561597557815187529582019590820190600101615959565b509495945050505050565b6040815260006159936040830185615945565b82810360208401526120388185615945565b6020808252601f908201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c00604082015260600190565b602081526000610af06020830184615945565b60008219821115615a0257615a02615854565b500190565b928352602083019190915260ff16604082015260600190565b6000600019821415615a3457615a34615854565b5060010190565b600181815b80851115615a76578160001904821115615a5c57615a5c615854565b80851615615a6957918102915b93841c9390800290615a40565b509250929050565b600082615a8d575060016108b8565b81615a9a575060006108b8565b8160018114615ab05760028114615aba57615ad6565b60019150506108b8565b60ff841115615acb57615acb615854565b50506001821b6108b8565b5060208310610133831016604e8410600b8410161715615af9575081810a6108b8565b615b038383615a3b565b8060001904821115615b1757615b17615854565b029392505050565b6000610af060ff841683615a7e565b600082615b3d57615b3d615889565b500690565b60008151615b54818560208601614f27565b9290920192915050565b600080845481600182811c915080831680615b7a57607f831692505b6020808410821415615b9a57634e487b7160e01b86526022600452602486fd5b818015615bae5760018114615bbf57615bec565b60ff19861689528489019650615bec565b60008b81526020902060005b86811015615be45781548b820152908501908301615bcb565b505084890196505b5050505050506120388185615b42565b600060208284031215615c0e57600080fd5b8151610af081615721565b6e020b733b63290283937ba37b1b7b61608d1b815260008251615c4381600f850160208701614f27565b650815985d5b1d60d21b600f939091019283015250601501919050565b60008251615c72818460208701614f27565b650b5d985d5b1d60d21b920191825250600601919050565b600060208284031215615c9c57600080fd5b610af0826151be565b600060208284031215615cb757600080fd5b8135610af08161555a565b634e487b7160e01b600052602160045260246000fd5b60008060408385031215615ceb57600080fd5b505080516020909101519092909150565b60008060008060008060c08789031215615d1557600080fd5b8651615d2081614fab565b6020880151604089015160608a015160808b015160a0909b0151939c929b509099909850965090945092505050565b60008060008060808587031215615d6557600080fd5b845193506020850151615d7781614fab565b6040860151606090960151949790965092505050565b9283526001600160a01b03918216602084015216604082015260600190565b6001600160a01b03929092168252602082015260400190565b6001600160a01b038781168252868116602083015285166040820152606081018490526080810183905260c060a082018190526000906143ff90830184614f53565b828152604060208201526000611ce86040830184614f53565b600060208284031215615e3257600080fd5b8151610af081614ef4565b6001600160a01b0385811682528416602082015260408101839052608060608201819052600090615e7090830184614f53565b9695505050505050565b60008251615e8c818460208701614f27565b919091019291505056fe70cf49afe7355562d5b022e594790f22b71ad8cc7eec902fa5feac7c67f71091722cb71fa87c947148cefc06dd890af5802a6a00207c5ddecf1191bf71ce3cd4ddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3efa264697066735822122004adf5a8fe3c52a612a81111fd6100f9eeb84fbeb3cfcc411a5bf2e9a14a72cb64736f6c634300080c0033" +} \ No newline at end of file diff --git a/deployments/arbitrum/solcInputs/dc345d3eed7216da5bac40699a727ed4.json b/deployments/arbitrum/solcInputs/dc345d3eed7216da5bac40699a727ed4.json new file mode 100644 index 00000000..07ab4718 --- /dev/null +++ b/deployments/arbitrum/solcInputs/dc345d3eed7216da5bac40699a727ed4.json @@ -0,0 +1,124 @@ +{ + "language": "Solidity", + "sources": { + "contracts/vaultManager/VaultManagerLiquidationBoost.sol": { + "content": "// SPDX-License-Identifier: GPL-3.0\n\npragma solidity ^0.8.12;\n\nimport \"./VaultManager.sol\";\n\n/// @title VaultManagerLiquidationBoost\n/// @author Angle Labs, Inc.\n/// @notice Liquidation discount depending also on the liquidator veANGLE balance\ncontract VaultManagerLiquidationBoost is VaultManager {\n using SafeERC20 for IERC20;\n using Address for address;\n\n // =================================== SETTER ==================================\n\n /// @inheritdoc VaultManager\n /// @param _veBoostProxy Address which queries veANGLE balances and adjusted balances from delegation\n /// @param xBoost Threshold values of veANGLE adjusted balances\n /// @param yBoost Values of the liquidation boost at the threshold values of x\n /// @dev There are 2 modes:\n /// When boost is enabled, `xBoost` and `yBoost` should have a length of 2, but if they have a\n /// higher length contract will still work as expected. Contract will also work as expected if their\n /// length differ\n /// When boost is disabled, `_veBoostProxy` needs to be zero address and `yBoost[0]` is the base boost\n function setLiquidationBoostParameters(\n address _veBoostProxy,\n uint256[] memory xBoost,\n uint256[] memory yBoost\n ) external override onlyGovernorOrGuardian {\n if (\n (xBoost.length != yBoost.length) ||\n (yBoost[0] == 0) ||\n ((_veBoostProxy != address(0)) && (xBoost[1] <= xBoost[0] || yBoost[1] < yBoost[0]))\n ) revert InvalidSetOfParameters();\n veBoostProxy = IVeBoostProxy(_veBoostProxy);\n xLiquidationBoost = xBoost;\n yLiquidationBoost = yBoost;\n emit LiquidationBoostParametersUpdated(_veBoostProxy, xBoost, yBoost);\n }\n\n // ======================== OVERRIDEN VIRTUAL FUNCTIONS ========================\n\n /// @inheritdoc VaultManager\n function _computeLiquidationBoost(address liquidator) internal view override returns (uint256) {\n if (address(veBoostProxy) == address(0)) {\n return yLiquidationBoost[0];\n } else {\n uint256 adjustedBalance = veBoostProxy.adjusted_balance_of(liquidator);\n if (adjustedBalance >= xLiquidationBoost[1]) return yLiquidationBoost[1];\n else if (adjustedBalance <= xLiquidationBoost[0]) return yLiquidationBoost[0];\n else\n return\n yLiquidationBoost[0] +\n ((yLiquidationBoost[1] - yLiquidationBoost[0]) * (adjustedBalance - xLiquidationBoost[0])) /\n (xLiquidationBoost[1] - xLiquidationBoost[0]);\n }\n }\n}\n" + }, + "contracts/vaultManager/VaultManager.sol": { + "content": "// SPDX-License-Identifier: GPL-3.0\n\npragma solidity ^0.8.12;\n\nimport \"./VaultManagerPermit.sol\";\n\n/// @title VaultManager\n/// @author Angle Labs, Inc.\n/// @notice This contract allows people to deposit collateral and open up loans of a given AgToken. It handles all the loan\n/// logic (fees and interest rate) as well as the liquidation logic\n/// @dev This implementation only supports non-rebasing ERC20 tokens as collateral\n/// @dev This contract is encoded as a NFT contract\ncontract VaultManager is VaultManagerPermit, IVaultManagerFunctions {\n using SafeERC20 for IERC20;\n using Address for address;\n\n /// @inheritdoc IVaultManagerFunctions\n uint256 public dust;\n\n /// @notice Minimum amount of collateral (in stablecoin value, e.g in `BASE_TOKENS = 10**18`) that can be left\n /// in a vault during a liquidation where the health factor function is decreasing\n uint256 internal _dustCollateral;\n\n uint256[48] private __gapVaultManager;\n\n /// @inheritdoc IVaultManagerFunctions\n function initialize(\n ITreasury _treasury,\n IERC20 _collateral,\n IOracle _oracle,\n VaultParameters calldata params,\n string memory _symbol\n ) external initializer {\n if (_oracle.treasury() != _treasury) revert InvalidTreasury();\n treasury = _treasury;\n collateral = _collateral;\n _collatBase = 10**(IERC20Metadata(address(collateral)).decimals());\n stablecoin = IAgToken(_treasury.stablecoin());\n oracle = _oracle;\n string memory _name = string.concat(\"Angle Protocol \", _symbol, \" Vault\");\n name = _name;\n __ERC721Permit_init(_name);\n symbol = string.concat(_symbol, \"-vault\");\n\n interestAccumulator = BASE_INTEREST;\n lastInterestAccumulatorUpdated = block.timestamp;\n\n // Checking if the parameters have been correctly initialized\n if (\n params.collateralFactor > params.liquidationSurcharge ||\n params.liquidationSurcharge > BASE_PARAMS ||\n BASE_PARAMS > params.targetHealthFactor ||\n params.maxLiquidationDiscount >= BASE_PARAMS ||\n params.baseBoost == 0\n ) revert InvalidSetOfParameters();\n\n debtCeiling = params.debtCeiling;\n collateralFactor = params.collateralFactor;\n targetHealthFactor = params.targetHealthFactor;\n interestRate = params.interestRate;\n liquidationSurcharge = params.liquidationSurcharge;\n maxLiquidationDiscount = params.maxLiquidationDiscount;\n whitelistingActivated = params.whitelistingActivated;\n yLiquidationBoost = [params.baseBoost];\n paused = true;\n }\n\n // ================================= MODIFIERS =================================\n\n /// @notice Checks whether the `msg.sender` has the governor role or not\n modifier onlyGovernor() {\n if (!treasury.isGovernor(msg.sender)) revert NotGovernor();\n _;\n }\n\n /// @notice Checks whether the `msg.sender` has the governor role or the guardian role\n modifier onlyGovernorOrGuardian() {\n if (!treasury.isGovernorOrGuardian(msg.sender)) revert NotGovernorOrGuardian();\n _;\n }\n\n /// @notice Checks whether the `msg.sender` is the treasury contract\n modifier onlyTreasury() {\n if (msg.sender != address(treasury)) revert NotTreasury();\n _;\n }\n\n /// @notice Checks whether the contract is paused\n modifier whenNotPaused() {\n if (paused) revert Paused();\n _;\n }\n\n // ============================== VAULT FUNCTIONS ==============================\n\n /// @inheritdoc IVaultManagerFunctions\n function createVault(address toVault) external whenNotPaused returns (uint256) {\n return _mint(toVault);\n }\n\n /// @inheritdoc IVaultManagerFunctions\n function angle(\n ActionType[] memory actions,\n bytes[] memory datas,\n address from,\n address to\n ) external returns (PaymentData memory) {\n return angle(actions, datas, from, to, address(0), new bytes(0));\n }\n\n /// @inheritdoc IVaultManagerFunctions\n function angle(\n ActionType[] memory actions,\n bytes[] memory datas,\n address from,\n address to,\n address who,\n bytes memory repayData\n ) public whenNotPaused nonReentrant returns (PaymentData memory paymentData) {\n if (actions.length != datas.length || actions.length == 0) revert IncompatibleLengths();\n // `newInterestAccumulator` and `oracleValue` are expensive to compute. Therefore, they are computed\n // only once inside the first action where they are necessary, then they are passed forward to further actions\n uint256 newInterestAccumulator;\n uint256 oracleValue;\n uint256 collateralAmount;\n uint256 stablecoinAmount;\n uint256 vaultID;\n for (uint256 i; i < actions.length; ++i) {\n ActionType action = actions[i];\n // Processing actions which do not need the value of the oracle or of the `interestAccumulator`\n if (action == ActionType.createVault) {\n _mint(abi.decode(datas[i], (address)));\n } else if (action == ActionType.addCollateral) {\n (vaultID, collateralAmount) = abi.decode(datas[i], (uint256, uint256));\n if (vaultID == 0) vaultID = vaultIDCount;\n _addCollateral(vaultID, collateralAmount);\n paymentData.collateralAmountToReceive += collateralAmount;\n } else if (action == ActionType.permit) {\n address owner;\n bytes32 r;\n bytes32 s;\n // Watch out naming conventions for permit are not respected to save some space and reduce the stack size\n // `vaultID` is used in place of the `deadline` parameter\n // Same for `collateralAmount` used in place of `value`\n // `stablecoinAmount` is used in place of the `v`\n (owner, collateralAmount, vaultID, stablecoinAmount, r, s) = abi.decode(\n datas[i],\n (address, uint256, uint256, uint256, bytes32, bytes32)\n );\n IERC20PermitUpgradeable(address(collateral)).permit(\n owner,\n address(this),\n collateralAmount,\n vaultID,\n uint8(stablecoinAmount),\n r,\n s\n );\n } else {\n // Processing actions which rely on the `interestAccumulator`: first accruing it to make\n // sure surplus is correctly taken into account between debt changes\n if (newInterestAccumulator == 0) newInterestAccumulator = _accrue();\n if (action == ActionType.repayDebt) {\n (vaultID, stablecoinAmount) = abi.decode(datas[i], (uint256, uint256));\n if (vaultID == 0) vaultID = vaultIDCount;\n stablecoinAmount = _repayDebt(vaultID, stablecoinAmount, newInterestAccumulator);\n uint256 stablecoinAmountPlusRepayFee = (stablecoinAmount * BASE_PARAMS) / (BASE_PARAMS - repayFee);\n surplus += stablecoinAmountPlusRepayFee - stablecoinAmount;\n paymentData.stablecoinAmountToReceive += stablecoinAmountPlusRepayFee;\n } else {\n // Processing actions which need the oracle value\n if (oracleValue == 0) oracleValue = oracle.read();\n if (action == ActionType.closeVault) {\n vaultID = abi.decode(datas[i], (uint256));\n if (vaultID == 0) vaultID = vaultIDCount;\n (stablecoinAmount, collateralAmount) = _closeVault(\n vaultID,\n oracleValue,\n newInterestAccumulator\n );\n paymentData.collateralAmountToGive += collateralAmount;\n paymentData.stablecoinAmountToReceive += stablecoinAmount;\n } else if (action == ActionType.removeCollateral) {\n (vaultID, collateralAmount) = abi.decode(datas[i], (uint256, uint256));\n if (vaultID == 0) vaultID = vaultIDCount;\n _removeCollateral(vaultID, collateralAmount, oracleValue, newInterestAccumulator);\n paymentData.collateralAmountToGive += collateralAmount;\n } else if (action == ActionType.borrow) {\n (vaultID, stablecoinAmount) = abi.decode(datas[i], (uint256, uint256));\n if (vaultID == 0) vaultID = vaultIDCount;\n stablecoinAmount = _borrow(vaultID, stablecoinAmount, oracleValue, newInterestAccumulator);\n paymentData.stablecoinAmountToGive += stablecoinAmount;\n } else if (action == ActionType.getDebtIn) {\n address vaultManager;\n uint256 dstVaultID;\n (vaultID, vaultManager, dstVaultID, stablecoinAmount) = abi.decode(\n datas[i],\n (uint256, address, uint256, uint256)\n );\n if (vaultID == 0) vaultID = vaultIDCount;\n _getDebtIn(\n vaultID,\n IVaultManager(vaultManager),\n dstVaultID,\n stablecoinAmount,\n oracleValue,\n newInterestAccumulator\n );\n }\n }\n }\n }\n\n // Processing the different cases for the repayment, there are 4 of them:\n // - (1) Stablecoins to receive + collateral to send\n // - (2) Stablecoins to receive + collateral to receive\n // - (3) Stablecoins to send + collateral to send\n // - (4) Stablecoins to send + collateral to receive\n if (paymentData.stablecoinAmountToReceive >= paymentData.stablecoinAmountToGive) {\n uint256 stablecoinPayment = paymentData.stablecoinAmountToReceive - paymentData.stablecoinAmountToGive;\n if (paymentData.collateralAmountToGive >= paymentData.collateralAmountToReceive) {\n // In the case where all amounts are null, the function will enter here and nothing will be done\n // for the repayment\n _handleRepay(\n // Collateral payment is the difference between what to give and what to receive\n paymentData.collateralAmountToGive - paymentData.collateralAmountToReceive,\n stablecoinPayment,\n from,\n to,\n who,\n repayData\n );\n } else {\n if (stablecoinPayment != 0) stablecoin.burnFrom(stablecoinPayment, from, msg.sender);\n // In this case the collateral amount is necessarily non null\n collateral.safeTransferFrom(\n msg.sender,\n address(this),\n paymentData.collateralAmountToReceive - paymentData.collateralAmountToGive\n );\n }\n } else {\n uint256 stablecoinPayment = paymentData.stablecoinAmountToGive - paymentData.stablecoinAmountToReceive;\n // `stablecoinPayment` is strictly positive in this case\n stablecoin.mint(to, stablecoinPayment);\n if (paymentData.collateralAmountToGive > paymentData.collateralAmountToReceive) {\n collateral.safeTransfer(to, paymentData.collateralAmountToGive - paymentData.collateralAmountToReceive);\n } else {\n uint256 collateralPayment = paymentData.collateralAmountToReceive - paymentData.collateralAmountToGive;\n if (collateralPayment != 0) {\n if (repayData.length != 0) {\n ISwapper(who).swap(\n IERC20(address(stablecoin)),\n collateral,\n msg.sender,\n // As per the `ISwapper` interface, we must first give the amount of token owed by the address before\n // the amount of token it (or another related address) obtained\n collateralPayment,\n stablecoinPayment,\n repayData\n );\n }\n collateral.safeTransferFrom(msg.sender, address(this), collateralPayment);\n }\n }\n }\n }\n\n /// @inheritdoc IVaultManagerFunctions\n function getDebtOut(\n uint256 vaultID,\n uint256 stablecoinAmount,\n uint256 senderBorrowFee,\n uint256 senderRepayFee\n ) external whenNotPaused {\n if (!treasury.isVaultManager(msg.sender)) revert NotVaultManager();\n // Getting debt out of a vault is equivalent to repaying a portion of your debt, and this could leave exploits:\n // someone could borrow from a vault and transfer its debt to a `VaultManager` contract where debt repayment will\n // be cheaper: in which case we're making people pay the delta\n uint256 _repayFee;\n if (repayFee > senderRepayFee) {\n _repayFee = repayFee - senderRepayFee;\n }\n // Checking the delta of borrow fees to eliminate the risk of exploits here: a similar thing could happen: people\n // could mint from where it is cheap to mint and then transfer their debt to places where it is more expensive\n // to mint\n uint256 _borrowFee;\n if (senderBorrowFee > borrowFee) {\n _borrowFee = senderBorrowFee - borrowFee;\n }\n\n uint256 stablecoinAmountLessFeePaid = (stablecoinAmount *\n (BASE_PARAMS - _repayFee) *\n (BASE_PARAMS - _borrowFee)) / (BASE_PARAMS**2);\n surplus += stablecoinAmount - stablecoinAmountLessFeePaid;\n _repayDebt(vaultID, stablecoinAmountLessFeePaid, 0);\n }\n\n // =============================== VIEW FUNCTIONS ==============================\n\n /// @inheritdoc IVaultManagerFunctions\n function getVaultDebt(uint256 vaultID) external view returns (uint256) {\n return (vaultData[vaultID].normalizedDebt * _calculateCurrentInterestAccumulator()) / BASE_INTEREST;\n }\n\n /// @inheritdoc IVaultManagerFunctions\n function getTotalDebt() external view returns (uint256) {\n return (totalNormalizedDebt * _calculateCurrentInterestAccumulator()) / BASE_INTEREST;\n }\n\n /// @notice Checks whether a given vault is liquidable and if yes gives information regarding its liquidation\n /// @param vaultID ID of the vault to check\n /// @param liquidator Address of the liquidator which will be performing the liquidation\n /// @return liqOpp Description of the opportunity of liquidation\n /// @dev This function will revert if it's called on a vault that does not exist\n function checkLiquidation(uint256 vaultID, address liquidator)\n external\n view\n returns (LiquidationOpportunity memory liqOpp)\n {\n liqOpp = _checkLiquidation(\n vaultData[vaultID],\n liquidator,\n oracle.read(),\n _calculateCurrentInterestAccumulator()\n );\n }\n\n // ====================== INTERNAL UTILITY VIEW FUNCTIONS ======================\n\n /// @notice Computes the health factor of a given vault. This can later be used to check whether a given vault is solvent\n /// (i.e. should be liquidated or not)\n /// @param vault Data of the vault to check\n /// @param oracleValue Oracle value at the time of the call (it is in the base of the stablecoin, that is for agTokens 10**18)\n /// @param newInterestAccumulator Value of the `interestAccumulator` at the time of the call\n /// @return healthFactor Health factor of the vault: if it's inferior to 1 (`BASE_PARAMS` in fact) this means that the vault can be liquidated\n /// @return currentDebt Current value of the debt of the vault (taking into account interest)\n /// @return collateralAmountInStable Collateral in the vault expressed in stablecoin value\n function _isSolvent(\n Vault memory vault,\n uint256 oracleValue,\n uint256 newInterestAccumulator\n )\n internal\n view\n returns (\n uint256 healthFactor,\n uint256 currentDebt,\n uint256 collateralAmountInStable\n )\n {\n currentDebt = (vault.normalizedDebt * newInterestAccumulator) / BASE_INTEREST;\n collateralAmountInStable = (vault.collateralAmount * oracleValue) / _collatBase;\n if (currentDebt == 0) healthFactor = type(uint256).max;\n else healthFactor = (collateralAmountInStable * collateralFactor) / currentDebt;\n }\n\n /// @notice Calculates the current value of the `interestAccumulator` without updating the value\n /// in storage\n /// @dev This function avoids expensive exponentiation and the calculation is performed using a binomial approximation\n /// (1+x)^n = 1+n*x+[n/2*(n-1)]*x^2+[n/6*(n-1)*(n-2)*x^3...\n /// @dev The approximation slightly undercharges borrowers with the advantage of a great gas cost reduction\n /// @dev This function was mostly inspired from Aave implementation\n function _calculateCurrentInterestAccumulator() internal view returns (uint256) {\n uint256 exp = block.timestamp - lastInterestAccumulatorUpdated;\n uint256 ratePerSecond = interestRate;\n if (exp == 0 || ratePerSecond == 0) return interestAccumulator;\n uint256 expMinusOne = exp - 1;\n uint256 expMinusTwo = exp > 2 ? exp - 2 : 0;\n uint256 basePowerTwo = (ratePerSecond * ratePerSecond + HALF_BASE_INTEREST) / BASE_INTEREST;\n uint256 basePowerThree = (basePowerTwo * ratePerSecond + HALF_BASE_INTEREST) / BASE_INTEREST;\n uint256 secondTerm = (exp * expMinusOne * basePowerTwo) / 2;\n uint256 thirdTerm = (exp * expMinusOne * expMinusTwo * basePowerThree) / 6;\n return (interestAccumulator * (BASE_INTEREST + ratePerSecond * exp + secondTerm + thirdTerm)) / BASE_INTEREST;\n }\n\n // ================= INTERNAL UTILITY STATE-MODIFYING FUNCTIONS ================\n\n /// @notice Closes a vault without handling the repayment of the concerned address\n /// @param vaultID ID of the vault to close\n /// @param oracleValue Oracle value at the start of the call\n /// @param newInterestAccumulator Interest rate accumulator value at the start of the call\n /// @return Current debt of the vault to be repaid\n /// @return Value of the collateral in the vault to reimburse\n /// @dev The returned values are here to facilitate composability between calls\n function _closeVault(\n uint256 vaultID,\n uint256 oracleValue,\n uint256 newInterestAccumulator\n ) internal onlyApprovedOrOwner(msg.sender, vaultID) returns (uint256, uint256) {\n Vault memory vault = vaultData[vaultID];\n (uint256 healthFactor, uint256 currentDebt, ) = _isSolvent(vault, oracleValue, newInterestAccumulator);\n if (healthFactor <= BASE_PARAMS) revert InsolventVault();\n totalNormalizedDebt -= vault.normalizedDebt;\n _burn(vaultID);\n uint256 currentDebtPlusRepayFee = (currentDebt * BASE_PARAMS) / (BASE_PARAMS - repayFee);\n surplus += currentDebtPlusRepayFee - currentDebt;\n return (currentDebtPlusRepayFee, vault.collateralAmount);\n }\n\n /// @notice Increases the collateral balance of a vault\n /// @param vaultID ID of the vault to increase the collateral balance of\n /// @param collateralAmount Amount by which increasing the collateral balance of\n function _addCollateral(uint256 vaultID, uint256 collateralAmount) internal {\n if (!_exists(vaultID)) revert NonexistentVault();\n _checkpointCollateral(vaultID, collateralAmount, true);\n vaultData[vaultID].collateralAmount += collateralAmount;\n emit CollateralAmountUpdated(vaultID, collateralAmount, 1);\n }\n\n /// @notice Decreases the collateral balance from a vault (without proceeding to collateral transfers)\n /// @param vaultID ID of the vault to decrease the collateral balance of\n /// @param collateralAmount Amount of collateral to reduce the balance of\n /// @param oracleValue Oracle value at the start of the call (given here to avoid double computations)\n /// @param interestAccumulator_ Value of the interest rate accumulator (potentially zero if it has not been\n /// computed yet)\n function _removeCollateral(\n uint256 vaultID,\n uint256 collateralAmount,\n uint256 oracleValue,\n uint256 interestAccumulator_\n ) internal onlyApprovedOrOwner(msg.sender, vaultID) {\n _checkpointCollateral(vaultID, collateralAmount, false);\n vaultData[vaultID].collateralAmount -= collateralAmount;\n (uint256 healthFactor, , ) = _isSolvent(vaultData[vaultID], oracleValue, interestAccumulator_);\n if (healthFactor <= BASE_PARAMS) revert InsolventVault();\n emit CollateralAmountUpdated(vaultID, collateralAmount, 0);\n }\n\n /// @notice Increases the debt balance of a vault and takes into account borrowing fees\n /// @param vaultID ID of the vault to increase borrow balance of\n /// @param stablecoinAmount Amount of stablecoins to borrow\n /// @param oracleValue Oracle value at the start of the call\n /// @param newInterestAccumulator Value of the interest rate accumulator\n /// @return toMint Amount of stablecoins to mint\n function _borrow(\n uint256 vaultID,\n uint256 stablecoinAmount,\n uint256 oracleValue,\n uint256 newInterestAccumulator\n ) internal onlyApprovedOrOwner(msg.sender, vaultID) returns (uint256 toMint) {\n stablecoinAmount = _increaseDebt(vaultID, stablecoinAmount, oracleValue, newInterestAccumulator);\n uint256 borrowFeePaid = (borrowFee * stablecoinAmount) / BASE_PARAMS;\n surplus += borrowFeePaid;\n toMint = stablecoinAmount - borrowFeePaid;\n }\n\n /// @notice Gets debt in a vault from another vault potentially in another `VaultManager` contract\n /// @param srcVaultID ID of the vault from this contract for which growing debt\n /// @param vaultManager Address of the `VaultManager` where the targeted vault is\n /// @param dstVaultID ID of the vault in the target contract\n /// @param stablecoinAmount Amount of stablecoins to grow the debt of. This amount will be converted\n /// to a normalized value in both `VaultManager` contracts\n /// @param oracleValue Oracle value at the start of the call (potentially zero if it has not been computed yet)\n /// @param newInterestAccumulator Value of the interest rate accumulator (potentially zero if it has not been\n /// computed yet)\n /// @dev A solvency check is performed after the debt increase in the source `vaultID`\n /// @dev Only approved addresses by the source vault owner can perform this action, however any vault\n /// from any vaultManager contract can see its debt reduced by this means\n function _getDebtIn(\n uint256 srcVaultID,\n IVaultManager vaultManager,\n uint256 dstVaultID,\n uint256 stablecoinAmount,\n uint256 oracleValue,\n uint256 newInterestAccumulator\n ) internal onlyApprovedOrOwner(msg.sender, srcVaultID) {\n emit DebtTransferred(srcVaultID, dstVaultID, address(vaultManager), stablecoinAmount);\n // The `stablecoinAmount` needs to be rounded down in the `_increaseDebt` function to reduce the room for exploits\n stablecoinAmount = _increaseDebt(srcVaultID, stablecoinAmount, oracleValue, newInterestAccumulator);\n if (address(vaultManager) == address(this)) {\n // No repayFees taken in this case, otherwise the same stablecoin may end up paying fees twice\n _repayDebt(dstVaultID, stablecoinAmount, newInterestAccumulator);\n } else {\n // No need to check the integrity of `VaultManager` here because `_getDebtIn` can be entered only through the\n // `angle` function which is non reentrant. Also, `getDebtOut` failing would be at the attacker loss, as they\n // would get their debt increasing in the current vault without decreasing it in the remote vault.\n vaultManager.getDebtOut(dstVaultID, stablecoinAmount, borrowFee, repayFee);\n }\n }\n\n /// @notice Increases the debt of a given vault and verifies that this vault is still solvent\n /// @param vaultID ID of the vault to increase the debt of\n /// @param stablecoinAmount Amount of stablecoin to increase the debt of: this amount is converted in\n /// normalized debt using the pre-computed (or not) `newInterestAccumulator` value\n /// @param oracleValue Oracle value at the start of the call (given here to avoid double computations)\n /// @param newInterestAccumulator Value of the interest rate accumulator (potentially zero if it has not been\n /// computed yet)\n /// @return Amount of stablecoins to issue from this debt increase\n /// @dev The `stablecoinAmount` outputted need to be rounded down with respect to the change amount so that\n /// amount of stablecoins minted is smaller than the debt increase\n function _increaseDebt(\n uint256 vaultID,\n uint256 stablecoinAmount,\n uint256 oracleValue,\n uint256 newInterestAccumulator\n ) internal returns (uint256) {\n // We normalize the amount by dividing it by `newInterestAccumulator`. This makes accounting easier, since\n // it allows us to process all (past and future) debts like debts created at the inception of the contract.\n uint256 changeAmount = (stablecoinAmount * BASE_INTEREST) / newInterestAccumulator;\n // if there was no previous debt, we have to check that the debt creation will be higher than `dust`\n if (vaultData[vaultID].normalizedDebt == 0)\n if (stablecoinAmount <= dust) revert DustyLeftoverAmount();\n vaultData[vaultID].normalizedDebt += changeAmount;\n totalNormalizedDebt += changeAmount;\n if (totalNormalizedDebt * newInterestAccumulator > debtCeiling * BASE_INTEREST) revert DebtCeilingExceeded();\n (uint256 healthFactor, , ) = _isSolvent(vaultData[vaultID], oracleValue, newInterestAccumulator);\n if (healthFactor <= BASE_PARAMS) revert InsolventVault();\n emit InternalDebtUpdated(vaultID, changeAmount, 1);\n return (changeAmount * newInterestAccumulator) / BASE_INTEREST;\n }\n\n /// @notice Decreases the debt of a given vault and verifies that this vault still has an amount of debt superior\n /// to a dusty amount or no debt at all\n /// @param vaultID ID of the vault to decrease the debt of\n /// @param stablecoinAmount Amount of stablecoin to decrease the debt of: this amount is converted in\n /// normalized debt using the pre-computed (or not) `newInterestAccumulator` value\n /// To repay the whole debt, one can pass `type(uint256).max`\n /// @param newInterestAccumulator Value of the interest rate accumulator (potentially zero if it has not been\n /// computed yet, like in `getDebtOut`)\n /// @return Amount of stablecoins to be burnt to correctly repay the debt\n /// @dev If `stablecoinAmount` is `type(uint256).max`, this function will repay all the debt of the vault\n function _repayDebt(\n uint256 vaultID,\n uint256 stablecoinAmount,\n uint256 newInterestAccumulator\n ) internal returns (uint256) {\n if (newInterestAccumulator == 0) newInterestAccumulator = _accrue();\n uint256 newVaultNormalizedDebt = vaultData[vaultID].normalizedDebt;\n // To save one variable declaration, `changeAmount` is first expressed in stablecoin amount before being converted\n // to a normalized amount. Here we first store the maximum amount that can be repaid given the current debt\n uint256 changeAmount = (newVaultNormalizedDebt * newInterestAccumulator) / BASE_INTEREST;\n // In some situations (e.g. liquidations), the `stablecoinAmount` is rounded above and we want to make\n // sure to avoid underflows in all situations\n if (stablecoinAmount >= changeAmount) {\n stablecoinAmount = changeAmount;\n changeAmount = newVaultNormalizedDebt;\n } else {\n changeAmount = (stablecoinAmount * BASE_INTEREST) / newInterestAccumulator;\n }\n newVaultNormalizedDebt -= changeAmount;\n totalNormalizedDebt -= changeAmount;\n if (newVaultNormalizedDebt != 0 && newVaultNormalizedDebt * newInterestAccumulator <= dust * BASE_INTEREST)\n revert DustyLeftoverAmount();\n vaultData[vaultID].normalizedDebt = newVaultNormalizedDebt;\n emit InternalDebtUpdated(vaultID, changeAmount, 0);\n return stablecoinAmount;\n }\n\n /// @notice Handles the simultaneous repayment of stablecoins with a transfer of collateral\n /// @param collateralAmountToGive Amount of collateral the contract should give\n /// @param stableAmountToRepay Amount of stablecoins the contract should burn from the call\n /// @param from Address from which stablecoins should be burnt: it should be the `msg.sender` or at least\n /// approved by it\n /// @param to Address to which collateral should be sent\n /// @param who Address which should be notified if needed of the transfer\n /// @param data Data to pass to the `who` contract for it to successfully give the correct amount of stablecoins\n /// to the `from` address\n /// @dev This function allows for capital-efficient liquidations and repayments of loans\n function _handleRepay(\n uint256 collateralAmountToGive,\n uint256 stableAmountToRepay,\n address from,\n address to,\n address who,\n bytes memory data\n ) internal {\n if (collateralAmountToGive != 0) collateral.safeTransfer(to, collateralAmountToGive);\n if (stableAmountToRepay != 0) {\n if (data.length != 0) {\n ISwapper(who).swap(\n collateral,\n IERC20(address(stablecoin)),\n from,\n stableAmountToRepay,\n collateralAmountToGive,\n data\n );\n }\n stablecoin.burnFrom(stableAmountToRepay, from, msg.sender);\n }\n }\n\n // ====================== TREASURY RELATIONSHIP FUNCTIONS ======================\n\n /// @inheritdoc IVaultManagerFunctions\n function accrueInterestToTreasury() external onlyTreasury returns (uint256 surplusValue, uint256 badDebtValue) {\n _accrue();\n surplusValue = surplus;\n badDebtValue = badDebt;\n surplus = 0;\n badDebt = 0;\n if (surplusValue >= badDebtValue) {\n surplusValue -= badDebtValue;\n badDebtValue = 0;\n stablecoin.mint(address(treasury), surplusValue);\n } else {\n badDebtValue -= surplusValue;\n surplusValue = 0;\n }\n emit AccruedToTreasury(surplusValue, badDebtValue);\n }\n\n /// @notice Accrues interest accumulated across all vaults to the surplus and updates the `interestAccumulator`\n /// @return newInterestAccumulator Computed value of the interest accumulator\n /// @dev It should also be called when updating the value of the per second interest rate or when the `totalNormalizedDebt`\n /// value is about to change\n function _accrue() internal returns (uint256 newInterestAccumulator) {\n newInterestAccumulator = _calculateCurrentInterestAccumulator();\n uint256 interestAccrued = (totalNormalizedDebt * (newInterestAccumulator - interestAccumulator)) /\n BASE_INTEREST;\n surplus += interestAccrued;\n interestAccumulator = newInterestAccumulator;\n lastInterestAccumulatorUpdated = block.timestamp;\n emit InterestAccumulatorUpdated(newInterestAccumulator, block.timestamp);\n return newInterestAccumulator;\n }\n\n // ================================ LIQUIDATIONS ===============================\n\n /// @notice Liquidates an ensemble of vaults specified by their IDs\n /// @dev This function is a simplified wrapper of the function below. It is built to remove for liquidators the need to specify\n /// a `who` and a `data` parameter\n function liquidate(\n uint256[] memory vaultIDs,\n uint256[] memory amounts,\n address from,\n address to\n ) external returns (LiquidatorData memory) {\n return liquidate(vaultIDs, amounts, from, to, address(0), new bytes(0));\n }\n\n /// @notice Liquidates an ensemble of vaults specified by their IDs\n /// @param vaultIDs List of the vaults to liquidate\n /// @param amounts Amount of stablecoin to bring for the liquidation of each vault\n /// @param from Address from which the stablecoins for the liquidation should be taken: this address should be the `msg.sender`\n /// or have received an approval\n /// @param to Address to which discounted collateral should be sent\n /// @param who Address of the contract to handle repayment of stablecoins from received collateral\n /// @param data Data to pass to the repayment contract in case of. If empty, liquidators simply have to bring the exact amount of\n /// stablecoins to get the discounted collateral. If not, it is used by the repayment contract to swap a portion or all\n /// of the collateral received to stablecoins to be sent to the `from` address. More details in the `_handleRepay` function\n /// @return liqData Data about the liquidation process for the liquidator to track everything that has been going on (like how much\n /// stablecoins have been repaid, how much collateral has been received)\n /// @dev This function will revert if it's called on a vault that cannot be liquidated or that does not exist\n function liquidate(\n uint256[] memory vaultIDs,\n uint256[] memory amounts,\n address from,\n address to,\n address who,\n bytes memory data\n ) public whenNotPaused nonReentrant returns (LiquidatorData memory liqData) {\n uint256 vaultIDsLength = vaultIDs.length;\n if (vaultIDsLength != amounts.length || vaultIDsLength == 0) revert IncompatibleLengths();\n // Stores all the data about an ongoing liquidation of multiple vaults\n liqData.oracleValue = oracle.read();\n liqData.newInterestAccumulator = _accrue();\n emit LiquidatedVaults(vaultIDs);\n for (uint256 i; i < vaultIDsLength; ++i) {\n Vault memory vault = vaultData[vaultIDs[i]];\n // Computing if liquidation can take place for a vault\n LiquidationOpportunity memory liqOpp = _checkLiquidation(\n vault,\n msg.sender,\n liqData.oracleValue,\n liqData.newInterestAccumulator\n );\n\n // Makes sure not to leave a dusty amount in the vault by either not liquidating too much\n // or everything\n if (\n (liqOpp.thresholdRepayAmount != 0 && amounts[i] >= liqOpp.thresholdRepayAmount) ||\n amounts[i] > liqOpp.maxStablecoinAmountToRepay\n ) amounts[i] = liqOpp.maxStablecoinAmountToRepay;\n\n // liqOpp.discount stores in fact `1-discount`\n uint256 collateralReleased = (amounts[i] * BASE_PARAMS * _collatBase) /\n (liqOpp.discount * liqData.oracleValue);\n\n _checkpointCollateral(\n vaultIDs[i],\n vault.collateralAmount <= collateralReleased ? vault.collateralAmount : collateralReleased,\n false\n );\n // Because we're rounding up in some divisions, `collateralReleased` can be greater than the `collateralAmount` of the vault\n // In this case, `stablecoinAmountToReceive` is still rounded up\n if (vault.collateralAmount <= collateralReleased) {\n collateralReleased = vault.collateralAmount;\n // Remove all the vault's debt (debt repayed + bad debt) from VaultManager totalDebt\n totalNormalizedDebt -= vault.normalizedDebt;\n // Reinitializing the `vaultID`: we're not burning the vault in this case for integration purposes\n delete vaultData[vaultIDs[i]];\n {\n uint256 debtReimbursed = (amounts[i] * liquidationSurcharge) / BASE_PARAMS;\n liqData.badDebtFromLiquidation += debtReimbursed < liqOpp.currentDebt\n ? liqOpp.currentDebt - debtReimbursed\n : 0;\n }\n // There may be an edge case in which: `amounts[i] = (currentDebt * BASE_PARAMS) / surcharge + 1`\n // In this case, as long as `surcharge < BASE_PARAMS`, there cannot be any underflow in the operation\n // above\n emit InternalDebtUpdated(vaultIDs[i], vault.normalizedDebt, 0);\n } else {\n vaultData[vaultIDs[i]].collateralAmount -= collateralReleased;\n _repayDebt(\n vaultIDs[i],\n (amounts[i] * liquidationSurcharge) / BASE_PARAMS,\n liqData.newInterestAccumulator\n );\n }\n liqData.collateralAmountToGive += collateralReleased;\n liqData.stablecoinAmountToReceive += amounts[i];\n }\n // Normalization of good and bad debt is already handled in the `accrueInterestToTreasury` function\n surplus += (liqData.stablecoinAmountToReceive * (BASE_PARAMS - liquidationSurcharge)) / BASE_PARAMS;\n badDebt += liqData.badDebtFromLiquidation;\n _handleRepay(liqData.collateralAmountToGive, liqData.stablecoinAmountToReceive, from, to, who, data);\n }\n\n /// @notice Internal version of the `checkLiquidation` function\n /// @dev This function takes two additional parameters as when entering this function `oracleValue`\n /// and `newInterestAccumulator` should have always been computed\n function _checkLiquidation(\n Vault memory vault,\n address liquidator,\n uint256 oracleValue,\n uint256 newInterestAccumulator\n ) internal view returns (LiquidationOpportunity memory liqOpp) {\n // Checking if the vault can be liquidated\n (uint256 healthFactor, uint256 currentDebt, uint256 collateralAmountInStable) = _isSolvent(\n vault,\n oracleValue,\n newInterestAccumulator\n );\n // Health factor of a vault that does not exist is `type(uint256).max`\n if (healthFactor >= BASE_PARAMS) revert HealthyVault();\n\n uint256 liquidationDiscount = (_computeLiquidationBoost(liquidator) * (BASE_PARAMS - healthFactor)) /\n BASE_PARAMS;\n // In fact `liquidationDiscount` is stored here as 1 minus discount to save some computation costs\n // This value is necessarily != 0 as `maxLiquidationDiscount < BASE_PARAMS`\n liquidationDiscount = liquidationDiscount >= maxLiquidationDiscount\n ? BASE_PARAMS - maxLiquidationDiscount\n : BASE_PARAMS - liquidationDiscount;\n // Same for the surcharge here: it's in fact 1 - the fee taken by the protocol\n uint256 surcharge = liquidationSurcharge;\n // Checking if we're in a situation where the health factor is an increasing or a decreasing function of the\n // amount repaid\n uint256 maxAmountToRepay;\n uint256 thresholdRepayAmount;\n // In the first case, the health factor is an increasing function of the stablecoin amount to repay,\n // this means that the liquidator can bring the vault to the target health ratio\n if (healthFactor * liquidationDiscount * surcharge >= collateralFactor * BASE_PARAMS**2) {\n // This is the max amount to repay that will bring the person to the target health factor\n // Denom is always positive when a vault gets liquidated in this case and when the health factor\n // is an increasing function of the amount of stablecoins repaid\n // And given that most parameters are in base 9, the numerator can very hardly overflow here\n maxAmountToRepay =\n ((targetHealthFactor * currentDebt - collateralAmountInStable * collateralFactor) *\n BASE_PARAMS *\n liquidationDiscount) /\n (surcharge * targetHealthFactor * liquidationDiscount - (BASE_PARAMS**2) * collateralFactor);\n // The quantity below tends to be rounded in the above direction, which means that governance or guardians should\n // set the `targetHealthFactor` accordingly\n // Need to check for the dust: liquidating should not leave a dusty amount in the vault\n if (currentDebt * BASE_PARAMS <= maxAmountToRepay * surcharge + dust * BASE_PARAMS) {\n // If liquidating to the target threshold would leave a dusty amount: the liquidator can repay all\n // We're rounding up the max amount to repay to make sure all the debt ends up being paid\n // and we're computing again the real value of the debt to avoid propagation of rounding errors\n maxAmountToRepay =\n (vault.normalizedDebt * newInterestAccumulator * BASE_PARAMS) /\n (surcharge * BASE_INTEREST) +\n 1;\n // In this case the threshold amount is such that it leaves just enough dust: amount is rounded\n // down such that if a liquidator repays this amount then there would be more than `dust` left in\n // the liquidated vault\n if (currentDebt > dust)\n thresholdRepayAmount = ((currentDebt - dust) * BASE_PARAMS) / surcharge;\n // If there is from the beginning a dusty debt (because of an implementation upgrade), then\n // liquidator should repay everything that's left\n else thresholdRepayAmount = 1;\n }\n } else {\n // In all cases the liquidator can repay stablecoins such that they'll end up getting exactly the collateral\n // in the liquidated vault\n // Rounding up to make sure all gets liquidated in this case: the liquidator will never get more than the collateral\n // amount in the vault however: we're performing the computation of the `collateralAmountInStable` again to avoid\n // propagation of rounding errors\n maxAmountToRepay =\n (vault.collateralAmount * liquidationDiscount * oracleValue) /\n (BASE_PARAMS * _collatBase) +\n 1;\n // It should however make sure not to leave a dusty amount of collateral (in stablecoin value) in the vault\n if (collateralAmountInStable > _dustCollateral)\n // There's no issue with this amount being rounded down\n thresholdRepayAmount =\n ((collateralAmountInStable - _dustCollateral) * liquidationDiscount) /\n BASE_PARAMS;\n // If there is from the beginning a dusty amount of collateral, liquidator should repay everything that's left\n else thresholdRepayAmount = 1;\n }\n liqOpp.maxStablecoinAmountToRepay = maxAmountToRepay;\n liqOpp.maxCollateralAmountGiven =\n (maxAmountToRepay * BASE_PARAMS * _collatBase) /\n (oracleValue * liquidationDiscount);\n liqOpp.thresholdRepayAmount = thresholdRepayAmount;\n liqOpp.discount = liquidationDiscount;\n liqOpp.currentDebt = currentDebt;\n }\n\n // ================================== SETTERS ==================================\n\n /// @notice Sets parameters encoded as uint64\n /// @param param Value for the parameter\n /// @param what Parameter to change\n /// @dev This function performs the required checks when updating a parameter\n /// @dev When setting parameters governance or the guardian should make sure that when `HF < CF/((1-surcharge)(1-discount))`\n /// and hence when liquidating a vault is going to decrease its health factor, `discount = max discount`.\n /// Otherwise, it may be profitable for the liquidator to liquidate in multiple times: as it will decrease\n /// the HF and therefore increase the discount between each time\n function setUint64(uint64 param, bytes32 what) external onlyGovernorOrGuardian {\n if (what == \"CF\") {\n if (param > liquidationSurcharge) revert TooHighParameterValue();\n collateralFactor = param;\n } else if (what == \"THF\") {\n if (param < BASE_PARAMS) revert TooSmallParameterValue();\n targetHealthFactor = param;\n } else if (what == \"BF\") {\n if (param > BASE_PARAMS) revert TooHighParameterValue();\n borrowFee = param;\n } else if (what == \"RF\") {\n // As liquidation surcharge is stored as `1-fee` and as we need `repayFee` to be smaller\n // then the liquidation surcharge, then we need to have:\n // `liquidationSurcharge <= BASE_PARAMS - repayFee` and as such `liquidationSurcharge + repayFee <= BASE_PARAMS`\n if (param + liquidationSurcharge > BASE_PARAMS) revert TooHighParameterValue();\n repayFee = param;\n } else if (what == \"IR\") {\n _accrue();\n interestRate = param;\n } else if (what == \"LS\") {\n if (collateralFactor > param || param + repayFee > BASE_PARAMS) revert InvalidParameterValue();\n liquidationSurcharge = param;\n } else if (what == \"MLD\") {\n if (param > BASE_PARAMS) revert TooHighParameterValue();\n maxLiquidationDiscount = param;\n } else {\n revert InvalidParameterType();\n }\n emit FiledUint64(param, what);\n }\n\n /// @notice Sets `debtCeiling`\n /// @param _debtCeiling New value for `debtCeiling`\n /// @dev `debtCeiling` should not be bigger than `type(uint256).max / 10**27` otherwise there could be overflows\n function setDebtCeiling(uint256 _debtCeiling) external onlyGovernorOrGuardian {\n debtCeiling = _debtCeiling;\n emit DebtCeilingUpdated(_debtCeiling);\n }\n\n /// @notice Sets the parameters for the liquidation booster which encodes the slope of the discount\n function setLiquidationBoostParameters(\n address _veBoostProxy,\n uint256[] memory xBoost,\n uint256[] memory yBoost\n ) external virtual onlyGovernorOrGuardian {\n if (yBoost[0] == 0) revert InvalidSetOfParameters();\n yLiquidationBoost = yBoost;\n emit LiquidationBoostParametersUpdated(_veBoostProxy, xBoost, yBoost);\n }\n\n /// @notice Pauses external permissionless functions of the contract\n function togglePause() external onlyGovernorOrGuardian {\n paused = !paused;\n }\n\n /// @notice Changes the ERC721 metadata URI\n function setBaseURI(string memory baseURI_) external onlyGovernorOrGuardian {\n _baseURI = baseURI_;\n }\n\n /// @notice Changes the whitelisting of an address\n /// @param target Address to toggle\n /// @dev If the `target` address is the zero address then this function toggles whitelisting\n /// for all addresses\n function toggleWhitelist(address target) external onlyGovernor {\n if (target != address(0)) {\n isWhitelisted[target] = 1 - isWhitelisted[target];\n } else {\n whitelistingActivated = !whitelistingActivated;\n }\n }\n\n /// @notice Changes the reference to the oracle contract used to get the price of the oracle\n /// @param _oracle Reference to the oracle contract\n function setOracle(address _oracle) external onlyGovernor {\n if (IOracle(_oracle).treasury() != treasury) revert InvalidTreasury();\n oracle = IOracle(_oracle);\n }\n\n /// @notice Sets the dust variables\n /// @param _dust New minimum debt allowed\n /// @param dustCollateral_ New minimum collateral allowed in a vault after a liquidation\n /// @dev dustCollateral_ is in stable value\n function setDusts(uint256 _dust, uint256 dustCollateral_) external onlyGovernor {\n dust = _dust;\n _dustCollateral = dustCollateral_;\n }\n\n /// @inheritdoc IVaultManagerFunctions\n function setTreasury(address _treasury) external onlyTreasury {\n treasury = ITreasury(_treasury);\n // This function makes sure to propagate the change to the associated contract\n // even though a single oracle contract could be used in different places\n oracle.setTreasury(_treasury);\n }\n\n // ============================= VIRTUAL FUNCTIONS =============================\n\n /// @notice Computes the liquidation boost of a given address, that is the slope of the discount function\n /// @return The slope of the discount function\n function _computeLiquidationBoost(address) internal view virtual returns (uint256) {\n return yLiquidationBoost[0];\n }\n\n /// @notice Hook called before any collateral internal changes\n /// @param vaultID Vault which sees its collateral amount changed\n /// @param amount Collateral amount balance of the owner of vaultID increase/decrease\n /// @param add Whether the balance should be increased/decreased\n /// @param vaultID Vault which sees its collateral amount changed\n function _checkpointCollateral(\n uint256 vaultID,\n uint256 amount,\n bool add\n ) internal virtual {}\n}\n" + }, + "contracts/vaultManager/VaultManagerPermit.sol": { + "content": "// SPDX-License-Identifier: GPL-3.0\n\npragma solidity ^0.8.12;\n\nimport \"./VaultManagerERC721.sol\";\nimport \"../interfaces/external/IERC1271.sol\";\n\n/// @title VaultManagerPermit\n/// @author Angle Labs, Inc.\n/// @dev Base Implementation of permit functions for the `VaultManager` contract\nabstract contract VaultManagerPermit is Initializable, VaultManagerERC721 {\n using Address for address;\n\n mapping(address => uint256) private _nonces;\n /* solhint-disable var-name-mixedcase */\n bytes32 private _HASHED_NAME;\n bytes32 private _HASHED_VERSION;\n bytes32 private _PERMIT_TYPEHASH;\n /* solhint-enable var-name-mixedcase */\n\n error ExpiredDeadline();\n error InvalidSignature();\n\n //solhint-disable-next-line\n function __ERC721Permit_init(string memory _name) internal onlyInitializing {\n _PERMIT_TYPEHASH = keccak256(\n \"Permit(address owner,address spender,bool approved,uint256 nonce,uint256 deadline)\"\n );\n _HASHED_NAME = keccak256(bytes(_name));\n _HASHED_VERSION = keccak256(bytes(\"1\"));\n }\n\n /// @notice Allows an address to give or revoke approval for all its vaults to another address\n /// @param owner Address signing the permit and giving (or revoking) its approval for all the controlled vaults\n /// @param spender Address to give approval to\n /// @param approved Whether to give or revoke the approval\n /// @param deadline Deadline parameter for the signature to be valid\n /// @dev The `v`, `r`, and `s` parameters are used as signature data\n function permit(\n address owner,\n address spender,\n bool approved,\n uint256 deadline,\n uint8 v,\n bytes32 r,\n bytes32 s\n ) external {\n if (block.timestamp > deadline) revert ExpiredDeadline();\n // Additional signature checks performed in the `ECDSAUpgradeable.recover` function\n if (uint256(s) > 0x7FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF5D576E7357A4501DDFE92F46681B20A0 || (v != 27 && v != 28))\n revert InvalidSignature();\n\n bytes32 digest = keccak256(\n abi.encodePacked(\n \"\\x19\\x01\",\n _domainSeparatorV4(),\n keccak256(\n abi.encode(\n _PERMIT_TYPEHASH,\n // 0x3f43a9c6bafb5c7aab4e0cfe239dc5d4c15caf0381c6104188191f78a6640bd8,\n owner,\n spender,\n approved,\n _useNonce(owner),\n deadline\n )\n )\n )\n );\n if (owner.isContract()) {\n if (IERC1271(owner).isValidSignature(digest, abi.encodePacked(r, s, v)) != 0x1626ba7e)\n revert InvalidSignature();\n } else {\n address signer = ecrecover(digest, v, r, s);\n if (signer != owner || signer == address(0)) revert InvalidSignature();\n }\n\n _setApprovalForAll(owner, spender, approved);\n }\n\n /// @notice Returns the current nonce for an `owner` address\n function nonces(address owner) public view returns (uint256) {\n return _nonces[owner];\n }\n\n /// @notice Returns the domain separator for the current chain.\n // solhint-disable-next-line func-name-mixedcase\n function DOMAIN_SEPARATOR() external view returns (bytes32) {\n return _domainSeparatorV4();\n }\n\n /// @notice Internal version of the `DOMAIN_SEPARATOR` function\n function _domainSeparatorV4() internal view returns (bytes32) {\n return\n keccak256(\n abi.encode(\n // keccak256('EIP712Domain(string name,string version,uint256 chainId,address verifyingContract)')\n 0x8b73c3c69bb8fe3d512ecc4cf759cc79239f7b179b0ffacaa9a75d522b39400f,\n _HASHED_NAME,\n _HASHED_VERSION,\n block.chainid,\n address(this)\n )\n );\n }\n\n /// @notice Consumes a nonce for an address: returns the current value and increments it\n function _useNonce(address owner) internal returns (uint256 current) {\n current = _nonces[owner];\n _nonces[owner] = current + 1;\n }\n\n uint256[49] private __gap;\n}\n" + }, + "contracts/vaultManager/VaultManagerERC721.sol": { + "content": "// SPDX-License-Identifier: GPL-3.0\n\npragma solidity ^0.8.12;\n\nimport \"./VaultManagerStorage.sol\";\n\n/// @title VaultManagerERC721\n/// @author Angle Labs, Inc.\n/// @dev Base ERC721 Implementation of VaultManager\nabstract contract VaultManagerERC721 is IERC721MetadataUpgradeable, VaultManagerStorage {\n using SafeERC20 for IERC20;\n using Address for address;\n\n /// @inheritdoc IERC721MetadataUpgradeable\n string public name;\n /// @inheritdoc IERC721MetadataUpgradeable\n string public symbol;\n\n // ================================= MODIFIERS =================================\n\n /// @notice Checks if the person interacting with the vault with `vaultID` is approved\n /// @param caller Address of the person seeking to interact with the vault\n /// @param vaultID ID of the concerned vault\n modifier onlyApprovedOrOwner(address caller, uint256 vaultID) {\n if (!_isApprovedOrOwner(caller, vaultID)) revert NotApproved();\n _;\n }\n\n // ================================ ERC721 LOGIC ===============================\n\n /// @notice Checks whether a given address is approved for a vault or owns this vault\n /// @param spender Address for which vault ownership should be checked\n /// @param vaultID ID of the vault to check\n /// @return Whether the `spender` address owns or is approved for `vaultID`\n function isApprovedOrOwner(address spender, uint256 vaultID) external view returns (bool) {\n return _isApprovedOrOwner(spender, vaultID);\n }\n\n /// @inheritdoc IERC721MetadataUpgradeable\n function tokenURI(uint256 vaultID) external view returns (string memory) {\n if (!_exists(vaultID)) revert NonexistentVault();\n // There is no vault with `vaultID` equal to 0, so the following variable is\n // always greater than zero\n uint256 temp = vaultID;\n uint256 digits;\n while (temp != 0) {\n ++digits;\n temp /= 10;\n }\n bytes memory buffer = new bytes(digits);\n while (vaultID != 0) {\n digits -= 1;\n buffer[digits] = bytes1(uint8(48 + uint256(vaultID % 10)));\n vaultID /= 10;\n }\n return bytes(_baseURI).length != 0 ? string(abi.encodePacked(_baseURI, string(buffer))) : \"\";\n }\n\n /// @inheritdoc IERC721Upgradeable\n function balanceOf(address owner) external view returns (uint256) {\n if (owner == address(0)) revert ZeroAddress();\n return _balances[owner];\n }\n\n /// @inheritdoc IERC721Upgradeable\n function ownerOf(uint256 vaultID) external view returns (address) {\n return _ownerOf(vaultID);\n }\n\n /// @inheritdoc IERC721Upgradeable\n function approve(address to, uint256 vaultID) external {\n address owner = _ownerOf(vaultID);\n if (to == owner) revert ApprovalToOwner();\n if (msg.sender != owner && !isApprovedForAll(owner, msg.sender)) revert NotApproved();\n\n _approve(to, vaultID);\n }\n\n /// @inheritdoc IERC721Upgradeable\n function getApproved(uint256 vaultID) external view returns (address) {\n if (!_exists(vaultID)) revert NonexistentVault();\n return _getApproved(vaultID);\n }\n\n /// @inheritdoc IERC721Upgradeable\n function setApprovalForAll(address operator, bool approved) external {\n _setApprovalForAll(msg.sender, operator, approved);\n }\n\n /// @inheritdoc IERC721Upgradeable\n function isApprovedForAll(address owner, address operator) public view returns (bool) {\n return _operatorApprovals[owner][operator] == 1;\n }\n\n /// @inheritdoc IERC721Upgradeable\n function transferFrom(\n address from,\n address to,\n uint256 vaultID\n ) external onlyApprovedOrOwner(msg.sender, vaultID) {\n _transfer(from, to, vaultID);\n }\n\n /// @inheritdoc IERC721Upgradeable\n function safeTransferFrom(\n address from,\n address to,\n uint256 vaultID\n ) external {\n safeTransferFrom(from, to, vaultID, \"\");\n }\n\n /// @inheritdoc IERC721Upgradeable\n function safeTransferFrom(\n address from,\n address to,\n uint256 vaultID,\n bytes memory _data\n ) public onlyApprovedOrOwner(msg.sender, vaultID) {\n _safeTransfer(from, to, vaultID, _data);\n }\n\n // ================================ ERC165 LOGIC ===============================\n\n /// @inheritdoc IERC165Upgradeable\n function supportsInterface(bytes4 interfaceId) external pure returns (bool) {\n return\n interfaceId == type(IERC721MetadataUpgradeable).interfaceId ||\n interfaceId == type(IERC721Upgradeable).interfaceId ||\n interfaceId == type(IVaultManager).interfaceId ||\n interfaceId == type(IERC165Upgradeable).interfaceId;\n }\n\n // ================== INTERNAL FUNCTIONS FOR THE ERC721 LOGIC ==================\n\n /// @notice Internal version of the `ownerOf` function\n function _ownerOf(uint256 vaultID) internal view returns (address owner) {\n owner = _owners[vaultID];\n if (owner == address(0)) revert NonexistentVault();\n }\n\n /// @notice Internal version of the `getApproved` function\n function _getApproved(uint256 vaultID) internal view returns (address) {\n return _vaultApprovals[vaultID];\n }\n\n /// @notice Internal version of the `safeTransferFrom` function (with the data parameter)\n function _safeTransfer(\n address from,\n address to,\n uint256 vaultID,\n bytes memory _data\n ) internal {\n _transfer(from, to, vaultID);\n if (!_checkOnERC721Received(from, to, vaultID, _data)) revert NonERC721Receiver();\n }\n\n /// @notice Checks whether a vault exists\n /// @param vaultID ID of the vault to check\n /// @return Whether `vaultID` has been created\n function _exists(uint256 vaultID) internal view returns (bool) {\n return _owners[vaultID] != address(0);\n }\n\n /// @notice Internal version of the `isApprovedOrOwner` function\n function _isApprovedOrOwner(address spender, uint256 vaultID) internal view returns (bool) {\n // The following checks if the vault exists\n address owner = _ownerOf(vaultID);\n return (spender == owner || _getApproved(vaultID) == spender || _operatorApprovals[owner][spender] == 1);\n }\n\n /// @notice Internal version of the `createVault` function\n /// Mints `vaultID` and transfers it to `to`\n /// @dev This method is equivalent to the `_safeMint` method used in OpenZeppelin ERC721 contract\n /// @dev Emits a {Transfer} event\n function _mint(address to) internal returns (uint256 vaultID) {\n if (whitelistingActivated && (isWhitelisted[to] != 1 || isWhitelisted[msg.sender] != 1))\n revert NotWhitelisted();\n if (to == address(0)) revert ZeroAddress();\n\n unchecked {\n vaultIDCount += 1;\n }\n\n vaultID = vaultIDCount;\n _beforeTokenTransfer(address(0), to, vaultID);\n\n unchecked {\n _balances[to] += 1;\n }\n\n _owners[vaultID] = to;\n emit Transfer(address(0), to, vaultID);\n if (!_checkOnERC721Received(address(0), to, vaultID, \"\")) revert NonERC721Receiver();\n }\n\n /// @notice Destroys `vaultID`\n /// @dev `vaultID` must exist\n /// @dev Emits a {Transfer} event\n function _burn(uint256 vaultID) internal {\n address owner = _ownerOf(vaultID);\n\n _beforeTokenTransfer(owner, address(0), vaultID);\n // Clear approvals\n _approve(address(0), vaultID);\n // The following line cannot underflow as the owner's balance is necessarily\n // greater than 1\n unchecked {\n _balances[owner] -= 1;\n }\n delete _owners[vaultID];\n delete vaultData[vaultID];\n\n emit Transfer(owner, address(0), vaultID);\n }\n\n /// @notice Transfers `vaultID` from `from` to `to` as opposed to {transferFrom},\n /// this imposes no restrictions on msg.sender\n /// @dev `to` cannot be the zero address and `perpetualID` must be owned by `from`\n /// @dev Emits a {Transfer} event\n /// @dev A whitelist check is performed if necessary on the `to` address\n function _transfer(\n address from,\n address to,\n uint256 vaultID\n ) internal {\n if (_ownerOf(vaultID) != from) revert NotApproved();\n if (to == address(0)) revert ZeroAddress();\n if (whitelistingActivated && isWhitelisted[to] != 1) revert NotWhitelisted();\n\n _beforeTokenTransfer(from, to, vaultID);\n\n // Clear approvals from the previous owner\n _approve(address(0), vaultID);\n unchecked {\n _balances[from] -= 1;\n _balances[to] += 1;\n }\n _owners[vaultID] = to;\n\n emit Transfer(from, to, vaultID);\n }\n\n /// @notice Approves `to` to operate on `vaultID`\n function _approve(address to, uint256 vaultID) internal {\n _vaultApprovals[vaultID] = to;\n emit Approval(_ownerOf(vaultID), to, vaultID);\n }\n\n /// @notice Internal version of the `setApprovalForAll` function\n /// @dev It contains an `approver` field to be used in case someone signs a permit for a particular\n /// address, and this signature is given to the contract by another address (like a router)\n function _setApprovalForAll(\n address approver,\n address operator,\n bool approved\n ) internal {\n if (operator == approver) revert ApprovalToCaller();\n uint256 approval = approved ? 1 : 0;\n _operatorApprovals[approver][operator] = approval;\n emit ApprovalForAll(approver, operator, approved);\n }\n\n /// @notice Internal function to invoke {IERC721Receiver-onERC721Received} on a target address\n /// The call is not executed if the target address is not a contract\n /// @param from Address representing the previous owner of the given token ID\n /// @param to Target address that will receive the tokens\n /// @param vaultID ID of the token to be transferred\n /// @param _data Bytes optional data to send along with the call\n /// @return Bool whether the call correctly returned the expected value\n function _checkOnERC721Received(\n address from,\n address to,\n uint256 vaultID,\n bytes memory _data\n ) private returns (bool) {\n if (to.isContract()) {\n try IERC721ReceiverUpgradeable(to).onERC721Received(msg.sender, from, vaultID, _data) returns (\n bytes4 retval\n ) {\n return retval == IERC721ReceiverUpgradeable.onERC721Received.selector;\n } catch (bytes memory reason) {\n if (reason.length == 0) {\n revert NonERC721Receiver();\n } else {\n // solhint-disable-next-line no-inline-assembly\n assembly {\n revert(add(32, reason), mload(reason))\n }\n }\n }\n } else {\n return true;\n }\n }\n\n /// @notice Hook that is called before any token transfer. This includes minting and burning.\n /// Calling conditions:\n ///\n /// - When `from` and `to` are both non-zero, `from`'s `vaultID` will be\n /// transferred to `to`.\n /// - When `from` is zero, `vaultID` will be minted for `to`.\n /// - When `to` is zero, `from`'s `vaultID` will be burned.\n /// - `from` and `to` are never both zero.\n function _beforeTokenTransfer(\n address from,\n address to,\n uint256 vaultID\n ) internal virtual {}\n}\n" + }, + "contracts/interfaces/external/IERC1271.sol": { + "content": "// SPDX-License-Identifier: GPL-2.0-or-later\npragma solidity ^0.8.12;\n\n/// @title Interface for verifying contract-based account signatures\n/// @notice Interface that verifies provided signature for the data\n/// @dev Interface defined by EIP-1271\ninterface IERC1271 {\n /// @notice Returns whether the provided signature is valid for the provided data\n /// @dev MUST return the bytes4 magic value 0x1626ba7e when function passes.\n /// MUST NOT modify state (using STATICCALL for solc < 0.5, view modifier for solc > 0.5).\n /// MUST allow external calls.\n /// @param hash Hash of the data to be signed\n /// @param signature Signature byte array associated with _data\n /// @return magicValue The bytes4 magic value 0x1626ba7e\n function isValidSignature(bytes32 hash, bytes memory signature) external view returns (bytes4 magicValue);\n}\n" + }, + "contracts/vaultManager/VaultManagerStorage.sol": { + "content": "// SPDX-License-Identifier: GPL-3.0\n\npragma solidity ^0.8.12;\n\nimport \"@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol\";\nimport \"@openzeppelin/contracts-upgradeable/token/ERC20/extensions/draft-IERC20PermitUpgradeable.sol\";\nimport \"@openzeppelin/contracts-upgradeable/token/ERC721/IERC721ReceiverUpgradeable.sol\";\nimport \"@openzeppelin/contracts-upgradeable/interfaces/IERC721MetadataUpgradeable.sol\";\nimport \"@openzeppelin/contracts-upgradeable/utils/introspection/IERC165Upgradeable.sol\";\nimport \"@openzeppelin/contracts-upgradeable/utils/AddressUpgradeable.sol\";\nimport \"@openzeppelin/contracts-upgradeable/security/ReentrancyGuardUpgradeable.sol\";\nimport \"@openzeppelin/contracts/token/ERC20/extensions/IERC20Metadata.sol\";\nimport \"@openzeppelin/contracts/token/ERC20/IERC20.sol\";\nimport \"@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol\";\n\nimport \"../interfaces/IAgToken.sol\";\nimport \"../interfaces/IOracle.sol\";\nimport \"../interfaces/ISwapper.sol\";\nimport \"../interfaces/ITreasury.sol\";\nimport \"../interfaces/IVaultManager.sol\";\nimport \"../interfaces/governance/IVeBoostProxy.sol\";\n\n/// @title VaultManagerStorage\n/// @author Angle Labs, Inc.\n/// @dev Variables, references, parameters and events needed in the `VaultManager` contract\n// solhint-disable-next-line max-states-count\ncontract VaultManagerStorage is IVaultManagerStorage, Initializable, ReentrancyGuardUpgradeable {\n /// @notice Base used for parameter computation: almost all the parameters of this contract are set in `BASE_PARAMS`\n uint256 public constant BASE_PARAMS = 10**9;\n /// @notice Base used for interest rate computation\n uint256 public constant BASE_INTEREST = 10**27;\n /// @notice Used for interest rate computation\n uint256 public constant HALF_BASE_INTEREST = 10**27 / 2;\n\n // ================================= REFERENCES ================================\n\n /// @inheritdoc IVaultManagerStorage\n ITreasury public treasury;\n /// @inheritdoc IVaultManagerStorage\n IERC20 public collateral;\n /// @inheritdoc IVaultManagerStorage\n IAgToken public stablecoin;\n /// @inheritdoc IVaultManagerStorage\n IOracle public oracle;\n /// @notice Reference to the contract which computes adjusted veANGLE balances for liquidators boosts\n IVeBoostProxy public veBoostProxy;\n /// @notice Base of the collateral\n uint256 internal _collatBase;\n\n // ================================= PARAMETERS ================================\n // Unless specified otherwise, parameters of this contract are expressed in `BASE_PARAMS`\n\n /// @notice Maximum amount of stablecoins that can be issued with this contract (in `BASE_TOKENS`). This parameter should\n /// not be bigger than `type(uint256).max / BASE_INTEREST` otherwise there may be some overflows in the `increaseDebt` function\n uint256 public debtCeiling;\n /// @notice Threshold veANGLE balance values for the computation of the boost for liquidators: the length of this array\n /// should normally be 2. The base of the x-values in this array should be `BASE_TOKENS`\n uint256[] public xLiquidationBoost;\n /// @notice Values of the liquidation boost at the threshold values of x\n uint256[] public yLiquidationBoost;\n /// @inheritdoc IVaultManagerStorage\n uint64 public collateralFactor;\n /// @notice Maximum Health factor at which a vault can end up after a liquidation (unless it's fully liquidated)\n uint64 public targetHealthFactor;\n /// @notice Upfront fee taken when borrowing stablecoins: this fee is optional and should in practice not be used\n uint64 public borrowFee;\n /// @notice Upfront fee taken when repaying stablecoins: this fee is optional as well. It should be smaller\n /// than the liquidation surcharge (cf below) to avoid exploits where people voluntarily get liquidated at a 0\n /// discount to pay smaller repaying fees\n uint64 public repayFee;\n /// @notice Per second interest taken to borrowers taking agToken loans. Contrarily to other parameters, it is set in `BASE_INTEREST`\n /// that is to say in base 10**27\n uint64 public interestRate;\n /// @notice Fee taken by the protocol during a liquidation. Technically, this value is not the fee per se, it's 1 - fee.\n /// For instance for a 2% fee, `liquidationSurcharge` should be 98%\n uint64 public liquidationSurcharge;\n /// @notice Maximum discount given to liquidators\n uint64 public maxLiquidationDiscount;\n /// @notice Whether whitelisting is required to own a vault or not\n bool public whitelistingActivated;\n /// @notice Whether the contract is paused or not\n bool public paused;\n\n // ================================= VARIABLES =================================\n\n /// @notice Timestamp at which the `interestAccumulator` was updated\n uint256 public lastInterestAccumulatorUpdated;\n /// @inheritdoc IVaultManagerStorage\n uint256 public interestAccumulator;\n /// @inheritdoc IVaultManagerStorage\n uint256 public totalNormalizedDebt;\n /// @notice Surplus accumulated by the contract: surplus is always in stablecoins, and is then reset\n /// when the value is communicated to the treasury contract\n uint256 public surplus;\n /// @notice Bad debt made from liquidated vaults which ended up having no collateral and a positive amount\n /// of stablecoins\n uint256 public badDebt;\n\n // ================================== MAPPINGS =================================\n\n /// @inheritdoc IVaultManagerStorage\n mapping(uint256 => Vault) public vaultData;\n /// @notice Maps an address to 1 if it's whitelisted and can open or own a vault\n mapping(address => uint256) public isWhitelisted;\n\n // ================================ ERC721 DATA ================================\n\n /// @inheritdoc IVaultManagerStorage\n uint256 public vaultIDCount;\n\n /// @notice URI\n string internal _baseURI;\n\n // Mapping from `vaultID` to owner address\n mapping(uint256 => address) internal _owners;\n\n // Mapping from owner address to vault owned count\n mapping(address => uint256) internal _balances;\n\n // Mapping from `vaultID` to approved address\n mapping(uint256 => address) internal _vaultApprovals;\n\n // Mapping from owner to operator approvals\n mapping(address => mapping(address => uint256)) internal _operatorApprovals;\n\n uint256[50] private __gap;\n\n // =================================== EVENTS ==================================\n\n event AccruedToTreasury(uint256 surplusEndValue, uint256 badDebtEndValue);\n event CollateralAmountUpdated(uint256 vaultID, uint256 collateralAmount, uint8 isIncrease);\n event InterestAccumulatorUpdated(uint256 value, uint256 timestamp);\n event InternalDebtUpdated(uint256 vaultID, uint256 internalAmount, uint8 isIncrease);\n event FiledUint64(uint64 param, bytes32 what);\n event DebtCeilingUpdated(uint256 debtCeiling);\n event LiquidationBoostParametersUpdated(address indexed _veBoostProxy, uint256[] xBoost, uint256[] yBoost);\n event LiquidatedVaults(uint256[] vaultIDs);\n event DebtTransferred(uint256 srcVaultID, uint256 dstVaultID, address dstVaultManager, uint256 amount);\n\n // =================================== ERRORS ==================================\n\n error ApprovalToOwner();\n error ApprovalToCaller();\n error DustyLeftoverAmount();\n error DebtCeilingExceeded();\n error HealthyVault();\n error IncompatibleLengths();\n error InsolventVault();\n error InvalidParameterValue();\n error InvalidParameterType();\n error InvalidSetOfParameters();\n error InvalidTreasury();\n error NonERC721Receiver();\n error NonexistentVault();\n error NotApproved();\n error NotGovernor();\n error NotGovernorOrGuardian();\n error NotTreasury();\n error NotWhitelisted();\n error NotVaultManager();\n error Paused();\n error TooHighParameterValue();\n error TooSmallParameterValue();\n error ZeroAddress();\n\n /// @custom:oz-upgrades-unsafe-allow constructor\n constructor() initializer {}\n}\n" + }, + "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.7.0) (proxy/utils/Initializable.sol)\n\npragma solidity ^0.8.2;\n\nimport \"../../utils/AddressUpgradeable.sol\";\n\n/**\n * @dev This is a base contract to aid in writing upgradeable contracts, or any kind of contract that will be deployed\n * behind a proxy. Since proxied contracts do not make use of a constructor, it's common to move constructor logic to an\n * external initializer function, usually called `initialize`. It then becomes necessary to protect this initializer\n * function so it can only be called once. The {initializer} modifier provided by this contract will have this effect.\n *\n * The initialization functions use a version number. Once a version number is used, it is consumed and cannot be\n * reused. This mechanism prevents re-execution of each \"step\" but allows the creation of new initialization steps in\n * case an upgrade adds a module that needs to be initialized.\n *\n * For example:\n *\n * [.hljs-theme-light.nopadding]\n * ```\n * contract MyToken is ERC20Upgradeable {\n * function initialize() initializer public {\n * __ERC20_init(\"MyToken\", \"MTK\");\n * }\n * }\n * contract MyTokenV2 is MyToken, ERC20PermitUpgradeable {\n * function initializeV2() reinitializer(2) public {\n * __ERC20Permit_init(\"MyToken\");\n * }\n * }\n * ```\n *\n * TIP: To avoid leaving the proxy in an uninitialized state, the initializer function should be called as early as\n * possible by providing the encoded function call as the `_data` argument to {ERC1967Proxy-constructor}.\n *\n * CAUTION: When used with inheritance, manual care must be taken to not invoke a parent initializer twice, or to ensure\n * that all initializers are idempotent. This is not verified automatically as constructors are by Solidity.\n *\n * [CAUTION]\n * ====\n * Avoid leaving a contract uninitialized.\n *\n * An uninitialized contract can be taken over by an attacker. This applies to both a proxy and its implementation\n * contract, which may impact the proxy. To prevent the implementation contract from being used, you should invoke\n * the {_disableInitializers} function in the constructor to automatically lock it when it is deployed:\n *\n * [.hljs-theme-light.nopadding]\n * ```\n * /// @custom:oz-upgrades-unsafe-allow constructor\n * constructor() {\n * _disableInitializers();\n * }\n * ```\n * ====\n */\nabstract contract Initializable {\n /**\n * @dev Indicates that the contract has been initialized.\n * @custom:oz-retyped-from bool\n */\n uint8 private _initialized;\n\n /**\n * @dev Indicates that the contract is in the process of being initialized.\n */\n bool private _initializing;\n\n /**\n * @dev Triggered when the contract has been initialized or reinitialized.\n */\n event Initialized(uint8 version);\n\n /**\n * @dev A modifier that defines a protected initializer function that can be invoked at most once. In its scope,\n * `onlyInitializing` functions can be used to initialize parent contracts. Equivalent to `reinitializer(1)`.\n */\n modifier initializer() {\n bool isTopLevelCall = !_initializing;\n require(\n (isTopLevelCall && _initialized < 1) || (!AddressUpgradeable.isContract(address(this)) && _initialized == 1),\n \"Initializable: contract is already initialized\"\n );\n _initialized = 1;\n if (isTopLevelCall) {\n _initializing = true;\n }\n _;\n if (isTopLevelCall) {\n _initializing = false;\n emit Initialized(1);\n }\n }\n\n /**\n * @dev A modifier that defines a protected reinitializer function that can be invoked at most once, and only if the\n * contract hasn't been initialized to a greater version before. In its scope, `onlyInitializing` functions can be\n * used to initialize parent contracts.\n *\n * `initializer` is equivalent to `reinitializer(1)`, so a reinitializer may be used after the original\n * initialization step. This is essential to configure modules that are added through upgrades and that require\n * initialization.\n *\n * Note that versions can jump in increments greater than 1; this implies that if multiple reinitializers coexist in\n * a contract, executing them in the right order is up to the developer or operator.\n */\n modifier reinitializer(uint8 version) {\n require(!_initializing && _initialized < version, \"Initializable: contract is already initialized\");\n _initialized = version;\n _initializing = true;\n _;\n _initializing = false;\n emit Initialized(version);\n }\n\n /**\n * @dev Modifier to protect an initialization function so that it can only be invoked by functions with the\n * {initializer} and {reinitializer} modifiers, directly or indirectly.\n */\n modifier onlyInitializing() {\n require(_initializing, \"Initializable: contract is not initializing\");\n _;\n }\n\n /**\n * @dev Locks the contract, preventing any future reinitialization. This cannot be part of an initializer call.\n * Calling this in the constructor of a contract will prevent that contract from being initialized or reinitialized\n * to any version. It is recommended to use this to lock implementation contracts that are designed to be called\n * through proxies.\n */\n function _disableInitializers() internal virtual {\n require(!_initializing, \"Initializable: contract is initializing\");\n if (_initialized < type(uint8).max) {\n _initialized = type(uint8).max;\n emit Initialized(type(uint8).max);\n }\n }\n}\n" + }, + "@openzeppelin/contracts-upgradeable/token/ERC20/extensions/draft-IERC20PermitUpgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (token/ERC20/extensions/draft-IERC20Permit.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Interface of the ERC20 Permit extension allowing approvals to be made via signatures, as defined in\n * https://eips.ethereum.org/EIPS/eip-2612[EIP-2612].\n *\n * Adds the {permit} method, which can be used to change an account's ERC20 allowance (see {IERC20-allowance}) by\n * presenting a message signed by the account. By not relying on {IERC20-approve}, the token holder account doesn't\n * need to send a transaction, and thus is not required to hold Ether at all.\n */\ninterface IERC20PermitUpgradeable {\n /**\n * @dev Sets `value` as the allowance of `spender` over ``owner``'s tokens,\n * given ``owner``'s signed approval.\n *\n * IMPORTANT: The same issues {IERC20-approve} has related to transaction\n * ordering also apply here.\n *\n * Emits an {Approval} event.\n *\n * Requirements:\n *\n * - `spender` cannot be the zero address.\n * - `deadline` must be a timestamp in the future.\n * - `v`, `r` and `s` must be a valid `secp256k1` signature from `owner`\n * over the EIP712-formatted function arguments.\n * - the signature must use ``owner``'s current nonce (see {nonces}).\n *\n * For more information on the signature format, see the\n * https://eips.ethereum.org/EIPS/eip-2612#specification[relevant EIP\n * section].\n */\n function permit(\n address owner,\n address spender,\n uint256 value,\n uint256 deadline,\n uint8 v,\n bytes32 r,\n bytes32 s\n ) external;\n\n /**\n * @dev Returns the current nonce for `owner`. This value must be\n * included whenever a signature is generated for {permit}.\n *\n * Every successful call to {permit} increases ``owner``'s nonce by one. This\n * prevents a signature from being used multiple times.\n */\n function nonces(address owner) external view returns (uint256);\n\n /**\n * @dev Returns the domain separator used in the encoding of the signature for {permit}, as defined by {EIP712}.\n */\n // solhint-disable-next-line func-name-mixedcase\n function DOMAIN_SEPARATOR() external view returns (bytes32);\n}\n" + }, + "@openzeppelin/contracts-upgradeable/token/ERC721/IERC721ReceiverUpgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.6.0) (token/ERC721/IERC721Receiver.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @title ERC721 token receiver interface\n * @dev Interface for any contract that wants to support safeTransfers\n * from ERC721 asset contracts.\n */\ninterface IERC721ReceiverUpgradeable {\n /**\n * @dev Whenever an {IERC721} `tokenId` token is transferred to this contract via {IERC721-safeTransferFrom}\n * by `operator` from `from`, this function is called.\n *\n * It must return its Solidity selector to confirm the token transfer.\n * If any other value is returned or the interface is not implemented by the recipient, the transfer will be reverted.\n *\n * The selector can be obtained in Solidity with `IERC721Receiver.onERC721Received.selector`.\n */\n function onERC721Received(\n address operator,\n address from,\n uint256 tokenId,\n bytes calldata data\n ) external returns (bytes4);\n}\n" + }, + "@openzeppelin/contracts-upgradeable/interfaces/IERC721MetadataUpgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (interfaces/IERC721Metadata.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../token/ERC721/extensions/IERC721MetadataUpgradeable.sol\";\n" + }, + "@openzeppelin/contracts-upgradeable/utils/introspection/IERC165Upgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (utils/introspection/IERC165.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Interface of the ERC165 standard, as defined in the\n * https://eips.ethereum.org/EIPS/eip-165[EIP].\n *\n * Implementers can declare support of contract interfaces, which can then be\n * queried by others ({ERC165Checker}).\n *\n * For an implementation, see {ERC165}.\n */\ninterface IERC165Upgradeable {\n /**\n * @dev Returns true if this contract implements the interface defined by\n * `interfaceId`. See the corresponding\n * https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section]\n * to learn more about how these ids are created.\n *\n * This function call must use less than 30 000 gas.\n */\n function supportsInterface(bytes4 interfaceId) external view returns (bool);\n}\n" + }, + "@openzeppelin/contracts-upgradeable/utils/AddressUpgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.7.0) (utils/Address.sol)\n\npragma solidity ^0.8.1;\n\n/**\n * @dev Collection of functions related to the address type\n */\nlibrary AddressUpgradeable {\n /**\n * @dev Returns true if `account` is a contract.\n *\n * [IMPORTANT]\n * ====\n * It is unsafe to assume that an address for which this function returns\n * false is an externally-owned account (EOA) and not a contract.\n *\n * Among others, `isContract` will return false for the following\n * types of addresses:\n *\n * - an externally-owned account\n * - a contract in construction\n * - an address where a contract will be created\n * - an address where a contract lived, but was destroyed\n * ====\n *\n * [IMPORTANT]\n * ====\n * You shouldn't rely on `isContract` to protect against flash loan attacks!\n *\n * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets\n * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract\n * constructor.\n * ====\n */\n function isContract(address account) internal view returns (bool) {\n // This method relies on extcodesize/address.code.length, which returns 0\n // for contracts in construction, since the code is only stored at the end\n // of the constructor execution.\n\n return account.code.length > 0;\n }\n\n /**\n * @dev Replacement for Solidity's `transfer`: sends `amount` wei to\n * `recipient`, forwarding all available gas and reverting on errors.\n *\n * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost\n * of certain opcodes, possibly making contracts go over the 2300 gas limit\n * imposed by `transfer`, making them unable to receive funds via\n * `transfer`. {sendValue} removes this limitation.\n *\n * https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more].\n *\n * IMPORTANT: because control is transferred to `recipient`, care must be\n * taken to not create reentrancy vulnerabilities. Consider using\n * {ReentrancyGuard} or the\n * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].\n */\n function sendValue(address payable recipient, uint256 amount) internal {\n require(address(this).balance >= amount, \"Address: insufficient balance\");\n\n (bool success, ) = recipient.call{value: amount}(\"\");\n require(success, \"Address: unable to send value, recipient may have reverted\");\n }\n\n /**\n * @dev Performs a Solidity function call using a low level `call`. A\n * plain `call` is an unsafe replacement for a function call: use this\n * function instead.\n *\n * If `target` reverts with a revert reason, it is bubbled up by this\n * function (like regular Solidity function calls).\n *\n * Returns the raw returned data. To convert to the expected return value,\n * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].\n *\n * Requirements:\n *\n * - `target` must be a contract.\n * - calling `target` with `data` must not revert.\n *\n * _Available since v3.1._\n */\n function functionCall(address target, bytes memory data) internal returns (bytes memory) {\n return functionCall(target, data, \"Address: low-level call failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with\n * `errorMessage` as a fallback revert reason when `target` reverts.\n *\n * _Available since v3.1._\n */\n function functionCall(\n address target,\n bytes memory data,\n string memory errorMessage\n ) internal returns (bytes memory) {\n return functionCallWithValue(target, data, 0, errorMessage);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but also transferring `value` wei to `target`.\n *\n * Requirements:\n *\n * - the calling contract must have an ETH balance of at least `value`.\n * - the called Solidity function must be `payable`.\n *\n * _Available since v3.1._\n */\n function functionCallWithValue(\n address target,\n bytes memory data,\n uint256 value\n ) internal returns (bytes memory) {\n return functionCallWithValue(target, data, value, \"Address: low-level call with value failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but\n * with `errorMessage` as a fallback revert reason when `target` reverts.\n *\n * _Available since v3.1._\n */\n function functionCallWithValue(\n address target,\n bytes memory data,\n uint256 value,\n string memory errorMessage\n ) internal returns (bytes memory) {\n require(address(this).balance >= value, \"Address: insufficient balance for call\");\n require(isContract(target), \"Address: call to non-contract\");\n\n (bool success, bytes memory returndata) = target.call{value: value}(data);\n return verifyCallResult(success, returndata, errorMessage);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but performing a static call.\n *\n * _Available since v3.3._\n */\n function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {\n return functionStaticCall(target, data, \"Address: low-level static call failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\n * but performing a static call.\n *\n * _Available since v3.3._\n */\n function functionStaticCall(\n address target,\n bytes memory data,\n string memory errorMessage\n ) internal view returns (bytes memory) {\n require(isContract(target), \"Address: static call to non-contract\");\n\n (bool success, bytes memory returndata) = target.staticcall(data);\n return verifyCallResult(success, returndata, errorMessage);\n }\n\n /**\n * @dev Tool to verifies that a low level call was successful, and revert if it wasn't, either by bubbling the\n * revert reason using the provided one.\n *\n * _Available since v4.3._\n */\n function verifyCallResult(\n bool success,\n bytes memory returndata,\n string memory errorMessage\n ) internal pure returns (bytes memory) {\n if (success) {\n return returndata;\n } else {\n // Look for revert reason and bubble it up if present\n if (returndata.length > 0) {\n // The easiest way to bubble the revert reason is using memory via assembly\n /// @solidity memory-safe-assembly\n assembly {\n let returndata_size := mload(returndata)\n revert(add(32, returndata), returndata_size)\n }\n } else {\n revert(errorMessage);\n }\n }\n }\n}\n" + }, + "@openzeppelin/contracts-upgradeable/security/ReentrancyGuardUpgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (security/ReentrancyGuard.sol)\n\npragma solidity ^0.8.0;\nimport \"../proxy/utils/Initializable.sol\";\n\n/**\n * @dev Contract module that helps prevent reentrant calls to a function.\n *\n * Inheriting from `ReentrancyGuard` will make the {nonReentrant} modifier\n * available, which can be applied to functions to make sure there are no nested\n * (reentrant) calls to them.\n *\n * Note that because there is a single `nonReentrant` guard, functions marked as\n * `nonReentrant` may not call one another. This can be worked around by making\n * those functions `private`, and then adding `external` `nonReentrant` entry\n * points to them.\n *\n * TIP: If you would like to learn more about reentrancy and alternative ways\n * to protect against it, check out our blog post\n * https://blog.openzeppelin.com/reentrancy-after-istanbul/[Reentrancy After Istanbul].\n */\nabstract contract ReentrancyGuardUpgradeable is Initializable {\n // Booleans are more expensive than uint256 or any type that takes up a full\n // word because each write operation emits an extra SLOAD to first read the\n // slot's contents, replace the bits taken up by the boolean, and then write\n // back. This is the compiler's defense against contract upgrades and\n // pointer aliasing, and it cannot be disabled.\n\n // The values being non-zero value makes deployment a bit more expensive,\n // but in exchange the refund on every call to nonReentrant will be lower in\n // amount. Since refunds are capped to a percentage of the total\n // transaction's gas, it is best to keep them low in cases like this one, to\n // increase the likelihood of the full refund coming into effect.\n uint256 private constant _NOT_ENTERED = 1;\n uint256 private constant _ENTERED = 2;\n\n uint256 private _status;\n\n function __ReentrancyGuard_init() internal onlyInitializing {\n __ReentrancyGuard_init_unchained();\n }\n\n function __ReentrancyGuard_init_unchained() internal onlyInitializing {\n _status = _NOT_ENTERED;\n }\n\n /**\n * @dev Prevents a contract from calling itself, directly or indirectly.\n * Calling a `nonReentrant` function from another `nonReentrant`\n * function is not supported. It is possible to prevent this from happening\n * by making the `nonReentrant` function external, and making it call a\n * `private` function that does the actual work.\n */\n modifier nonReentrant() {\n // On the first call to nonReentrant, _notEntered will be true\n require(_status != _ENTERED, \"ReentrancyGuard: reentrant call\");\n\n // Any calls to nonReentrant after this point will fail\n _status = _ENTERED;\n\n _;\n\n // By storing the original value once again, a refund is triggered (see\n // https://eips.ethereum.org/EIPS/eip-2200)\n _status = _NOT_ENTERED;\n }\n\n /**\n * @dev This empty reserved space is put in place to allow future versions to add new\n * variables without shifting down storage in the inheritance chain.\n * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps\n */\n uint256[49] private __gap;\n}\n" + }, + "@openzeppelin/contracts/token/ERC20/extensions/IERC20Metadata.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (token/ERC20/extensions/IERC20Metadata.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../IERC20.sol\";\n\n/**\n * @dev Interface for the optional metadata functions from the ERC20 standard.\n *\n * _Available since v4.1._\n */\ninterface IERC20Metadata is IERC20 {\n /**\n * @dev Returns the name of the token.\n */\n function name() external view returns (string memory);\n\n /**\n * @dev Returns the symbol of the token.\n */\n function symbol() external view returns (string memory);\n\n /**\n * @dev Returns the decimals places of the token.\n */\n function decimals() external view returns (uint8);\n}\n" + }, + "@openzeppelin/contracts/token/ERC20/IERC20.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.6.0) (token/ERC20/IERC20.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Interface of the ERC20 standard as defined in the EIP.\n */\ninterface IERC20 {\n /**\n * @dev Emitted when `value` tokens are moved from one account (`from`) to\n * another (`to`).\n *\n * Note that `value` may be zero.\n */\n event Transfer(address indexed from, address indexed to, uint256 value);\n\n /**\n * @dev Emitted when the allowance of a `spender` for an `owner` is set by\n * a call to {approve}. `value` is the new allowance.\n */\n event Approval(address indexed owner, address indexed spender, uint256 value);\n\n /**\n * @dev Returns the amount of tokens in existence.\n */\n function totalSupply() external view returns (uint256);\n\n /**\n * @dev Returns the amount of tokens owned by `account`.\n */\n function balanceOf(address account) external view returns (uint256);\n\n /**\n * @dev Moves `amount` tokens from the caller's account to `to`.\n *\n * Returns a boolean value indicating whether the operation succeeded.\n *\n * Emits a {Transfer} event.\n */\n function transfer(address to, uint256 amount) external returns (bool);\n\n /**\n * @dev Returns the remaining number of tokens that `spender` will be\n * allowed to spend on behalf of `owner` through {transferFrom}. This is\n * zero by default.\n *\n * This value changes when {approve} or {transferFrom} are called.\n */\n function allowance(address owner, address spender) external view returns (uint256);\n\n /**\n * @dev Sets `amount` as the allowance of `spender` over the caller's tokens.\n *\n * Returns a boolean value indicating whether the operation succeeded.\n *\n * IMPORTANT: Beware that changing an allowance with this method brings the risk\n * that someone may use both the old and the new allowance by unfortunate\n * transaction ordering. One possible solution to mitigate this race\n * condition is to first reduce the spender's allowance to 0 and set the\n * desired value afterwards:\n * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729\n *\n * Emits an {Approval} event.\n */\n function approve(address spender, uint256 amount) external returns (bool);\n\n /**\n * @dev Moves `amount` tokens from `from` to `to` using the\n * allowance mechanism. `amount` is then deducted from the caller's\n * allowance.\n *\n * Returns a boolean value indicating whether the operation succeeded.\n *\n * Emits a {Transfer} event.\n */\n function transferFrom(\n address from,\n address to,\n uint256 amount\n ) external returns (bool);\n}\n" + }, + "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.7.0) (token/ERC20/utils/SafeERC20.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../IERC20.sol\";\nimport \"../extensions/draft-IERC20Permit.sol\";\nimport \"../../../utils/Address.sol\";\n\n/**\n * @title SafeERC20\n * @dev Wrappers around ERC20 operations that throw on failure (when the token\n * contract returns false). Tokens that return no value (and instead revert or\n * throw on failure) are also supported, non-reverting calls are assumed to be\n * successful.\n * To use this library you can add a `using SafeERC20 for IERC20;` statement to your contract,\n * which allows you to call the safe operations as `token.safeTransfer(...)`, etc.\n */\nlibrary SafeERC20 {\n using Address for address;\n\n function safeTransfer(\n IERC20 token,\n address to,\n uint256 value\n ) internal {\n _callOptionalReturn(token, abi.encodeWithSelector(token.transfer.selector, to, value));\n }\n\n function safeTransferFrom(\n IERC20 token,\n address from,\n address to,\n uint256 value\n ) internal {\n _callOptionalReturn(token, abi.encodeWithSelector(token.transferFrom.selector, from, to, value));\n }\n\n /**\n * @dev Deprecated. This function has issues similar to the ones found in\n * {IERC20-approve}, and its usage is discouraged.\n *\n * Whenever possible, use {safeIncreaseAllowance} and\n * {safeDecreaseAllowance} instead.\n */\n function safeApprove(\n IERC20 token,\n address spender,\n uint256 value\n ) internal {\n // safeApprove should only be called when setting an initial allowance,\n // or when resetting it to zero. To increase and decrease it, use\n // 'safeIncreaseAllowance' and 'safeDecreaseAllowance'\n require(\n (value == 0) || (token.allowance(address(this), spender) == 0),\n \"SafeERC20: approve from non-zero to non-zero allowance\"\n );\n _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, value));\n }\n\n function safeIncreaseAllowance(\n IERC20 token,\n address spender,\n uint256 value\n ) internal {\n uint256 newAllowance = token.allowance(address(this), spender) + value;\n _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));\n }\n\n function safeDecreaseAllowance(\n IERC20 token,\n address spender,\n uint256 value\n ) internal {\n unchecked {\n uint256 oldAllowance = token.allowance(address(this), spender);\n require(oldAllowance >= value, \"SafeERC20: decreased allowance below zero\");\n uint256 newAllowance = oldAllowance - value;\n _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));\n }\n }\n\n function safePermit(\n IERC20Permit token,\n address owner,\n address spender,\n uint256 value,\n uint256 deadline,\n uint8 v,\n bytes32 r,\n bytes32 s\n ) internal {\n uint256 nonceBefore = token.nonces(owner);\n token.permit(owner, spender, value, deadline, v, r, s);\n uint256 nonceAfter = token.nonces(owner);\n require(nonceAfter == nonceBefore + 1, \"SafeERC20: permit did not succeed\");\n }\n\n /**\n * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement\n * on the return value: the return value is optional (but if data is returned, it must not be false).\n * @param token The token targeted by the call.\n * @param data The call data (encoded using abi.encode or one of its variants).\n */\n function _callOptionalReturn(IERC20 token, bytes memory data) private {\n // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since\n // we're implementing it ourselves. We use {Address.functionCall} to perform this call, which verifies that\n // the target address contains contract code and also asserts for success in the low-level call.\n\n bytes memory returndata = address(token).functionCall(data, \"SafeERC20: low-level call failed\");\n if (returndata.length > 0) {\n // Return data is optional\n require(abi.decode(returndata, (bool)), \"SafeERC20: ERC20 operation did not succeed\");\n }\n }\n}\n" + }, + "contracts/interfaces/IAgToken.sol": { + "content": "// SPDX-License-Identifier: GPL-3.0\n\npragma solidity ^0.8.12;\n\nimport \"@openzeppelin/contracts-upgradeable/token/ERC20/IERC20Upgradeable.sol\";\n\n/// @title IAgToken\n/// @author Angle Labs, Inc.\n/// @notice Interface for the stablecoins `AgToken` contracts\n/// @dev This interface only contains functions of the `AgToken` contract which are called by other contracts\n/// of this module or of the first module of the Angle Protocol\ninterface IAgToken is IERC20Upgradeable {\n // ======================= Minter Role Only Functions ===========================\n\n /// @notice Lets the `StableMaster` contract or another whitelisted contract mint agTokens\n /// @param account Address to mint to\n /// @param amount Amount to mint\n /// @dev The contracts allowed to issue agTokens are the `StableMaster` contract, `VaultManager` contracts\n /// associated to this stablecoin as well as the flash loan module (if activated) and potentially contracts\n /// whitelisted by governance\n function mint(address account, uint256 amount) external;\n\n /// @notice Burns `amount` tokens from a `burner` address after being asked to by `sender`\n /// @param amount Amount of tokens to burn\n /// @param burner Address to burn from\n /// @param sender Address which requested the burn from `burner`\n /// @dev This method is to be called by a contract with the minter right after being requested\n /// to do so by a `sender` address willing to burn tokens from another `burner` address\n /// @dev The method checks the allowance between the `sender` and the `burner`\n function burnFrom(\n uint256 amount,\n address burner,\n address sender\n ) external;\n\n /// @notice Burns `amount` tokens from a `burner` address\n /// @param amount Amount of tokens to burn\n /// @param burner Address to burn from\n /// @dev This method is to be called by a contract with a minter right on the AgToken after being\n /// requested to do so by an address willing to burn tokens from its address\n function burnSelf(uint256 amount, address burner) external;\n\n // ========================= Treasury Only Functions ===========================\n\n /// @notice Adds a minter in the contract\n /// @param minter Minter address to add\n /// @dev Zero address checks are performed directly in the `Treasury` contract\n function addMinter(address minter) external;\n\n /// @notice Removes a minter from the contract\n /// @param minter Minter address to remove\n /// @dev This function can also be called by a minter wishing to revoke itself\n function removeMinter(address minter) external;\n\n /// @notice Sets a new treasury contract\n /// @param _treasury New treasury address\n function setTreasury(address _treasury) external;\n\n // ========================= External functions ================================\n\n /// @notice Checks whether an address has the right to mint agTokens\n /// @param minter Address for which the minting right should be checked\n /// @return Whether the address has the right to mint agTokens or not\n function isMinter(address minter) external view returns (bool);\n}\n" + }, + "contracts/interfaces/IOracle.sol": { + "content": "// SPDX-License-Identifier: GPL-3.0\n\npragma solidity ^0.8.12;\n\nimport \"./ITreasury.sol\";\n\n/// @title IOracle\n/// @author Angle Labs, Inc.\n/// @notice Interface for the `Oracle` contract\n/// @dev This interface only contains functions of the contract which are called by other contracts\n/// of this module\ninterface IOracle {\n /// @notice Reads the rate from the Chainlink circuit and other data provided\n /// @return quoteAmount The current rate between the in-currency and out-currency in the base\n /// of the out currency\n /// @dev For instance if the out currency is EUR (and hence agEUR), then the base of the returned\n /// value is 10**18\n function read() external view returns (uint256);\n\n /// @notice Changes the treasury contract\n /// @param _treasury Address of the new treasury contract\n /// @dev This function can be called by an approved `VaultManager` contract which can call\n /// this function after being requested to do so by a `treasury` contract\n /// @dev In some situations (like reactor contracts), the `VaultManager` may not directly be linked\n /// to the `oracle` contract and as such we may need governors to be able to call this function as well\n function setTreasury(address _treasury) external;\n\n /// @notice Reference to the `treasury` contract handling this `VaultManager`\n function treasury() external view returns (ITreasury treasury);\n}\n" + }, + "contracts/interfaces/ISwapper.sol": { + "content": "// SPDX-License-Identifier: GPL-3.0\n\npragma solidity ^0.8.12;\n\nimport \"@openzeppelin/contracts/token/ERC20/IERC20.sol\";\n\n/// @title ISwapper\n/// @author Angle Labs, Inc.\n/// @notice Interface for Swapper contracts\n/// @dev This interface defines the key functions `Swapper` contracts should have when interacting with\n/// Angle\ninterface ISwapper {\n /// @notice Notifies a contract that an address should be given `outToken` from `inToken`\n /// @param inToken Address of the token received\n /// @param outToken Address of the token to obtain\n /// @param outTokenRecipient Address to which the outToken should be sent\n /// @param outTokenOwed Minimum amount of outToken the `outTokenRecipient` address should have at the end of the call\n /// @param inTokenObtained Amount of collateral obtained by a related address prior\n /// to the call to this function\n /// @param data Extra data needed (to encode Uniswap swaps for instance)\n function swap(\n IERC20 inToken,\n IERC20 outToken,\n address outTokenRecipient,\n uint256 outTokenOwed,\n uint256 inTokenObtained,\n bytes calldata data\n ) external;\n}\n" + }, + "contracts/interfaces/ITreasury.sol": { + "content": "// SPDX-License-Identifier: GPL-3.0\n\npragma solidity ^0.8.12;\n\nimport \"./IAgToken.sol\";\nimport \"./ICoreBorrow.sol\";\nimport \"./IFlashAngle.sol\";\n\n/// @title ITreasury\n/// @author Angle Labs, Inc.\n/// @notice Interface for the `Treasury` contract\n/// @dev This interface only contains functions of the `Treasury` which are called by other contracts\n/// of this module\ninterface ITreasury {\n /// @notice Stablecoin handled by this `treasury` contract\n function stablecoin() external view returns (IAgToken);\n\n /// @notice Checks whether a given address has the governor role\n /// @param admin Address to check\n /// @return Whether the address has the governor role\n /// @dev Access control is only kept in the `CoreBorrow` contract\n function isGovernor(address admin) external view returns (bool);\n\n /// @notice Checks whether a given address has the guardian or the governor role\n /// @param admin Address to check\n /// @return Whether the address has the guardian or the governor role\n /// @dev Access control is only kept in the `CoreBorrow` contract which means that this function\n /// queries the `CoreBorrow` contract\n function isGovernorOrGuardian(address admin) external view returns (bool);\n\n /// @notice Checks whether a given address has well been initialized in this contract\n /// as a `VaultManager`\n /// @param _vaultManager Address to check\n /// @return Whether the address has been initialized or not\n function isVaultManager(address _vaultManager) external view returns (bool);\n\n /// @notice Sets a new flash loan module for this stablecoin\n /// @param _flashLoanModule Reference to the new flash loan module\n /// @dev This function removes the minting right to the old flash loan module and grants\n /// it to the new module\n function setFlashLoanModule(address _flashLoanModule) external;\n}\n" + }, + "contracts/interfaces/IVaultManager.sol": { + "content": "// SPDX-License-Identifier: GPL-3.0\n\npragma solidity ^0.8.12;\n\nimport \"@openzeppelin/contracts/interfaces/IERC721Metadata.sol\";\nimport \"@openzeppelin/contracts/token/ERC20/IERC20.sol\";\nimport \"./ITreasury.sol\";\nimport \"./IOracle.sol\";\n\n// ========================= Key Structs and Enums =============================\n\n/// @notice Parameters associated to a given `VaultManager` contract: these all correspond\n/// to parameters which signification is detailed in the `VaultManagerStorage` file\nstruct VaultParameters {\n uint256 debtCeiling;\n uint64 collateralFactor;\n uint64 targetHealthFactor;\n uint64 interestRate;\n uint64 liquidationSurcharge;\n uint64 maxLiquidationDiscount;\n bool whitelistingActivated;\n uint256 baseBoost;\n}\n\n/// @notice Data stored to track someone's loan (or equivalently called position)\nstruct Vault {\n // Amount of collateral deposited in the vault, in collateral decimals. For example, if the collateral\n // is USDC with 6 decimals, then `collateralAmount` will be in base 10**6\n uint256 collateralAmount;\n // Normalized value of the debt (that is to say of the stablecoins borrowed). It is expressed\n // in the base of Angle stablecoins (i.e. `BASE_TOKENS = 10**18`)\n uint256 normalizedDebt;\n}\n\n/// @notice For a given `vaultID`, this encodes a liquidation opportunity that is to say details about the maximum\n/// amount that could be repaid by liquidating the position\n/// @dev All the values are null in the case of a vault which cannot be liquidated under these conditions\nstruct LiquidationOpportunity {\n // Maximum stablecoin amount that can be repaid upon liquidating the vault\n uint256 maxStablecoinAmountToRepay;\n // Collateral amount given to the person in the case where the maximum amount to repay is given\n uint256 maxCollateralAmountGiven;\n // Threshold value of stablecoin amount to repay: it is ok for a liquidator to repay below threshold,\n // but if this threshold is non null and the liquidator wants to repay more than threshold, it should repay\n // the max stablecoin amount given in this vault\n uint256 thresholdRepayAmount;\n // Discount proposed to the liquidator on the collateral\n uint256 discount;\n // Amount of debt in the vault\n uint256 currentDebt;\n}\n\n/// @notice Data stored during a liquidation process to keep in memory what's due to a liquidator and some\n/// essential data for vaults being liquidated\nstruct LiquidatorData {\n // Current amount of stablecoins the liquidator should give to the contract\n uint256 stablecoinAmountToReceive;\n // Current amount of collateral the contract should give to the liquidator\n uint256 collateralAmountToGive;\n // Bad debt accrued across the liquidation process\n uint256 badDebtFromLiquidation;\n // Oracle value (in stablecoin base) at the time of the liquidation\n uint256 oracleValue;\n // Value of the `interestAccumulator` at the time of the call\n uint256 newInterestAccumulator;\n}\n\n/// @notice Data to track during a series of action the amount to give or receive in stablecoins and collateral\n/// to the caller or associated addresses\nstruct PaymentData {\n // Stablecoin amount the contract should give\n uint256 stablecoinAmountToGive;\n // Stablecoin amount owed to the contract\n uint256 stablecoinAmountToReceive;\n // Collateral amount the contract should give\n uint256 collateralAmountToGive;\n // Collateral amount owed to the contract\n uint256 collateralAmountToReceive;\n}\n\n/// @notice Actions possible when composing calls to the different entry functions proposed\nenum ActionType {\n createVault,\n closeVault,\n addCollateral,\n removeCollateral,\n repayDebt,\n borrow,\n getDebtIn,\n permit\n}\n\n// ========================= Interfaces =============================\n\n/// @title IVaultManagerFunctions\n/// @author Angle Labs, Inc.\n/// @notice Interface for the `VaultManager` contract\n/// @dev This interface only contains functions of the contract which are called by other contracts\n/// of this module (without getters)\ninterface IVaultManagerFunctions {\n /// @notice Accrues interest accumulated across all vaults to the surplus and sends the surplus to the treasury\n /// @return surplusValue Value of the surplus communicated to the `Treasury`\n /// @return badDebtValue Value of the bad debt communicated to the `Treasury`\n /// @dev `surplus` and `badDebt` should be reset to 0 once their current value have been given to the `treasury` contract\n function accrueInterestToTreasury() external returns (uint256 surplusValue, uint256 badDebtValue);\n\n /// @notice Removes debt from a vault after being requested to do so by another `VaultManager` contract\n /// @param vaultID ID of the vault to remove debt from\n /// @param amountStablecoins Amount of stablecoins to remove from the debt: this amount is to be converted to an\n /// internal debt amount\n /// @param senderBorrowFee Borrowing fees from the contract which requested this: this is to make sure that people are not\n /// arbitraging difference in minting fees\n /// @param senderRepayFee Repay fees from the contract which requested this: this is to make sure that people are not arbitraging\n /// differences in repay fees\n /// @dev This function can only be called from a vaultManager registered in the same Treasury\n function getDebtOut(\n uint256 vaultID,\n uint256 amountStablecoins,\n uint256 senderBorrowFee,\n uint256 senderRepayFee\n ) external;\n\n /// @notice Gets the current debt of a vault\n /// @param vaultID ID of the vault to check\n /// @return Debt of the vault\n function getVaultDebt(uint256 vaultID) external view returns (uint256);\n\n /// @notice Gets the total debt across all vaults\n /// @return Total debt across all vaults, taking into account the interest accumulated\n /// over time\n function getTotalDebt() external view returns (uint256);\n\n /// @notice Sets the treasury contract\n /// @param _treasury New treasury contract\n /// @dev All required checks when setting up a treasury contract are performed in the contract\n /// calling this function\n function setTreasury(address _treasury) external;\n\n /// @notice Creates a vault\n /// @param toVault Address for which the va\n /// @return vaultID ID of the vault created\n /// @dev This function just creates the vault without doing any collateral or\n function createVault(address toVault) external returns (uint256);\n\n /// @notice Allows composability between calls to the different entry points of this module. Any user calling\n /// this function can perform any of the allowed actions in the order of their choice\n /// @param actions Set of actions to perform\n /// @param datas Data to be decoded for each action: it can include like the `vaultID` or the `stablecoinAmount` to borrow\n /// @param from Address from which stablecoins will be taken if one action includes burning stablecoins. This address\n /// should either be the `msg.sender` or be approved by the latter\n /// @param to Address to which stablecoins and/or collateral will be sent in case of\n /// @param who Address of the contract to handle in case of repayment of stablecoins from received collateral\n /// @param repayData Data to pass to the repayment contract in case of\n /// @return paymentData Struct containing the accounting changes from the protocol's perspective (like how much of collateral\n /// or how much has been received). Note that the values in the struct are not aggregated and you could have in the output\n /// a positive amount of stablecoins to receive as well as a positive amount of stablecoins to give\n /// @dev This function is optimized to reduce gas cost due to payment from or to the user and that expensive calls\n /// or computations (like `oracleValue`) are done only once\n /// @dev When specifying `vaultID` in `data`, it is important to know that if you specify `vaultID = 0`, it will simply\n /// use the latest `vaultID`. This is the default behavior, and unless you're engaging into some complex protocol actions\n /// it is encouraged to use `vaultID = 0` only when the first action of the batch is `createVault`\n function angle(\n ActionType[] memory actions,\n bytes[] memory datas,\n address from,\n address to,\n address who,\n bytes memory repayData\n ) external returns (PaymentData memory paymentData);\n\n /// @notice This function is a wrapper built on top of the function above. It enables users to interact with the contract\n /// without having to provide `who` and `repayData` parameters\n function angle(\n ActionType[] memory actions,\n bytes[] memory datas,\n address from,\n address to\n ) external returns (PaymentData memory paymentData);\n\n /// @notice Initializes the `VaultManager` contract\n /// @param _treasury Treasury address handling the contract\n /// @param _collateral Collateral supported by this contract\n /// @param _oracle Oracle contract used\n /// @param _symbol Symbol used to define the `VaultManager` name and symbol\n /// @dev The parameters and the oracle are the only elements which could be modified once the\n /// contract has been initialized\n /// @dev For the contract to be fully initialized, governance needs to set the parameters for the liquidation\n /// boost\n function initialize(\n ITreasury _treasury,\n IERC20 _collateral,\n IOracle _oracle,\n VaultParameters calldata params,\n string memory _symbol\n ) external;\n\n /// @notice Minimum amount of debt a vault can have, expressed in `BASE_TOKENS` that is to say the base of the agTokens\n function dust() external view returns (uint256);\n}\n\n/// @title IVaultManagerStorage\n/// @author Angle Labs, Inc.\n/// @notice Interface for the `VaultManager` contract\n/// @dev This interface contains getters of the contract's public variables used by other contracts\n/// of this module\ninterface IVaultManagerStorage {\n /// @notice Encodes the maximum ratio stablecoin/collateral a vault can have before being liquidated. It's what\n /// determines the minimum collateral ratio of a position\n function collateralFactor() external view returns (uint64);\n\n /// @notice Stablecoin handled by this contract. Another `VaultManager` contract could have\n /// the same rights as this `VaultManager` on the stablecoin contract\n function stablecoin() external view returns (IAgToken);\n\n /// @notice Reference to the `treasury` contract handling this `VaultManager`\n function treasury() external view returns (ITreasury);\n\n /// @notice Oracle contract to get access to the price of the collateral with respect to the stablecoin\n function oracle() external view returns (IOracle);\n\n /// @notice The `interestAccumulator` variable keeps track of the interest that should accrue to the protocol.\n /// The stored value is not necessarily the true value: this one is recomputed every time an action takes place\n /// within the protocol. It is in base `BASE_INTEREST`\n function interestAccumulator() external view returns (uint256);\n\n /// @notice Reference to the collateral handled by this `VaultManager`\n function collateral() external view returns (IERC20);\n\n /// @notice Total normalized amount of stablecoins borrowed, not taking into account the potential bad debt accumulated\n /// This value is expressed in the base of Angle stablecoins (`BASE_TOKENS = 10**18`)\n function totalNormalizedDebt() external view returns (uint256);\n\n /// @notice Maximum amount of stablecoins that can be issued with this contract. It is expressed in `BASE_TOKENS`\n function debtCeiling() external view returns (uint256);\n\n /// @notice Maps a `vaultID` to its data (namely collateral amount and normalized debt)\n function vaultData(uint256 vaultID) external view returns (uint256 collateralAmount, uint256 normalizedDebt);\n\n /// @notice ID of the last vault created. The `vaultIDCount` variables serves as a counter to generate a unique\n /// `vaultID` for each vault: it is like `tokenID` in basic ERC721 contracts\n function vaultIDCount() external view returns (uint256);\n}\n\n/// @title IVaultManager\n/// @author Angle Labs, Inc.\n/// @notice Interface for the `VaultManager` contract\ninterface IVaultManager is IVaultManagerFunctions, IVaultManagerStorage, IERC721Metadata {\n function isApprovedOrOwner(address spender, uint256 vaultID) external view returns (bool);\n}\n\n/// @title IVaultManagerListing\n/// @author Angle Labs, Inc.\n/// @notice Interface for the `VaultManagerListing` contract\ninterface IVaultManagerListing is IVaultManager {\n /// @notice Get the collateral owned by `user` in the contract\n /// @dev This function effectively sums the collateral amounts of all the vaults owned by `user`\n function getUserCollateral(address user) external view returns (uint256);\n}\n" + }, + "contracts/interfaces/governance/IVeBoostProxy.sol": { + "content": "// SPDX-License-Identifier: GPL-3.0\n\npragma solidity ^0.8.12;\n\n/// @title IVeBoostProxy\n/// @author Angle Labs, Inc.\n/// @notice Interface for the `VeBoostProxy` contract\n/// @dev This interface only contains functions of the contract which are called by other contracts\n/// of this module\n/// @dev The `veBoostProxy` contract used by Angle is a full fork of Curve Finance implementation\ninterface IVeBoostProxy {\n /// @notice Reads the adjusted veANGLE balance of an address (adjusted by delegation)\n //solhint-disable-next-line\n function adjusted_balance_of(address) external view returns (uint256);\n}\n" + }, + "@openzeppelin/contracts-upgradeable/token/ERC721/extensions/IERC721MetadataUpgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (token/ERC721/extensions/IERC721Metadata.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../IERC721Upgradeable.sol\";\n\n/**\n * @title ERC-721 Non-Fungible Token Standard, optional metadata extension\n * @dev See https://eips.ethereum.org/EIPS/eip-721\n */\ninterface IERC721MetadataUpgradeable is IERC721Upgradeable {\n /**\n * @dev Returns the token collection name.\n */\n function name() external view returns (string memory);\n\n /**\n * @dev Returns the token collection symbol.\n */\n function symbol() external view returns (string memory);\n\n /**\n * @dev Returns the Uniform Resource Identifier (URI) for `tokenId` token.\n */\n function tokenURI(uint256 tokenId) external view returns (string memory);\n}\n" + }, + "@openzeppelin/contracts-upgradeable/token/ERC721/IERC721Upgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.7.0) (token/ERC721/IERC721.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../../utils/introspection/IERC165Upgradeable.sol\";\n\n/**\n * @dev Required interface of an ERC721 compliant contract.\n */\ninterface IERC721Upgradeable is IERC165Upgradeable {\n /**\n * @dev Emitted when `tokenId` token is transferred from `from` to `to`.\n */\n event Transfer(address indexed from, address indexed to, uint256 indexed tokenId);\n\n /**\n * @dev Emitted when `owner` enables `approved` to manage the `tokenId` token.\n */\n event Approval(address indexed owner, address indexed approved, uint256 indexed tokenId);\n\n /**\n * @dev Emitted when `owner` enables or disables (`approved`) `operator` to manage all of its assets.\n */\n event ApprovalForAll(address indexed owner, address indexed operator, bool approved);\n\n /**\n * @dev Returns the number of tokens in ``owner``'s account.\n */\n function balanceOf(address owner) external view returns (uint256 balance);\n\n /**\n * @dev Returns the owner of the `tokenId` token.\n *\n * Requirements:\n *\n * - `tokenId` must exist.\n */\n function ownerOf(uint256 tokenId) external view returns (address owner);\n\n /**\n * @dev Safely transfers `tokenId` token from `from` to `to`.\n *\n * Requirements:\n *\n * - `from` cannot be the zero address.\n * - `to` cannot be the zero address.\n * - `tokenId` token must exist and be owned by `from`.\n * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}.\n * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.\n *\n * Emits a {Transfer} event.\n */\n function safeTransferFrom(\n address from,\n address to,\n uint256 tokenId,\n bytes calldata data\n ) external;\n\n /**\n * @dev Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipients\n * are aware of the ERC721 protocol to prevent tokens from being forever locked.\n *\n * Requirements:\n *\n * - `from` cannot be the zero address.\n * - `to` cannot be the zero address.\n * - `tokenId` token must exist and be owned by `from`.\n * - If the caller is not `from`, it must have been allowed to move this token by either {approve} or {setApprovalForAll}.\n * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.\n *\n * Emits a {Transfer} event.\n */\n function safeTransferFrom(\n address from,\n address to,\n uint256 tokenId\n ) external;\n\n /**\n * @dev Transfers `tokenId` token from `from` to `to`.\n *\n * WARNING: Usage of this method is discouraged, use {safeTransferFrom} whenever possible.\n *\n * Requirements:\n *\n * - `from` cannot be the zero address.\n * - `to` cannot be the zero address.\n * - `tokenId` token must be owned by `from`.\n * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}.\n *\n * Emits a {Transfer} event.\n */\n function transferFrom(\n address from,\n address to,\n uint256 tokenId\n ) external;\n\n /**\n * @dev Gives permission to `to` to transfer `tokenId` token to another account.\n * The approval is cleared when the token is transferred.\n *\n * Only a single account can be approved at a time, so approving the zero address clears previous approvals.\n *\n * Requirements:\n *\n * - The caller must own the token or be an approved operator.\n * - `tokenId` must exist.\n *\n * Emits an {Approval} event.\n */\n function approve(address to, uint256 tokenId) external;\n\n /**\n * @dev Approve or remove `operator` as an operator for the caller.\n * Operators can call {transferFrom} or {safeTransferFrom} for any token owned by the caller.\n *\n * Requirements:\n *\n * - The `operator` cannot be the caller.\n *\n * Emits an {ApprovalForAll} event.\n */\n function setApprovalForAll(address operator, bool _approved) external;\n\n /**\n * @dev Returns the account approved for `tokenId` token.\n *\n * Requirements:\n *\n * - `tokenId` must exist.\n */\n function getApproved(uint256 tokenId) external view returns (address operator);\n\n /**\n * @dev Returns if the `operator` is allowed to manage all of the assets of `owner`.\n *\n * See {setApprovalForAll}\n */\n function isApprovedForAll(address owner, address operator) external view returns (bool);\n}\n" + }, + "@openzeppelin/contracts/token/ERC20/extensions/draft-IERC20Permit.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (token/ERC20/extensions/draft-IERC20Permit.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Interface of the ERC20 Permit extension allowing approvals to be made via signatures, as defined in\n * https://eips.ethereum.org/EIPS/eip-2612[EIP-2612].\n *\n * Adds the {permit} method, which can be used to change an account's ERC20 allowance (see {IERC20-allowance}) by\n * presenting a message signed by the account. By not relying on {IERC20-approve}, the token holder account doesn't\n * need to send a transaction, and thus is not required to hold Ether at all.\n */\ninterface IERC20Permit {\n /**\n * @dev Sets `value` as the allowance of `spender` over ``owner``'s tokens,\n * given ``owner``'s signed approval.\n *\n * IMPORTANT: The same issues {IERC20-approve} has related to transaction\n * ordering also apply here.\n *\n * Emits an {Approval} event.\n *\n * Requirements:\n *\n * - `spender` cannot be the zero address.\n * - `deadline` must be a timestamp in the future.\n * - `v`, `r` and `s` must be a valid `secp256k1` signature from `owner`\n * over the EIP712-formatted function arguments.\n * - the signature must use ``owner``'s current nonce (see {nonces}).\n *\n * For more information on the signature format, see the\n * https://eips.ethereum.org/EIPS/eip-2612#specification[relevant EIP\n * section].\n */\n function permit(\n address owner,\n address spender,\n uint256 value,\n uint256 deadline,\n uint8 v,\n bytes32 r,\n bytes32 s\n ) external;\n\n /**\n * @dev Returns the current nonce for `owner`. This value must be\n * included whenever a signature is generated for {permit}.\n *\n * Every successful call to {permit} increases ``owner``'s nonce by one. This\n * prevents a signature from being used multiple times.\n */\n function nonces(address owner) external view returns (uint256);\n\n /**\n * @dev Returns the domain separator used in the encoding of the signature for {permit}, as defined by {EIP712}.\n */\n // solhint-disable-next-line func-name-mixedcase\n function DOMAIN_SEPARATOR() external view returns (bytes32);\n}\n" + }, + "@openzeppelin/contracts/utils/Address.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.7.0) (utils/Address.sol)\n\npragma solidity ^0.8.1;\n\n/**\n * @dev Collection of functions related to the address type\n */\nlibrary Address {\n /**\n * @dev Returns true if `account` is a contract.\n *\n * [IMPORTANT]\n * ====\n * It is unsafe to assume that an address for which this function returns\n * false is an externally-owned account (EOA) and not a contract.\n *\n * Among others, `isContract` will return false for the following\n * types of addresses:\n *\n * - an externally-owned account\n * - a contract in construction\n * - an address where a contract will be created\n * - an address where a contract lived, but was destroyed\n * ====\n *\n * [IMPORTANT]\n * ====\n * You shouldn't rely on `isContract` to protect against flash loan attacks!\n *\n * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets\n * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract\n * constructor.\n * ====\n */\n function isContract(address account) internal view returns (bool) {\n // This method relies on extcodesize/address.code.length, which returns 0\n // for contracts in construction, since the code is only stored at the end\n // of the constructor execution.\n\n return account.code.length > 0;\n }\n\n /**\n * @dev Replacement for Solidity's `transfer`: sends `amount` wei to\n * `recipient`, forwarding all available gas and reverting on errors.\n *\n * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost\n * of certain opcodes, possibly making contracts go over the 2300 gas limit\n * imposed by `transfer`, making them unable to receive funds via\n * `transfer`. {sendValue} removes this limitation.\n *\n * https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more].\n *\n * IMPORTANT: because control is transferred to `recipient`, care must be\n * taken to not create reentrancy vulnerabilities. Consider using\n * {ReentrancyGuard} or the\n * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].\n */\n function sendValue(address payable recipient, uint256 amount) internal {\n require(address(this).balance >= amount, \"Address: insufficient balance\");\n\n (bool success, ) = recipient.call{value: amount}(\"\");\n require(success, \"Address: unable to send value, recipient may have reverted\");\n }\n\n /**\n * @dev Performs a Solidity function call using a low level `call`. A\n * plain `call` is an unsafe replacement for a function call: use this\n * function instead.\n *\n * If `target` reverts with a revert reason, it is bubbled up by this\n * function (like regular Solidity function calls).\n *\n * Returns the raw returned data. To convert to the expected return value,\n * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].\n *\n * Requirements:\n *\n * - `target` must be a contract.\n * - calling `target` with `data` must not revert.\n *\n * _Available since v3.1._\n */\n function functionCall(address target, bytes memory data) internal returns (bytes memory) {\n return functionCall(target, data, \"Address: low-level call failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with\n * `errorMessage` as a fallback revert reason when `target` reverts.\n *\n * _Available since v3.1._\n */\n function functionCall(\n address target,\n bytes memory data,\n string memory errorMessage\n ) internal returns (bytes memory) {\n return functionCallWithValue(target, data, 0, errorMessage);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but also transferring `value` wei to `target`.\n *\n * Requirements:\n *\n * - the calling contract must have an ETH balance of at least `value`.\n * - the called Solidity function must be `payable`.\n *\n * _Available since v3.1._\n */\n function functionCallWithValue(\n address target,\n bytes memory data,\n uint256 value\n ) internal returns (bytes memory) {\n return functionCallWithValue(target, data, value, \"Address: low-level call with value failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but\n * with `errorMessage` as a fallback revert reason when `target` reverts.\n *\n * _Available since v3.1._\n */\n function functionCallWithValue(\n address target,\n bytes memory data,\n uint256 value,\n string memory errorMessage\n ) internal returns (bytes memory) {\n require(address(this).balance >= value, \"Address: insufficient balance for call\");\n require(isContract(target), \"Address: call to non-contract\");\n\n (bool success, bytes memory returndata) = target.call{value: value}(data);\n return verifyCallResult(success, returndata, errorMessage);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but performing a static call.\n *\n * _Available since v3.3._\n */\n function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {\n return functionStaticCall(target, data, \"Address: low-level static call failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\n * but performing a static call.\n *\n * _Available since v3.3._\n */\n function functionStaticCall(\n address target,\n bytes memory data,\n string memory errorMessage\n ) internal view returns (bytes memory) {\n require(isContract(target), \"Address: static call to non-contract\");\n\n (bool success, bytes memory returndata) = target.staticcall(data);\n return verifyCallResult(success, returndata, errorMessage);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but performing a delegate call.\n *\n * _Available since v3.4._\n */\n function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {\n return functionDelegateCall(target, data, \"Address: low-level delegate call failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\n * but performing a delegate call.\n *\n * _Available since v3.4._\n */\n function functionDelegateCall(\n address target,\n bytes memory data,\n string memory errorMessage\n ) internal returns (bytes memory) {\n require(isContract(target), \"Address: delegate call to non-contract\");\n\n (bool success, bytes memory returndata) = target.delegatecall(data);\n return verifyCallResult(success, returndata, errorMessage);\n }\n\n /**\n * @dev Tool to verifies that a low level call was successful, and revert if it wasn't, either by bubbling the\n * revert reason using the provided one.\n *\n * _Available since v4.3._\n */\n function verifyCallResult(\n bool success,\n bytes memory returndata,\n string memory errorMessage\n ) internal pure returns (bytes memory) {\n if (success) {\n return returndata;\n } else {\n // Look for revert reason and bubble it up if present\n if (returndata.length > 0) {\n // The easiest way to bubble the revert reason is using memory via assembly\n /// @solidity memory-safe-assembly\n assembly {\n let returndata_size := mload(returndata)\n revert(add(32, returndata), returndata_size)\n }\n } else {\n revert(errorMessage);\n }\n }\n }\n}\n" + }, + "@openzeppelin/contracts-upgradeable/token/ERC20/IERC20Upgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.6.0) (token/ERC20/IERC20.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Interface of the ERC20 standard as defined in the EIP.\n */\ninterface IERC20Upgradeable {\n /**\n * @dev Emitted when `value` tokens are moved from one account (`from`) to\n * another (`to`).\n *\n * Note that `value` may be zero.\n */\n event Transfer(address indexed from, address indexed to, uint256 value);\n\n /**\n * @dev Emitted when the allowance of a `spender` for an `owner` is set by\n * a call to {approve}. `value` is the new allowance.\n */\n event Approval(address indexed owner, address indexed spender, uint256 value);\n\n /**\n * @dev Returns the amount of tokens in existence.\n */\n function totalSupply() external view returns (uint256);\n\n /**\n * @dev Returns the amount of tokens owned by `account`.\n */\n function balanceOf(address account) external view returns (uint256);\n\n /**\n * @dev Moves `amount` tokens from the caller's account to `to`.\n *\n * Returns a boolean value indicating whether the operation succeeded.\n *\n * Emits a {Transfer} event.\n */\n function transfer(address to, uint256 amount) external returns (bool);\n\n /**\n * @dev Returns the remaining number of tokens that `spender` will be\n * allowed to spend on behalf of `owner` through {transferFrom}. This is\n * zero by default.\n *\n * This value changes when {approve} or {transferFrom} are called.\n */\n function allowance(address owner, address spender) external view returns (uint256);\n\n /**\n * @dev Sets `amount` as the allowance of `spender` over the caller's tokens.\n *\n * Returns a boolean value indicating whether the operation succeeded.\n *\n * IMPORTANT: Beware that changing an allowance with this method brings the risk\n * that someone may use both the old and the new allowance by unfortunate\n * transaction ordering. One possible solution to mitigate this race\n * condition is to first reduce the spender's allowance to 0 and set the\n * desired value afterwards:\n * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729\n *\n * Emits an {Approval} event.\n */\n function approve(address spender, uint256 amount) external returns (bool);\n\n /**\n * @dev Moves `amount` tokens from `from` to `to` using the\n * allowance mechanism. `amount` is then deducted from the caller's\n * allowance.\n *\n * Returns a boolean value indicating whether the operation succeeded.\n *\n * Emits a {Transfer} event.\n */\n function transferFrom(\n address from,\n address to,\n uint256 amount\n ) external returns (bool);\n}\n" + }, + "contracts/interfaces/ICoreBorrow.sol": { + "content": "// SPDX-License-Identifier: GPL-3.0\n\npragma solidity ^0.8.12;\n\n/// @title ICoreBorrow\n/// @author Angle Labs, Inc.\n/// @notice Interface for the `CoreBorrow` contract\n/// @dev This interface only contains functions of the `CoreBorrow` contract which are called by other contracts\n/// of this module\ninterface ICoreBorrow {\n /// @notice Checks if an address corresponds to a treasury of a stablecoin with a flash loan\n /// module initialized on it\n /// @param treasury Address to check\n /// @return Whether the address has the `FLASHLOANER_TREASURY_ROLE` or not\n function isFlashLoanerTreasury(address treasury) external view returns (bool);\n\n /// @notice Checks whether an address is governor of the Angle Protocol or not\n /// @param admin Address to check\n /// @return Whether the address has the `GOVERNOR_ROLE` or not\n function isGovernor(address admin) external view returns (bool);\n\n /// @notice Checks whether an address is governor or a guardian of the Angle Protocol or not\n /// @param admin Address to check\n /// @return Whether the address has the `GUARDIAN_ROLE` or not\n /// @dev Governance should make sure when adding a governor to also give this governor the guardian\n /// role by calling the `addGovernor` function\n function isGovernorOrGuardian(address admin) external view returns (bool);\n}\n" + }, + "contracts/interfaces/IFlashAngle.sol": { + "content": "// SPDX-License-Identifier: GPL-3.0\n\npragma solidity ^0.8.12;\n\nimport \"./IAgToken.sol\";\nimport \"./ICoreBorrow.sol\";\n\n/// @title IFlashAngle\n/// @author Angle Labs, Inc.\n/// @notice Interface for the `FlashAngle` contract\n/// @dev This interface only contains functions of the contract which are called by other contracts\n/// of this module\ninterface IFlashAngle {\n /// @notice Reference to the `CoreBorrow` contract managing the FlashLoan module\n function core() external view returns (ICoreBorrow);\n\n /// @notice Sends the fees taken from flash loans to the treasury contract associated to the stablecoin\n /// @param stablecoin Stablecoin from which profits should be sent\n /// @return balance Amount of profits sent\n /// @dev This function can only be called by the treasury contract\n function accrueInterestToTreasury(IAgToken stablecoin) external returns (uint256 balance);\n\n /// @notice Adds support for a stablecoin\n /// @param _treasury Treasury associated to the stablecoin to add support for\n /// @dev This function can only be called by the `CoreBorrow` contract\n function addStablecoinSupport(address _treasury) external;\n\n /// @notice Removes support for a stablecoin\n /// @param _treasury Treasury associated to the stablecoin to remove support for\n /// @dev This function can only be called by the `CoreBorrow` contract\n function removeStablecoinSupport(address _treasury) external;\n\n /// @notice Sets a new core contract\n /// @param _core Core contract address to set\n /// @dev This function can only be called by the `CoreBorrow` contract\n function setCore(address _core) external;\n}\n" + }, + "@openzeppelin/contracts/interfaces/IERC721Metadata.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (interfaces/IERC721Metadata.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../token/ERC721/extensions/IERC721Metadata.sol\";\n" + }, + "@openzeppelin/contracts/token/ERC721/extensions/IERC721Metadata.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (token/ERC721/extensions/IERC721Metadata.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../IERC721.sol\";\n\n/**\n * @title ERC-721 Non-Fungible Token Standard, optional metadata extension\n * @dev See https://eips.ethereum.org/EIPS/eip-721\n */\ninterface IERC721Metadata is IERC721 {\n /**\n * @dev Returns the token collection name.\n */\n function name() external view returns (string memory);\n\n /**\n * @dev Returns the token collection symbol.\n */\n function symbol() external view returns (string memory);\n\n /**\n * @dev Returns the Uniform Resource Identifier (URI) for `tokenId` token.\n */\n function tokenURI(uint256 tokenId) external view returns (string memory);\n}\n" + }, + "@openzeppelin/contracts/token/ERC721/IERC721.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.7.0) (token/ERC721/IERC721.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../../utils/introspection/IERC165.sol\";\n\n/**\n * @dev Required interface of an ERC721 compliant contract.\n */\ninterface IERC721 is IERC165 {\n /**\n * @dev Emitted when `tokenId` token is transferred from `from` to `to`.\n */\n event Transfer(address indexed from, address indexed to, uint256 indexed tokenId);\n\n /**\n * @dev Emitted when `owner` enables `approved` to manage the `tokenId` token.\n */\n event Approval(address indexed owner, address indexed approved, uint256 indexed tokenId);\n\n /**\n * @dev Emitted when `owner` enables or disables (`approved`) `operator` to manage all of its assets.\n */\n event ApprovalForAll(address indexed owner, address indexed operator, bool approved);\n\n /**\n * @dev Returns the number of tokens in ``owner``'s account.\n */\n function balanceOf(address owner) external view returns (uint256 balance);\n\n /**\n * @dev Returns the owner of the `tokenId` token.\n *\n * Requirements:\n *\n * - `tokenId` must exist.\n */\n function ownerOf(uint256 tokenId) external view returns (address owner);\n\n /**\n * @dev Safely transfers `tokenId` token from `from` to `to`.\n *\n * Requirements:\n *\n * - `from` cannot be the zero address.\n * - `to` cannot be the zero address.\n * - `tokenId` token must exist and be owned by `from`.\n * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}.\n * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.\n *\n * Emits a {Transfer} event.\n */\n function safeTransferFrom(\n address from,\n address to,\n uint256 tokenId,\n bytes calldata data\n ) external;\n\n /**\n * @dev Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipients\n * are aware of the ERC721 protocol to prevent tokens from being forever locked.\n *\n * Requirements:\n *\n * - `from` cannot be the zero address.\n * - `to` cannot be the zero address.\n * - `tokenId` token must exist and be owned by `from`.\n * - If the caller is not `from`, it must have been allowed to move this token by either {approve} or {setApprovalForAll}.\n * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.\n *\n * Emits a {Transfer} event.\n */\n function safeTransferFrom(\n address from,\n address to,\n uint256 tokenId\n ) external;\n\n /**\n * @dev Transfers `tokenId` token from `from` to `to`.\n *\n * WARNING: Usage of this method is discouraged, use {safeTransferFrom} whenever possible.\n *\n * Requirements:\n *\n * - `from` cannot be the zero address.\n * - `to` cannot be the zero address.\n * - `tokenId` token must be owned by `from`.\n * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}.\n *\n * Emits a {Transfer} event.\n */\n function transferFrom(\n address from,\n address to,\n uint256 tokenId\n ) external;\n\n /**\n * @dev Gives permission to `to` to transfer `tokenId` token to another account.\n * The approval is cleared when the token is transferred.\n *\n * Only a single account can be approved at a time, so approving the zero address clears previous approvals.\n *\n * Requirements:\n *\n * - The caller must own the token or be an approved operator.\n * - `tokenId` must exist.\n *\n * Emits an {Approval} event.\n */\n function approve(address to, uint256 tokenId) external;\n\n /**\n * @dev Approve or remove `operator` as an operator for the caller.\n * Operators can call {transferFrom} or {safeTransferFrom} for any token owned by the caller.\n *\n * Requirements:\n *\n * - The `operator` cannot be the caller.\n *\n * Emits an {ApprovalForAll} event.\n */\n function setApprovalForAll(address operator, bool _approved) external;\n\n /**\n * @dev Returns the account approved for `tokenId` token.\n *\n * Requirements:\n *\n * - `tokenId` must exist.\n */\n function getApproved(uint256 tokenId) external view returns (address operator);\n\n /**\n * @dev Returns if the `operator` is allowed to manage all of the assets of `owner`.\n *\n * See {setApprovalForAll}\n */\n function isApprovedForAll(address owner, address operator) external view returns (bool);\n}\n" + }, + "@openzeppelin/contracts/utils/introspection/IERC165.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (utils/introspection/IERC165.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Interface of the ERC165 standard, as defined in the\n * https://eips.ethereum.org/EIPS/eip-165[EIP].\n *\n * Implementers can declare support of contract interfaces, which can then be\n * queried by others ({ERC165Checker}).\n *\n * For an implementation, see {ERC165}.\n */\ninterface IERC165 {\n /**\n * @dev Returns true if this contract implements the interface defined by\n * `interfaceId`. See the corresponding\n * https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section]\n * to learn more about how these ids are created.\n *\n * This function call must use less than 30 000 gas.\n */\n function supportsInterface(bytes4 interfaceId) external view returns (bool);\n}\n" + } + }, + "settings": { + "optimizer": { + "enabled": true, + "runs": 1 + }, + "outputSelection": { + "*": { + "*": [ + "abi", + "evm.bytecode", + "evm.deployedBytecode", + "evm.methodIdentifiers", + "metadata" + ], + "": [ + "ast" + ] + } + } + } +} \ No newline at end of file diff --git a/deployments/mainnet/VaultManagerNoDust_Implementation.json b/deployments/mainnet/VaultManagerNoDust_Implementation.json new file mode 100644 index 00000000..38ea400a --- /dev/null +++ b/deployments/mainnet/VaultManagerNoDust_Implementation.json @@ -0,0 +1,1810 @@ +{ + "address": "0x874eB5967b57eF1605037812E781Cc30a659fD1a", + "abi": [ + { + "inputs": [], + "name": "ApprovalToCaller", + "type": "error" + }, + { + "inputs": [], + "name": "ApprovalToOwner", + "type": "error" + }, + { + "inputs": [], + "name": "DebtCeilingExceeded", + "type": "error" + }, + { + "inputs": [], + "name": "DustyLeftoverAmount", + "type": "error" + }, + { + "inputs": [], + "name": "ExpiredDeadline", + "type": "error" + }, + { + "inputs": [], + "name": "HealthyVault", + "type": "error" + }, + { + "inputs": [], + "name": "IncompatibleLengths", + "type": "error" + }, + { + "inputs": [], + "name": "InsolventVault", + "type": "error" + }, + { + "inputs": [], + "name": "InvalidParameterType", + "type": "error" + }, + { + "inputs": [], + "name": "InvalidParameterValue", + "type": "error" + }, + { + "inputs": [], + "name": "InvalidSetOfParameters", + "type": "error" + }, + { + "inputs": [], + "name": "InvalidSignature", + "type": "error" + }, + { + "inputs": [], + "name": "InvalidTreasury", + "type": "error" + }, + { + "inputs": [], + "name": "NonERC721Receiver", + "type": "error" + }, + { + "inputs": [], + "name": "NonexistentVault", + "type": "error" + }, + { + "inputs": [], + "name": "NotApproved", + "type": "error" + }, + { + "inputs": [], + "name": "NotGovernor", + "type": "error" + }, + { + "inputs": [], + "name": "NotGovernorOrGuardian", + "type": "error" + }, + { + "inputs": [], + "name": "NotTreasury", + "type": "error" + }, + { + "inputs": [], + "name": "NotVaultManager", + "type": "error" + }, + { + "inputs": [], + "name": "NotWhitelisted", + "type": "error" + }, + { + "inputs": [], + "name": "Paused", + "type": "error" + }, + { + "inputs": [], + "name": "TooHighParameterValue", + "type": "error" + }, + { + "inputs": [], + "name": "TooSmallParameterValue", + "type": "error" + }, + { + "inputs": [], + "name": "ZeroAddress", + "type": "error" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint256", + "name": "surplusEndValue", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "badDebtEndValue", + "type": "uint256" + } + ], + "name": "AccruedToTreasury", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "owner", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "approved", + "type": "address" + }, + { + "indexed": true, + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + } + ], + "name": "Approval", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "owner", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "operator", + "type": "address" + }, + { + "indexed": false, + "internalType": "bool", + "name": "approved", + "type": "bool" + } + ], + "name": "ApprovalForAll", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint256", + "name": "vaultID", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "collateralAmount", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint8", + "name": "isIncrease", + "type": "uint8" + } + ], + "name": "CollateralAmountUpdated", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint256", + "name": "debtCeiling", + "type": "uint256" + } + ], + "name": "DebtCeilingUpdated", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint256", + "name": "srcVaultID", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "dstVaultID", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "address", + "name": "dstVaultManager", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "DebtTransferred", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint64", + "name": "param", + "type": "uint64" + }, + { + "indexed": false, + "internalType": "bytes32", + "name": "what", + "type": "bytes32" + } + ], + "name": "FiledUint64", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint8", + "name": "version", + "type": "uint8" + } + ], + "name": "Initialized", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint256", + "name": "value", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "timestamp", + "type": "uint256" + } + ], + "name": "InterestAccumulatorUpdated", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint256", + "name": "vaultID", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "internalAmount", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint8", + "name": "isIncrease", + "type": "uint8" + } + ], + "name": "InternalDebtUpdated", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint256[]", + "name": "vaultIDs", + "type": "uint256[]" + } + ], + "name": "LiquidatedVaults", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "_veBoostProxy", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256[]", + "name": "xBoost", + "type": "uint256[]" + }, + { + "indexed": false, + "internalType": "uint256[]", + "name": "yBoost", + "type": "uint256[]" + } + ], + "name": "LiquidationBoostParametersUpdated", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "from", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "to", + "type": "address" + }, + { + "indexed": true, + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + } + ], + "name": "Transfer", + "type": "event" + }, + { + "inputs": [], + "name": "BASE_INTEREST", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "BASE_PARAMS", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "DOMAIN_SEPARATOR", + "outputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "HALF_BASE_INTEREST", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "accrueInterestToTreasury", + "outputs": [ + { + "internalType": "uint256", + "name": "surplusValue", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "badDebtValue", + "type": "uint256" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "enum ActionType[]", + "name": "actions", + "type": "uint8[]" + }, + { + "internalType": "bytes[]", + "name": "datas", + "type": "bytes[]" + }, + { + "internalType": "address", + "name": "from", + "type": "address" + }, + { + "internalType": "address", + "name": "to", + "type": "address" + } + ], + "name": "angle", + "outputs": [ + { + "components": [ + { + "internalType": "uint256", + "name": "stablecoinAmountToGive", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "stablecoinAmountToReceive", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "collateralAmountToGive", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "collateralAmountToReceive", + "type": "uint256" + } + ], + "internalType": "struct PaymentData", + "name": "", + "type": "tuple" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "enum ActionType[]", + "name": "actions", + "type": "uint8[]" + }, + { + "internalType": "bytes[]", + "name": "datas", + "type": "bytes[]" + }, + { + "internalType": "address", + "name": "from", + "type": "address" + }, + { + "internalType": "address", + "name": "to", + "type": "address" + }, + { + "internalType": "address", + "name": "who", + "type": "address" + }, + { + "internalType": "bytes", + "name": "repayData", + "type": "bytes" + } + ], + "name": "angle", + "outputs": [ + { + "components": [ + { + "internalType": "uint256", + "name": "stablecoinAmountToGive", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "stablecoinAmountToReceive", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "collateralAmountToGive", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "collateralAmountToReceive", + "type": "uint256" + } + ], + "internalType": "struct PaymentData", + "name": "paymentData", + "type": "tuple" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "to", + "type": "address" + }, + { + "internalType": "uint256", + "name": "vaultID", + "type": "uint256" + } + ], + "name": "approve", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "badDebt", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "owner", + "type": "address" + } + ], + "name": "balanceOf", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "borrowFee", + "outputs": [ + { + "internalType": "uint64", + "name": "", + "type": "uint64" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "vaultID", + "type": "uint256" + }, + { + "internalType": "address", + "name": "liquidator", + "type": "address" + } + ], + "name": "checkLiquidation", + "outputs": [ + { + "components": [ + { + "internalType": "uint256", + "name": "maxStablecoinAmountToRepay", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "maxCollateralAmountGiven", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "thresholdRepayAmount", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "discount", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "currentDebt", + "type": "uint256" + } + ], + "internalType": "struct LiquidationOpportunity", + "name": "liqOpp", + "type": "tuple" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "collateral", + "outputs": [ + { + "internalType": "contract IERC20", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "collateralFactor", + "outputs": [ + { + "internalType": "uint64", + "name": "", + "type": "uint64" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "toVault", + "type": "address" + } + ], + "name": "createVault", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "debtCeiling", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "dust", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "vaultID", + "type": "uint256" + } + ], + "name": "getApproved", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "vaultID", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "stablecoinAmount", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "senderBorrowFee", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "senderRepayFee", + "type": "uint256" + } + ], + "name": "getDebtOut", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "getTotalDebt", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "vaultID", + "type": "uint256" + } + ], + "name": "getVaultDebt", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "contract ITreasury", + "name": "_treasury", + "type": "address" + }, + { + "internalType": "contract IERC20", + "name": "_collateral", + "type": "address" + }, + { + "internalType": "contract IOracle", + "name": "_oracle", + "type": "address" + }, + { + "components": [ + { + "internalType": "uint256", + "name": "debtCeiling", + "type": "uint256" + }, + { + "internalType": "uint64", + "name": "collateralFactor", + "type": "uint64" + }, + { + "internalType": "uint64", + "name": "targetHealthFactor", + "type": "uint64" + }, + { + "internalType": "uint64", + "name": "interestRate", + "type": "uint64" + }, + { + "internalType": "uint64", + "name": "liquidationSurcharge", + "type": "uint64" + }, + { + "internalType": "uint64", + "name": "maxLiquidationDiscount", + "type": "uint64" + }, + { + "internalType": "bool", + "name": "whitelistingActivated", + "type": "bool" + }, + { + "internalType": "uint256", + "name": "baseBoost", + "type": "uint256" + } + ], + "internalType": "struct VaultParameters", + "name": "params", + "type": "tuple" + }, + { + "internalType": "string", + "name": "_symbol", + "type": "string" + } + ], + "name": "initialize", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "interestAccumulator", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "interestRate", + "outputs": [ + { + "internalType": "uint64", + "name": "", + "type": "uint64" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "owner", + "type": "address" + }, + { + "internalType": "address", + "name": "operator", + "type": "address" + } + ], + "name": "isApprovedForAll", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "spender", + "type": "address" + }, + { + "internalType": "uint256", + "name": "vaultID", + "type": "uint256" + } + ], + "name": "isApprovedOrOwner", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "name": "isWhitelisted", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "lastInterestAccumulatorUpdated", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256[]", + "name": "vaultIDs", + "type": "uint256[]" + }, + { + "internalType": "uint256[]", + "name": "amounts", + "type": "uint256[]" + }, + { + "internalType": "address", + "name": "from", + "type": "address" + }, + { + "internalType": "address", + "name": "to", + "type": "address" + }, + { + "internalType": "address", + "name": "who", + "type": "address" + }, + { + "internalType": "bytes", + "name": "data", + "type": "bytes" + } + ], + "name": "liquidate", + "outputs": [ + { + "components": [ + { + "internalType": "uint256", + "name": "stablecoinAmountToReceive", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "collateralAmountToGive", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "badDebtFromLiquidation", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "oracleValue", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "newInterestAccumulator", + "type": "uint256" + } + ], + "internalType": "struct LiquidatorData", + "name": "liqData", + "type": "tuple" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256[]", + "name": "vaultIDs", + "type": "uint256[]" + }, + { + "internalType": "uint256[]", + "name": "amounts", + "type": "uint256[]" + }, + { + "internalType": "address", + "name": "from", + "type": "address" + }, + { + "internalType": "address", + "name": "to", + "type": "address" + } + ], + "name": "liquidate", + "outputs": [ + { + "components": [ + { + "internalType": "uint256", + "name": "stablecoinAmountToReceive", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "collateralAmountToGive", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "badDebtFromLiquidation", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "oracleValue", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "newInterestAccumulator", + "type": "uint256" + } + ], + "internalType": "struct LiquidatorData", + "name": "", + "type": "tuple" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "liquidationSurcharge", + "outputs": [ + { + "internalType": "uint64", + "name": "", + "type": "uint64" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "maxLiquidationDiscount", + "outputs": [ + { + "internalType": "uint64", + "name": "", + "type": "uint64" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "name", + "outputs": [ + { + "internalType": "string", + "name": "", + "type": "string" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "owner", + "type": "address" + } + ], + "name": "nonces", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "oracle", + "outputs": [ + { + "internalType": "contract IOracle", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "vaultID", + "type": "uint256" + } + ], + "name": "ownerOf", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "paused", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "owner", + "type": "address" + }, + { + "internalType": "address", + "name": "spender", + "type": "address" + }, + { + "internalType": "bool", + "name": "approved", + "type": "bool" + }, + { + "internalType": "uint256", + "name": "deadline", + "type": "uint256" + }, + { + "internalType": "uint8", + "name": "v", + "type": "uint8" + }, + { + "internalType": "bytes32", + "name": "r", + "type": "bytes32" + }, + { + "internalType": "bytes32", + "name": "s", + "type": "bytes32" + } + ], + "name": "permit", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "repayFee", + "outputs": [ + { + "internalType": "uint64", + "name": "", + "type": "uint64" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "from", + "type": "address" + }, + { + "internalType": "address", + "name": "to", + "type": "address" + }, + { + "internalType": "uint256", + "name": "vaultID", + "type": "uint256" + } + ], + "name": "safeTransferFrom", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "from", + "type": "address" + }, + { + "internalType": "address", + "name": "to", + "type": "address" + }, + { + "internalType": "uint256", + "name": "vaultID", + "type": "uint256" + }, + { + "internalType": "bytes", + "name": "_data", + "type": "bytes" + } + ], + "name": "safeTransferFrom", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "operator", + "type": "address" + }, + { + "internalType": "bool", + "name": "approved", + "type": "bool" + } + ], + "name": "setApprovalForAll", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "string", + "name": "baseURI_", + "type": "string" + } + ], + "name": "setBaseURI", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "_debtCeiling", + "type": "uint256" + } + ], + "name": "setDebtCeiling", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "_dust", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "dustCollateral_", + "type": "uint256" + } + ], + "name": "setDusts", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_veBoostProxy", + "type": "address" + }, + { + "internalType": "uint256[]", + "name": "xBoost", + "type": "uint256[]" + }, + { + "internalType": "uint256[]", + "name": "yBoost", + "type": "uint256[]" + } + ], + "name": "setLiquidationBoostParameters", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_oracle", + "type": "address" + } + ], + "name": "setOracle", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_treasury", + "type": "address" + } + ], + "name": "setTreasury", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint64", + "name": "param", + "type": "uint64" + }, + { + "internalType": "bytes32", + "name": "what", + "type": "bytes32" + } + ], + "name": "setUint64", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "stablecoin", + "outputs": [ + { + "internalType": "contract IAgToken", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes4", + "name": "interfaceId", + "type": "bytes4" + } + ], + "name": "supportsInterface", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "pure", + "type": "function" + }, + { + "inputs": [], + "name": "surplus", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "symbol", + "outputs": [ + { + "internalType": "string", + "name": "", + "type": "string" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "targetHealthFactor", + "outputs": [ + { + "internalType": "uint64", + "name": "", + "type": "uint64" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "togglePause", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "target", + "type": "address" + } + ], + "name": "toggleWhitelist", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "vaultID", + "type": "uint256" + } + ], + "name": "tokenURI", + "outputs": [ + { + "internalType": "string", + "name": "", + "type": "string" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "totalNormalizedDebt", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "from", + "type": "address" + }, + { + "internalType": "address", + "name": "to", + "type": "address" + }, + { + "internalType": "uint256", + "name": "vaultID", + "type": "uint256" + } + ], + "name": "transferFrom", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "treasury", + "outputs": [ + { + "internalType": "contract ITreasury", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "name": "vaultData", + "outputs": [ + { + "internalType": "uint256", + "name": "collateralAmount", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "normalizedDebt", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "vaultIDCount", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "veBoostProxy", + "outputs": [ + { + "internalType": "contract IVeBoostProxy", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "whitelistingActivated", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "name": "xLiquidationBoost", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "name": "yLiquidationBoost", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + } + ], + "transactionHash": "0x93feab684138c7323d56e8782bb8d27b6ca6b9577d07a8d7653d6ab11f1d6cbf", + "receipt": { + "to": null, + "from": "0xfdA462548Ce04282f4B6D6619823a7C64Fdc0185", + "contractAddress": "0x874eB5967b57eF1605037812E781Cc30a659fD1a", + "transactionIndex": 101, + "gasUsed": "5344056", + "logsBloom": "0x00000000000000000000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000080000000000000000000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000004040000000000000000000000000000000000000000000000000000000000000000000000000000000000040000000000000000", + "blockHash": "0x7c516a78f8ef13b1b7cd6b6a02c0d1bfc193c6ff285c6ee9f309f059d6e15710", + "transactionHash": "0x93feab684138c7323d56e8782bb8d27b6ca6b9577d07a8d7653d6ab11f1d6cbf", + "logs": [ + { + "transactionIndex": 101, + "blockNumber": 16041772, + "transactionHash": "0x93feab684138c7323d56e8782bb8d27b6ca6b9577d07a8d7653d6ab11f1d6cbf", + "address": "0x874eB5967b57eF1605037812E781Cc30a659fD1a", + "topics": [ + "0x7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb3847402498" + ], + "data": "0x0000000000000000000000000000000000000000000000000000000000000001", + "logIndex": 198, + "blockHash": "0x7c516a78f8ef13b1b7cd6b6a02c0d1bfc193c6ff285c6ee9f309f059d6e15710" + } + ], + "blockNumber": 16041772, + "cumulativeGasUsed": "19300959", + "status": 1, + "byzantium": true + }, + "args": [], + "numDeployments": 1, + "solcInputHash": "dc345d3eed7216da5bac40699a727ed4", + "metadata": "{\"compiler\":{\"version\":\"0.8.12+commit.f00d7308\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[],\"name\":\"ApprovalToCaller\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"ApprovalToOwner\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"DebtCeilingExceeded\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"DustyLeftoverAmount\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"ExpiredDeadline\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"HealthyVault\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"IncompatibleLengths\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"InsolventVault\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"InvalidParameterType\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"InvalidParameterValue\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"InvalidSetOfParameters\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"InvalidSignature\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"InvalidTreasury\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"NonERC721Receiver\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"NonexistentVault\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"NotApproved\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"NotGovernor\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"NotGovernorOrGuardian\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"NotTreasury\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"NotVaultManager\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"NotWhitelisted\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"Paused\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"TooHighParameterValue\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"TooSmallParameterValue\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"ZeroAddress\",\"type\":\"error\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"surplusEndValue\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"badDebtEndValue\",\"type\":\"uint256\"}],\"name\":\"AccruedToTreasury\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"owner\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"approved\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"tokenId\",\"type\":\"uint256\"}],\"name\":\"Approval\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"owner\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"operator\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"bool\",\"name\":\"approved\",\"type\":\"bool\"}],\"name\":\"ApprovalForAll\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"vaultID\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"collateralAmount\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint8\",\"name\":\"isIncrease\",\"type\":\"uint8\"}],\"name\":\"CollateralAmountUpdated\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"debtCeiling\",\"type\":\"uint256\"}],\"name\":\"DebtCeilingUpdated\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"srcVaultID\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"dstVaultID\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"dstVaultManager\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"DebtTransferred\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint64\",\"name\":\"param\",\"type\":\"uint64\"},{\"indexed\":false,\"internalType\":\"bytes32\",\"name\":\"what\",\"type\":\"bytes32\"}],\"name\":\"FiledUint64\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint8\",\"name\":\"version\",\"type\":\"uint8\"}],\"name\":\"Initialized\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"value\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"timestamp\",\"type\":\"uint256\"}],\"name\":\"InterestAccumulatorUpdated\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"vaultID\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"internalAmount\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint8\",\"name\":\"isIncrease\",\"type\":\"uint8\"}],\"name\":\"InternalDebtUpdated\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256[]\",\"name\":\"vaultIDs\",\"type\":\"uint256[]\"}],\"name\":\"LiquidatedVaults\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"_veBoostProxy\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256[]\",\"name\":\"xBoost\",\"type\":\"uint256[]\"},{\"indexed\":false,\"internalType\":\"uint256[]\",\"name\":\"yBoost\",\"type\":\"uint256[]\"}],\"name\":\"LiquidationBoostParametersUpdated\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"from\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"to\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"tokenId\",\"type\":\"uint256\"}],\"name\":\"Transfer\",\"type\":\"event\"},{\"inputs\":[],\"name\":\"BASE_INTEREST\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"BASE_PARAMS\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"DOMAIN_SEPARATOR\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"HALF_BASE_INTEREST\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"accrueInterestToTreasury\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"surplusValue\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"badDebtValue\",\"type\":\"uint256\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"enum ActionType[]\",\"name\":\"actions\",\"type\":\"uint8[]\"},{\"internalType\":\"bytes[]\",\"name\":\"datas\",\"type\":\"bytes[]\"},{\"internalType\":\"address\",\"name\":\"from\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"to\",\"type\":\"address\"}],\"name\":\"angle\",\"outputs\":[{\"components\":[{\"internalType\":\"uint256\",\"name\":\"stablecoinAmountToGive\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"stablecoinAmountToReceive\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"collateralAmountToGive\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"collateralAmountToReceive\",\"type\":\"uint256\"}],\"internalType\":\"struct PaymentData\",\"name\":\"\",\"type\":\"tuple\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"enum ActionType[]\",\"name\":\"actions\",\"type\":\"uint8[]\"},{\"internalType\":\"bytes[]\",\"name\":\"datas\",\"type\":\"bytes[]\"},{\"internalType\":\"address\",\"name\":\"from\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"to\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"who\",\"type\":\"address\"},{\"internalType\":\"bytes\",\"name\":\"repayData\",\"type\":\"bytes\"}],\"name\":\"angle\",\"outputs\":[{\"components\":[{\"internalType\":\"uint256\",\"name\":\"stablecoinAmountToGive\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"stablecoinAmountToReceive\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"collateralAmountToGive\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"collateralAmountToReceive\",\"type\":\"uint256\"}],\"internalType\":\"struct PaymentData\",\"name\":\"paymentData\",\"type\":\"tuple\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"to\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"vaultID\",\"type\":\"uint256\"}],\"name\":\"approve\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"badDebt\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"owner\",\"type\":\"address\"}],\"name\":\"balanceOf\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"borrowFee\",\"outputs\":[{\"internalType\":\"uint64\",\"name\":\"\",\"type\":\"uint64\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"vaultID\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"liquidator\",\"type\":\"address\"}],\"name\":\"checkLiquidation\",\"outputs\":[{\"components\":[{\"internalType\":\"uint256\",\"name\":\"maxStablecoinAmountToRepay\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"maxCollateralAmountGiven\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"thresholdRepayAmount\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"discount\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"currentDebt\",\"type\":\"uint256\"}],\"internalType\":\"struct LiquidationOpportunity\",\"name\":\"liqOpp\",\"type\":\"tuple\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"collateral\",\"outputs\":[{\"internalType\":\"contract IERC20\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"collateralFactor\",\"outputs\":[{\"internalType\":\"uint64\",\"name\":\"\",\"type\":\"uint64\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"toVault\",\"type\":\"address\"}],\"name\":\"createVault\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"debtCeiling\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"dust\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"vaultID\",\"type\":\"uint256\"}],\"name\":\"getApproved\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"vaultID\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"stablecoinAmount\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"senderBorrowFee\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"senderRepayFee\",\"type\":\"uint256\"}],\"name\":\"getDebtOut\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"getTotalDebt\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"vaultID\",\"type\":\"uint256\"}],\"name\":\"getVaultDebt\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"contract ITreasury\",\"name\":\"_treasury\",\"type\":\"address\"},{\"internalType\":\"contract IERC20\",\"name\":\"_collateral\",\"type\":\"address\"},{\"internalType\":\"contract IOracle\",\"name\":\"_oracle\",\"type\":\"address\"},{\"components\":[{\"internalType\":\"uint256\",\"name\":\"debtCeiling\",\"type\":\"uint256\"},{\"internalType\":\"uint64\",\"name\":\"collateralFactor\",\"type\":\"uint64\"},{\"internalType\":\"uint64\",\"name\":\"targetHealthFactor\",\"type\":\"uint64\"},{\"internalType\":\"uint64\",\"name\":\"interestRate\",\"type\":\"uint64\"},{\"internalType\":\"uint64\",\"name\":\"liquidationSurcharge\",\"type\":\"uint64\"},{\"internalType\":\"uint64\",\"name\":\"maxLiquidationDiscount\",\"type\":\"uint64\"},{\"internalType\":\"bool\",\"name\":\"whitelistingActivated\",\"type\":\"bool\"},{\"internalType\":\"uint256\",\"name\":\"baseBoost\",\"type\":\"uint256\"}],\"internalType\":\"struct VaultParameters\",\"name\":\"params\",\"type\":\"tuple\"},{\"internalType\":\"string\",\"name\":\"_symbol\",\"type\":\"string\"}],\"name\":\"initialize\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"interestAccumulator\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"interestRate\",\"outputs\":[{\"internalType\":\"uint64\",\"name\":\"\",\"type\":\"uint64\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"owner\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"operator\",\"type\":\"address\"}],\"name\":\"isApprovedForAll\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"spender\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"vaultID\",\"type\":\"uint256\"}],\"name\":\"isApprovedOrOwner\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"name\":\"isWhitelisted\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"lastInterestAccumulatorUpdated\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256[]\",\"name\":\"vaultIDs\",\"type\":\"uint256[]\"},{\"internalType\":\"uint256[]\",\"name\":\"amounts\",\"type\":\"uint256[]\"},{\"internalType\":\"address\",\"name\":\"from\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"to\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"who\",\"type\":\"address\"},{\"internalType\":\"bytes\",\"name\":\"data\",\"type\":\"bytes\"}],\"name\":\"liquidate\",\"outputs\":[{\"components\":[{\"internalType\":\"uint256\",\"name\":\"stablecoinAmountToReceive\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"collateralAmountToGive\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"badDebtFromLiquidation\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"oracleValue\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"newInterestAccumulator\",\"type\":\"uint256\"}],\"internalType\":\"struct LiquidatorData\",\"name\":\"liqData\",\"type\":\"tuple\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256[]\",\"name\":\"vaultIDs\",\"type\":\"uint256[]\"},{\"internalType\":\"uint256[]\",\"name\":\"amounts\",\"type\":\"uint256[]\"},{\"internalType\":\"address\",\"name\":\"from\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"to\",\"type\":\"address\"}],\"name\":\"liquidate\",\"outputs\":[{\"components\":[{\"internalType\":\"uint256\",\"name\":\"stablecoinAmountToReceive\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"collateralAmountToGive\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"badDebtFromLiquidation\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"oracleValue\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"newInterestAccumulator\",\"type\":\"uint256\"}],\"internalType\":\"struct LiquidatorData\",\"name\":\"\",\"type\":\"tuple\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"liquidationSurcharge\",\"outputs\":[{\"internalType\":\"uint64\",\"name\":\"\",\"type\":\"uint64\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"maxLiquidationDiscount\",\"outputs\":[{\"internalType\":\"uint64\",\"name\":\"\",\"type\":\"uint64\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"name\",\"outputs\":[{\"internalType\":\"string\",\"name\":\"\",\"type\":\"string\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"owner\",\"type\":\"address\"}],\"name\":\"nonces\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"oracle\",\"outputs\":[{\"internalType\":\"contract IOracle\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"vaultID\",\"type\":\"uint256\"}],\"name\":\"ownerOf\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"paused\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"owner\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"spender\",\"type\":\"address\"},{\"internalType\":\"bool\",\"name\":\"approved\",\"type\":\"bool\"},{\"internalType\":\"uint256\",\"name\":\"deadline\",\"type\":\"uint256\"},{\"internalType\":\"uint8\",\"name\":\"v\",\"type\":\"uint8\"},{\"internalType\":\"bytes32\",\"name\":\"r\",\"type\":\"bytes32\"},{\"internalType\":\"bytes32\",\"name\":\"s\",\"type\":\"bytes32\"}],\"name\":\"permit\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"repayFee\",\"outputs\":[{\"internalType\":\"uint64\",\"name\":\"\",\"type\":\"uint64\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"from\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"to\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"vaultID\",\"type\":\"uint256\"}],\"name\":\"safeTransferFrom\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"from\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"to\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"vaultID\",\"type\":\"uint256\"},{\"internalType\":\"bytes\",\"name\":\"_data\",\"type\":\"bytes\"}],\"name\":\"safeTransferFrom\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"operator\",\"type\":\"address\"},{\"internalType\":\"bool\",\"name\":\"approved\",\"type\":\"bool\"}],\"name\":\"setApprovalForAll\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"string\",\"name\":\"baseURI_\",\"type\":\"string\"}],\"name\":\"setBaseURI\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_debtCeiling\",\"type\":\"uint256\"}],\"name\":\"setDebtCeiling\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_dust\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"dustCollateral_\",\"type\":\"uint256\"}],\"name\":\"setDusts\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_veBoostProxy\",\"type\":\"address\"},{\"internalType\":\"uint256[]\",\"name\":\"xBoost\",\"type\":\"uint256[]\"},{\"internalType\":\"uint256[]\",\"name\":\"yBoost\",\"type\":\"uint256[]\"}],\"name\":\"setLiquidationBoostParameters\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_oracle\",\"type\":\"address\"}],\"name\":\"setOracle\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_treasury\",\"type\":\"address\"}],\"name\":\"setTreasury\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint64\",\"name\":\"param\",\"type\":\"uint64\"},{\"internalType\":\"bytes32\",\"name\":\"what\",\"type\":\"bytes32\"}],\"name\":\"setUint64\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"stablecoin\",\"outputs\":[{\"internalType\":\"contract IAgToken\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes4\",\"name\":\"interfaceId\",\"type\":\"bytes4\"}],\"name\":\"supportsInterface\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"pure\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"surplus\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"symbol\",\"outputs\":[{\"internalType\":\"string\",\"name\":\"\",\"type\":\"string\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"targetHealthFactor\",\"outputs\":[{\"internalType\":\"uint64\",\"name\":\"\",\"type\":\"uint64\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"togglePause\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"target\",\"type\":\"address\"}],\"name\":\"toggleWhitelist\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"vaultID\",\"type\":\"uint256\"}],\"name\":\"tokenURI\",\"outputs\":[{\"internalType\":\"string\",\"name\":\"\",\"type\":\"string\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"totalNormalizedDebt\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"from\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"to\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"vaultID\",\"type\":\"uint256\"}],\"name\":\"transferFrom\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"treasury\",\"outputs\":[{\"internalType\":\"contract ITreasury\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"name\":\"vaultData\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"collateralAmount\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"normalizedDebt\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"vaultIDCount\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"veBoostProxy\",\"outputs\":[{\"internalType\":\"contract IVeBoostProxy\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"whitelistingActivated\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"name\":\"xLiquidationBoost\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"name\":\"yLiquidationBoost\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"}],\"devdoc\":{\"author\":\"Angle Labs, Inc.\",\"kind\":\"dev\",\"methods\":{\"accrueInterestToTreasury()\":{\"details\":\"`surplus` and `badDebt` should be reset to 0 once their current value have been given to the `treasury` contract\",\"returns\":{\"badDebtValue\":\"Value of the bad debt communicated to the `Treasury`\",\"surplusValue\":\"Value of the surplus communicated to the `Treasury`\"}},\"angle(uint8[],bytes[],address,address,address,bytes)\":{\"details\":\"This function is optimized to reduce gas cost due to payment from or to the user and that expensive calls or computations (like `oracleValue`) are done only onceWhen specifying `vaultID` in `data`, it is important to know that if you specify `vaultID = 0`, it will simply use the latest `vaultID`. This is the default behavior, and unless you're engaging into some complex protocol actions it is encouraged to use `vaultID = 0` only when the first action of the batch is `createVault`\",\"params\":{\"actions\":\"Set of actions to perform\",\"datas\":\"Data to be decoded for each action: it can include like the `vaultID` or the `stablecoinAmount` to borrow\",\"from\":\"Address from which stablecoins will be taken if one action includes burning stablecoins. This address should either be the `msg.sender` or be approved by the latter\",\"repayData\":\"Data to pass to the repayment contract in case of\",\"to\":\"Address to which stablecoins and/or collateral will be sent in case of\",\"who\":\"Address of the contract to handle in case of repayment of stablecoins from received collateral\"},\"returns\":{\"paymentData\":\"Struct containing the accounting changes from the protocol's perspective (like how much of collateral or how much has been received). Note that the values in the struct are not aggregated and you could have in the output a positive amount of stablecoins to receive as well as a positive amount of stablecoins to give\"}},\"approve(address,uint256)\":{\"details\":\"Gives permission to `to` to transfer `tokenId` token to another account. The approval is cleared when the token is transferred. Only a single account can be approved at a time, so approving the zero address clears previous approvals. Requirements: - The caller must own the token or be an approved operator. - `tokenId` must exist. Emits an {Approval} event.\"},\"balanceOf(address)\":{\"details\":\"Returns the number of tokens in ``owner``'s account.\"},\"checkLiquidation(uint256,address)\":{\"details\":\"This function will revert if it's called on a vault that does not exist\",\"params\":{\"liquidator\":\"Address of the liquidator which will be performing the liquidation\",\"vaultID\":\"ID of the vault to check\"},\"returns\":{\"liqOpp\":\"Description of the opportunity of liquidation\"}},\"createVault(address)\":{\"details\":\"This function just creates the vault without doing any collateral or\",\"params\":{\"toVault\":\"Address for which the va\"},\"returns\":{\"_0\":\"vaultID ID of the vault created\"}},\"getApproved(uint256)\":{\"details\":\"Returns the account approved for `tokenId` token. Requirements: - `tokenId` must exist.\"},\"getDebtOut(uint256,uint256,uint256,uint256)\":{\"details\":\"This function can only be called from a vaultManager registered in the same Treasury\",\"params\":{\"amountStablecoins\":\"Amount of stablecoins to remove from the debt: this amount is to be converted to an internal debt amount\",\"senderBorrowFee\":\"Borrowing fees from the contract which requested this: this is to make sure that people are not arbitraging difference in minting fees\",\"senderRepayFee\":\"Repay fees from the contract which requested this: this is to make sure that people are not arbitraging differences in repay fees\",\"vaultID\":\"ID of the vault to remove debt from\"}},\"getTotalDebt()\":{\"returns\":{\"_0\":\"Total debt across all vaults, taking into account the interest accumulated over time\"}},\"getVaultDebt(uint256)\":{\"params\":{\"vaultID\":\"ID of the vault to check\"},\"returns\":{\"_0\":\"Debt of the vault\"}},\"initialize(address,address,address,(uint256,uint64,uint64,uint64,uint64,uint64,bool,uint256),string)\":{\"details\":\"The parameters and the oracle are the only elements which could be modified once the contract has been initializedFor the contract to be fully initialized, governance needs to set the parameters for the liquidation boost\",\"params\":{\"_collateral\":\"Collateral supported by this contract\",\"_oracle\":\"Oracle contract used\",\"_symbol\":\"Symbol used to define the `VaultManager` name and symbol\",\"_treasury\":\"Treasury address handling the contract\"}},\"isApprovedForAll(address,address)\":{\"details\":\"Returns if the `operator` is allowed to manage all of the assets of `owner`. See {setApprovalForAll}\"},\"isApprovedOrOwner(address,uint256)\":{\"params\":{\"spender\":\"Address for which vault ownership should be checked\",\"vaultID\":\"ID of the vault to check\"},\"returns\":{\"_0\":\"Whether the `spender` address owns or is approved for `vaultID`\"}},\"liquidate(uint256[],uint256[],address,address)\":{\"details\":\"This function is a simplified wrapper of the function below. It is built to remove for liquidators the need to specify a `who` and a `data` parameter\"},\"liquidate(uint256[],uint256[],address,address,address,bytes)\":{\"details\":\"This function will revert if it's called on a vault that cannot be liquidated or that does not exist\",\"params\":{\"amounts\":\"Amount of stablecoin to bring for the liquidation of each vault\",\"data\":\"Data to pass to the repayment contract in case of. If empty, liquidators simply have to bring the exact amount of stablecoins to get the discounted collateral. If not, it is used by the repayment contract to swap a portion or all of the collateral received to stablecoins to be sent to the `from` address. More details in the `_handleRepay` function\",\"from\":\"Address from which the stablecoins for the liquidation should be taken: this address should be the `msg.sender` or have received an approval\",\"to\":\"Address to which discounted collateral should be sent\",\"vaultIDs\":\"List of the vaults to liquidate\",\"who\":\"Address of the contract to handle repayment of stablecoins from received collateral\"},\"returns\":{\"liqData\":\"Data about the liquidation process for the liquidator to track everything that has been going on (like how much stablecoins have been repaid, how much collateral has been received)\"}},\"ownerOf(uint256)\":{\"details\":\"Returns the owner of the `tokenId` token. Requirements: - `tokenId` must exist.\"},\"permit(address,address,bool,uint256,uint8,bytes32,bytes32)\":{\"details\":\"The `v`, `r`, and `s` parameters are used as signature data\",\"params\":{\"approved\":\"Whether to give or revoke the approval\",\"deadline\":\"Deadline parameter for the signature to be valid\",\"owner\":\"Address signing the permit and giving (or revoking) its approval for all the controlled vaults\",\"spender\":\"Address to give approval to\"}},\"safeTransferFrom(address,address,uint256)\":{\"details\":\"Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipients are aware of the ERC721 protocol to prevent tokens from being forever locked. Requirements: - `from` cannot be the zero address. - `to` cannot be the zero address. - `tokenId` token must exist and be owned by `from`. - If the caller is not `from`, it must have been allowed to move this token by either {approve} or {setApprovalForAll}. - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer. Emits a {Transfer} event.\"},\"safeTransferFrom(address,address,uint256,bytes)\":{\"details\":\"Safely transfers `tokenId` token from `from` to `to`. Requirements: - `from` cannot be the zero address. - `to` cannot be the zero address. - `tokenId` token must exist and be owned by `from`. - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}. - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer. Emits a {Transfer} event.\"},\"setApprovalForAll(address,bool)\":{\"details\":\"Approve or remove `operator` as an operator for the caller. Operators can call {transferFrom} or {safeTransferFrom} for any token owned by the caller. Requirements: - The `operator` cannot be the caller. Emits an {ApprovalForAll} event.\"},\"setDebtCeiling(uint256)\":{\"details\":\"`debtCeiling` should not be bigger than `type(uint256).max / 10**27` otherwise there could be overflows\",\"params\":{\"_debtCeiling\":\"New value for `debtCeiling`\"}},\"setDusts(uint256,uint256)\":{\"details\":\"dustCollateral_ is in stable value\",\"params\":{\"_dust\":\"New minimum debt allowed\",\"dustCollateral_\":\"New minimum collateral allowed in a vault after a liquidation\"}},\"setLiquidationBoostParameters(address,uint256[],uint256[])\":{\"details\":\"There are 2 modes: When boost is enabled, `xBoost` and `yBoost` should have a length of 2, but if they have a higher length contract will still work as expected. Contract will also work as expected if their length differ When boost is disabled, `_veBoostProxy` needs to be zero address and `yBoost[0]` is the base boost\",\"params\":{\"_veBoostProxy\":\"Address which queries veANGLE balances and adjusted balances from delegation\",\"xBoost\":\"Threshold values of veANGLE adjusted balances\",\"yBoost\":\"Values of the liquidation boost at the threshold values of x\"}},\"setOracle(address)\":{\"params\":{\"_oracle\":\"Reference to the oracle contract\"}},\"setTreasury(address)\":{\"details\":\"All required checks when setting up a treasury contract are performed in the contract calling this function\",\"params\":{\"_treasury\":\"New treasury contract\"}},\"setUint64(uint64,bytes32)\":{\"details\":\"This function performs the required checks when updating a parameterWhen setting parameters governance or the guardian should make sure that when `HF < CF/((1-surcharge)(1-discount))` and hence when liquidating a vault is going to decrease its health factor, `discount = max discount`. Otherwise, it may be profitable for the liquidator to liquidate in multiple times: as it will decrease the HF and therefore increase the discount between each time\",\"params\":{\"param\":\"Value for the parameter\",\"what\":\"Parameter to change\"}},\"supportsInterface(bytes4)\":{\"details\":\"Returns true if this contract implements the interface defined by `interfaceId`. See the corresponding https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section] to learn more about how these ids are created. This function call must use less than 30 000 gas.\"},\"toggleWhitelist(address)\":{\"details\":\"If the `target` address is the zero address then this function toggles whitelisting for all addresses\",\"params\":{\"target\":\"Address to toggle\"}},\"tokenURI(uint256)\":{\"details\":\"Returns the Uniform Resource Identifier (URI) for `tokenId` token.\"},\"transferFrom(address,address,uint256)\":{\"details\":\"Transfers `tokenId` token from `from` to `to`. WARNING: Usage of this method is discouraged, use {safeTransferFrom} whenever possible. Requirements: - `from` cannot be the zero address. - `to` cannot be the zero address. - `tokenId` token must be owned by `from`. - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}. Emits a {Transfer} event.\"}},\"title\":\"VaultManagerLiquidationBoost\",\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{\"BASE_INTEREST()\":{\"notice\":\"Base used for interest rate computation\"},\"BASE_PARAMS()\":{\"notice\":\"Base used for parameter computation: almost all the parameters of this contract are set in `BASE_PARAMS`\"},\"DOMAIN_SEPARATOR()\":{\"notice\":\"Returns the domain separator for the current chain.\"},\"HALF_BASE_INTEREST()\":{\"notice\":\"Used for interest rate computation\"},\"accrueInterestToTreasury()\":{\"notice\":\"Accrues interest accumulated across all vaults to the surplus and sends the surplus to the treasury\"},\"angle(uint8[],bytes[],address,address)\":{\"notice\":\"This function is a wrapper built on top of the function above. It enables users to interact with the contract without having to provide `who` and `repayData` parameters\"},\"angle(uint8[],bytes[],address,address,address,bytes)\":{\"notice\":\"Allows composability between calls to the different entry points of this module. Any user calling this function can perform any of the allowed actions in the order of their choice\"},\"badDebt()\":{\"notice\":\"Bad debt made from liquidated vaults which ended up having no collateral and a positive amount of stablecoins\"},\"borrowFee()\":{\"notice\":\"Upfront fee taken when borrowing stablecoins: this fee is optional and should in practice not be used\"},\"checkLiquidation(uint256,address)\":{\"notice\":\"Checks whether a given vault is liquidable and if yes gives information regarding its liquidation\"},\"collateral()\":{\"notice\":\"Reference to the collateral handled by this `VaultManager`\"},\"collateralFactor()\":{\"notice\":\"Encodes the maximum ratio stablecoin/collateral a vault can have before being liquidated. It's what determines the minimum collateral ratio of a position\"},\"createVault(address)\":{\"notice\":\"Creates a vault\"},\"debtCeiling()\":{\"notice\":\"Maximum amount of stablecoins that can be issued with this contract (in `BASE_TOKENS`). This parameter should not be bigger than `type(uint256).max / BASE_INTEREST` otherwise there may be some overflows in the `increaseDebt` function\"},\"dust()\":{\"notice\":\"Minimum amount of debt a vault can have, expressed in `BASE_TOKENS` that is to say the base of the agTokens\"},\"getDebtOut(uint256,uint256,uint256,uint256)\":{\"notice\":\"Removes debt from a vault after being requested to do so by another `VaultManager` contract\"},\"getTotalDebt()\":{\"notice\":\"Gets the total debt across all vaults\"},\"getVaultDebt(uint256)\":{\"notice\":\"Gets the current debt of a vault\"},\"initialize(address,address,address,(uint256,uint64,uint64,uint64,uint64,uint64,bool,uint256),string)\":{\"notice\":\"Initializes the `VaultManager` contract\"},\"interestAccumulator()\":{\"notice\":\"The `interestAccumulator` variable keeps track of the interest that should accrue to the protocol. The stored value is not necessarily the true value: this one is recomputed every time an action takes place within the protocol. It is in base `BASE_INTEREST`\"},\"interestRate()\":{\"notice\":\"Per second interest taken to borrowers taking agToken loans. Contrarily to other parameters, it is set in `BASE_INTEREST` that is to say in base 10**27\"},\"isApprovedOrOwner(address,uint256)\":{\"notice\":\"Checks whether a given address is approved for a vault or owns this vault\"},\"isWhitelisted(address)\":{\"notice\":\"Maps an address to 1 if it's whitelisted and can open or own a vault\"},\"lastInterestAccumulatorUpdated()\":{\"notice\":\"Timestamp at which the `interestAccumulator` was updated\"},\"liquidate(uint256[],uint256[],address,address)\":{\"notice\":\"Liquidates an ensemble of vaults specified by their IDs\"},\"liquidate(uint256[],uint256[],address,address,address,bytes)\":{\"notice\":\"Liquidates an ensemble of vaults specified by their IDs\"},\"liquidationSurcharge()\":{\"notice\":\"Fee taken by the protocol during a liquidation. Technically, this value is not the fee per se, it's 1 - fee. For instance for a 2% fee, `liquidationSurcharge` should be 98%\"},\"maxLiquidationDiscount()\":{\"notice\":\"Maximum discount given to liquidators\"},\"nonces(address)\":{\"notice\":\"Returns the current nonce for an `owner` address\"},\"oracle()\":{\"notice\":\"Oracle contract to get access to the price of the collateral with respect to the stablecoin\"},\"paused()\":{\"notice\":\"Whether the contract is paused or not\"},\"permit(address,address,bool,uint256,uint8,bytes32,bytes32)\":{\"notice\":\"Allows an address to give or revoke approval for all its vaults to another address\"},\"repayFee()\":{\"notice\":\"Upfront fee taken when repaying stablecoins: this fee is optional as well. It should be smaller than the liquidation surcharge (cf below) to avoid exploits where people voluntarily get liquidated at a 0 discount to pay smaller repaying fees\"},\"setBaseURI(string)\":{\"notice\":\"Changes the ERC721 metadata URI\"},\"setDebtCeiling(uint256)\":{\"notice\":\"Sets `debtCeiling`\"},\"setDusts(uint256,uint256)\":{\"notice\":\"Sets the dust variables\"},\"setLiquidationBoostParameters(address,uint256[],uint256[])\":{\"notice\":\"Sets the parameters for the liquidation booster which encodes the slope of the discount\"},\"setOracle(address)\":{\"notice\":\"Changes the reference to the oracle contract used to get the price of the oracle\"},\"setTreasury(address)\":{\"notice\":\"Sets the treasury contract\"},\"setUint64(uint64,bytes32)\":{\"notice\":\"Sets parameters encoded as uint64\"},\"stablecoin()\":{\"notice\":\"Stablecoin handled by this contract. Another `VaultManager` contract could have the same rights as this `VaultManager` on the stablecoin contract\"},\"surplus()\":{\"notice\":\"Surplus accumulated by the contract: surplus is always in stablecoins, and is then reset when the value is communicated to the treasury contract\"},\"targetHealthFactor()\":{\"notice\":\"Maximum Health factor at which a vault can end up after a liquidation (unless it's fully liquidated)\"},\"togglePause()\":{\"notice\":\"Pauses external permissionless functions of the contract\"},\"toggleWhitelist(address)\":{\"notice\":\"Changes the whitelisting of an address\"},\"totalNormalizedDebt()\":{\"notice\":\"Total normalized amount of stablecoins borrowed, not taking into account the potential bad debt accumulated This value is expressed in the base of Angle stablecoins (`BASE_TOKENS = 10**18`)\"},\"treasury()\":{\"notice\":\"Reference to the `treasury` contract handling this `VaultManager`\"},\"vaultData(uint256)\":{\"notice\":\"Maps a `vaultID` to its data (namely collateral amount and normalized debt)\"},\"vaultIDCount()\":{\"notice\":\"ID of the last vault created. The `vaultIDCount` variables serves as a counter to generate a unique `vaultID` for each vault: it is like `tokenID` in basic ERC721 contracts\"},\"veBoostProxy()\":{\"notice\":\"Reference to the contract which computes adjusted veANGLE balances for liquidators boosts\"},\"whitelistingActivated()\":{\"notice\":\"Whether whitelisting is required to own a vault or not\"},\"xLiquidationBoost(uint256)\":{\"notice\":\"Threshold veANGLE balance values for the computation of the boost for liquidators: the length of this array should normally be 2. The base of the x-values in this array should be `BASE_TOKENS`\"},\"yLiquidationBoost(uint256)\":{\"notice\":\"Values of the liquidation boost at the threshold values of x\"}},\"notice\":\"Liquidation discount depending also on the liquidator veANGLE balance\",\"version\":1}},\"settings\":{\"compilationTarget\":{\"contracts/vaultManager/VaultManagerLiquidationBoost.sol\":\"VaultManagerLiquidationBoost\"},\"evmVersion\":\"london\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\"},\"optimizer\":{\"enabled\":true,\"runs\":1},\"remappings\":[]},\"sources\":{\"@openzeppelin/contracts-upgradeable/interfaces/IERC721MetadataUpgradeable.sol\":{\"keccak256\":\"0xc0e1ac396ac591a4c38ddcdd220321128eb94424d73e41a573cf58d5c643af38\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://2bd729caa85e0c3740b2d3a28a91fac0fd1ef66e0907145005a37f1927ae7a22\",\"dweb:/ipfs/QmcfVoLnE2PZj3U6KbACk6ykqE5WXuAM3hsXLJxC2sxZGt\"]},\"@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol\":{\"keccak256\":\"0x0203dcadc5737d9ef2c211d6fa15d18ebc3b30dfa51903b64870b01a062b0b4e\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://6eb2fd1e9894dbe778f4b8131adecebe570689e63cf892f4e21257bfe1252497\",\"dweb:/ipfs/QmXgUGNfZvrn6N2miv3nooSs7Jm34A41qz94fu2GtDFcx8\"]},\"@openzeppelin/contracts-upgradeable/security/ReentrancyGuardUpgradeable.sol\":{\"keccak256\":\"0x8cc03c5ac17e8a7396e487cda41fc1f1dfdb91db7d528e6da84bee3b6dd7e167\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://607818f1b44548c2d8268176f73cdb290e1faed971b1061930d92698366e2a11\",\"dweb:/ipfs/QmQibMe3r5no95b6q7isGT5R75V8xSofWEDLXzp95b7LgZ\"]},\"@openzeppelin/contracts-upgradeable/token/ERC20/IERC20Upgradeable.sol\":{\"keccak256\":\"0x4e733d3164f73f461eaf9d8087a7ad1ea180bdc8ba0d3d61b0e1ae16d8e63dff\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://75b47c3aeca7b66ea6752f8be020ec5c1c502de6ec9065272dae23d3a52196e2\",\"dweb:/ipfs/QmUebPMHv16tYKFh5BmBQkMfRFb5b8UZ2RgVwdjxCeufVF\"]},\"@openzeppelin/contracts-upgradeable/token/ERC20/extensions/draft-IERC20PermitUpgradeable.sol\":{\"keccak256\":\"0xcc70d8e2281fb3ff69e8ab242500f10142cd0a7fa8dd9e45882be270d4d09024\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://17a4063bc918df0f7bb9cbf04c6f0bb4977afab3f2fc212bc138a178312a221d\",\"dweb:/ipfs/QmZMdvsHP5mDEAAdrK4bNeNh47TfmSFgN9qEBFTbie7zmm\"]},\"@openzeppelin/contracts-upgradeable/token/ERC721/IERC721ReceiverUpgradeable.sol\":{\"keccak256\":\"0xbb2ed8106d94aeae6858e2551a1e7174df73994b77b13ebd120ccaaef80155f5\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://8bc3c6a456dba727d8dd9fd33420febede490abb49a07469f61d2a3ace66a95a\",\"dweb:/ipfs/QmVAWtEVj7K5AbvgJa9Dz22KiDq9eoptCjnVZqsTMtKXyd\"]},\"@openzeppelin/contracts-upgradeable/token/ERC721/IERC721Upgradeable.sol\":{\"keccak256\":\"0x016298e66a5810253c6c905e61966bb31c8775c3f3517bf946ff56ee31d6c005\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://1723de5ae414f210db039b19e6487c19c2d643483c9be7c445cf481a80c199d2\",\"dweb:/ipfs/QmcBLbmPdZsNngYhA1KDadNUqQZoGACytFWuUH74RC4AXC\"]},\"@openzeppelin/contracts-upgradeable/token/ERC721/extensions/IERC721MetadataUpgradeable.sol\":{\"keccak256\":\"0x95a471796eb5f030fdc438660bebec121ad5d063763e64d92376ffb4b5ce8b70\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://4ffbd627e6958983d288801acdedbf3491ee0ebf1a430338bce47c96481ce9e3\",\"dweb:/ipfs/QmUM1vpmNgBV34sYf946SthDJNGhwwqjoRggmj4TUUQmdB\"]},\"@openzeppelin/contracts-upgradeable/utils/AddressUpgradeable.sol\":{\"keccak256\":\"0x611aa3f23e59cfdd1863c536776407b3e33d695152a266fa7cfb34440a29a8a3\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://9b4b2110b7f2b3eb32951bc08046fa90feccffa594e1176cb91cdfb0e94726b4\",\"dweb:/ipfs/QmSxLwYjicf9zWFuieRc8WQwE4FisA1Um5jp1iSa731TGt\"]},\"@openzeppelin/contracts-upgradeable/utils/introspection/IERC165Upgradeable.sol\":{\"keccak256\":\"0xc6cef87559d0aeffdf0a99803de655938a7779ec0a3cd5d4383483ad85565a09\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://92ad7e572cf44e6b4b37631b44b62f9eb9fb1cf14d9ce51c1504d5dc7ccaf758\",\"dweb:/ipfs/QmcnbqX85tsWnUXPmtuPLE4SczME2sJaTfmqEFkuAJvWhy\"]},\"@openzeppelin/contracts/interfaces/IERC721Metadata.sol\":{\"keccak256\":\"0x1e88abdf82fcbbf98f97be17ea56c924376350637896bc37366ec9f89b7c2628\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://c8eb8afc411b87c9718cfe5c68669d5210d7012a96890c520c0fc321f74f0992\",\"dweb:/ipfs/Qmcr74gEtRpWER5qjFN86AKUep66pGuzp9WDYueaNtt97n\"]},\"@openzeppelin/contracts/token/ERC20/IERC20.sol\":{\"keccak256\":\"0x9750c6b834f7b43000631af5cc30001c5f547b3ceb3635488f140f60e897ea6b\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://5a7d5b1ef5d8d5889ad2ed89d8619c09383b80b72ab226e0fe7bde1636481e34\",\"dweb:/ipfs/QmebXWgtEfumQGBdVeM6c71McLixYXQP5Bk6kKXuoY4Bmr\"]},\"@openzeppelin/contracts/token/ERC20/extensions/IERC20Metadata.sol\":{\"keccak256\":\"0x8de418a5503946cabe331f35fe242d3201a73f67f77aaeb7110acb1f30423aca\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://5a376d3dda2cb70536c0a45c208b29b34ac560c4cb4f513a42079f96ba47d2dd\",\"dweb:/ipfs/QmZQg6gn1sUpM8wHzwNvSnihumUCAhxD119MpXeKp8B9s8\"]},\"@openzeppelin/contracts/token/ERC20/extensions/draft-IERC20Permit.sol\":{\"keccak256\":\"0xf41ca991f30855bf80ffd11e9347856a517b977f0a6c2d52e6421a99b7840329\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://b2717fd2bdac99daa960a6de500754ea1b932093c946388c381da48658234b95\",\"dweb:/ipfs/QmP6QVMn6UeA3ByahyJbYQr5M6coHKBKsf3ySZSfbyA8R7\"]},\"@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol\":{\"keccak256\":\"0x032807210d1d7d218963d7355d62e021a84bf1b3339f4f50be2f63b53cccaf29\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://11756f42121f6541a35a8339ea899ee7514cfaa2e6d740625fcc844419296aa6\",\"dweb:/ipfs/QmekMuk6BY4DAjzeXr4MSbKdgoqqsZnA8JPtuyWc6CwXHf\"]},\"@openzeppelin/contracts/token/ERC721/IERC721.sol\":{\"keccak256\":\"0xed6a749c5373af398105ce6ee3ac4763aa450ea7285d268c85d9eeca809cdb1f\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://20a97f891d06f0fe91560ea1a142aaa26fdd22bed1b51606b7d48f670deeb50f\",\"dweb:/ipfs/QmTbCtZKChpaX5H2iRiTDMcSz29GSLCpTCDgJpcMR4wg8x\"]},\"@openzeppelin/contracts/token/ERC721/extensions/IERC721Metadata.sol\":{\"keccak256\":\"0x75b829ff2f26c14355d1cba20e16fe7b29ca58eb5fef665ede48bc0f9c6c74b9\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://a0a107160525724f9e1bbbab031defc2f298296dd9e331f16a6f7130cec32146\",\"dweb:/ipfs/QmemujxSd7gX8A9M8UwmNbz4Ms3U9FG9QfudUgxwvTmPWf\"]},\"@openzeppelin/contracts/utils/Address.sol\":{\"keccak256\":\"0xd6153ce99bcdcce22b124f755e72553295be6abcd63804cfdffceb188b8bef10\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://35c47bece3c03caaa07fab37dd2bb3413bfbca20db7bd9895024390e0a469487\",\"dweb:/ipfs/QmPGWT2x3QHcKxqe6gRmAkdakhbaRgx3DLzcakHz5M4eXG\"]},\"@openzeppelin/contracts/utils/introspection/IERC165.sol\":{\"keccak256\":\"0x447a5f3ddc18419d41ff92b3773fb86471b1db25773e07f877f548918a185bf1\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://be161e54f24e5c6fae81a12db1a8ae87bc5ae1b0ddc805d82a1440a68455088f\",\"dweb:/ipfs/QmP7C3CHdY9urF4dEMb9wmsp1wMxHF6nhA2yQE5SKiPAdy\"]},\"contracts/interfaces/IAgToken.sol\":{\"keccak256\":\"0x6dd62e6c5de3b2e6e7d08694c7b97bd7bdaa7dd53be12a7c2d8c279398b78d39\",\"license\":\"GPL-3.0\",\"urls\":[\"bzz-raw://6ea7608c4787711ccd11c0fc67c1c4997936d818ee59695624cd53493c2b703e\",\"dweb:/ipfs/QmRrhdCX6PXXMsBbJHE9GQ9kY1JHwZztttDoUHUsFW7tgE\"]},\"contracts/interfaces/ICoreBorrow.sol\":{\"keccak256\":\"0x10249210cbf522775f040baf981d7d037472168ce2746d87473ac7c29a34e62e\",\"license\":\"GPL-3.0\",\"urls\":[\"bzz-raw://5662508bcc221233db54b5b311c4e371bd8616b3c5c3572ae207c04060758b67\",\"dweb:/ipfs/QmZCQVyMFbWkBZJnwwB3vxLZkvSXGxEg3Hu1UFJQfpV9fi\"]},\"contracts/interfaces/IFlashAngle.sol\":{\"keccak256\":\"0x39b0097f695b9e934bccdc72676c91513f1077cc5d0fd151908fd25a7c5cfbe4\",\"license\":\"GPL-3.0\",\"urls\":[\"bzz-raw://5b0f3c3581f390b0242d8252a4a215dd04b4c5b74e1efb7396bbba72c3922a02\",\"dweb:/ipfs/Qmc7BxyifSkpKtneN2gMsKkworGPDwVfBdT2t66iGMDerm\"]},\"contracts/interfaces/IOracle.sol\":{\"keccak256\":\"0x94f9c32fbf4f360175d595122686d494a107e9dcbcb8b0b8850edd976204c387\",\"license\":\"GPL-3.0\",\"urls\":[\"bzz-raw://0a77c7a25e729bbf2d0c61f66680b6c9cdb29481fd876268e92aca52ac698fe4\",\"dweb:/ipfs/QmUcraMPnHBgokvPaXuyuVjsKmDJVEwVMfeqXqrMAEwwYp\"]},\"contracts/interfaces/ISwapper.sol\":{\"keccak256\":\"0x2c18883cbff92d1e558e670480f5e2f517bce8c95c202cc3f6602ac276222609\",\"license\":\"GPL-3.0\",\"urls\":[\"bzz-raw://948ebdaf95b08d6617f490aa0651a90d8cc3ef3d4c0b9edc3a50e4fe6df73013\",\"dweb:/ipfs/QmejFnT3zzN2StAUnVDHS62iFxZ4e5ZQBTQ3kghDPXRR9g\"]},\"contracts/interfaces/ITreasury.sol\":{\"keccak256\":\"0x624733dae1bfb98721ba994573aed10997f7448c893b791ed985300531c361fd\",\"license\":\"GPL-3.0\",\"urls\":[\"bzz-raw://8ef7cfe9121192bc39d0906c1585c288f1302237fdf8c0a1575395233d25b90a\",\"dweb:/ipfs/QmWCUt4VTope9mFQd1opjom4CnGpdV4yiG3AQpNkeAgsRp\"]},\"contracts/interfaces/IVaultManager.sol\":{\"keccak256\":\"0x9d2dca11dba2fa9d646ccf88b3c0929d7601de925f1a6270f9ef2bef9390e6e4\",\"license\":\"GPL-3.0\",\"urls\":[\"bzz-raw://8b4991cb79afa8a717f66e4d9ef0c92a619574706affd2462c2b48937ca3585e\",\"dweb:/ipfs/QmWAxyT7jJkuQeFdvQmLVjZbBpEHhZbtfyhijXaqHEdumW\"]},\"contracts/interfaces/external/IERC1271.sol\":{\"keccak256\":\"0x6887d50d488064e481dfba3a9c54c049430b1ffc0a5536387fa89ff5133e6479\",\"license\":\"GPL-2.0-or-later\",\"urls\":[\"bzz-raw://0b080810d65481a97abbb7306b31ed944cd01dd19cb27a7a8e779f81bd9b6d11\",\"dweb:/ipfs/QmZUoJgs3JxAeki6CkbFD8uxBypipefhMS8uuVkQcxnsug\"]},\"contracts/interfaces/governance/IVeBoostProxy.sol\":{\"keccak256\":\"0xce73b8dcafcfaba4d01216f02f49930c078617e11223290004c6f662fc900d6b\",\"license\":\"GPL-3.0\",\"urls\":[\"bzz-raw://eb1eec1ea1c000dc07fa89e4f5f8e7009c1777a03960d7e02dcf3fa6f1630333\",\"dweb:/ipfs/QmbMqqz6nBHQmY57EqfhQA5Ep8WVnQSjaejW79XWtowHzv\"]},\"contracts/vaultManager/VaultManager.sol\":{\"keccak256\":\"0x18cbfb818323a0e40f52aaefc1b940d4e11068f7dd5ceee9a5dc93f2efd9070b\",\"license\":\"GPL-3.0\",\"urls\":[\"bzz-raw://d9b13e669a257ef484528dcc7b0a55fb8885ceb8d3b5d70daa351ab14e01c9c2\",\"dweb:/ipfs/QmNe92AaSvMpYFp9ZwBYBmQAU3wKXYEXD38Xxex1pyevKK\"]},\"contracts/vaultManager/VaultManagerERC721.sol\":{\"keccak256\":\"0x9bb1a6093dc753bd8341e8257a895e764d2e02fccdb8a8b2da44f5268857611a\",\"license\":\"GPL-3.0\",\"urls\":[\"bzz-raw://cd915bd744a2aec9a5da0deec58b4ecec6033cb21aee3e21608e09b57a8ec54c\",\"dweb:/ipfs/QmNtfQsXo5YAz5igsKqHno3bKuk8vVUejK7gEEL9hx8MtF\"]},\"contracts/vaultManager/VaultManagerLiquidationBoost.sol\":{\"keccak256\":\"0xbe2a172d8bd96149ac6bd0113644d59337a40c99b8e9eff0a6393efc3ae8de81\",\"license\":\"GPL-3.0\",\"urls\":[\"bzz-raw://e114f045f071084f504b96d28796d391867346a95cf9004b3f47e10ce906bee1\",\"dweb:/ipfs/QmXSW6XnDTpCredi8KEjwNgntPL6kRPb1mMX5YF9QgHiXQ\"]},\"contracts/vaultManager/VaultManagerPermit.sol\":{\"keccak256\":\"0x1303785eb96597effcbf7d7969be0c5c40c0c7d5a5c6b5b2f7eb20325f07e61f\",\"license\":\"GPL-3.0\",\"urls\":[\"bzz-raw://e9c853c15dc80a49de107cb02788b55006a0797f4ac6c003ea7db2dc62b80ea5\",\"dweb:/ipfs/QmT1XyC5L8u95fYti9DnGTXsyWCQLBcvqGoEKmDazf8pog\"]},\"contracts/vaultManager/VaultManagerStorage.sol\":{\"keccak256\":\"0x612208b1e1f538968d270671f67d1e0e54183872d8a18ddb0f4d0ab3985e8bf3\",\"license\":\"GPL-3.0\",\"urls\":[\"bzz-raw://e78aaffe7506abe8ea1f1568e0f19091703bdd1a264ae59496415a4f53e76dcb\",\"dweb:/ipfs/QmSgEJaWmsRMwxuwviZuKM4s4BLCBfYAtHN6ak2PuAJLPc\"]}},\"version\":1}", + "bytecode": "0x60806040523480156200001157600080fd5b50600054610100900460ff1615808015620000335750600054600160ff909116105b8062000063575062000050306200013d60201b620033591760201c565b15801562000063575060005460ff166001145b620000cb5760405162461bcd60e51b815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201526d191e481a5b9a5d1a585b1a5e995960921b606482015260840160405180910390fd5b6000805460ff191660011790558015620000ef576000805461ff0019166101001790555b801562000136576000805461ff0019169055604051600181527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989060200160405180910390a15b506200014c565b6001600160a01b03163b151590565b615f2c806200015c6000396000f3fe608060405234801561001057600080fd5b50600436106102f65760003560e01c8063010db195146102fb57806301ffc9a71461032457806306fdde0314610347578063081812fc1461035c578063087a60071461036f578063095ea7b3146103865780630e198f221461039b57806313888565146103a457806323b872dd146103ad578063254cf439146103c0578063307439af146103f257806334ce998a1461041257806335836f151461041a5780633644e5151461042d57806339393ac91461043557806339eb4dc6146104485780633ae2325f1461045c5780633af32abf1461046f5780633c2e941b1461048f57806342842e0e14610498578063430c2081146104ab5780634f7e43df146104be57806355f804b3146104d85780635b84d88a146104eb5780635c975abb146104fe57806361d027b3146105125780636352211e1461052557806370a0823114610538578063741075431461054b5780637aacfffa1461055e5780637adbf9731461059a5780637c0f59f4146105ad5780637c3a00fd146105c75780637dc0d1d0146105da5780637e53bd97146105ed5780637e56d47c146106005780637ecebe0014610613578063835986b41461063c57806389050f1d1461064f57806395d89b41146106615780639a3b6f2f146106695780639f48118f146106af578063a22cb465146106ba578063af2c8c2e146106cd578063b1511cc9146106d6578063b4bd6f46146106e9578063b88d4fde146106fc578063bbcac5571461070f578063c4ae316814610718578063c66d8b0114610720578063c87b56dd1461073a578063d8dfeb451461074d578063d9b1cb5b14610760578063de1f776514610773578063de8fc69814610785578063df011c4114610798578063e182b883146107ab578063e1c84ea4146107be578063e626648a146107c7578063e985e9c5146107e1578063e9cbd822146107f4578063f0f4426014610807578063f51cc7dd1461081a578063fad9aba31461082d578063fc29b02114610836578063fd527cf814610849575b600080fd5b60375461030e906001600160a01b031681565b60405161031b9190614ee0565b60405180910390f35b610337610332366004614f0a565b610851565b604051901515815260200161031b565b61034f6108be565b60405161031b9190614f7f565b61030e61036a366004614f92565b61094c565b610378603f5481565b60405190815260200161031b565b610399610394366004614fc0565b61097d565b005b610378603e5481565b61037860415481565b6103996103bb366004614fec565b610a0a565b603c546103da90600160401b90046001600160401b031681565b6040516001600160401b03909116815260200161031b565b61040561040036600461502d565b610a45565b60405161031b919061505d565b610378610af7565b610378610428366004614f92565b610b29565b610378610b65565b610399610443366004615096565b610b6f565b603d5461033790600160c01b900460ff1681565b61037861046a366004614f92565b610c6f565b61037861047d366004615096565b60446020526000908152604090205481565b61037860455481565b6103996104a6366004614fec565b610c90565b6103376104b9366004614fc0565b610cab565b603d546103da90600160801b90046001600160401b031681565b6103996104e6366004615168565b610cb7565b6103996104f936600461519c565b610d5c565b603d5461033790600160c81b900460ff1681565b60335461030e906001600160a01b031681565b61030e610533366004614f92565b610df5565b610378610546366004615096565b610e00565b6103996105593660046151d5565b610e45565b61058561056c366004614f92565b6043602052600090815260409020805460019091015482565b6040805192835260208301919091520161031b565b6103996105a8366004615096565b611211565b603c546103da90600160c01b90046001600160401b031681565b603d546103da906001600160401b031681565b60365461030e906001600160a01b031681565b6103996105fb36600461527f565b611358565b61040561060e3660046152f4565b611549565b610378610621366004615096565b6001600160a01b03166000908152607f602052604090205490565b61039961064a3660046153b8565b611af6565b610378676765c793fa10079d601a1b81565b61034f611cae565b61067c6106773660046154d2565b611cbb565b60405161031b91908151815260208083015190820152604080830151908201526060918201519181019190915260800190565b610378633b9aca0081565b6103996106c8366004615568565b611cf0565b61037860405481565b6103996106e4366004614f92565b611cfb565b6103786106f7366004615096565b611dc4565b61039961070a366004615596565b611e00565b61037860425481565b610399611e3d565b603d546103da90600160401b90046001600160401b031681565b61034f610748366004614f92565b611eec565b60345461030e906001600160a01b031681565b61039961076e366004615601565b612041565b610378676765c793fa10079d601b1b81565b61067c610793366004615695565b6125ec565b603c546103da906001600160401b031681565b6103786107b9366004614f92565b612e73565b61037860395481565b603c546103da90600160801b90046001600160401b031681565b6103376107ef3660046156f3565b612e83565b60355461030e906001600160a01b031681565b610399610815366004615096565b612eb1565b610399610828366004615730565b612f51565b61037860b45481565b6104056108443660046157aa565b613210565b61058561323a565b60006001600160e01b03198216635b5e139f60e01b148061088257506001600160e01b031982166380ac58cd60e01b145b8061089d57506001600160e01b0319821663430c208160e01b145b806108b857506001600160e01b031982166301ffc9a760e01b145b92915050565b607d80546108cb90615806565b80601f01602080910402602001604051908101604052809291908181526020018280546108f790615806565b80156109445780601f1061091957610100808354040283529160200191610944565b820191906000526020600020905b81548152906001019060200180831161092757829003601f168201915b505050505081565b600061095782613368565b6109745760405163062a39dd60e11b815260040160405180910390fd5b6108b882613385565b6000610988826133a0565b9050806001600160a01b0316836001600160a01b031614156109bd576040516349fa8bc360e11b815260040160405180910390fd5b336001600160a01b038216148015906109dd57506109db8133612e83565b155b156109fb5760405163c19f17a960e01b815260040160405180910390fd5b610a0583836133d6565b505050565b3381610a168282613444565b610a335760405163c19f17a960e01b815260040160405180910390fd5b610a3e8585856134c2565b5050505050565b610a4d614db6565b60008381526043602090815260409182902082518084018452815481526001909101548183015260365483516315f789a960e21b81529351610af094929387936001600160a01b03909316926357de26a492600480830193928290030181865afa158015610abf573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610ae3919061583b565b610aeb6135e9565b61377e565b9392505050565b6000676765c793fa10079d601b1b610b0d6135e9565b604054610b1a919061586a565b610b24919061589f565b905090565b6000676765c793fa10079d601b1b610b3f6135e9565b600084815260436020526040902060010154610b5b919061586a565b6108b8919061589f565b6000610b24613ad0565b603354604051631c86b03760e31b81526001600160a01b039091169063e43581b890610b9f903390600401614ee0565b602060405180830381865afa158015610bbc573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610be091906158b3565b610bfd57604051633b8d9d7560e21b815260040160405180910390fd5b6001600160a01b03811615610c4c576001600160a01b038116600090815260446020526040902054610c309060016158d0565b6001600160a01b03821660009081526044602052604090205550565b603d805460ff60c01b198116600160c01b9182900460ff16159091021790555b50565b603b8181548110610c7f57600080fd5b600091825260209091200154905081565b610a0583838360405180602001604052806000815250611e00565b6000610af08383613444565b60335460405163521d4de960e01b81526001600160a01b039091169063521d4de990610ce7903390600401614ee0565b602060405180830381865afa158015610d04573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610d2891906158b3565b610d4557604051632678482f60e21b815260040160405180910390fd5b8051610d58906046906020840190614de5565b5050565b603354604051631c86b03760e31b81526001600160a01b039091169063e43581b890610d8c903390600401614ee0565b602060405180830381865afa158015610da9573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610dcd91906158b3565b610dea57604051633b8d9d7560e21b815260040160405180910390fd5b60b49190915560b555565b60006108b8826133a0565b60006001600160a01b038216610e295760405163d92e233d60e01b815260040160405180910390fd5b506001600160a01b031660009081526048602052604090205490565b60335460405163521d4de960e01b81526001600160a01b039091169063521d4de990610e75903390600401614ee0565b602060405180830381865afa158015610e92573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610eb691906158b3565b610ed357604051632678482f60e21b815260040160405180910390fd5b806121a360f11b1415610f3757603d546001600160401b03600160401b90910481169083161115610f1757604051637650e96360e11b815260040160405180910390fd5b603c80546001600160401b0319166001600160401b0384161790556111ca565b80622a242360e91b1415610f9c57633b9aca00826001600160401b03161015610f735760405163da6a17b960e01b815260040160405180910390fd5b603c8054600160401b600160801b031916600160401b6001600160401b038516021790556111ca565b8061212360f11b141561100057633b9aca00826001600160401b03161115610fd757604051637650e96360e11b815260040160405180910390fd5b603c8054600160801b600160c01b031916600160801b6001600160401b038516021790556111ca565b8061292360f11b141561107d57603d54633b9aca009061103090600160401b90046001600160401b0316846158e7565b6001600160401b0316111561105857604051637650e96360e11b815260040160405180910390fd5b603c80546001600160c01b0316600160c01b6001600160401b038516021790556111ca565b806124a960f11b14156110b357611092613b3c565b50603d80546001600160401b0319166001600160401b0384161790556111ca565b80614c5360f01b141561114c57603c546001600160401b03808416911611806111055750603c54633b9aca00906110fa90600160c01b90046001600160401b0316846158e7565b6001600160401b0316115b156111235760405163180d062b60e31b815260040160405180910390fd5b603d8054600160401b600160801b031916600160401b6001600160401b038516021790556111ca565b806213531160ea1b14156111b157633b9aca00826001600160401b0316111561118857604051637650e96360e11b815260040160405180910390fd5b603d8054600160801b600160c01b031916600160801b6001600160401b038516021790556111ca565b60405163e1daa9cf60e01b815260040160405180910390fd5b604080516001600160401b0384168152602081018390527f13b367dac93b85d1ed9b3d8961d8b48e1a677c9800bb1613b4b0416b2d5b61d091015b60405180910390a15050565b603354604051631c86b03760e31b81526001600160a01b039091169063e43581b890611241903390600401614ee0565b602060405180830381865afa15801561125e573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061128291906158b3565b61129f57604051633b8d9d7560e21b815260040160405180910390fd5b603354604080516361d027b360e01b815290516001600160a01b03928316928416916361d027b39160048083019260209291908290030181865afa1580156112eb573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061130f9190615912565b6001600160a01b031614611336576040516302979eb960e31b815260040160405180910390fd5b603680546001600160a01b0319166001600160a01b0392909216919091179055565b60335460405163521d4de960e01b81526001600160a01b039091169063521d4de990611388903390600401614ee0565b602060405180830381865afa1580156113a5573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906113c991906158b3565b6113e657604051632678482f60e21b815260040160405180910390fd5b805182511415806114115750806000815181106114055761140561592f565b60200260200101516000145b806114a057506001600160a01b038316158015906114a057508160008151811061143d5761143d61592f565b6020026020010151826001815181106114585761145861592f565b60200260200101511115806114a057508060008151811061147b5761147b61592f565b6020026020010151816001815181106114965761149661592f565b6020026020010151105b156114be57604051631746545d60e11b815260040160405180910390fd5b603780546001600160a01b0319166001600160a01b03851617905581516114ec90603a906020850190614e69565b50805161150090603b906020840190614e69565b50826001600160a01b03167feb74d4d9fea592587c926aeb35eb6a7893fb28db0c1c8eb2eb3c586e7164b76c838360405161153c929190615980565b60405180910390a2505050565b611551614db6565b603d54600160c81b900460ff161561157c576040516313d0ff5960e31b815260040160405180910390fd5b600260015414156115a85760405162461bcd60e51b815260040161159f906159a5565b60405180910390fd5b600260015586518651811415806115bd575080155b156115db576040516346282e8d60e01b815260040160405180910390fd5b603660009054906101000a90046001600160a01b03166001600160a01b03166357de26a46040518163ffffffff1660e01b8152600401602060405180830381865afa15801561162e573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611652919061583b565b606083015261165f613b3c565b60808301526040517f965a177723c641ee49150b583a0b9ad4730bb20d3474e00ae5a65e777c00d67b90611694908a906159dc565b60405180910390a160005b81811015611a66576000604360008b84815181106116bf576116bf61592f565b60200260200101518152602001908152602001600020604051806040016040529081600082015481526020016001820154815250509050600061170c82338760600151886080015161377e565b90508060400151600014158015611740575080604001518a84815181106117355761173561592f565b602002602001015110155b80611767575080600001518a848151811061175d5761175d61592f565b6020026020010151115b156117905780600001518a84815181106117835761178361592f565b6020026020010181815250505b6000856060015182606001516117a6919061586a565b603854633b9aca008d87815181106117c0576117c061592f565b60200260200101516117d2919061586a565b6117dc919061586a565b6117e6919061589f565b90506118148c85815181106117fd576117fd61592f565b60200260200101518285600001511115610c6c5750565b8251811061194a575081516020830151604080546000906118369084906158d0565b92505081905550604360008d86815181106118535761185361592f565b60209081029190910181015182528101919091526040016000908120818155600101819055603d548c51633b9aca0091600160401b90046001600160401b0316908e90889081106118a6576118a661592f565b60200260200101516118b8919061586a565b6118c2919061589f565b9050826080015181106118d65760006118e6565b8083608001516118e691906158d0565b876040018181516118f791906159ef565b905250508b51600080516020615e97833981519152908d908690811061191f5761191f61592f565b60200260200101518460200151600060405161193d93929190615a07565b60405180910390a1611a0b565b80604360008e87815181106119615761196161592f565b60200260200101518152602001908152602001600020600001600082825461198991906158d0565b92505081905550611a098c85815181106119a5576119a561592f565b6020026020010151633b9aca00603d60089054906101000a90046001600160401b03166001600160401b03168e88815181106119e3576119e361592f565b60200260200101516119f5919061586a565b6119ff919061589f565b8860800151613bdd565b505b8086602001818151611a1d91906159ef565b9052508a518b9085908110611a3457611a3461592f565b602002602001015186600001818151611a4d91906159ef565b905250611a5f9250839150615a209050565b905061169f565b50603d54633b9aca0090611a8a90600160401b90046001600160401b0316826158d0565b8351611a96919061586a565b611aa0919061589f565b60416000828254611ab191906159ef565b9091555050604082015160428054600090611acd9084906159ef565b909155505060208201518251611ae7919088888888613d0c565b50600180559695505050505050565b603d54600160c81b900460ff1615611b21576040516313d0ff5960e31b815260040160405180910390fd5b6033546040516333b52a9f60e11b81526001600160a01b039091169063676a553e90611b51903390600401614ee0565b602060405180830381865afa158015611b6e573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611b9291906158b3565b611baf5760405163027f480760e01b815260040160405180910390fd5b603c54600090600160c01b90046001600160401b0316821015611bed57603c54611bea908390600160c01b90046001600160401b03166158d0565b90505b603c54600090600160801b90046001600160401b0316841115611c2a57603c54611c2790600160801b90046001600160401b0316856158d0565b90505b6000611c3b6002633b9aca00615b1f565b611c4983633b9aca006158d0565b611c5785633b9aca006158d0565b611c61908961586a565b611c6b919061586a565b611c75919061589f565b9050611c8181876158d0565b60416000828254611c9291906159ef565b90915550611ca4905087826000613bdd565b5050505050505050565b607e80546108cb90615806565b611cc3614ea3565b60408051600080825260208201909252611ce5918791879187918791906125ec565b90505b949350505050565b610d58338383613e16565b60335460405163521d4de960e01b81526001600160a01b039091169063521d4de990611d2b903390600401614ee0565b602060405180830381865afa158015611d48573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611d6c91906158b3565b611d8957604051632678482f60e21b815260040160405180910390fd5b60398190556040518181527fdd63b3dcdbebad734892f7c7a26d0f647fbc7eec973e0775f5229018ac4ab47a9060200160405180910390a150565b603d54600090600160c81b900460ff1615611df2576040516313d0ff5960e31b815260040160405180910390fd5b6108b882613ecc565b919050565b3382611e0c8282613444565b611e295760405163c19f17a960e01b815260040160405180910390fd5b611e3586868686613ffa565b505050505050565b60335460405163521d4de960e01b81526001600160a01b039091169063521d4de990611e6d903390600401614ee0565b602060405180830381865afa158015611e8a573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611eae91906158b3565b611ecb57604051632678482f60e21b815260040160405180910390fd5b603d805460ff60c81b198116600160c81b9182900460ff1615909102179055565b6060611ef782613368565b611f145760405163062a39dd60e11b815260040160405180910390fd5b8160005b8115611f3b57611f2781615a20565b9050611f34600a8361589f565b9150611f18565b6000816001600160401b03811115611f5557611f556150b3565b6040519080825280601f01601f191660200182016040528015611f7f576020820181803683370190505b5090505b8415611fea57611f946001836158d0565b9150611fa1600a86615b2e565b611fac9060306159ef565b60f81b818381518110611fc157611fc161592f565b60200101906001600160f81b031916908160001a905350611fe3600a8661589f565b9450611f83565b60468054611ff790615806565b151590506120145760405180602001604052806000815250612038565b604681604051602001612028929190615b5e565b6040516020818303038152906040525b95945050505050565b600054610100900460ff16158080156120615750600054600160ff909116105b80612082575061207030613359565b158015612082575060005460ff166001145b6120e55760405162461bcd60e51b815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201526d191e481a5b9a5d1a585b1a5e995960921b606482015260840161159f565b6000805460ff191660011790558015612108576000805461ff0019166101001790555b856001600160a01b0316846001600160a01b03166361d027b36040518163ffffffff1660e01b8152600401602060405180830381865afa158015612150573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906121749190615912565b6001600160a01b03161461219b576040516302979eb960e31b815260040160405180910390fd5b603380546001600160a01b038089166001600160a01b0319928316179092556034805492881692909116821790556040805163313ce56760e01b8152905163313ce567916004808201926020929091908290030181865afa158015612204573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906122289190615bfc565b61223390600a615b1f565b603881905550856001600160a01b031663e9cbd8226040518163ffffffff1660e01b8152600401602060405180830381865afa158015612277573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061229b9190615912565b603580546001600160a01b03199081166001600160a01b0393841617909155603680549091169186169190911790556040516000906122de908490602001615c19565b60408051601f19818403018152919052805190915061230490607d906020840190614de5565b5061230e81614034565b8260405160200161231f9190615c60565b604051602081830303815290604052607e9080519060200190612343929190614de5565b50676765c793fa10079d601b1b603f5542603e5561236760a0850160808601615c8a565b6001600160401b03166123806040860160208701615c8a565b6001600160401b031611806123b05750633b9aca006123a560a0860160808701615c8a565b6001600160401b0316115b806123d657506123c66060850160408601615c8a565b6001600160401b0316633b9aca00115b806123fd5750633b9aca006123f160c0860160a08701615c8a565b6001600160401b031610155b8061240a575060e0840135155b1561242857604051631746545d60e11b815260040160405180910390fd5b833560395561243d6040850160208601615c8a565b603c80546001600160401b0319166001600160401b039290921691909117905561246d6060850160408601615c8a565b603c80546001600160401b0392909216600160401b02600160401b600160801b03199092169190911790556124a86080850160608601615c8a565b603d80546001600160401b0319166001600160401b03929092169190911790556124d860a0850160808601615c8a565b603d80546001600160401b0392909216600160401b02600160401b600160801b031990921691909117905561251360c0850160a08601615c8a565b603d80546001600160401b0392909216600160801b02600160801b600160c01b031990921691909117905561254e60e0850160c08601615ca5565b603d8054911515600160c01b0260ff60c01b19909216919091179055604080516020810190915260e0850135815261258a90603b906001614e69565b5050603d805460ff60c81b1916600160c81b1790558015611e35576000805461ff0019169055604051600181527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989060200160405180910390a1505050505050565b6125f4614ea3565b603d54600160c81b900460ff161561261f576040516313d0ff5960e31b815260040160405180910390fd5b600260015414156126425760405162461bcd60e51b815260040161159f906159a5565b60026001558551875114158061265757508651155b15612675576040516346282e8d60e01b815260040160405180910390fd5b6000806000806000805b8c51811015612bdc5760008d828151811061269c5761269c61592f565b60200260200101519050600060078111156126b9576126b9615cc2565b8160078111156126cb576126cb615cc2565b141561270c576127068d83815181106126e6576126e661592f565b60200260200101518060200190518101906127019190615912565b613ecc565b50612bcb565b600281600781111561272057612720615cc2565b1415612786578c82815181106127385761273861592f565b60200260200101518060200190518101906127539190615cd8565b95509250826127625760455492505b61276c838661410a565b848860600181815161277e91906159ef565b905250612bcb565b600781600781111561279a5761279a615cc2565b14156128735760008060008f85815181106127b7576127b761592f565b60200260200101518060200190518101906127d29190615cfc565b60345460405163d505accf60e01b81526001600160a01b038089166004830152306024830152604482018890526064820187905260ff8616608483015260a4820185905260c48201849052969f50939d50939b509497509550929350169063d505accf9060e401600060405180830381600087803b15801561285357600080fd5b505af1158015612867573d6000803e3d6000fd5b50505050505050612bcb565b8661288357612880613b3c565b96505b600481600781111561289757612897615cc2565b1415612963578c82815181106128af576128af61592f565b60200260200101518060200190518101906128ca9190615cd8565b94509250826128d95760455492505b6128e4838589613bdd565b603c5490945060009061290b90600160c01b90046001600160401b0316633b9aca006158d0565b612919633b9aca008761586a565b612923919061589f565b905061292f85826158d0565b6041600082825461294091906159ef565b92505081905550808960200181815161295991906159ef565b905250612bcb9050565b856129e257603660009054906101000a90046001600160a01b03166001600160a01b03166357de26a46040518163ffffffff1660e01b8152600401602060405180830381865afa1580156129bb573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906129df919061583b565b95505b60018160078111156129f6576129f6615cc2565b1415612a72578c8281518110612a0e57612a0e61592f565b6020026020010151806020019051810190612a29919061583b565b925082612a365760455492505b612a41838789614176565b80965081955050508488604001818151612a5b91906159ef565b90525060208801805185919061277e9083906159ef565b6003816007811115612a8657612a86615cc2565b1415612ae6578c8281518110612a9e57612a9e61592f565b6020026020010151806020019051810190612ab99190615cd8565b9550925082612ac85760455492505b612ad48386888a614296565b848860400181815161277e91906159ef565b6005816007811115612afa57612afa615cc2565b1415612b5c578c8281518110612b1257612b1261592f565b6020026020010151806020019051810190612b2d9190615cd8565b9450925082612b3c5760455492505b612b488385888a614370565b9350838860000181815161277e91906159ef565b6006816007811115612b7057612b70615cc2565b1415612bcb576000808e8481518110612b8b57612b8b61592f565b6020026020010151806020019051810190612ba69190615d4f565b98509196509250905084612bba5760455494505b612bc8858383898c8e61440b565b50505b50612bd581615a20565b905061267f565b508551602087015110612cd35785516020870151600091612bfc916158d0565b90508660600151876040015110612c3357612c2e87606001518860400151612c2491906158d0565b828d8d8d8d613d0c565b612ccd565b8015612ca057603554604051630d43af8160e21b81526001600160a01b039091169063350ebe0490612c6d9084908f903390600401615d8d565b600060405180830381600087803b158015612c8757600080fd5b505af1158015612c9b573d6000803e3d6000fd5b505050505b612ccd333089604001518a60600151612cb991906158d0565b6034546001600160a01b0316929190614547565b50612e5f565b60208601518651600091612ce6916158d0565b6035546040516340c10f1960e01b81529192506001600160a01b0316906340c10f1990612d19908d908590600401615dac565b600060405180830381600087803b158015612d3357600080fd5b505af1158015612d47573d6000803e3d6000fd5b50505050866060015187604001511115612d8b57612d868a88606001518960400151612d7391906158d0565b6034546001600160a01b031691906145b2565b612e5d565b600087604001518860600151612da191906158d0565b90508015612e5b57885115612e4357896001600160a01b031663a5d4096b603560009054906101000a90046001600160a01b0316603460009054906101000a90046001600160a01b03163385878f6040518763ffffffff1660e01b8152600401612e1096959493929190615dc5565b600060405180830381600087803b158015612e2a57600080fd5b505af1158015612e3e573d6000803e3d6000fd5b505050505b603454612e5b906001600160a01b0316333084614547565b505b505b505060018055509198975050505050505050565b603a8181548110610c7f57600080fd5b6001600160a01b039182166000908152604a6020908152604080832093909416825291909152205460011490565b6033546001600160a01b03163314612edc5760405163b90cdbb160e01b815260040160405180910390fd5b603380546001600160a01b0319166001600160a01b0383811691909117909155603654604051630787a21360e51b815291169063f0f4426090612f23908490600401614ee0565b600060405180830381600087803b158015612f3d57600080fd5b505af1158015610a3e573d6000803e3d6000fd5b83421115612f725760405163f87d927160e01b815260040160405180910390fd5b6fa2a8918ca85bafe22016d0b997e4df60600160ff1b03811180612fa957508260ff16601b14158015612fa957508260ff16601c14155b15612fc757604051638baa579f60e01b815260040160405180910390fd5b6000612fd1613ad0565b608254898989612fe08d6145d1565b6040805160208101969096526001600160a01b03948516908601529290911660608401521515608083015260a082015260c0810187905260e0016040516020818303038152906040528051906020012060405160200161305792919061190160f01b81526002810192909252602282015260420190565b604051602081830303815290604052805190602001209050613081886001600160a01b0316613359565b1561315d57604080516020810185905280820184905260f886901b6001600160f81b0319166060820152815160418183030181526061820192839052630b135d3f60e11b9092526001600160a01b038a1691631626ba7e916130e7918591606501615e07565b602060405180830381865afa158015613104573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906131289190615e20565b6001600160e01b031916631626ba7e60e01b1461315857604051638baa579f60e01b815260040160405180910390fd5b613205565b6040805160008082526020820180845284905260ff871692820192909252606081018590526080810184905260019060a0016020604051602081039080840390855afa1580156131b1573d6000803e3d6000fd5b505050602060405103519050886001600160a01b0316816001600160a01b03161415806131e557506001600160a01b038116155b1561320357604051638baa579f60e01b815260040160405180910390fd5b505b611ca4888888613e16565b613218614db6565b60408051600080825260208201909252611ce591879187918791879190611549565b60335460009081906001600160a01b0316331461326a5760405163b90cdbb160e01b815260040160405180910390fd5b613272613b3c565b50506041805460428054600093849055929055915080821061330b5761329881836158d0565b6035546033546040516340c10f1960e01b8152929450600093506001600160a01b03918216926340c10f19926132d49216908690600401615dac565b600060405180830381600087803b1580156132ee57600080fd5b505af1158015613302573d6000803e3d6000fd5b5050505061331c565b61331582826158d0565b9050600091505b60408051838152602081018390527ffeb12225c131aab793a00c5239afb778932d170fa28ce6e9d23703e4bd892121910160405180910390a19091565b6001600160a01b03163b151590565b6000908152604760205260409020546001600160a01b0316151590565b6000908152604960205260409020546001600160a01b031690565b6000818152604760205260409020546001600160a01b031680611dfb5760405163062a39dd60e11b815260040160405180910390fd5b600081815260496020526040902080546001600160a01b0319166001600160a01b038416908117909155819061340b826133a0565b6001600160a01b03167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92560405160405180910390a45050565b600080613450836133a0565b9050806001600160a01b0316846001600160a01b0316148061348b5750836001600160a01b031661348084613385565b6001600160a01b0316145b80611ce857506001600160a01b038082166000908152604a6020908152604080832093881683529290522054600114949350505050565b826001600160a01b03166134d5826133a0565b6001600160a01b0316146134fc5760405163c19f17a960e01b815260040160405180910390fd5b6001600160a01b0382166135235760405163d92e233d60e01b815260040160405180910390fd5b603d54600160c01b900460ff16801561355557506001600160a01b038216600090815260446020526040902054600114155b1561357357604051630b094f2760e31b815260040160405180910390fd5b61357e6000826133d6565b6001600160a01b038084166000818152604860209081526040808320805460001901905593861680835284832080546001019055858352604790915283822080546001600160a01b03191682179055925184939291600080516020615ed783398151915291a4505050565b600080603e54426135fa91906158d0565b603d549091506001600160401b0316811580613614575080155b1561362357603f549250505090565b60006136306001846158d0565b905060006002841161364357600061364e565b61364e6002856158d0565b90506000676765c793fa10079d601b1b676765c793fa10079d601a1b613674868061586a565b61367e91906159ef565b613688919061589f565b90506000676765c793fa10079d601b1b676765c793fa10079d601a1b6136ae878561586a565b6136b891906159ef565b6136c2919061589f565b905060006002836136d3878a61586a565b6136dd919061586a565b6136e7919061589f565b90506000600683866136f9898c61586a565b613703919061586a565b61370d919061586a565b613717919061589f565b9050676765c793fa10079d601b1b81836137318b8b61586a565b61374690676765c793fa10079d601b1b6159ef565b61375091906159ef565b61375a91906159ef565b603f54613767919061586a565b613771919061589f565b9850505050505050505090565b613786614db6565b6000806000613796888787614615565b925092509250633b9aca0083106137c0576040516315fe9b6160e21b815260040160405180910390fd5b6000633b9aca006137d185826158d0565b6137da8a61469e565b6137e4919061586a565b6137ee919061589f565b603d54909150600160801b90046001600160401b031681101561381e5761381981633b9aca006158d0565b61383f565b603d5461383f90600160801b90046001600160401b0316633b9aca006158d0565b603d54909150600160401b90046001600160401b03166000806138676002633b9aca00615b1f565b603c5461387d91906001600160401b031661586a565b83613888868a61586a565b613892919061586a565b10613a1b57603c546001600160401b03166138b26002633b9aca00615b1f565b6138bc919061586a565b603c5485906138db90600160401b90046001600160401b03168661586a565b6138e5919061586a565b6138ef91906158d0565b603c548590633b9aca009061390d906001600160401b03168961586a565b603c5461392b908b90600160401b90046001600160401b031661586a565b61393591906158d0565b61393f919061586a565b613949919061586a565b613953919061589f565b9150633b9aca0060b454613967919061586a565b613971848461586a565b61397b91906159ef565b613989633b9aca008861586a565b11613a16576139a3676765c793fa10079d601b1b8461586a565b633b9aca008a8e602001516139b8919061586a565b6139c2919061586a565b6139cc919061589f565b6139d79060016159ef565b915060b454861115613a125782633b9aca0060b454886139f791906158d0565b613a01919061586a565b613a0b919061589f565b9050613a7e565b5060015b613a7e565b603854613a2c90633b9aca0061586a565b8c518b90613a3b90879061586a565b613a45919061586a565b613a4f919061589f565b613a5a9060016159ef565b915060b554851115613a7a57633b9aca008460b554876139f791906158d0565b5060015b818852613a8b848b61586a565b603854613a9c633b9aca008561586a565b613aa6919061586a565b613ab0919061589f565b602089015260408801525050606085015250608083015250949350505050565b60808054608154604080517f8b73c3c69bb8fe3d512ecc4cf759cc79239f7b179b0ffacaa9a75d522b39400f602082015290810192909252606082015246918101919091523060a082015260009060c00160405160208183030381529060405280519060200120905090565b6000613b466135e9565b90506000676765c793fa10079d601b1b603f5483613b6491906158d0565b604054613b71919061586a565b613b7b919061589f565b90508060416000828254613b8f91906159ef565b9091555050603f82905542603e8190556040805184815260208101929092527fd1fa8ba00a3bf20274346919dce0de62d2a140af2c71fe7e29fa6472eea3bb9d910160405180910390a15090565b600081613bef57613bec613b3c565b91505b60008481526043602052604081206001015490676765c793fa10079d601b1b613c18858461586a565b613c22919061589f565b9050808510613c3357935080613c56565b83613c49676765c793fa10079d601b1b8761586a565b613c53919061589f565b90505b613c6081836158d0565b91508060406000828254613c7491906158d0565b90915550508115801590613ca95750676765c793fa10079d601b1b60b454613c9c919061586a565b613ca6858461586a565b11155b15613cc75760405163228af07f60e21b815260040160405180910390fd5b60008681526043602052604080822060010184905551600080516020615e9783398151915291613cfa9189918591615a07565b60405180910390a15092949350505050565b8515613d2957603454613d29906001600160a01b031684886145b2565b8415611e3557805115613da85760345460355460405163a5d4096b60e01b81526001600160a01b038086169363a5d4096b93613d759391831692169089908b908d908990600401615dc5565b600060405180830381600087803b158015613d8f57600080fd5b505af1158015613da3573d6000803e3d6000fd5b505050505b603554604051630d43af8160e21b81526001600160a01b039091169063350ebe0490613ddc90889088903390600401615d8d565b600060405180830381600087803b158015613df657600080fd5b505af1158015613e0a573d6000803e3d6000fd5b50505050505050505050565b826001600160a01b0316826001600160a01b03161415613e49576040516320c5195360e21b815260040160405180910390fd5b600081613e57576000613e5a565b60015b6001600160a01b038581166000818152604a602090815260408083209489168084529482529182902060ff959095169485905590518615158152939450919290917f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c31910160405180910390a350505050565b603d54600090600160c01b900460ff168015613f1b57506001600160a01b0382166000908152604460205260409020546001141580613f1b575033600090815260446020526040902054600114155b15613f3957604051630b094f2760e31b815260040160405180910390fd5b6001600160a01b038216613f605760405163d92e233d60e01b815260040160405180910390fd5b5060458054600101908190556001600160a01b038216600081815260486020908152604080832080546001019055848352604790915280822080546001600160a01b031916841790555183929190600080516020615ed7833981519152908290a4613fdd60008383604051806020016040528060008152506148cd565b611dfb576040516320149b4360e21b815260040160405180910390fd5b6140058484846134c2565b614011848484846148cd565b61402e576040516320149b4360e21b815260040160405180910390fd5b50505050565b600054610100900460ff1661409f5760405162461bcd60e51b815260206004820152602b60248201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960448201526a6e697469616c697a696e6760a81b606482015260840161159f565b7f3f43a9c6bafb5c7aab4e0cfe239dc5d4c15caf0381c6104188191f78a6640bd860825580516020918201206080556040805180820190915260018152603160f81b9101527fc89efdaa54c0f20c7adf612882df0950f5a951637e0307cdcb4c672f298b8bc6608155565b61411382613368565b6141305760405163062a39dd60e11b815260040160405180910390fd5b6000828152604360205260408120805483929061414e9084906159ef565b9091555050604051600080516020615eb7833981519152906112059084908490600190615a07565b60008033856141858282613444565b6141a25760405163c19f17a960e01b815260040160405180910390fd5b6000878152604360209081526040808320815180830190925280548252600101549181019190915290806141d7838a8a614615565b5091509150633b9aca00821161420057604051631527804d60e31b815260040160405180910390fd5b82602001516040600082825461421691906158d0565b9091555061422590508a6149d0565b603c5460009061424990600160c01b90046001600160401b0316633b9aca006158d0565b614257633b9aca008461586a565b614261919061589f565b905061426d82826158d0565b6041600082825461427e91906159ef565b90915550509251929a92995091975050505050505050565b33846142a28282613444565b6142bf5760405163c19f17a960e01b815260040160405180910390fd5b600086815260436020526040812080548792906142dd9084906158d0565b909155505060008681526043602090815260408083208151808301909252805482526001015491810191909152614315908686614615565b50509050633b9aca00811161433d57604051631527804d60e31b815260040160405180910390fd5b600080516020615eb78339815191528787600060405161435f93929190615a07565b60405180910390a150505050505050565b6000338561437e8282613444565b61439b5760405163c19f17a960e01b815260040160405180910390fd5b6143a787878787614a4f565b603c54909650600090633b9aca00906143d1908990600160801b90046001600160401b031661586a565b6143db919061589f565b905080604160008282546143ef91906159ef565b909155506143ff905081886158d0565b98975050505050505050565b33866144178282613444565b6144345760405163c19f17a960e01b815260040160405180910390fd5b60408051898152602081018890526001600160a01b038916818301526060810187905290517fddd3b70af631334f7552aadb582ed091018e62e103fa8b150ca66cc700d4dac69181900360800190a161448f88868686614a4f565b94506001600160a01b0387163014156144b3576144ad868685613bdd565b50611ca4565b603c546040516320d661ad60e21b815260048101889052602481018790526001600160401b03600160801b830481166044830152600160c01b90920490911660648201526001600160a01b0388169063835986b490608401600060405180830381600087803b15801561452557600080fd5b505af1158015614539573d6000803e3d6000fd5b505050505050505050505050565b6040516001600160a01b038085166024830152831660448201526064810182905261402e9085906323b872dd60e01b906084015b60408051601f198184030181529190526020810180516001600160e01b03166001600160e01b031990931692909217909152614be2565b610a058363a9059cbb60e01b848460405160240161457b929190615dac565b6001600160a01b0381166000908152607f60205260409020546145f58160016159ef565b6001600160a01b039092166000908152607f602052604090209190915590565b6000806000676765c793fa10079d601b1b848760200151614636919061586a565b614640919061589f565b9150603854858760000151614655919061586a565b61465f919061589f565b905081614670576000199250614695565b603c548290614688906001600160401b03168361586a565b614692919061589f565b92505b93509350939050565b6037546000906001600160a01b03166146d757603b6000815481106146c5576146c561592f565b90600052602060002001549050919050565b603754604051635dfba04560e11b81526000916001600160a01b03169063bbf7408a90614708908690600401614ee0565b602060405180830381865afa158015614725573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190614749919061583b565b9050603a60018154811061475f5761475f61592f565b9060005260206000200154811061479757603b6001815481106147845761478461592f565b9060005260206000200154915050919050565b603a6000815481106147ab576147ab61592f565b906000526020600020015481116147d057603b6000815481106147845761478461592f565b603a6000815481106147e4576147e461592f565b9060005260206000200154603a6001815481106148035761480361592f565b906000526020600020015461481891906158d0565b603a60008154811061482c5761482c61592f565b90600052602060002001548261484291906158d0565b603b6000815481106148565761485661592f565b9060005260206000200154603b6001815481106148755761487561592f565b906000526020600020015461488a91906158d0565b614894919061586a565b61489e919061589f565b603b6000815481106148b2576148b261592f565b9060005260206000200154610af091906159ef565b50919050565b60006148e1846001600160a01b0316613359565b156149c857604051630a85bd0160e11b81526001600160a01b0385169063150b7a0290614918903390899088908890600401615e3d565b6020604051808303816000875af1925050508015614953575060408051601f3d908101601f1916820190925261495091810190615e20565b60015b6149ae573d808015614981576040519150601f19603f3d011682016040523d82523d6000602084013e614986565b606091505b5080516149a6576040516320149b4360e21b815260040160405180910390fd5b805181602001fd5b6001600160e01b031916630a85bd0160e11b149050611ce8565b506001611ce8565b60006149db826133a0565b90506149e86000836133d6565b6001600160a01b038116600081815260486020908152604080832080546000190190558583526047825280832080546001600160a01b0319169055604390915280822082815560010182905551849290600080516020615ed7833981519152908390a45050565b60008082614a68676765c793fa10079d601b1b8761586a565b614a72919061589f565b600087815260436020526040902060010154909150614aad5760b4548511614aad5760405163228af07f60e21b815260040160405180910390fd5b60008681526043602052604081206001018054839290614ace9084906159ef565b925050819055508060406000828254614ae791906159ef565b9091555050603954614b0590676765c793fa10079d601b1b9061586a565b83604054614b13919061586a565b1115614b32576040516371239a6160e11b815260040160405180910390fd5b60008681526043602090815260408083208151808301909252805482526001015491810191909152614b65908686614615565b50509050633b9aca008111614b8d57604051631527804d60e31b815260040160405180910390fd5b600080516020615e9783398151915287836001604051614baf93929190615a07565b60405180910390a1676765c793fa10079d601b1b614bcd858461586a565b614bd7919061589f565b979650505050505050565b6000614c37826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b0316614cb49092919063ffffffff16565b805190915015610a055780806020019051810190614c5591906158b3565b610a055760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b606482015260840161159f565b6060611ce8848460008585614cc885613359565b614d145760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e7472616374000000604482015260640161159f565b600080866001600160a01b03168587604051614d309190615e7a565b60006040518083038185875af1925050503d8060008114614d6d576040519150601f19603f3d011682016040523d82523d6000602084013e614d72565b606091505b5091509150614bd782828660608315614d8c575081610af0565b825115614d9c5782518084602001fd5b8160405162461bcd60e51b815260040161159f9190614f7f565b6040518060a0016040528060008152602001600081526020016000815260200160008152602001600081525090565b828054614df190615806565b90600052602060002090601f016020900481019282614e135760008555614e59565b82601f10614e2c57805160ff1916838001178555614e59565b82800160010185558215614e59579182015b82811115614e59578251825591602001919060010190614e3e565b50614e65929150614ecb565b5090565b828054828255906000526020600020908101928215614e595791602002820182811115614e59578251825591602001919060010190614e3e565b6040518060800160405280600081526020016000815260200160008152602001600081525090565b5b80821115614e655760008155600101614ecc565b6001600160a01b0391909116815260200190565b6001600160e01b031981168114610c6c57600080fd5b600060208284031215614f1c57600080fd5b8135610af081614ef4565b60005b83811015614f42578181015183820152602001614f2a565b8381111561402e5750506000910152565b60008151808452614f6b816020860160208601614f27565b601f01601f19169290920160200192915050565b602081526000610af06020830184614f53565b600060208284031215614fa457600080fd5b5035919050565b6001600160a01b0381168114610c6c57600080fd5b60008060408385031215614fd357600080fd5b8235614fde81614fab565b946020939093013593505050565b60008060006060848603121561500157600080fd5b833561500c81614fab565b9250602084013561501c81614fab565b929592945050506040919091013590565b6000806040838503121561504057600080fd5b82359150602083013561505281614fab565b809150509250929050565b60a081016108b8828480518252602081015160208301526040810151604083015260608101516060830152608081015160808301525050565b6000602082840312156150a857600080fd5b8135610af081614fab565b634e487b7160e01b600052604160045260246000fd5b604051601f8201601f191681016001600160401b03811182821017156150f1576150f16150b3565b604052919050565b600082601f83011261510a57600080fd5b81356001600160401b03811115615123576151236150b3565b615136601f8201601f19166020016150c9565b81815284602083860101111561514b57600080fd5b816020850160208301376000918101602001919091529392505050565b60006020828403121561517a57600080fd5b81356001600160401b0381111561519057600080fd5b611ce8848285016150f9565b600080604083850312156151af57600080fd5b50508035926020909101359150565b80356001600160401b0381168114611dfb57600080fd5b600080604083850312156151e857600080fd5b614fde836151be565b60006001600160401b0382111561520a5761520a6150b3565b5060051b60200190565b600082601f83011261522557600080fd5b8135602061523a615235836151f1565b6150c9565b82815260059290921b8401810191818101908684111561525957600080fd5b8286015b84811015615274578035835291830191830161525d565b509695505050505050565b60008060006060848603121561529457600080fd5b833561529f81614fab565b925060208401356001600160401b03808211156152bb57600080fd5b6152c787838801615214565b935060408601359150808211156152dd57600080fd5b506152ea86828701615214565b9150509250925092565b60008060008060008060c0878903121561530d57600080fd5b86356001600160401b038082111561532457600080fd5b6153308a838b01615214565b9750602089013591508082111561534657600080fd5b6153528a838b01615214565b96506040890135915061536482614fab565b90945060608801359061537682614fab565b90935060808801359061538882614fab565b90925060a0880135908082111561539e57600080fd5b506153ab89828a016150f9565b9150509295509295509295565b600080600080608085870312156153ce57600080fd5b5050823594602084013594506040840135936060013592509050565b600082601f8301126153fb57600080fd5b8135602061540b615235836151f1565b82815260059290921b8401810191818101908684111561542a57600080fd5b8286015b84811015615274578035600881106154465760008081fd5b835291830191830161542e565b600082601f83011261546457600080fd5b81356020615474615235836151f1565b82815260059290921b8401810191818101908684111561549357600080fd5b8286015b848110156152745780356001600160401b038111156154b65760008081fd5b6154c48986838b01016150f9565b845250918301918301615497565b600080600080608085870312156154e857600080fd5b84356001600160401b03808211156154ff57600080fd5b61550b888389016153ea565b9550602087013591508082111561552157600080fd5b5061552e87828801615453565b935050604085013561553f81614fab565b9150606085013561554f81614fab565b939692955090935050565b8015158114610c6c57600080fd5b6000806040838503121561557b57600080fd5b823561558681614fab565b915060208301356150528161555a565b600080600080608085870312156155ac57600080fd5b84356155b781614fab565b935060208501356155c781614fab565b92506040850135915060608501356001600160401b038111156155e957600080fd5b6155f5878288016150f9565b91505092959194509250565b600080600080600085870361018081121561561b57600080fd5b863561562681614fab565b9550602087013561563681614fab565b9450604087013561564681614fab565b9350610100605f198201121561565b57600080fd5b506060860191506101608601356001600160401b0381111561567c57600080fd5b615688888289016150f9565b9150509295509295909350565b60008060008060008060c087890312156156ae57600080fd5b86356001600160401b03808211156156c557600080fd5b6156d18a838b016153ea565b975060208901359150808211156156e757600080fd5b6153528a838b01615453565b6000806040838503121561570657600080fd5b823561571181614fab565b9150602083013561505281614fab565b60ff81168114610c6c57600080fd5b600080600080600080600060e0888a03121561574b57600080fd5b873561575681614fab565b9650602088013561576681614fab565b955060408801356157768161555a565b945060608801359350608088013561578d81615721565b9699959850939692959460a0840135945060c09093013592915050565b600080600080608085870312156157c057600080fd5b84356001600160401b03808211156157d757600080fd5b6157e388838901615214565b955060208701359150808211156157f957600080fd5b5061552e87828801615214565b600181811c9082168061581a57607f821691505b602082108114156148c757634e487b7160e01b600052602260045260246000fd5b60006020828403121561584d57600080fd5b5051919050565b634e487b7160e01b600052601160045260246000fd5b600081600019048311821515161561588457615884615854565b500290565b634e487b7160e01b600052601260045260246000fd5b6000826158ae576158ae615889565b500490565b6000602082840312156158c557600080fd5b8151610af08161555a565b6000828210156158e2576158e2615854565b500390565b60006001600160401b0382811684821680830382111561590957615909615854565b01949350505050565b60006020828403121561592457600080fd5b8151610af081614fab565b634e487b7160e01b600052603260045260246000fd5b600081518084526020808501945080840160005b8381101561597557815187529582019590820190600101615959565b509495945050505050565b6040815260006159936040830185615945565b82810360208401526120388185615945565b6020808252601f908201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c00604082015260600190565b602081526000610af06020830184615945565b60008219821115615a0257615a02615854565b500190565b928352602083019190915260ff16604082015260600190565b6000600019821415615a3457615a34615854565b5060010190565b600181815b80851115615a76578160001904821115615a5c57615a5c615854565b80851615615a6957918102915b93841c9390800290615a40565b509250929050565b600082615a8d575060016108b8565b81615a9a575060006108b8565b8160018114615ab05760028114615aba57615ad6565b60019150506108b8565b60ff841115615acb57615acb615854565b50506001821b6108b8565b5060208310610133831016604e8410600b8410161715615af9575081810a6108b8565b615b038383615a3b565b8060001904821115615b1757615b17615854565b029392505050565b6000610af060ff841683615a7e565b600082615b3d57615b3d615889565b500690565b60008151615b54818560208601614f27565b9290920192915050565b600080845481600182811c915080831680615b7a57607f831692505b6020808410821415615b9a57634e487b7160e01b86526022600452602486fd5b818015615bae5760018114615bbf57615bec565b60ff19861689528489019650615bec565b60008b81526020902060005b86811015615be45781548b820152908501908301615bcb565b505084890196505b5050505050506120388185615b42565b600060208284031215615c0e57600080fd5b8151610af081615721565b6e020b733b63290283937ba37b1b7b61608d1b815260008251615c4381600f850160208701614f27565b650815985d5b1d60d21b600f939091019283015250601501919050565b60008251615c72818460208701614f27565b650b5d985d5b1d60d21b920191825250600601919050565b600060208284031215615c9c57600080fd5b610af0826151be565b600060208284031215615cb757600080fd5b8135610af08161555a565b634e487b7160e01b600052602160045260246000fd5b60008060408385031215615ceb57600080fd5b505080516020909101519092909150565b60008060008060008060c08789031215615d1557600080fd5b8651615d2081614fab565b6020880151604089015160608a015160808b015160a0909b0151939c929b509099909850965090945092505050565b60008060008060808587031215615d6557600080fd5b845193506020850151615d7781614fab565b6040860151606090960151949790965092505050565b9283526001600160a01b03918216602084015216604082015260600190565b6001600160a01b03929092168252602082015260400190565b6001600160a01b038781168252868116602083015285166040820152606081018490526080810183905260c060a082018190526000906143ff90830184614f53565b828152604060208201526000611ce86040830184614f53565b600060208284031215615e3257600080fd5b8151610af081614ef4565b6001600160a01b0385811682528416602082015260408101839052608060608201819052600090615e7090830184614f53565b9695505050505050565b60008251615e8c818460208701614f27565b919091019291505056fe70cf49afe7355562d5b022e594790f22b71ad8cc7eec902fa5feac7c67f71091722cb71fa87c947148cefc06dd890af5802a6a00207c5ddecf1191bf71ce3cd4ddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3efa264697066735822122004adf5a8fe3c52a612a81111fd6100f9eeb84fbeb3cfcc411a5bf2e9a14a72cb64736f6c634300080c0033", + "deployedBytecode": "0x608060405234801561001057600080fd5b50600436106102f65760003560e01c8063010db195146102fb57806301ffc9a71461032457806306fdde0314610347578063081812fc1461035c578063087a60071461036f578063095ea7b3146103865780630e198f221461039b57806313888565146103a457806323b872dd146103ad578063254cf439146103c0578063307439af146103f257806334ce998a1461041257806335836f151461041a5780633644e5151461042d57806339393ac91461043557806339eb4dc6146104485780633ae2325f1461045c5780633af32abf1461046f5780633c2e941b1461048f57806342842e0e14610498578063430c2081146104ab5780634f7e43df146104be57806355f804b3146104d85780635b84d88a146104eb5780635c975abb146104fe57806361d027b3146105125780636352211e1461052557806370a0823114610538578063741075431461054b5780637aacfffa1461055e5780637adbf9731461059a5780637c0f59f4146105ad5780637c3a00fd146105c75780637dc0d1d0146105da5780637e53bd97146105ed5780637e56d47c146106005780637ecebe0014610613578063835986b41461063c57806389050f1d1461064f57806395d89b41146106615780639a3b6f2f146106695780639f48118f146106af578063a22cb465146106ba578063af2c8c2e146106cd578063b1511cc9146106d6578063b4bd6f46146106e9578063b88d4fde146106fc578063bbcac5571461070f578063c4ae316814610718578063c66d8b0114610720578063c87b56dd1461073a578063d8dfeb451461074d578063d9b1cb5b14610760578063de1f776514610773578063de8fc69814610785578063df011c4114610798578063e182b883146107ab578063e1c84ea4146107be578063e626648a146107c7578063e985e9c5146107e1578063e9cbd822146107f4578063f0f4426014610807578063f51cc7dd1461081a578063fad9aba31461082d578063fc29b02114610836578063fd527cf814610849575b600080fd5b60375461030e906001600160a01b031681565b60405161031b9190614ee0565b60405180910390f35b610337610332366004614f0a565b610851565b604051901515815260200161031b565b61034f6108be565b60405161031b9190614f7f565b61030e61036a366004614f92565b61094c565b610378603f5481565b60405190815260200161031b565b610399610394366004614fc0565b61097d565b005b610378603e5481565b61037860415481565b6103996103bb366004614fec565b610a0a565b603c546103da90600160401b90046001600160401b031681565b6040516001600160401b03909116815260200161031b565b61040561040036600461502d565b610a45565b60405161031b919061505d565b610378610af7565b610378610428366004614f92565b610b29565b610378610b65565b610399610443366004615096565b610b6f565b603d5461033790600160c01b900460ff1681565b61037861046a366004614f92565b610c6f565b61037861047d366004615096565b60446020526000908152604090205481565b61037860455481565b6103996104a6366004614fec565b610c90565b6103376104b9366004614fc0565b610cab565b603d546103da90600160801b90046001600160401b031681565b6103996104e6366004615168565b610cb7565b6103996104f936600461519c565b610d5c565b603d5461033790600160c81b900460ff1681565b60335461030e906001600160a01b031681565b61030e610533366004614f92565b610df5565b610378610546366004615096565b610e00565b6103996105593660046151d5565b610e45565b61058561056c366004614f92565b6043602052600090815260409020805460019091015482565b6040805192835260208301919091520161031b565b6103996105a8366004615096565b611211565b603c546103da90600160c01b90046001600160401b031681565b603d546103da906001600160401b031681565b60365461030e906001600160a01b031681565b6103996105fb36600461527f565b611358565b61040561060e3660046152f4565b611549565b610378610621366004615096565b6001600160a01b03166000908152607f602052604090205490565b61039961064a3660046153b8565b611af6565b610378676765c793fa10079d601a1b81565b61034f611cae565b61067c6106773660046154d2565b611cbb565b60405161031b91908151815260208083015190820152604080830151908201526060918201519181019190915260800190565b610378633b9aca0081565b6103996106c8366004615568565b611cf0565b61037860405481565b6103996106e4366004614f92565b611cfb565b6103786106f7366004615096565b611dc4565b61039961070a366004615596565b611e00565b61037860425481565b610399611e3d565b603d546103da90600160401b90046001600160401b031681565b61034f610748366004614f92565b611eec565b60345461030e906001600160a01b031681565b61039961076e366004615601565b612041565b610378676765c793fa10079d601b1b81565b61067c610793366004615695565b6125ec565b603c546103da906001600160401b031681565b6103786107b9366004614f92565b612e73565b61037860395481565b603c546103da90600160801b90046001600160401b031681565b6103376107ef3660046156f3565b612e83565b60355461030e906001600160a01b031681565b610399610815366004615096565b612eb1565b610399610828366004615730565b612f51565b61037860b45481565b6104056108443660046157aa565b613210565b61058561323a565b60006001600160e01b03198216635b5e139f60e01b148061088257506001600160e01b031982166380ac58cd60e01b145b8061089d57506001600160e01b0319821663430c208160e01b145b806108b857506001600160e01b031982166301ffc9a760e01b145b92915050565b607d80546108cb90615806565b80601f01602080910402602001604051908101604052809291908181526020018280546108f790615806565b80156109445780601f1061091957610100808354040283529160200191610944565b820191906000526020600020905b81548152906001019060200180831161092757829003601f168201915b505050505081565b600061095782613368565b6109745760405163062a39dd60e11b815260040160405180910390fd5b6108b882613385565b6000610988826133a0565b9050806001600160a01b0316836001600160a01b031614156109bd576040516349fa8bc360e11b815260040160405180910390fd5b336001600160a01b038216148015906109dd57506109db8133612e83565b155b156109fb5760405163c19f17a960e01b815260040160405180910390fd5b610a0583836133d6565b505050565b3381610a168282613444565b610a335760405163c19f17a960e01b815260040160405180910390fd5b610a3e8585856134c2565b5050505050565b610a4d614db6565b60008381526043602090815260409182902082518084018452815481526001909101548183015260365483516315f789a960e21b81529351610af094929387936001600160a01b03909316926357de26a492600480830193928290030181865afa158015610abf573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610ae3919061583b565b610aeb6135e9565b61377e565b9392505050565b6000676765c793fa10079d601b1b610b0d6135e9565b604054610b1a919061586a565b610b24919061589f565b905090565b6000676765c793fa10079d601b1b610b3f6135e9565b600084815260436020526040902060010154610b5b919061586a565b6108b8919061589f565b6000610b24613ad0565b603354604051631c86b03760e31b81526001600160a01b039091169063e43581b890610b9f903390600401614ee0565b602060405180830381865afa158015610bbc573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610be091906158b3565b610bfd57604051633b8d9d7560e21b815260040160405180910390fd5b6001600160a01b03811615610c4c576001600160a01b038116600090815260446020526040902054610c309060016158d0565b6001600160a01b03821660009081526044602052604090205550565b603d805460ff60c01b198116600160c01b9182900460ff16159091021790555b50565b603b8181548110610c7f57600080fd5b600091825260209091200154905081565b610a0583838360405180602001604052806000815250611e00565b6000610af08383613444565b60335460405163521d4de960e01b81526001600160a01b039091169063521d4de990610ce7903390600401614ee0565b602060405180830381865afa158015610d04573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610d2891906158b3565b610d4557604051632678482f60e21b815260040160405180910390fd5b8051610d58906046906020840190614de5565b5050565b603354604051631c86b03760e31b81526001600160a01b039091169063e43581b890610d8c903390600401614ee0565b602060405180830381865afa158015610da9573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610dcd91906158b3565b610dea57604051633b8d9d7560e21b815260040160405180910390fd5b60b49190915560b555565b60006108b8826133a0565b60006001600160a01b038216610e295760405163d92e233d60e01b815260040160405180910390fd5b506001600160a01b031660009081526048602052604090205490565b60335460405163521d4de960e01b81526001600160a01b039091169063521d4de990610e75903390600401614ee0565b602060405180830381865afa158015610e92573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610eb691906158b3565b610ed357604051632678482f60e21b815260040160405180910390fd5b806121a360f11b1415610f3757603d546001600160401b03600160401b90910481169083161115610f1757604051637650e96360e11b815260040160405180910390fd5b603c80546001600160401b0319166001600160401b0384161790556111ca565b80622a242360e91b1415610f9c57633b9aca00826001600160401b03161015610f735760405163da6a17b960e01b815260040160405180910390fd5b603c8054600160401b600160801b031916600160401b6001600160401b038516021790556111ca565b8061212360f11b141561100057633b9aca00826001600160401b03161115610fd757604051637650e96360e11b815260040160405180910390fd5b603c8054600160801b600160c01b031916600160801b6001600160401b038516021790556111ca565b8061292360f11b141561107d57603d54633b9aca009061103090600160401b90046001600160401b0316846158e7565b6001600160401b0316111561105857604051637650e96360e11b815260040160405180910390fd5b603c80546001600160c01b0316600160c01b6001600160401b038516021790556111ca565b806124a960f11b14156110b357611092613b3c565b50603d80546001600160401b0319166001600160401b0384161790556111ca565b80614c5360f01b141561114c57603c546001600160401b03808416911611806111055750603c54633b9aca00906110fa90600160c01b90046001600160401b0316846158e7565b6001600160401b0316115b156111235760405163180d062b60e31b815260040160405180910390fd5b603d8054600160401b600160801b031916600160401b6001600160401b038516021790556111ca565b806213531160ea1b14156111b157633b9aca00826001600160401b0316111561118857604051637650e96360e11b815260040160405180910390fd5b603d8054600160801b600160c01b031916600160801b6001600160401b038516021790556111ca565b60405163e1daa9cf60e01b815260040160405180910390fd5b604080516001600160401b0384168152602081018390527f13b367dac93b85d1ed9b3d8961d8b48e1a677c9800bb1613b4b0416b2d5b61d091015b60405180910390a15050565b603354604051631c86b03760e31b81526001600160a01b039091169063e43581b890611241903390600401614ee0565b602060405180830381865afa15801561125e573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061128291906158b3565b61129f57604051633b8d9d7560e21b815260040160405180910390fd5b603354604080516361d027b360e01b815290516001600160a01b03928316928416916361d027b39160048083019260209291908290030181865afa1580156112eb573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061130f9190615912565b6001600160a01b031614611336576040516302979eb960e31b815260040160405180910390fd5b603680546001600160a01b0319166001600160a01b0392909216919091179055565b60335460405163521d4de960e01b81526001600160a01b039091169063521d4de990611388903390600401614ee0565b602060405180830381865afa1580156113a5573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906113c991906158b3565b6113e657604051632678482f60e21b815260040160405180910390fd5b805182511415806114115750806000815181106114055761140561592f565b60200260200101516000145b806114a057506001600160a01b038316158015906114a057508160008151811061143d5761143d61592f565b6020026020010151826001815181106114585761145861592f565b60200260200101511115806114a057508060008151811061147b5761147b61592f565b6020026020010151816001815181106114965761149661592f565b6020026020010151105b156114be57604051631746545d60e11b815260040160405180910390fd5b603780546001600160a01b0319166001600160a01b03851617905581516114ec90603a906020850190614e69565b50805161150090603b906020840190614e69565b50826001600160a01b03167feb74d4d9fea592587c926aeb35eb6a7893fb28db0c1c8eb2eb3c586e7164b76c838360405161153c929190615980565b60405180910390a2505050565b611551614db6565b603d54600160c81b900460ff161561157c576040516313d0ff5960e31b815260040160405180910390fd5b600260015414156115a85760405162461bcd60e51b815260040161159f906159a5565b60405180910390fd5b600260015586518651811415806115bd575080155b156115db576040516346282e8d60e01b815260040160405180910390fd5b603660009054906101000a90046001600160a01b03166001600160a01b03166357de26a46040518163ffffffff1660e01b8152600401602060405180830381865afa15801561162e573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611652919061583b565b606083015261165f613b3c565b60808301526040517f965a177723c641ee49150b583a0b9ad4730bb20d3474e00ae5a65e777c00d67b90611694908a906159dc565b60405180910390a160005b81811015611a66576000604360008b84815181106116bf576116bf61592f565b60200260200101518152602001908152602001600020604051806040016040529081600082015481526020016001820154815250509050600061170c82338760600151886080015161377e565b90508060400151600014158015611740575080604001518a84815181106117355761173561592f565b602002602001015110155b80611767575080600001518a848151811061175d5761175d61592f565b6020026020010151115b156117905780600001518a84815181106117835761178361592f565b6020026020010181815250505b6000856060015182606001516117a6919061586a565b603854633b9aca008d87815181106117c0576117c061592f565b60200260200101516117d2919061586a565b6117dc919061586a565b6117e6919061589f565b90506118148c85815181106117fd576117fd61592f565b60200260200101518285600001511115610c6c5750565b8251811061194a575081516020830151604080546000906118369084906158d0565b92505081905550604360008d86815181106118535761185361592f565b60209081029190910181015182528101919091526040016000908120818155600101819055603d548c51633b9aca0091600160401b90046001600160401b0316908e90889081106118a6576118a661592f565b60200260200101516118b8919061586a565b6118c2919061589f565b9050826080015181106118d65760006118e6565b8083608001516118e691906158d0565b876040018181516118f791906159ef565b905250508b51600080516020615e97833981519152908d908690811061191f5761191f61592f565b60200260200101518460200151600060405161193d93929190615a07565b60405180910390a1611a0b565b80604360008e87815181106119615761196161592f565b60200260200101518152602001908152602001600020600001600082825461198991906158d0565b92505081905550611a098c85815181106119a5576119a561592f565b6020026020010151633b9aca00603d60089054906101000a90046001600160401b03166001600160401b03168e88815181106119e3576119e361592f565b60200260200101516119f5919061586a565b6119ff919061589f565b8860800151613bdd565b505b8086602001818151611a1d91906159ef565b9052508a518b9085908110611a3457611a3461592f565b602002602001015186600001818151611a4d91906159ef565b905250611a5f9250839150615a209050565b905061169f565b50603d54633b9aca0090611a8a90600160401b90046001600160401b0316826158d0565b8351611a96919061586a565b611aa0919061589f565b60416000828254611ab191906159ef565b9091555050604082015160428054600090611acd9084906159ef565b909155505060208201518251611ae7919088888888613d0c565b50600180559695505050505050565b603d54600160c81b900460ff1615611b21576040516313d0ff5960e31b815260040160405180910390fd5b6033546040516333b52a9f60e11b81526001600160a01b039091169063676a553e90611b51903390600401614ee0565b602060405180830381865afa158015611b6e573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611b9291906158b3565b611baf5760405163027f480760e01b815260040160405180910390fd5b603c54600090600160c01b90046001600160401b0316821015611bed57603c54611bea908390600160c01b90046001600160401b03166158d0565b90505b603c54600090600160801b90046001600160401b0316841115611c2a57603c54611c2790600160801b90046001600160401b0316856158d0565b90505b6000611c3b6002633b9aca00615b1f565b611c4983633b9aca006158d0565b611c5785633b9aca006158d0565b611c61908961586a565b611c6b919061586a565b611c75919061589f565b9050611c8181876158d0565b60416000828254611c9291906159ef565b90915550611ca4905087826000613bdd565b5050505050505050565b607e80546108cb90615806565b611cc3614ea3565b60408051600080825260208201909252611ce5918791879187918791906125ec565b90505b949350505050565b610d58338383613e16565b60335460405163521d4de960e01b81526001600160a01b039091169063521d4de990611d2b903390600401614ee0565b602060405180830381865afa158015611d48573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611d6c91906158b3565b611d8957604051632678482f60e21b815260040160405180910390fd5b60398190556040518181527fdd63b3dcdbebad734892f7c7a26d0f647fbc7eec973e0775f5229018ac4ab47a9060200160405180910390a150565b603d54600090600160c81b900460ff1615611df2576040516313d0ff5960e31b815260040160405180910390fd5b6108b882613ecc565b919050565b3382611e0c8282613444565b611e295760405163c19f17a960e01b815260040160405180910390fd5b611e3586868686613ffa565b505050505050565b60335460405163521d4de960e01b81526001600160a01b039091169063521d4de990611e6d903390600401614ee0565b602060405180830381865afa158015611e8a573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611eae91906158b3565b611ecb57604051632678482f60e21b815260040160405180910390fd5b603d805460ff60c81b198116600160c81b9182900460ff1615909102179055565b6060611ef782613368565b611f145760405163062a39dd60e11b815260040160405180910390fd5b8160005b8115611f3b57611f2781615a20565b9050611f34600a8361589f565b9150611f18565b6000816001600160401b03811115611f5557611f556150b3565b6040519080825280601f01601f191660200182016040528015611f7f576020820181803683370190505b5090505b8415611fea57611f946001836158d0565b9150611fa1600a86615b2e565b611fac9060306159ef565b60f81b818381518110611fc157611fc161592f565b60200101906001600160f81b031916908160001a905350611fe3600a8661589f565b9450611f83565b60468054611ff790615806565b151590506120145760405180602001604052806000815250612038565b604681604051602001612028929190615b5e565b6040516020818303038152906040525b95945050505050565b600054610100900460ff16158080156120615750600054600160ff909116105b80612082575061207030613359565b158015612082575060005460ff166001145b6120e55760405162461bcd60e51b815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201526d191e481a5b9a5d1a585b1a5e995960921b606482015260840161159f565b6000805460ff191660011790558015612108576000805461ff0019166101001790555b856001600160a01b0316846001600160a01b03166361d027b36040518163ffffffff1660e01b8152600401602060405180830381865afa158015612150573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906121749190615912565b6001600160a01b03161461219b576040516302979eb960e31b815260040160405180910390fd5b603380546001600160a01b038089166001600160a01b0319928316179092556034805492881692909116821790556040805163313ce56760e01b8152905163313ce567916004808201926020929091908290030181865afa158015612204573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906122289190615bfc565b61223390600a615b1f565b603881905550856001600160a01b031663e9cbd8226040518163ffffffff1660e01b8152600401602060405180830381865afa158015612277573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061229b9190615912565b603580546001600160a01b03199081166001600160a01b0393841617909155603680549091169186169190911790556040516000906122de908490602001615c19565b60408051601f19818403018152919052805190915061230490607d906020840190614de5565b5061230e81614034565b8260405160200161231f9190615c60565b604051602081830303815290604052607e9080519060200190612343929190614de5565b50676765c793fa10079d601b1b603f5542603e5561236760a0850160808601615c8a565b6001600160401b03166123806040860160208701615c8a565b6001600160401b031611806123b05750633b9aca006123a560a0860160808701615c8a565b6001600160401b0316115b806123d657506123c66060850160408601615c8a565b6001600160401b0316633b9aca00115b806123fd5750633b9aca006123f160c0860160a08701615c8a565b6001600160401b031610155b8061240a575060e0840135155b1561242857604051631746545d60e11b815260040160405180910390fd5b833560395561243d6040850160208601615c8a565b603c80546001600160401b0319166001600160401b039290921691909117905561246d6060850160408601615c8a565b603c80546001600160401b0392909216600160401b02600160401b600160801b03199092169190911790556124a86080850160608601615c8a565b603d80546001600160401b0319166001600160401b03929092169190911790556124d860a0850160808601615c8a565b603d80546001600160401b0392909216600160401b02600160401b600160801b031990921691909117905561251360c0850160a08601615c8a565b603d80546001600160401b0392909216600160801b02600160801b600160c01b031990921691909117905561254e60e0850160c08601615ca5565b603d8054911515600160c01b0260ff60c01b19909216919091179055604080516020810190915260e0850135815261258a90603b906001614e69565b5050603d805460ff60c81b1916600160c81b1790558015611e35576000805461ff0019169055604051600181527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989060200160405180910390a1505050505050565b6125f4614ea3565b603d54600160c81b900460ff161561261f576040516313d0ff5960e31b815260040160405180910390fd5b600260015414156126425760405162461bcd60e51b815260040161159f906159a5565b60026001558551875114158061265757508651155b15612675576040516346282e8d60e01b815260040160405180910390fd5b6000806000806000805b8c51811015612bdc5760008d828151811061269c5761269c61592f565b60200260200101519050600060078111156126b9576126b9615cc2565b8160078111156126cb576126cb615cc2565b141561270c576127068d83815181106126e6576126e661592f565b60200260200101518060200190518101906127019190615912565b613ecc565b50612bcb565b600281600781111561272057612720615cc2565b1415612786578c82815181106127385761273861592f565b60200260200101518060200190518101906127539190615cd8565b95509250826127625760455492505b61276c838661410a565b848860600181815161277e91906159ef565b905250612bcb565b600781600781111561279a5761279a615cc2565b14156128735760008060008f85815181106127b7576127b761592f565b60200260200101518060200190518101906127d29190615cfc565b60345460405163d505accf60e01b81526001600160a01b038089166004830152306024830152604482018890526064820187905260ff8616608483015260a4820185905260c48201849052969f50939d50939b509497509550929350169063d505accf9060e401600060405180830381600087803b15801561285357600080fd5b505af1158015612867573d6000803e3d6000fd5b50505050505050612bcb565b8661288357612880613b3c565b96505b600481600781111561289757612897615cc2565b1415612963578c82815181106128af576128af61592f565b60200260200101518060200190518101906128ca9190615cd8565b94509250826128d95760455492505b6128e4838589613bdd565b603c5490945060009061290b90600160c01b90046001600160401b0316633b9aca006158d0565b612919633b9aca008761586a565b612923919061589f565b905061292f85826158d0565b6041600082825461294091906159ef565b92505081905550808960200181815161295991906159ef565b905250612bcb9050565b856129e257603660009054906101000a90046001600160a01b03166001600160a01b03166357de26a46040518163ffffffff1660e01b8152600401602060405180830381865afa1580156129bb573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906129df919061583b565b95505b60018160078111156129f6576129f6615cc2565b1415612a72578c8281518110612a0e57612a0e61592f565b6020026020010151806020019051810190612a29919061583b565b925082612a365760455492505b612a41838789614176565b80965081955050508488604001818151612a5b91906159ef565b90525060208801805185919061277e9083906159ef565b6003816007811115612a8657612a86615cc2565b1415612ae6578c8281518110612a9e57612a9e61592f565b6020026020010151806020019051810190612ab99190615cd8565b9550925082612ac85760455492505b612ad48386888a614296565b848860400181815161277e91906159ef565b6005816007811115612afa57612afa615cc2565b1415612b5c578c8281518110612b1257612b1261592f565b6020026020010151806020019051810190612b2d9190615cd8565b9450925082612b3c5760455492505b612b488385888a614370565b9350838860000181815161277e91906159ef565b6006816007811115612b7057612b70615cc2565b1415612bcb576000808e8481518110612b8b57612b8b61592f565b6020026020010151806020019051810190612ba69190615d4f565b98509196509250905084612bba5760455494505b612bc8858383898c8e61440b565b50505b50612bd581615a20565b905061267f565b508551602087015110612cd35785516020870151600091612bfc916158d0565b90508660600151876040015110612c3357612c2e87606001518860400151612c2491906158d0565b828d8d8d8d613d0c565b612ccd565b8015612ca057603554604051630d43af8160e21b81526001600160a01b039091169063350ebe0490612c6d9084908f903390600401615d8d565b600060405180830381600087803b158015612c8757600080fd5b505af1158015612c9b573d6000803e3d6000fd5b505050505b612ccd333089604001518a60600151612cb991906158d0565b6034546001600160a01b0316929190614547565b50612e5f565b60208601518651600091612ce6916158d0565b6035546040516340c10f1960e01b81529192506001600160a01b0316906340c10f1990612d19908d908590600401615dac565b600060405180830381600087803b158015612d3357600080fd5b505af1158015612d47573d6000803e3d6000fd5b50505050866060015187604001511115612d8b57612d868a88606001518960400151612d7391906158d0565b6034546001600160a01b031691906145b2565b612e5d565b600087604001518860600151612da191906158d0565b90508015612e5b57885115612e4357896001600160a01b031663a5d4096b603560009054906101000a90046001600160a01b0316603460009054906101000a90046001600160a01b03163385878f6040518763ffffffff1660e01b8152600401612e1096959493929190615dc5565b600060405180830381600087803b158015612e2a57600080fd5b505af1158015612e3e573d6000803e3d6000fd5b505050505b603454612e5b906001600160a01b0316333084614547565b505b505b505060018055509198975050505050505050565b603a8181548110610c7f57600080fd5b6001600160a01b039182166000908152604a6020908152604080832093909416825291909152205460011490565b6033546001600160a01b03163314612edc5760405163b90cdbb160e01b815260040160405180910390fd5b603380546001600160a01b0319166001600160a01b0383811691909117909155603654604051630787a21360e51b815291169063f0f4426090612f23908490600401614ee0565b600060405180830381600087803b158015612f3d57600080fd5b505af1158015610a3e573d6000803e3d6000fd5b83421115612f725760405163f87d927160e01b815260040160405180910390fd5b6fa2a8918ca85bafe22016d0b997e4df60600160ff1b03811180612fa957508260ff16601b14158015612fa957508260ff16601c14155b15612fc757604051638baa579f60e01b815260040160405180910390fd5b6000612fd1613ad0565b608254898989612fe08d6145d1565b6040805160208101969096526001600160a01b03948516908601529290911660608401521515608083015260a082015260c0810187905260e0016040516020818303038152906040528051906020012060405160200161305792919061190160f01b81526002810192909252602282015260420190565b604051602081830303815290604052805190602001209050613081886001600160a01b0316613359565b1561315d57604080516020810185905280820184905260f886901b6001600160f81b0319166060820152815160418183030181526061820192839052630b135d3f60e11b9092526001600160a01b038a1691631626ba7e916130e7918591606501615e07565b602060405180830381865afa158015613104573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906131289190615e20565b6001600160e01b031916631626ba7e60e01b1461315857604051638baa579f60e01b815260040160405180910390fd5b613205565b6040805160008082526020820180845284905260ff871692820192909252606081018590526080810184905260019060a0016020604051602081039080840390855afa1580156131b1573d6000803e3d6000fd5b505050602060405103519050886001600160a01b0316816001600160a01b03161415806131e557506001600160a01b038116155b1561320357604051638baa579f60e01b815260040160405180910390fd5b505b611ca4888888613e16565b613218614db6565b60408051600080825260208201909252611ce591879187918791879190611549565b60335460009081906001600160a01b0316331461326a5760405163b90cdbb160e01b815260040160405180910390fd5b613272613b3c565b50506041805460428054600093849055929055915080821061330b5761329881836158d0565b6035546033546040516340c10f1960e01b8152929450600093506001600160a01b03918216926340c10f19926132d49216908690600401615dac565b600060405180830381600087803b1580156132ee57600080fd5b505af1158015613302573d6000803e3d6000fd5b5050505061331c565b61331582826158d0565b9050600091505b60408051838152602081018390527ffeb12225c131aab793a00c5239afb778932d170fa28ce6e9d23703e4bd892121910160405180910390a19091565b6001600160a01b03163b151590565b6000908152604760205260409020546001600160a01b0316151590565b6000908152604960205260409020546001600160a01b031690565b6000818152604760205260409020546001600160a01b031680611dfb5760405163062a39dd60e11b815260040160405180910390fd5b600081815260496020526040902080546001600160a01b0319166001600160a01b038416908117909155819061340b826133a0565b6001600160a01b03167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92560405160405180910390a45050565b600080613450836133a0565b9050806001600160a01b0316846001600160a01b0316148061348b5750836001600160a01b031661348084613385565b6001600160a01b0316145b80611ce857506001600160a01b038082166000908152604a6020908152604080832093881683529290522054600114949350505050565b826001600160a01b03166134d5826133a0565b6001600160a01b0316146134fc5760405163c19f17a960e01b815260040160405180910390fd5b6001600160a01b0382166135235760405163d92e233d60e01b815260040160405180910390fd5b603d54600160c01b900460ff16801561355557506001600160a01b038216600090815260446020526040902054600114155b1561357357604051630b094f2760e31b815260040160405180910390fd5b61357e6000826133d6565b6001600160a01b038084166000818152604860209081526040808320805460001901905593861680835284832080546001019055858352604790915283822080546001600160a01b03191682179055925184939291600080516020615ed783398151915291a4505050565b600080603e54426135fa91906158d0565b603d549091506001600160401b0316811580613614575080155b1561362357603f549250505090565b60006136306001846158d0565b905060006002841161364357600061364e565b61364e6002856158d0565b90506000676765c793fa10079d601b1b676765c793fa10079d601a1b613674868061586a565b61367e91906159ef565b613688919061589f565b90506000676765c793fa10079d601b1b676765c793fa10079d601a1b6136ae878561586a565b6136b891906159ef565b6136c2919061589f565b905060006002836136d3878a61586a565b6136dd919061586a565b6136e7919061589f565b90506000600683866136f9898c61586a565b613703919061586a565b61370d919061586a565b613717919061589f565b9050676765c793fa10079d601b1b81836137318b8b61586a565b61374690676765c793fa10079d601b1b6159ef565b61375091906159ef565b61375a91906159ef565b603f54613767919061586a565b613771919061589f565b9850505050505050505090565b613786614db6565b6000806000613796888787614615565b925092509250633b9aca0083106137c0576040516315fe9b6160e21b815260040160405180910390fd5b6000633b9aca006137d185826158d0565b6137da8a61469e565b6137e4919061586a565b6137ee919061589f565b603d54909150600160801b90046001600160401b031681101561381e5761381981633b9aca006158d0565b61383f565b603d5461383f90600160801b90046001600160401b0316633b9aca006158d0565b603d54909150600160401b90046001600160401b03166000806138676002633b9aca00615b1f565b603c5461387d91906001600160401b031661586a565b83613888868a61586a565b613892919061586a565b10613a1b57603c546001600160401b03166138b26002633b9aca00615b1f565b6138bc919061586a565b603c5485906138db90600160401b90046001600160401b03168661586a565b6138e5919061586a565b6138ef91906158d0565b603c548590633b9aca009061390d906001600160401b03168961586a565b603c5461392b908b90600160401b90046001600160401b031661586a565b61393591906158d0565b61393f919061586a565b613949919061586a565b613953919061589f565b9150633b9aca0060b454613967919061586a565b613971848461586a565b61397b91906159ef565b613989633b9aca008861586a565b11613a16576139a3676765c793fa10079d601b1b8461586a565b633b9aca008a8e602001516139b8919061586a565b6139c2919061586a565b6139cc919061589f565b6139d79060016159ef565b915060b454861115613a125782633b9aca0060b454886139f791906158d0565b613a01919061586a565b613a0b919061589f565b9050613a7e565b5060015b613a7e565b603854613a2c90633b9aca0061586a565b8c518b90613a3b90879061586a565b613a45919061586a565b613a4f919061589f565b613a5a9060016159ef565b915060b554851115613a7a57633b9aca008460b554876139f791906158d0565b5060015b818852613a8b848b61586a565b603854613a9c633b9aca008561586a565b613aa6919061586a565b613ab0919061589f565b602089015260408801525050606085015250608083015250949350505050565b60808054608154604080517f8b73c3c69bb8fe3d512ecc4cf759cc79239f7b179b0ffacaa9a75d522b39400f602082015290810192909252606082015246918101919091523060a082015260009060c00160405160208183030381529060405280519060200120905090565b6000613b466135e9565b90506000676765c793fa10079d601b1b603f5483613b6491906158d0565b604054613b71919061586a565b613b7b919061589f565b90508060416000828254613b8f91906159ef565b9091555050603f82905542603e8190556040805184815260208101929092527fd1fa8ba00a3bf20274346919dce0de62d2a140af2c71fe7e29fa6472eea3bb9d910160405180910390a15090565b600081613bef57613bec613b3c565b91505b60008481526043602052604081206001015490676765c793fa10079d601b1b613c18858461586a565b613c22919061589f565b9050808510613c3357935080613c56565b83613c49676765c793fa10079d601b1b8761586a565b613c53919061589f565b90505b613c6081836158d0565b91508060406000828254613c7491906158d0565b90915550508115801590613ca95750676765c793fa10079d601b1b60b454613c9c919061586a565b613ca6858461586a565b11155b15613cc75760405163228af07f60e21b815260040160405180910390fd5b60008681526043602052604080822060010184905551600080516020615e9783398151915291613cfa9189918591615a07565b60405180910390a15092949350505050565b8515613d2957603454613d29906001600160a01b031684886145b2565b8415611e3557805115613da85760345460355460405163a5d4096b60e01b81526001600160a01b038086169363a5d4096b93613d759391831692169089908b908d908990600401615dc5565b600060405180830381600087803b158015613d8f57600080fd5b505af1158015613da3573d6000803e3d6000fd5b505050505b603554604051630d43af8160e21b81526001600160a01b039091169063350ebe0490613ddc90889088903390600401615d8d565b600060405180830381600087803b158015613df657600080fd5b505af1158015613e0a573d6000803e3d6000fd5b50505050505050505050565b826001600160a01b0316826001600160a01b03161415613e49576040516320c5195360e21b815260040160405180910390fd5b600081613e57576000613e5a565b60015b6001600160a01b038581166000818152604a602090815260408083209489168084529482529182902060ff959095169485905590518615158152939450919290917f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c31910160405180910390a350505050565b603d54600090600160c01b900460ff168015613f1b57506001600160a01b0382166000908152604460205260409020546001141580613f1b575033600090815260446020526040902054600114155b15613f3957604051630b094f2760e31b815260040160405180910390fd5b6001600160a01b038216613f605760405163d92e233d60e01b815260040160405180910390fd5b5060458054600101908190556001600160a01b038216600081815260486020908152604080832080546001019055848352604790915280822080546001600160a01b031916841790555183929190600080516020615ed7833981519152908290a4613fdd60008383604051806020016040528060008152506148cd565b611dfb576040516320149b4360e21b815260040160405180910390fd5b6140058484846134c2565b614011848484846148cd565b61402e576040516320149b4360e21b815260040160405180910390fd5b50505050565b600054610100900460ff1661409f5760405162461bcd60e51b815260206004820152602b60248201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960448201526a6e697469616c697a696e6760a81b606482015260840161159f565b7f3f43a9c6bafb5c7aab4e0cfe239dc5d4c15caf0381c6104188191f78a6640bd860825580516020918201206080556040805180820190915260018152603160f81b9101527fc89efdaa54c0f20c7adf612882df0950f5a951637e0307cdcb4c672f298b8bc6608155565b61411382613368565b6141305760405163062a39dd60e11b815260040160405180910390fd5b6000828152604360205260408120805483929061414e9084906159ef565b9091555050604051600080516020615eb7833981519152906112059084908490600190615a07565b60008033856141858282613444565b6141a25760405163c19f17a960e01b815260040160405180910390fd5b6000878152604360209081526040808320815180830190925280548252600101549181019190915290806141d7838a8a614615565b5091509150633b9aca00821161420057604051631527804d60e31b815260040160405180910390fd5b82602001516040600082825461421691906158d0565b9091555061422590508a6149d0565b603c5460009061424990600160c01b90046001600160401b0316633b9aca006158d0565b614257633b9aca008461586a565b614261919061589f565b905061426d82826158d0565b6041600082825461427e91906159ef565b90915550509251929a92995091975050505050505050565b33846142a28282613444565b6142bf5760405163c19f17a960e01b815260040160405180910390fd5b600086815260436020526040812080548792906142dd9084906158d0565b909155505060008681526043602090815260408083208151808301909252805482526001015491810191909152614315908686614615565b50509050633b9aca00811161433d57604051631527804d60e31b815260040160405180910390fd5b600080516020615eb78339815191528787600060405161435f93929190615a07565b60405180910390a150505050505050565b6000338561437e8282613444565b61439b5760405163c19f17a960e01b815260040160405180910390fd5b6143a787878787614a4f565b603c54909650600090633b9aca00906143d1908990600160801b90046001600160401b031661586a565b6143db919061589f565b905080604160008282546143ef91906159ef565b909155506143ff905081886158d0565b98975050505050505050565b33866144178282613444565b6144345760405163c19f17a960e01b815260040160405180910390fd5b60408051898152602081018890526001600160a01b038916818301526060810187905290517fddd3b70af631334f7552aadb582ed091018e62e103fa8b150ca66cc700d4dac69181900360800190a161448f88868686614a4f565b94506001600160a01b0387163014156144b3576144ad868685613bdd565b50611ca4565b603c546040516320d661ad60e21b815260048101889052602481018790526001600160401b03600160801b830481166044830152600160c01b90920490911660648201526001600160a01b0388169063835986b490608401600060405180830381600087803b15801561452557600080fd5b505af1158015614539573d6000803e3d6000fd5b505050505050505050505050565b6040516001600160a01b038085166024830152831660448201526064810182905261402e9085906323b872dd60e01b906084015b60408051601f198184030181529190526020810180516001600160e01b03166001600160e01b031990931692909217909152614be2565b610a058363a9059cbb60e01b848460405160240161457b929190615dac565b6001600160a01b0381166000908152607f60205260409020546145f58160016159ef565b6001600160a01b039092166000908152607f602052604090209190915590565b6000806000676765c793fa10079d601b1b848760200151614636919061586a565b614640919061589f565b9150603854858760000151614655919061586a565b61465f919061589f565b905081614670576000199250614695565b603c548290614688906001600160401b03168361586a565b614692919061589f565b92505b93509350939050565b6037546000906001600160a01b03166146d757603b6000815481106146c5576146c561592f565b90600052602060002001549050919050565b603754604051635dfba04560e11b81526000916001600160a01b03169063bbf7408a90614708908690600401614ee0565b602060405180830381865afa158015614725573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190614749919061583b565b9050603a60018154811061475f5761475f61592f565b9060005260206000200154811061479757603b6001815481106147845761478461592f565b9060005260206000200154915050919050565b603a6000815481106147ab576147ab61592f565b906000526020600020015481116147d057603b6000815481106147845761478461592f565b603a6000815481106147e4576147e461592f565b9060005260206000200154603a6001815481106148035761480361592f565b906000526020600020015461481891906158d0565b603a60008154811061482c5761482c61592f565b90600052602060002001548261484291906158d0565b603b6000815481106148565761485661592f565b9060005260206000200154603b6001815481106148755761487561592f565b906000526020600020015461488a91906158d0565b614894919061586a565b61489e919061589f565b603b6000815481106148b2576148b261592f565b9060005260206000200154610af091906159ef565b50919050565b60006148e1846001600160a01b0316613359565b156149c857604051630a85bd0160e11b81526001600160a01b0385169063150b7a0290614918903390899088908890600401615e3d565b6020604051808303816000875af1925050508015614953575060408051601f3d908101601f1916820190925261495091810190615e20565b60015b6149ae573d808015614981576040519150601f19603f3d011682016040523d82523d6000602084013e614986565b606091505b5080516149a6576040516320149b4360e21b815260040160405180910390fd5b805181602001fd5b6001600160e01b031916630a85bd0160e11b149050611ce8565b506001611ce8565b60006149db826133a0565b90506149e86000836133d6565b6001600160a01b038116600081815260486020908152604080832080546000190190558583526047825280832080546001600160a01b0319169055604390915280822082815560010182905551849290600080516020615ed7833981519152908390a45050565b60008082614a68676765c793fa10079d601b1b8761586a565b614a72919061589f565b600087815260436020526040902060010154909150614aad5760b4548511614aad5760405163228af07f60e21b815260040160405180910390fd5b60008681526043602052604081206001018054839290614ace9084906159ef565b925050819055508060406000828254614ae791906159ef565b9091555050603954614b0590676765c793fa10079d601b1b9061586a565b83604054614b13919061586a565b1115614b32576040516371239a6160e11b815260040160405180910390fd5b60008681526043602090815260408083208151808301909252805482526001015491810191909152614b65908686614615565b50509050633b9aca008111614b8d57604051631527804d60e31b815260040160405180910390fd5b600080516020615e9783398151915287836001604051614baf93929190615a07565b60405180910390a1676765c793fa10079d601b1b614bcd858461586a565b614bd7919061589f565b979650505050505050565b6000614c37826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b0316614cb49092919063ffffffff16565b805190915015610a055780806020019051810190614c5591906158b3565b610a055760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b606482015260840161159f565b6060611ce8848460008585614cc885613359565b614d145760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e7472616374000000604482015260640161159f565b600080866001600160a01b03168587604051614d309190615e7a565b60006040518083038185875af1925050503d8060008114614d6d576040519150601f19603f3d011682016040523d82523d6000602084013e614d72565b606091505b5091509150614bd782828660608315614d8c575081610af0565b825115614d9c5782518084602001fd5b8160405162461bcd60e51b815260040161159f9190614f7f565b6040518060a0016040528060008152602001600081526020016000815260200160008152602001600081525090565b828054614df190615806565b90600052602060002090601f016020900481019282614e135760008555614e59565b82601f10614e2c57805160ff1916838001178555614e59565b82800160010185558215614e59579182015b82811115614e59578251825591602001919060010190614e3e565b50614e65929150614ecb565b5090565b828054828255906000526020600020908101928215614e595791602002820182811115614e59578251825591602001919060010190614e3e565b6040518060800160405280600081526020016000815260200160008152602001600081525090565b5b80821115614e655760008155600101614ecc565b6001600160a01b0391909116815260200190565b6001600160e01b031981168114610c6c57600080fd5b600060208284031215614f1c57600080fd5b8135610af081614ef4565b60005b83811015614f42578181015183820152602001614f2a565b8381111561402e5750506000910152565b60008151808452614f6b816020860160208601614f27565b601f01601f19169290920160200192915050565b602081526000610af06020830184614f53565b600060208284031215614fa457600080fd5b5035919050565b6001600160a01b0381168114610c6c57600080fd5b60008060408385031215614fd357600080fd5b8235614fde81614fab565b946020939093013593505050565b60008060006060848603121561500157600080fd5b833561500c81614fab565b9250602084013561501c81614fab565b929592945050506040919091013590565b6000806040838503121561504057600080fd5b82359150602083013561505281614fab565b809150509250929050565b60a081016108b8828480518252602081015160208301526040810151604083015260608101516060830152608081015160808301525050565b6000602082840312156150a857600080fd5b8135610af081614fab565b634e487b7160e01b600052604160045260246000fd5b604051601f8201601f191681016001600160401b03811182821017156150f1576150f16150b3565b604052919050565b600082601f83011261510a57600080fd5b81356001600160401b03811115615123576151236150b3565b615136601f8201601f19166020016150c9565b81815284602083860101111561514b57600080fd5b816020850160208301376000918101602001919091529392505050565b60006020828403121561517a57600080fd5b81356001600160401b0381111561519057600080fd5b611ce8848285016150f9565b600080604083850312156151af57600080fd5b50508035926020909101359150565b80356001600160401b0381168114611dfb57600080fd5b600080604083850312156151e857600080fd5b614fde836151be565b60006001600160401b0382111561520a5761520a6150b3565b5060051b60200190565b600082601f83011261522557600080fd5b8135602061523a615235836151f1565b6150c9565b82815260059290921b8401810191818101908684111561525957600080fd5b8286015b84811015615274578035835291830191830161525d565b509695505050505050565b60008060006060848603121561529457600080fd5b833561529f81614fab565b925060208401356001600160401b03808211156152bb57600080fd5b6152c787838801615214565b935060408601359150808211156152dd57600080fd5b506152ea86828701615214565b9150509250925092565b60008060008060008060c0878903121561530d57600080fd5b86356001600160401b038082111561532457600080fd5b6153308a838b01615214565b9750602089013591508082111561534657600080fd5b6153528a838b01615214565b96506040890135915061536482614fab565b90945060608801359061537682614fab565b90935060808801359061538882614fab565b90925060a0880135908082111561539e57600080fd5b506153ab89828a016150f9565b9150509295509295509295565b600080600080608085870312156153ce57600080fd5b5050823594602084013594506040840135936060013592509050565b600082601f8301126153fb57600080fd5b8135602061540b615235836151f1565b82815260059290921b8401810191818101908684111561542a57600080fd5b8286015b84811015615274578035600881106154465760008081fd5b835291830191830161542e565b600082601f83011261546457600080fd5b81356020615474615235836151f1565b82815260059290921b8401810191818101908684111561549357600080fd5b8286015b848110156152745780356001600160401b038111156154b65760008081fd5b6154c48986838b01016150f9565b845250918301918301615497565b600080600080608085870312156154e857600080fd5b84356001600160401b03808211156154ff57600080fd5b61550b888389016153ea565b9550602087013591508082111561552157600080fd5b5061552e87828801615453565b935050604085013561553f81614fab565b9150606085013561554f81614fab565b939692955090935050565b8015158114610c6c57600080fd5b6000806040838503121561557b57600080fd5b823561558681614fab565b915060208301356150528161555a565b600080600080608085870312156155ac57600080fd5b84356155b781614fab565b935060208501356155c781614fab565b92506040850135915060608501356001600160401b038111156155e957600080fd5b6155f5878288016150f9565b91505092959194509250565b600080600080600085870361018081121561561b57600080fd5b863561562681614fab565b9550602087013561563681614fab565b9450604087013561564681614fab565b9350610100605f198201121561565b57600080fd5b506060860191506101608601356001600160401b0381111561567c57600080fd5b615688888289016150f9565b9150509295509295909350565b60008060008060008060c087890312156156ae57600080fd5b86356001600160401b03808211156156c557600080fd5b6156d18a838b016153ea565b975060208901359150808211156156e757600080fd5b6153528a838b01615453565b6000806040838503121561570657600080fd5b823561571181614fab565b9150602083013561505281614fab565b60ff81168114610c6c57600080fd5b600080600080600080600060e0888a03121561574b57600080fd5b873561575681614fab565b9650602088013561576681614fab565b955060408801356157768161555a565b945060608801359350608088013561578d81615721565b9699959850939692959460a0840135945060c09093013592915050565b600080600080608085870312156157c057600080fd5b84356001600160401b03808211156157d757600080fd5b6157e388838901615214565b955060208701359150808211156157f957600080fd5b5061552e87828801615214565b600181811c9082168061581a57607f821691505b602082108114156148c757634e487b7160e01b600052602260045260246000fd5b60006020828403121561584d57600080fd5b5051919050565b634e487b7160e01b600052601160045260246000fd5b600081600019048311821515161561588457615884615854565b500290565b634e487b7160e01b600052601260045260246000fd5b6000826158ae576158ae615889565b500490565b6000602082840312156158c557600080fd5b8151610af08161555a565b6000828210156158e2576158e2615854565b500390565b60006001600160401b0382811684821680830382111561590957615909615854565b01949350505050565b60006020828403121561592457600080fd5b8151610af081614fab565b634e487b7160e01b600052603260045260246000fd5b600081518084526020808501945080840160005b8381101561597557815187529582019590820190600101615959565b509495945050505050565b6040815260006159936040830185615945565b82810360208401526120388185615945565b6020808252601f908201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c00604082015260600190565b602081526000610af06020830184615945565b60008219821115615a0257615a02615854565b500190565b928352602083019190915260ff16604082015260600190565b6000600019821415615a3457615a34615854565b5060010190565b600181815b80851115615a76578160001904821115615a5c57615a5c615854565b80851615615a6957918102915b93841c9390800290615a40565b509250929050565b600082615a8d575060016108b8565b81615a9a575060006108b8565b8160018114615ab05760028114615aba57615ad6565b60019150506108b8565b60ff841115615acb57615acb615854565b50506001821b6108b8565b5060208310610133831016604e8410600b8410161715615af9575081810a6108b8565b615b038383615a3b565b8060001904821115615b1757615b17615854565b029392505050565b6000610af060ff841683615a7e565b600082615b3d57615b3d615889565b500690565b60008151615b54818560208601614f27565b9290920192915050565b600080845481600182811c915080831680615b7a57607f831692505b6020808410821415615b9a57634e487b7160e01b86526022600452602486fd5b818015615bae5760018114615bbf57615bec565b60ff19861689528489019650615bec565b60008b81526020902060005b86811015615be45781548b820152908501908301615bcb565b505084890196505b5050505050506120388185615b42565b600060208284031215615c0e57600080fd5b8151610af081615721565b6e020b733b63290283937ba37b1b7b61608d1b815260008251615c4381600f850160208701614f27565b650815985d5b1d60d21b600f939091019283015250601501919050565b60008251615c72818460208701614f27565b650b5d985d5b1d60d21b920191825250600601919050565b600060208284031215615c9c57600080fd5b610af0826151be565b600060208284031215615cb757600080fd5b8135610af08161555a565b634e487b7160e01b600052602160045260246000fd5b60008060408385031215615ceb57600080fd5b505080516020909101519092909150565b60008060008060008060c08789031215615d1557600080fd5b8651615d2081614fab565b6020880151604089015160608a015160808b015160a0909b0151939c929b509099909850965090945092505050565b60008060008060808587031215615d6557600080fd5b845193506020850151615d7781614fab565b6040860151606090960151949790965092505050565b9283526001600160a01b03918216602084015216604082015260600190565b6001600160a01b03929092168252602082015260400190565b6001600160a01b038781168252868116602083015285166040820152606081018490526080810183905260c060a082018190526000906143ff90830184614f53565b828152604060208201526000611ce86040830184614f53565b600060208284031215615e3257600080fd5b8151610af081614ef4565b6001600160a01b0385811682528416602082015260408101839052608060608201819052600090615e7090830184614f53565b9695505050505050565b60008251615e8c818460208701614f27565b919091019291505056fe70cf49afe7355562d5b022e594790f22b71ad8cc7eec902fa5feac7c67f71091722cb71fa87c947148cefc06dd890af5802a6a00207c5ddecf1191bf71ce3cd4ddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3efa264697066735822122004adf5a8fe3c52a612a81111fd6100f9eeb84fbeb3cfcc411a5bf2e9a14a72cb64736f6c634300080c0033" +} \ No newline at end of file diff --git a/deployments/mainnet/solcInputs/dc345d3eed7216da5bac40699a727ed4.json b/deployments/mainnet/solcInputs/dc345d3eed7216da5bac40699a727ed4.json new file mode 100644 index 00000000..07ab4718 --- /dev/null +++ b/deployments/mainnet/solcInputs/dc345d3eed7216da5bac40699a727ed4.json @@ -0,0 +1,124 @@ +{ + "language": "Solidity", + "sources": { + "contracts/vaultManager/VaultManagerLiquidationBoost.sol": { + "content": "// SPDX-License-Identifier: GPL-3.0\n\npragma solidity ^0.8.12;\n\nimport \"./VaultManager.sol\";\n\n/// @title VaultManagerLiquidationBoost\n/// @author Angle Labs, Inc.\n/// @notice Liquidation discount depending also on the liquidator veANGLE balance\ncontract VaultManagerLiquidationBoost is VaultManager {\n using SafeERC20 for IERC20;\n using Address for address;\n\n // =================================== SETTER ==================================\n\n /// @inheritdoc VaultManager\n /// @param _veBoostProxy Address which queries veANGLE balances and adjusted balances from delegation\n /// @param xBoost Threshold values of veANGLE adjusted balances\n /// @param yBoost Values of the liquidation boost at the threshold values of x\n /// @dev There are 2 modes:\n /// When boost is enabled, `xBoost` and `yBoost` should have a length of 2, but if they have a\n /// higher length contract will still work as expected. Contract will also work as expected if their\n /// length differ\n /// When boost is disabled, `_veBoostProxy` needs to be zero address and `yBoost[0]` is the base boost\n function setLiquidationBoostParameters(\n address _veBoostProxy,\n uint256[] memory xBoost,\n uint256[] memory yBoost\n ) external override onlyGovernorOrGuardian {\n if (\n (xBoost.length != yBoost.length) ||\n (yBoost[0] == 0) ||\n ((_veBoostProxy != address(0)) && (xBoost[1] <= xBoost[0] || yBoost[1] < yBoost[0]))\n ) revert InvalidSetOfParameters();\n veBoostProxy = IVeBoostProxy(_veBoostProxy);\n xLiquidationBoost = xBoost;\n yLiquidationBoost = yBoost;\n emit LiquidationBoostParametersUpdated(_veBoostProxy, xBoost, yBoost);\n }\n\n // ======================== OVERRIDEN VIRTUAL FUNCTIONS ========================\n\n /// @inheritdoc VaultManager\n function _computeLiquidationBoost(address liquidator) internal view override returns (uint256) {\n if (address(veBoostProxy) == address(0)) {\n return yLiquidationBoost[0];\n } else {\n uint256 adjustedBalance = veBoostProxy.adjusted_balance_of(liquidator);\n if (adjustedBalance >= xLiquidationBoost[1]) return yLiquidationBoost[1];\n else if (adjustedBalance <= xLiquidationBoost[0]) return yLiquidationBoost[0];\n else\n return\n yLiquidationBoost[0] +\n ((yLiquidationBoost[1] - yLiquidationBoost[0]) * (adjustedBalance - xLiquidationBoost[0])) /\n (xLiquidationBoost[1] - xLiquidationBoost[0]);\n }\n }\n}\n" + }, + "contracts/vaultManager/VaultManager.sol": { + "content": "// SPDX-License-Identifier: GPL-3.0\n\npragma solidity ^0.8.12;\n\nimport \"./VaultManagerPermit.sol\";\n\n/// @title VaultManager\n/// @author Angle Labs, Inc.\n/// @notice This contract allows people to deposit collateral and open up loans of a given AgToken. It handles all the loan\n/// logic (fees and interest rate) as well as the liquidation logic\n/// @dev This implementation only supports non-rebasing ERC20 tokens as collateral\n/// @dev This contract is encoded as a NFT contract\ncontract VaultManager is VaultManagerPermit, IVaultManagerFunctions {\n using SafeERC20 for IERC20;\n using Address for address;\n\n /// @inheritdoc IVaultManagerFunctions\n uint256 public dust;\n\n /// @notice Minimum amount of collateral (in stablecoin value, e.g in `BASE_TOKENS = 10**18`) that can be left\n /// in a vault during a liquidation where the health factor function is decreasing\n uint256 internal _dustCollateral;\n\n uint256[48] private __gapVaultManager;\n\n /// @inheritdoc IVaultManagerFunctions\n function initialize(\n ITreasury _treasury,\n IERC20 _collateral,\n IOracle _oracle,\n VaultParameters calldata params,\n string memory _symbol\n ) external initializer {\n if (_oracle.treasury() != _treasury) revert InvalidTreasury();\n treasury = _treasury;\n collateral = _collateral;\n _collatBase = 10**(IERC20Metadata(address(collateral)).decimals());\n stablecoin = IAgToken(_treasury.stablecoin());\n oracle = _oracle;\n string memory _name = string.concat(\"Angle Protocol \", _symbol, \" Vault\");\n name = _name;\n __ERC721Permit_init(_name);\n symbol = string.concat(_symbol, \"-vault\");\n\n interestAccumulator = BASE_INTEREST;\n lastInterestAccumulatorUpdated = block.timestamp;\n\n // Checking if the parameters have been correctly initialized\n if (\n params.collateralFactor > params.liquidationSurcharge ||\n params.liquidationSurcharge > BASE_PARAMS ||\n BASE_PARAMS > params.targetHealthFactor ||\n params.maxLiquidationDiscount >= BASE_PARAMS ||\n params.baseBoost == 0\n ) revert InvalidSetOfParameters();\n\n debtCeiling = params.debtCeiling;\n collateralFactor = params.collateralFactor;\n targetHealthFactor = params.targetHealthFactor;\n interestRate = params.interestRate;\n liquidationSurcharge = params.liquidationSurcharge;\n maxLiquidationDiscount = params.maxLiquidationDiscount;\n whitelistingActivated = params.whitelistingActivated;\n yLiquidationBoost = [params.baseBoost];\n paused = true;\n }\n\n // ================================= MODIFIERS =================================\n\n /// @notice Checks whether the `msg.sender` has the governor role or not\n modifier onlyGovernor() {\n if (!treasury.isGovernor(msg.sender)) revert NotGovernor();\n _;\n }\n\n /// @notice Checks whether the `msg.sender` has the governor role or the guardian role\n modifier onlyGovernorOrGuardian() {\n if (!treasury.isGovernorOrGuardian(msg.sender)) revert NotGovernorOrGuardian();\n _;\n }\n\n /// @notice Checks whether the `msg.sender` is the treasury contract\n modifier onlyTreasury() {\n if (msg.sender != address(treasury)) revert NotTreasury();\n _;\n }\n\n /// @notice Checks whether the contract is paused\n modifier whenNotPaused() {\n if (paused) revert Paused();\n _;\n }\n\n // ============================== VAULT FUNCTIONS ==============================\n\n /// @inheritdoc IVaultManagerFunctions\n function createVault(address toVault) external whenNotPaused returns (uint256) {\n return _mint(toVault);\n }\n\n /// @inheritdoc IVaultManagerFunctions\n function angle(\n ActionType[] memory actions,\n bytes[] memory datas,\n address from,\n address to\n ) external returns (PaymentData memory) {\n return angle(actions, datas, from, to, address(0), new bytes(0));\n }\n\n /// @inheritdoc IVaultManagerFunctions\n function angle(\n ActionType[] memory actions,\n bytes[] memory datas,\n address from,\n address to,\n address who,\n bytes memory repayData\n ) public whenNotPaused nonReentrant returns (PaymentData memory paymentData) {\n if (actions.length != datas.length || actions.length == 0) revert IncompatibleLengths();\n // `newInterestAccumulator` and `oracleValue` are expensive to compute. Therefore, they are computed\n // only once inside the first action where they are necessary, then they are passed forward to further actions\n uint256 newInterestAccumulator;\n uint256 oracleValue;\n uint256 collateralAmount;\n uint256 stablecoinAmount;\n uint256 vaultID;\n for (uint256 i; i < actions.length; ++i) {\n ActionType action = actions[i];\n // Processing actions which do not need the value of the oracle or of the `interestAccumulator`\n if (action == ActionType.createVault) {\n _mint(abi.decode(datas[i], (address)));\n } else if (action == ActionType.addCollateral) {\n (vaultID, collateralAmount) = abi.decode(datas[i], (uint256, uint256));\n if (vaultID == 0) vaultID = vaultIDCount;\n _addCollateral(vaultID, collateralAmount);\n paymentData.collateralAmountToReceive += collateralAmount;\n } else if (action == ActionType.permit) {\n address owner;\n bytes32 r;\n bytes32 s;\n // Watch out naming conventions for permit are not respected to save some space and reduce the stack size\n // `vaultID` is used in place of the `deadline` parameter\n // Same for `collateralAmount` used in place of `value`\n // `stablecoinAmount` is used in place of the `v`\n (owner, collateralAmount, vaultID, stablecoinAmount, r, s) = abi.decode(\n datas[i],\n (address, uint256, uint256, uint256, bytes32, bytes32)\n );\n IERC20PermitUpgradeable(address(collateral)).permit(\n owner,\n address(this),\n collateralAmount,\n vaultID,\n uint8(stablecoinAmount),\n r,\n s\n );\n } else {\n // Processing actions which rely on the `interestAccumulator`: first accruing it to make\n // sure surplus is correctly taken into account between debt changes\n if (newInterestAccumulator == 0) newInterestAccumulator = _accrue();\n if (action == ActionType.repayDebt) {\n (vaultID, stablecoinAmount) = abi.decode(datas[i], (uint256, uint256));\n if (vaultID == 0) vaultID = vaultIDCount;\n stablecoinAmount = _repayDebt(vaultID, stablecoinAmount, newInterestAccumulator);\n uint256 stablecoinAmountPlusRepayFee = (stablecoinAmount * BASE_PARAMS) / (BASE_PARAMS - repayFee);\n surplus += stablecoinAmountPlusRepayFee - stablecoinAmount;\n paymentData.stablecoinAmountToReceive += stablecoinAmountPlusRepayFee;\n } else {\n // Processing actions which need the oracle value\n if (oracleValue == 0) oracleValue = oracle.read();\n if (action == ActionType.closeVault) {\n vaultID = abi.decode(datas[i], (uint256));\n if (vaultID == 0) vaultID = vaultIDCount;\n (stablecoinAmount, collateralAmount) = _closeVault(\n vaultID,\n oracleValue,\n newInterestAccumulator\n );\n paymentData.collateralAmountToGive += collateralAmount;\n paymentData.stablecoinAmountToReceive += stablecoinAmount;\n } else if (action == ActionType.removeCollateral) {\n (vaultID, collateralAmount) = abi.decode(datas[i], (uint256, uint256));\n if (vaultID == 0) vaultID = vaultIDCount;\n _removeCollateral(vaultID, collateralAmount, oracleValue, newInterestAccumulator);\n paymentData.collateralAmountToGive += collateralAmount;\n } else if (action == ActionType.borrow) {\n (vaultID, stablecoinAmount) = abi.decode(datas[i], (uint256, uint256));\n if (vaultID == 0) vaultID = vaultIDCount;\n stablecoinAmount = _borrow(vaultID, stablecoinAmount, oracleValue, newInterestAccumulator);\n paymentData.stablecoinAmountToGive += stablecoinAmount;\n } else if (action == ActionType.getDebtIn) {\n address vaultManager;\n uint256 dstVaultID;\n (vaultID, vaultManager, dstVaultID, stablecoinAmount) = abi.decode(\n datas[i],\n (uint256, address, uint256, uint256)\n );\n if (vaultID == 0) vaultID = vaultIDCount;\n _getDebtIn(\n vaultID,\n IVaultManager(vaultManager),\n dstVaultID,\n stablecoinAmount,\n oracleValue,\n newInterestAccumulator\n );\n }\n }\n }\n }\n\n // Processing the different cases for the repayment, there are 4 of them:\n // - (1) Stablecoins to receive + collateral to send\n // - (2) Stablecoins to receive + collateral to receive\n // - (3) Stablecoins to send + collateral to send\n // - (4) Stablecoins to send + collateral to receive\n if (paymentData.stablecoinAmountToReceive >= paymentData.stablecoinAmountToGive) {\n uint256 stablecoinPayment = paymentData.stablecoinAmountToReceive - paymentData.stablecoinAmountToGive;\n if (paymentData.collateralAmountToGive >= paymentData.collateralAmountToReceive) {\n // In the case where all amounts are null, the function will enter here and nothing will be done\n // for the repayment\n _handleRepay(\n // Collateral payment is the difference between what to give and what to receive\n paymentData.collateralAmountToGive - paymentData.collateralAmountToReceive,\n stablecoinPayment,\n from,\n to,\n who,\n repayData\n );\n } else {\n if (stablecoinPayment != 0) stablecoin.burnFrom(stablecoinPayment, from, msg.sender);\n // In this case the collateral amount is necessarily non null\n collateral.safeTransferFrom(\n msg.sender,\n address(this),\n paymentData.collateralAmountToReceive - paymentData.collateralAmountToGive\n );\n }\n } else {\n uint256 stablecoinPayment = paymentData.stablecoinAmountToGive - paymentData.stablecoinAmountToReceive;\n // `stablecoinPayment` is strictly positive in this case\n stablecoin.mint(to, stablecoinPayment);\n if (paymentData.collateralAmountToGive > paymentData.collateralAmountToReceive) {\n collateral.safeTransfer(to, paymentData.collateralAmountToGive - paymentData.collateralAmountToReceive);\n } else {\n uint256 collateralPayment = paymentData.collateralAmountToReceive - paymentData.collateralAmountToGive;\n if (collateralPayment != 0) {\n if (repayData.length != 0) {\n ISwapper(who).swap(\n IERC20(address(stablecoin)),\n collateral,\n msg.sender,\n // As per the `ISwapper` interface, we must first give the amount of token owed by the address before\n // the amount of token it (or another related address) obtained\n collateralPayment,\n stablecoinPayment,\n repayData\n );\n }\n collateral.safeTransferFrom(msg.sender, address(this), collateralPayment);\n }\n }\n }\n }\n\n /// @inheritdoc IVaultManagerFunctions\n function getDebtOut(\n uint256 vaultID,\n uint256 stablecoinAmount,\n uint256 senderBorrowFee,\n uint256 senderRepayFee\n ) external whenNotPaused {\n if (!treasury.isVaultManager(msg.sender)) revert NotVaultManager();\n // Getting debt out of a vault is equivalent to repaying a portion of your debt, and this could leave exploits:\n // someone could borrow from a vault and transfer its debt to a `VaultManager` contract where debt repayment will\n // be cheaper: in which case we're making people pay the delta\n uint256 _repayFee;\n if (repayFee > senderRepayFee) {\n _repayFee = repayFee - senderRepayFee;\n }\n // Checking the delta of borrow fees to eliminate the risk of exploits here: a similar thing could happen: people\n // could mint from where it is cheap to mint and then transfer their debt to places where it is more expensive\n // to mint\n uint256 _borrowFee;\n if (senderBorrowFee > borrowFee) {\n _borrowFee = senderBorrowFee - borrowFee;\n }\n\n uint256 stablecoinAmountLessFeePaid = (stablecoinAmount *\n (BASE_PARAMS - _repayFee) *\n (BASE_PARAMS - _borrowFee)) / (BASE_PARAMS**2);\n surplus += stablecoinAmount - stablecoinAmountLessFeePaid;\n _repayDebt(vaultID, stablecoinAmountLessFeePaid, 0);\n }\n\n // =============================== VIEW FUNCTIONS ==============================\n\n /// @inheritdoc IVaultManagerFunctions\n function getVaultDebt(uint256 vaultID) external view returns (uint256) {\n return (vaultData[vaultID].normalizedDebt * _calculateCurrentInterestAccumulator()) / BASE_INTEREST;\n }\n\n /// @inheritdoc IVaultManagerFunctions\n function getTotalDebt() external view returns (uint256) {\n return (totalNormalizedDebt * _calculateCurrentInterestAccumulator()) / BASE_INTEREST;\n }\n\n /// @notice Checks whether a given vault is liquidable and if yes gives information regarding its liquidation\n /// @param vaultID ID of the vault to check\n /// @param liquidator Address of the liquidator which will be performing the liquidation\n /// @return liqOpp Description of the opportunity of liquidation\n /// @dev This function will revert if it's called on a vault that does not exist\n function checkLiquidation(uint256 vaultID, address liquidator)\n external\n view\n returns (LiquidationOpportunity memory liqOpp)\n {\n liqOpp = _checkLiquidation(\n vaultData[vaultID],\n liquidator,\n oracle.read(),\n _calculateCurrentInterestAccumulator()\n );\n }\n\n // ====================== INTERNAL UTILITY VIEW FUNCTIONS ======================\n\n /// @notice Computes the health factor of a given vault. This can later be used to check whether a given vault is solvent\n /// (i.e. should be liquidated or not)\n /// @param vault Data of the vault to check\n /// @param oracleValue Oracle value at the time of the call (it is in the base of the stablecoin, that is for agTokens 10**18)\n /// @param newInterestAccumulator Value of the `interestAccumulator` at the time of the call\n /// @return healthFactor Health factor of the vault: if it's inferior to 1 (`BASE_PARAMS` in fact) this means that the vault can be liquidated\n /// @return currentDebt Current value of the debt of the vault (taking into account interest)\n /// @return collateralAmountInStable Collateral in the vault expressed in stablecoin value\n function _isSolvent(\n Vault memory vault,\n uint256 oracleValue,\n uint256 newInterestAccumulator\n )\n internal\n view\n returns (\n uint256 healthFactor,\n uint256 currentDebt,\n uint256 collateralAmountInStable\n )\n {\n currentDebt = (vault.normalizedDebt * newInterestAccumulator) / BASE_INTEREST;\n collateralAmountInStable = (vault.collateralAmount * oracleValue) / _collatBase;\n if (currentDebt == 0) healthFactor = type(uint256).max;\n else healthFactor = (collateralAmountInStable * collateralFactor) / currentDebt;\n }\n\n /// @notice Calculates the current value of the `interestAccumulator` without updating the value\n /// in storage\n /// @dev This function avoids expensive exponentiation and the calculation is performed using a binomial approximation\n /// (1+x)^n = 1+n*x+[n/2*(n-1)]*x^2+[n/6*(n-1)*(n-2)*x^3...\n /// @dev The approximation slightly undercharges borrowers with the advantage of a great gas cost reduction\n /// @dev This function was mostly inspired from Aave implementation\n function _calculateCurrentInterestAccumulator() internal view returns (uint256) {\n uint256 exp = block.timestamp - lastInterestAccumulatorUpdated;\n uint256 ratePerSecond = interestRate;\n if (exp == 0 || ratePerSecond == 0) return interestAccumulator;\n uint256 expMinusOne = exp - 1;\n uint256 expMinusTwo = exp > 2 ? exp - 2 : 0;\n uint256 basePowerTwo = (ratePerSecond * ratePerSecond + HALF_BASE_INTEREST) / BASE_INTEREST;\n uint256 basePowerThree = (basePowerTwo * ratePerSecond + HALF_BASE_INTEREST) / BASE_INTEREST;\n uint256 secondTerm = (exp * expMinusOne * basePowerTwo) / 2;\n uint256 thirdTerm = (exp * expMinusOne * expMinusTwo * basePowerThree) / 6;\n return (interestAccumulator * (BASE_INTEREST + ratePerSecond * exp + secondTerm + thirdTerm)) / BASE_INTEREST;\n }\n\n // ================= INTERNAL UTILITY STATE-MODIFYING FUNCTIONS ================\n\n /// @notice Closes a vault without handling the repayment of the concerned address\n /// @param vaultID ID of the vault to close\n /// @param oracleValue Oracle value at the start of the call\n /// @param newInterestAccumulator Interest rate accumulator value at the start of the call\n /// @return Current debt of the vault to be repaid\n /// @return Value of the collateral in the vault to reimburse\n /// @dev The returned values are here to facilitate composability between calls\n function _closeVault(\n uint256 vaultID,\n uint256 oracleValue,\n uint256 newInterestAccumulator\n ) internal onlyApprovedOrOwner(msg.sender, vaultID) returns (uint256, uint256) {\n Vault memory vault = vaultData[vaultID];\n (uint256 healthFactor, uint256 currentDebt, ) = _isSolvent(vault, oracleValue, newInterestAccumulator);\n if (healthFactor <= BASE_PARAMS) revert InsolventVault();\n totalNormalizedDebt -= vault.normalizedDebt;\n _burn(vaultID);\n uint256 currentDebtPlusRepayFee = (currentDebt * BASE_PARAMS) / (BASE_PARAMS - repayFee);\n surplus += currentDebtPlusRepayFee - currentDebt;\n return (currentDebtPlusRepayFee, vault.collateralAmount);\n }\n\n /// @notice Increases the collateral balance of a vault\n /// @param vaultID ID of the vault to increase the collateral balance of\n /// @param collateralAmount Amount by which increasing the collateral balance of\n function _addCollateral(uint256 vaultID, uint256 collateralAmount) internal {\n if (!_exists(vaultID)) revert NonexistentVault();\n _checkpointCollateral(vaultID, collateralAmount, true);\n vaultData[vaultID].collateralAmount += collateralAmount;\n emit CollateralAmountUpdated(vaultID, collateralAmount, 1);\n }\n\n /// @notice Decreases the collateral balance from a vault (without proceeding to collateral transfers)\n /// @param vaultID ID of the vault to decrease the collateral balance of\n /// @param collateralAmount Amount of collateral to reduce the balance of\n /// @param oracleValue Oracle value at the start of the call (given here to avoid double computations)\n /// @param interestAccumulator_ Value of the interest rate accumulator (potentially zero if it has not been\n /// computed yet)\n function _removeCollateral(\n uint256 vaultID,\n uint256 collateralAmount,\n uint256 oracleValue,\n uint256 interestAccumulator_\n ) internal onlyApprovedOrOwner(msg.sender, vaultID) {\n _checkpointCollateral(vaultID, collateralAmount, false);\n vaultData[vaultID].collateralAmount -= collateralAmount;\n (uint256 healthFactor, , ) = _isSolvent(vaultData[vaultID], oracleValue, interestAccumulator_);\n if (healthFactor <= BASE_PARAMS) revert InsolventVault();\n emit CollateralAmountUpdated(vaultID, collateralAmount, 0);\n }\n\n /// @notice Increases the debt balance of a vault and takes into account borrowing fees\n /// @param vaultID ID of the vault to increase borrow balance of\n /// @param stablecoinAmount Amount of stablecoins to borrow\n /// @param oracleValue Oracle value at the start of the call\n /// @param newInterestAccumulator Value of the interest rate accumulator\n /// @return toMint Amount of stablecoins to mint\n function _borrow(\n uint256 vaultID,\n uint256 stablecoinAmount,\n uint256 oracleValue,\n uint256 newInterestAccumulator\n ) internal onlyApprovedOrOwner(msg.sender, vaultID) returns (uint256 toMint) {\n stablecoinAmount = _increaseDebt(vaultID, stablecoinAmount, oracleValue, newInterestAccumulator);\n uint256 borrowFeePaid = (borrowFee * stablecoinAmount) / BASE_PARAMS;\n surplus += borrowFeePaid;\n toMint = stablecoinAmount - borrowFeePaid;\n }\n\n /// @notice Gets debt in a vault from another vault potentially in another `VaultManager` contract\n /// @param srcVaultID ID of the vault from this contract for which growing debt\n /// @param vaultManager Address of the `VaultManager` where the targeted vault is\n /// @param dstVaultID ID of the vault in the target contract\n /// @param stablecoinAmount Amount of stablecoins to grow the debt of. This amount will be converted\n /// to a normalized value in both `VaultManager` contracts\n /// @param oracleValue Oracle value at the start of the call (potentially zero if it has not been computed yet)\n /// @param newInterestAccumulator Value of the interest rate accumulator (potentially zero if it has not been\n /// computed yet)\n /// @dev A solvency check is performed after the debt increase in the source `vaultID`\n /// @dev Only approved addresses by the source vault owner can perform this action, however any vault\n /// from any vaultManager contract can see its debt reduced by this means\n function _getDebtIn(\n uint256 srcVaultID,\n IVaultManager vaultManager,\n uint256 dstVaultID,\n uint256 stablecoinAmount,\n uint256 oracleValue,\n uint256 newInterestAccumulator\n ) internal onlyApprovedOrOwner(msg.sender, srcVaultID) {\n emit DebtTransferred(srcVaultID, dstVaultID, address(vaultManager), stablecoinAmount);\n // The `stablecoinAmount` needs to be rounded down in the `_increaseDebt` function to reduce the room for exploits\n stablecoinAmount = _increaseDebt(srcVaultID, stablecoinAmount, oracleValue, newInterestAccumulator);\n if (address(vaultManager) == address(this)) {\n // No repayFees taken in this case, otherwise the same stablecoin may end up paying fees twice\n _repayDebt(dstVaultID, stablecoinAmount, newInterestAccumulator);\n } else {\n // No need to check the integrity of `VaultManager` here because `_getDebtIn` can be entered only through the\n // `angle` function which is non reentrant. Also, `getDebtOut` failing would be at the attacker loss, as they\n // would get their debt increasing in the current vault without decreasing it in the remote vault.\n vaultManager.getDebtOut(dstVaultID, stablecoinAmount, borrowFee, repayFee);\n }\n }\n\n /// @notice Increases the debt of a given vault and verifies that this vault is still solvent\n /// @param vaultID ID of the vault to increase the debt of\n /// @param stablecoinAmount Amount of stablecoin to increase the debt of: this amount is converted in\n /// normalized debt using the pre-computed (or not) `newInterestAccumulator` value\n /// @param oracleValue Oracle value at the start of the call (given here to avoid double computations)\n /// @param newInterestAccumulator Value of the interest rate accumulator (potentially zero if it has not been\n /// computed yet)\n /// @return Amount of stablecoins to issue from this debt increase\n /// @dev The `stablecoinAmount` outputted need to be rounded down with respect to the change amount so that\n /// amount of stablecoins minted is smaller than the debt increase\n function _increaseDebt(\n uint256 vaultID,\n uint256 stablecoinAmount,\n uint256 oracleValue,\n uint256 newInterestAccumulator\n ) internal returns (uint256) {\n // We normalize the amount by dividing it by `newInterestAccumulator`. This makes accounting easier, since\n // it allows us to process all (past and future) debts like debts created at the inception of the contract.\n uint256 changeAmount = (stablecoinAmount * BASE_INTEREST) / newInterestAccumulator;\n // if there was no previous debt, we have to check that the debt creation will be higher than `dust`\n if (vaultData[vaultID].normalizedDebt == 0)\n if (stablecoinAmount <= dust) revert DustyLeftoverAmount();\n vaultData[vaultID].normalizedDebt += changeAmount;\n totalNormalizedDebt += changeAmount;\n if (totalNormalizedDebt * newInterestAccumulator > debtCeiling * BASE_INTEREST) revert DebtCeilingExceeded();\n (uint256 healthFactor, , ) = _isSolvent(vaultData[vaultID], oracleValue, newInterestAccumulator);\n if (healthFactor <= BASE_PARAMS) revert InsolventVault();\n emit InternalDebtUpdated(vaultID, changeAmount, 1);\n return (changeAmount * newInterestAccumulator) / BASE_INTEREST;\n }\n\n /// @notice Decreases the debt of a given vault and verifies that this vault still has an amount of debt superior\n /// to a dusty amount or no debt at all\n /// @param vaultID ID of the vault to decrease the debt of\n /// @param stablecoinAmount Amount of stablecoin to decrease the debt of: this amount is converted in\n /// normalized debt using the pre-computed (or not) `newInterestAccumulator` value\n /// To repay the whole debt, one can pass `type(uint256).max`\n /// @param newInterestAccumulator Value of the interest rate accumulator (potentially zero if it has not been\n /// computed yet, like in `getDebtOut`)\n /// @return Amount of stablecoins to be burnt to correctly repay the debt\n /// @dev If `stablecoinAmount` is `type(uint256).max`, this function will repay all the debt of the vault\n function _repayDebt(\n uint256 vaultID,\n uint256 stablecoinAmount,\n uint256 newInterestAccumulator\n ) internal returns (uint256) {\n if (newInterestAccumulator == 0) newInterestAccumulator = _accrue();\n uint256 newVaultNormalizedDebt = vaultData[vaultID].normalizedDebt;\n // To save one variable declaration, `changeAmount` is first expressed in stablecoin amount before being converted\n // to a normalized amount. Here we first store the maximum amount that can be repaid given the current debt\n uint256 changeAmount = (newVaultNormalizedDebt * newInterestAccumulator) / BASE_INTEREST;\n // In some situations (e.g. liquidations), the `stablecoinAmount` is rounded above and we want to make\n // sure to avoid underflows in all situations\n if (stablecoinAmount >= changeAmount) {\n stablecoinAmount = changeAmount;\n changeAmount = newVaultNormalizedDebt;\n } else {\n changeAmount = (stablecoinAmount * BASE_INTEREST) / newInterestAccumulator;\n }\n newVaultNormalizedDebt -= changeAmount;\n totalNormalizedDebt -= changeAmount;\n if (newVaultNormalizedDebt != 0 && newVaultNormalizedDebt * newInterestAccumulator <= dust * BASE_INTEREST)\n revert DustyLeftoverAmount();\n vaultData[vaultID].normalizedDebt = newVaultNormalizedDebt;\n emit InternalDebtUpdated(vaultID, changeAmount, 0);\n return stablecoinAmount;\n }\n\n /// @notice Handles the simultaneous repayment of stablecoins with a transfer of collateral\n /// @param collateralAmountToGive Amount of collateral the contract should give\n /// @param stableAmountToRepay Amount of stablecoins the contract should burn from the call\n /// @param from Address from which stablecoins should be burnt: it should be the `msg.sender` or at least\n /// approved by it\n /// @param to Address to which collateral should be sent\n /// @param who Address which should be notified if needed of the transfer\n /// @param data Data to pass to the `who` contract for it to successfully give the correct amount of stablecoins\n /// to the `from` address\n /// @dev This function allows for capital-efficient liquidations and repayments of loans\n function _handleRepay(\n uint256 collateralAmountToGive,\n uint256 stableAmountToRepay,\n address from,\n address to,\n address who,\n bytes memory data\n ) internal {\n if (collateralAmountToGive != 0) collateral.safeTransfer(to, collateralAmountToGive);\n if (stableAmountToRepay != 0) {\n if (data.length != 0) {\n ISwapper(who).swap(\n collateral,\n IERC20(address(stablecoin)),\n from,\n stableAmountToRepay,\n collateralAmountToGive,\n data\n );\n }\n stablecoin.burnFrom(stableAmountToRepay, from, msg.sender);\n }\n }\n\n // ====================== TREASURY RELATIONSHIP FUNCTIONS ======================\n\n /// @inheritdoc IVaultManagerFunctions\n function accrueInterestToTreasury() external onlyTreasury returns (uint256 surplusValue, uint256 badDebtValue) {\n _accrue();\n surplusValue = surplus;\n badDebtValue = badDebt;\n surplus = 0;\n badDebt = 0;\n if (surplusValue >= badDebtValue) {\n surplusValue -= badDebtValue;\n badDebtValue = 0;\n stablecoin.mint(address(treasury), surplusValue);\n } else {\n badDebtValue -= surplusValue;\n surplusValue = 0;\n }\n emit AccruedToTreasury(surplusValue, badDebtValue);\n }\n\n /// @notice Accrues interest accumulated across all vaults to the surplus and updates the `interestAccumulator`\n /// @return newInterestAccumulator Computed value of the interest accumulator\n /// @dev It should also be called when updating the value of the per second interest rate or when the `totalNormalizedDebt`\n /// value is about to change\n function _accrue() internal returns (uint256 newInterestAccumulator) {\n newInterestAccumulator = _calculateCurrentInterestAccumulator();\n uint256 interestAccrued = (totalNormalizedDebt * (newInterestAccumulator - interestAccumulator)) /\n BASE_INTEREST;\n surplus += interestAccrued;\n interestAccumulator = newInterestAccumulator;\n lastInterestAccumulatorUpdated = block.timestamp;\n emit InterestAccumulatorUpdated(newInterestAccumulator, block.timestamp);\n return newInterestAccumulator;\n }\n\n // ================================ LIQUIDATIONS ===============================\n\n /// @notice Liquidates an ensemble of vaults specified by their IDs\n /// @dev This function is a simplified wrapper of the function below. It is built to remove for liquidators the need to specify\n /// a `who` and a `data` parameter\n function liquidate(\n uint256[] memory vaultIDs,\n uint256[] memory amounts,\n address from,\n address to\n ) external returns (LiquidatorData memory) {\n return liquidate(vaultIDs, amounts, from, to, address(0), new bytes(0));\n }\n\n /// @notice Liquidates an ensemble of vaults specified by their IDs\n /// @param vaultIDs List of the vaults to liquidate\n /// @param amounts Amount of stablecoin to bring for the liquidation of each vault\n /// @param from Address from which the stablecoins for the liquidation should be taken: this address should be the `msg.sender`\n /// or have received an approval\n /// @param to Address to which discounted collateral should be sent\n /// @param who Address of the contract to handle repayment of stablecoins from received collateral\n /// @param data Data to pass to the repayment contract in case of. If empty, liquidators simply have to bring the exact amount of\n /// stablecoins to get the discounted collateral. If not, it is used by the repayment contract to swap a portion or all\n /// of the collateral received to stablecoins to be sent to the `from` address. More details in the `_handleRepay` function\n /// @return liqData Data about the liquidation process for the liquidator to track everything that has been going on (like how much\n /// stablecoins have been repaid, how much collateral has been received)\n /// @dev This function will revert if it's called on a vault that cannot be liquidated or that does not exist\n function liquidate(\n uint256[] memory vaultIDs,\n uint256[] memory amounts,\n address from,\n address to,\n address who,\n bytes memory data\n ) public whenNotPaused nonReentrant returns (LiquidatorData memory liqData) {\n uint256 vaultIDsLength = vaultIDs.length;\n if (vaultIDsLength != amounts.length || vaultIDsLength == 0) revert IncompatibleLengths();\n // Stores all the data about an ongoing liquidation of multiple vaults\n liqData.oracleValue = oracle.read();\n liqData.newInterestAccumulator = _accrue();\n emit LiquidatedVaults(vaultIDs);\n for (uint256 i; i < vaultIDsLength; ++i) {\n Vault memory vault = vaultData[vaultIDs[i]];\n // Computing if liquidation can take place for a vault\n LiquidationOpportunity memory liqOpp = _checkLiquidation(\n vault,\n msg.sender,\n liqData.oracleValue,\n liqData.newInterestAccumulator\n );\n\n // Makes sure not to leave a dusty amount in the vault by either not liquidating too much\n // or everything\n if (\n (liqOpp.thresholdRepayAmount != 0 && amounts[i] >= liqOpp.thresholdRepayAmount) ||\n amounts[i] > liqOpp.maxStablecoinAmountToRepay\n ) amounts[i] = liqOpp.maxStablecoinAmountToRepay;\n\n // liqOpp.discount stores in fact `1-discount`\n uint256 collateralReleased = (amounts[i] * BASE_PARAMS * _collatBase) /\n (liqOpp.discount * liqData.oracleValue);\n\n _checkpointCollateral(\n vaultIDs[i],\n vault.collateralAmount <= collateralReleased ? vault.collateralAmount : collateralReleased,\n false\n );\n // Because we're rounding up in some divisions, `collateralReleased` can be greater than the `collateralAmount` of the vault\n // In this case, `stablecoinAmountToReceive` is still rounded up\n if (vault.collateralAmount <= collateralReleased) {\n collateralReleased = vault.collateralAmount;\n // Remove all the vault's debt (debt repayed + bad debt) from VaultManager totalDebt\n totalNormalizedDebt -= vault.normalizedDebt;\n // Reinitializing the `vaultID`: we're not burning the vault in this case for integration purposes\n delete vaultData[vaultIDs[i]];\n {\n uint256 debtReimbursed = (amounts[i] * liquidationSurcharge) / BASE_PARAMS;\n liqData.badDebtFromLiquidation += debtReimbursed < liqOpp.currentDebt\n ? liqOpp.currentDebt - debtReimbursed\n : 0;\n }\n // There may be an edge case in which: `amounts[i] = (currentDebt * BASE_PARAMS) / surcharge + 1`\n // In this case, as long as `surcharge < BASE_PARAMS`, there cannot be any underflow in the operation\n // above\n emit InternalDebtUpdated(vaultIDs[i], vault.normalizedDebt, 0);\n } else {\n vaultData[vaultIDs[i]].collateralAmount -= collateralReleased;\n _repayDebt(\n vaultIDs[i],\n (amounts[i] * liquidationSurcharge) / BASE_PARAMS,\n liqData.newInterestAccumulator\n );\n }\n liqData.collateralAmountToGive += collateralReleased;\n liqData.stablecoinAmountToReceive += amounts[i];\n }\n // Normalization of good and bad debt is already handled in the `accrueInterestToTreasury` function\n surplus += (liqData.stablecoinAmountToReceive * (BASE_PARAMS - liquidationSurcharge)) / BASE_PARAMS;\n badDebt += liqData.badDebtFromLiquidation;\n _handleRepay(liqData.collateralAmountToGive, liqData.stablecoinAmountToReceive, from, to, who, data);\n }\n\n /// @notice Internal version of the `checkLiquidation` function\n /// @dev This function takes two additional parameters as when entering this function `oracleValue`\n /// and `newInterestAccumulator` should have always been computed\n function _checkLiquidation(\n Vault memory vault,\n address liquidator,\n uint256 oracleValue,\n uint256 newInterestAccumulator\n ) internal view returns (LiquidationOpportunity memory liqOpp) {\n // Checking if the vault can be liquidated\n (uint256 healthFactor, uint256 currentDebt, uint256 collateralAmountInStable) = _isSolvent(\n vault,\n oracleValue,\n newInterestAccumulator\n );\n // Health factor of a vault that does not exist is `type(uint256).max`\n if (healthFactor >= BASE_PARAMS) revert HealthyVault();\n\n uint256 liquidationDiscount = (_computeLiquidationBoost(liquidator) * (BASE_PARAMS - healthFactor)) /\n BASE_PARAMS;\n // In fact `liquidationDiscount` is stored here as 1 minus discount to save some computation costs\n // This value is necessarily != 0 as `maxLiquidationDiscount < BASE_PARAMS`\n liquidationDiscount = liquidationDiscount >= maxLiquidationDiscount\n ? BASE_PARAMS - maxLiquidationDiscount\n : BASE_PARAMS - liquidationDiscount;\n // Same for the surcharge here: it's in fact 1 - the fee taken by the protocol\n uint256 surcharge = liquidationSurcharge;\n // Checking if we're in a situation where the health factor is an increasing or a decreasing function of the\n // amount repaid\n uint256 maxAmountToRepay;\n uint256 thresholdRepayAmount;\n // In the first case, the health factor is an increasing function of the stablecoin amount to repay,\n // this means that the liquidator can bring the vault to the target health ratio\n if (healthFactor * liquidationDiscount * surcharge >= collateralFactor * BASE_PARAMS**2) {\n // This is the max amount to repay that will bring the person to the target health factor\n // Denom is always positive when a vault gets liquidated in this case and when the health factor\n // is an increasing function of the amount of stablecoins repaid\n // And given that most parameters are in base 9, the numerator can very hardly overflow here\n maxAmountToRepay =\n ((targetHealthFactor * currentDebt - collateralAmountInStable * collateralFactor) *\n BASE_PARAMS *\n liquidationDiscount) /\n (surcharge * targetHealthFactor * liquidationDiscount - (BASE_PARAMS**2) * collateralFactor);\n // The quantity below tends to be rounded in the above direction, which means that governance or guardians should\n // set the `targetHealthFactor` accordingly\n // Need to check for the dust: liquidating should not leave a dusty amount in the vault\n if (currentDebt * BASE_PARAMS <= maxAmountToRepay * surcharge + dust * BASE_PARAMS) {\n // If liquidating to the target threshold would leave a dusty amount: the liquidator can repay all\n // We're rounding up the max amount to repay to make sure all the debt ends up being paid\n // and we're computing again the real value of the debt to avoid propagation of rounding errors\n maxAmountToRepay =\n (vault.normalizedDebt * newInterestAccumulator * BASE_PARAMS) /\n (surcharge * BASE_INTEREST) +\n 1;\n // In this case the threshold amount is such that it leaves just enough dust: amount is rounded\n // down such that if a liquidator repays this amount then there would be more than `dust` left in\n // the liquidated vault\n if (currentDebt > dust)\n thresholdRepayAmount = ((currentDebt - dust) * BASE_PARAMS) / surcharge;\n // If there is from the beginning a dusty debt (because of an implementation upgrade), then\n // liquidator should repay everything that's left\n else thresholdRepayAmount = 1;\n }\n } else {\n // In all cases the liquidator can repay stablecoins such that they'll end up getting exactly the collateral\n // in the liquidated vault\n // Rounding up to make sure all gets liquidated in this case: the liquidator will never get more than the collateral\n // amount in the vault however: we're performing the computation of the `collateralAmountInStable` again to avoid\n // propagation of rounding errors\n maxAmountToRepay =\n (vault.collateralAmount * liquidationDiscount * oracleValue) /\n (BASE_PARAMS * _collatBase) +\n 1;\n // It should however make sure not to leave a dusty amount of collateral (in stablecoin value) in the vault\n if (collateralAmountInStable > _dustCollateral)\n // There's no issue with this amount being rounded down\n thresholdRepayAmount =\n ((collateralAmountInStable - _dustCollateral) * liquidationDiscount) /\n BASE_PARAMS;\n // If there is from the beginning a dusty amount of collateral, liquidator should repay everything that's left\n else thresholdRepayAmount = 1;\n }\n liqOpp.maxStablecoinAmountToRepay = maxAmountToRepay;\n liqOpp.maxCollateralAmountGiven =\n (maxAmountToRepay * BASE_PARAMS * _collatBase) /\n (oracleValue * liquidationDiscount);\n liqOpp.thresholdRepayAmount = thresholdRepayAmount;\n liqOpp.discount = liquidationDiscount;\n liqOpp.currentDebt = currentDebt;\n }\n\n // ================================== SETTERS ==================================\n\n /// @notice Sets parameters encoded as uint64\n /// @param param Value for the parameter\n /// @param what Parameter to change\n /// @dev This function performs the required checks when updating a parameter\n /// @dev When setting parameters governance or the guardian should make sure that when `HF < CF/((1-surcharge)(1-discount))`\n /// and hence when liquidating a vault is going to decrease its health factor, `discount = max discount`.\n /// Otherwise, it may be profitable for the liquidator to liquidate in multiple times: as it will decrease\n /// the HF and therefore increase the discount between each time\n function setUint64(uint64 param, bytes32 what) external onlyGovernorOrGuardian {\n if (what == \"CF\") {\n if (param > liquidationSurcharge) revert TooHighParameterValue();\n collateralFactor = param;\n } else if (what == \"THF\") {\n if (param < BASE_PARAMS) revert TooSmallParameterValue();\n targetHealthFactor = param;\n } else if (what == \"BF\") {\n if (param > BASE_PARAMS) revert TooHighParameterValue();\n borrowFee = param;\n } else if (what == \"RF\") {\n // As liquidation surcharge is stored as `1-fee` and as we need `repayFee` to be smaller\n // then the liquidation surcharge, then we need to have:\n // `liquidationSurcharge <= BASE_PARAMS - repayFee` and as such `liquidationSurcharge + repayFee <= BASE_PARAMS`\n if (param + liquidationSurcharge > BASE_PARAMS) revert TooHighParameterValue();\n repayFee = param;\n } else if (what == \"IR\") {\n _accrue();\n interestRate = param;\n } else if (what == \"LS\") {\n if (collateralFactor > param || param + repayFee > BASE_PARAMS) revert InvalidParameterValue();\n liquidationSurcharge = param;\n } else if (what == \"MLD\") {\n if (param > BASE_PARAMS) revert TooHighParameterValue();\n maxLiquidationDiscount = param;\n } else {\n revert InvalidParameterType();\n }\n emit FiledUint64(param, what);\n }\n\n /// @notice Sets `debtCeiling`\n /// @param _debtCeiling New value for `debtCeiling`\n /// @dev `debtCeiling` should not be bigger than `type(uint256).max / 10**27` otherwise there could be overflows\n function setDebtCeiling(uint256 _debtCeiling) external onlyGovernorOrGuardian {\n debtCeiling = _debtCeiling;\n emit DebtCeilingUpdated(_debtCeiling);\n }\n\n /// @notice Sets the parameters for the liquidation booster which encodes the slope of the discount\n function setLiquidationBoostParameters(\n address _veBoostProxy,\n uint256[] memory xBoost,\n uint256[] memory yBoost\n ) external virtual onlyGovernorOrGuardian {\n if (yBoost[0] == 0) revert InvalidSetOfParameters();\n yLiquidationBoost = yBoost;\n emit LiquidationBoostParametersUpdated(_veBoostProxy, xBoost, yBoost);\n }\n\n /// @notice Pauses external permissionless functions of the contract\n function togglePause() external onlyGovernorOrGuardian {\n paused = !paused;\n }\n\n /// @notice Changes the ERC721 metadata URI\n function setBaseURI(string memory baseURI_) external onlyGovernorOrGuardian {\n _baseURI = baseURI_;\n }\n\n /// @notice Changes the whitelisting of an address\n /// @param target Address to toggle\n /// @dev If the `target` address is the zero address then this function toggles whitelisting\n /// for all addresses\n function toggleWhitelist(address target) external onlyGovernor {\n if (target != address(0)) {\n isWhitelisted[target] = 1 - isWhitelisted[target];\n } else {\n whitelistingActivated = !whitelistingActivated;\n }\n }\n\n /// @notice Changes the reference to the oracle contract used to get the price of the oracle\n /// @param _oracle Reference to the oracle contract\n function setOracle(address _oracle) external onlyGovernor {\n if (IOracle(_oracle).treasury() != treasury) revert InvalidTreasury();\n oracle = IOracle(_oracle);\n }\n\n /// @notice Sets the dust variables\n /// @param _dust New minimum debt allowed\n /// @param dustCollateral_ New minimum collateral allowed in a vault after a liquidation\n /// @dev dustCollateral_ is in stable value\n function setDusts(uint256 _dust, uint256 dustCollateral_) external onlyGovernor {\n dust = _dust;\n _dustCollateral = dustCollateral_;\n }\n\n /// @inheritdoc IVaultManagerFunctions\n function setTreasury(address _treasury) external onlyTreasury {\n treasury = ITreasury(_treasury);\n // This function makes sure to propagate the change to the associated contract\n // even though a single oracle contract could be used in different places\n oracle.setTreasury(_treasury);\n }\n\n // ============================= VIRTUAL FUNCTIONS =============================\n\n /// @notice Computes the liquidation boost of a given address, that is the slope of the discount function\n /// @return The slope of the discount function\n function _computeLiquidationBoost(address) internal view virtual returns (uint256) {\n return yLiquidationBoost[0];\n }\n\n /// @notice Hook called before any collateral internal changes\n /// @param vaultID Vault which sees its collateral amount changed\n /// @param amount Collateral amount balance of the owner of vaultID increase/decrease\n /// @param add Whether the balance should be increased/decreased\n /// @param vaultID Vault which sees its collateral amount changed\n function _checkpointCollateral(\n uint256 vaultID,\n uint256 amount,\n bool add\n ) internal virtual {}\n}\n" + }, + "contracts/vaultManager/VaultManagerPermit.sol": { + "content": "// SPDX-License-Identifier: GPL-3.0\n\npragma solidity ^0.8.12;\n\nimport \"./VaultManagerERC721.sol\";\nimport \"../interfaces/external/IERC1271.sol\";\n\n/// @title VaultManagerPermit\n/// @author Angle Labs, Inc.\n/// @dev Base Implementation of permit functions for the `VaultManager` contract\nabstract contract VaultManagerPermit is Initializable, VaultManagerERC721 {\n using Address for address;\n\n mapping(address => uint256) private _nonces;\n /* solhint-disable var-name-mixedcase */\n bytes32 private _HASHED_NAME;\n bytes32 private _HASHED_VERSION;\n bytes32 private _PERMIT_TYPEHASH;\n /* solhint-enable var-name-mixedcase */\n\n error ExpiredDeadline();\n error InvalidSignature();\n\n //solhint-disable-next-line\n function __ERC721Permit_init(string memory _name) internal onlyInitializing {\n _PERMIT_TYPEHASH = keccak256(\n \"Permit(address owner,address spender,bool approved,uint256 nonce,uint256 deadline)\"\n );\n _HASHED_NAME = keccak256(bytes(_name));\n _HASHED_VERSION = keccak256(bytes(\"1\"));\n }\n\n /// @notice Allows an address to give or revoke approval for all its vaults to another address\n /// @param owner Address signing the permit and giving (or revoking) its approval for all the controlled vaults\n /// @param spender Address to give approval to\n /// @param approved Whether to give or revoke the approval\n /// @param deadline Deadline parameter for the signature to be valid\n /// @dev The `v`, `r`, and `s` parameters are used as signature data\n function permit(\n address owner,\n address spender,\n bool approved,\n uint256 deadline,\n uint8 v,\n bytes32 r,\n bytes32 s\n ) external {\n if (block.timestamp > deadline) revert ExpiredDeadline();\n // Additional signature checks performed in the `ECDSAUpgradeable.recover` function\n if (uint256(s) > 0x7FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF5D576E7357A4501DDFE92F46681B20A0 || (v != 27 && v != 28))\n revert InvalidSignature();\n\n bytes32 digest = keccak256(\n abi.encodePacked(\n \"\\x19\\x01\",\n _domainSeparatorV4(),\n keccak256(\n abi.encode(\n _PERMIT_TYPEHASH,\n // 0x3f43a9c6bafb5c7aab4e0cfe239dc5d4c15caf0381c6104188191f78a6640bd8,\n owner,\n spender,\n approved,\n _useNonce(owner),\n deadline\n )\n )\n )\n );\n if (owner.isContract()) {\n if (IERC1271(owner).isValidSignature(digest, abi.encodePacked(r, s, v)) != 0x1626ba7e)\n revert InvalidSignature();\n } else {\n address signer = ecrecover(digest, v, r, s);\n if (signer != owner || signer == address(0)) revert InvalidSignature();\n }\n\n _setApprovalForAll(owner, spender, approved);\n }\n\n /// @notice Returns the current nonce for an `owner` address\n function nonces(address owner) public view returns (uint256) {\n return _nonces[owner];\n }\n\n /// @notice Returns the domain separator for the current chain.\n // solhint-disable-next-line func-name-mixedcase\n function DOMAIN_SEPARATOR() external view returns (bytes32) {\n return _domainSeparatorV4();\n }\n\n /// @notice Internal version of the `DOMAIN_SEPARATOR` function\n function _domainSeparatorV4() internal view returns (bytes32) {\n return\n keccak256(\n abi.encode(\n // keccak256('EIP712Domain(string name,string version,uint256 chainId,address verifyingContract)')\n 0x8b73c3c69bb8fe3d512ecc4cf759cc79239f7b179b0ffacaa9a75d522b39400f,\n _HASHED_NAME,\n _HASHED_VERSION,\n block.chainid,\n address(this)\n )\n );\n }\n\n /// @notice Consumes a nonce for an address: returns the current value and increments it\n function _useNonce(address owner) internal returns (uint256 current) {\n current = _nonces[owner];\n _nonces[owner] = current + 1;\n }\n\n uint256[49] private __gap;\n}\n" + }, + "contracts/vaultManager/VaultManagerERC721.sol": { + "content": "// SPDX-License-Identifier: GPL-3.0\n\npragma solidity ^0.8.12;\n\nimport \"./VaultManagerStorage.sol\";\n\n/// @title VaultManagerERC721\n/// @author Angle Labs, Inc.\n/// @dev Base ERC721 Implementation of VaultManager\nabstract contract VaultManagerERC721 is IERC721MetadataUpgradeable, VaultManagerStorage {\n using SafeERC20 for IERC20;\n using Address for address;\n\n /// @inheritdoc IERC721MetadataUpgradeable\n string public name;\n /// @inheritdoc IERC721MetadataUpgradeable\n string public symbol;\n\n // ================================= MODIFIERS =================================\n\n /// @notice Checks if the person interacting with the vault with `vaultID` is approved\n /// @param caller Address of the person seeking to interact with the vault\n /// @param vaultID ID of the concerned vault\n modifier onlyApprovedOrOwner(address caller, uint256 vaultID) {\n if (!_isApprovedOrOwner(caller, vaultID)) revert NotApproved();\n _;\n }\n\n // ================================ ERC721 LOGIC ===============================\n\n /// @notice Checks whether a given address is approved for a vault or owns this vault\n /// @param spender Address for which vault ownership should be checked\n /// @param vaultID ID of the vault to check\n /// @return Whether the `spender` address owns or is approved for `vaultID`\n function isApprovedOrOwner(address spender, uint256 vaultID) external view returns (bool) {\n return _isApprovedOrOwner(spender, vaultID);\n }\n\n /// @inheritdoc IERC721MetadataUpgradeable\n function tokenURI(uint256 vaultID) external view returns (string memory) {\n if (!_exists(vaultID)) revert NonexistentVault();\n // There is no vault with `vaultID` equal to 0, so the following variable is\n // always greater than zero\n uint256 temp = vaultID;\n uint256 digits;\n while (temp != 0) {\n ++digits;\n temp /= 10;\n }\n bytes memory buffer = new bytes(digits);\n while (vaultID != 0) {\n digits -= 1;\n buffer[digits] = bytes1(uint8(48 + uint256(vaultID % 10)));\n vaultID /= 10;\n }\n return bytes(_baseURI).length != 0 ? string(abi.encodePacked(_baseURI, string(buffer))) : \"\";\n }\n\n /// @inheritdoc IERC721Upgradeable\n function balanceOf(address owner) external view returns (uint256) {\n if (owner == address(0)) revert ZeroAddress();\n return _balances[owner];\n }\n\n /// @inheritdoc IERC721Upgradeable\n function ownerOf(uint256 vaultID) external view returns (address) {\n return _ownerOf(vaultID);\n }\n\n /// @inheritdoc IERC721Upgradeable\n function approve(address to, uint256 vaultID) external {\n address owner = _ownerOf(vaultID);\n if (to == owner) revert ApprovalToOwner();\n if (msg.sender != owner && !isApprovedForAll(owner, msg.sender)) revert NotApproved();\n\n _approve(to, vaultID);\n }\n\n /// @inheritdoc IERC721Upgradeable\n function getApproved(uint256 vaultID) external view returns (address) {\n if (!_exists(vaultID)) revert NonexistentVault();\n return _getApproved(vaultID);\n }\n\n /// @inheritdoc IERC721Upgradeable\n function setApprovalForAll(address operator, bool approved) external {\n _setApprovalForAll(msg.sender, operator, approved);\n }\n\n /// @inheritdoc IERC721Upgradeable\n function isApprovedForAll(address owner, address operator) public view returns (bool) {\n return _operatorApprovals[owner][operator] == 1;\n }\n\n /// @inheritdoc IERC721Upgradeable\n function transferFrom(\n address from,\n address to,\n uint256 vaultID\n ) external onlyApprovedOrOwner(msg.sender, vaultID) {\n _transfer(from, to, vaultID);\n }\n\n /// @inheritdoc IERC721Upgradeable\n function safeTransferFrom(\n address from,\n address to,\n uint256 vaultID\n ) external {\n safeTransferFrom(from, to, vaultID, \"\");\n }\n\n /// @inheritdoc IERC721Upgradeable\n function safeTransferFrom(\n address from,\n address to,\n uint256 vaultID,\n bytes memory _data\n ) public onlyApprovedOrOwner(msg.sender, vaultID) {\n _safeTransfer(from, to, vaultID, _data);\n }\n\n // ================================ ERC165 LOGIC ===============================\n\n /// @inheritdoc IERC165Upgradeable\n function supportsInterface(bytes4 interfaceId) external pure returns (bool) {\n return\n interfaceId == type(IERC721MetadataUpgradeable).interfaceId ||\n interfaceId == type(IERC721Upgradeable).interfaceId ||\n interfaceId == type(IVaultManager).interfaceId ||\n interfaceId == type(IERC165Upgradeable).interfaceId;\n }\n\n // ================== INTERNAL FUNCTIONS FOR THE ERC721 LOGIC ==================\n\n /// @notice Internal version of the `ownerOf` function\n function _ownerOf(uint256 vaultID) internal view returns (address owner) {\n owner = _owners[vaultID];\n if (owner == address(0)) revert NonexistentVault();\n }\n\n /// @notice Internal version of the `getApproved` function\n function _getApproved(uint256 vaultID) internal view returns (address) {\n return _vaultApprovals[vaultID];\n }\n\n /// @notice Internal version of the `safeTransferFrom` function (with the data parameter)\n function _safeTransfer(\n address from,\n address to,\n uint256 vaultID,\n bytes memory _data\n ) internal {\n _transfer(from, to, vaultID);\n if (!_checkOnERC721Received(from, to, vaultID, _data)) revert NonERC721Receiver();\n }\n\n /// @notice Checks whether a vault exists\n /// @param vaultID ID of the vault to check\n /// @return Whether `vaultID` has been created\n function _exists(uint256 vaultID) internal view returns (bool) {\n return _owners[vaultID] != address(0);\n }\n\n /// @notice Internal version of the `isApprovedOrOwner` function\n function _isApprovedOrOwner(address spender, uint256 vaultID) internal view returns (bool) {\n // The following checks if the vault exists\n address owner = _ownerOf(vaultID);\n return (spender == owner || _getApproved(vaultID) == spender || _operatorApprovals[owner][spender] == 1);\n }\n\n /// @notice Internal version of the `createVault` function\n /// Mints `vaultID` and transfers it to `to`\n /// @dev This method is equivalent to the `_safeMint` method used in OpenZeppelin ERC721 contract\n /// @dev Emits a {Transfer} event\n function _mint(address to) internal returns (uint256 vaultID) {\n if (whitelistingActivated && (isWhitelisted[to] != 1 || isWhitelisted[msg.sender] != 1))\n revert NotWhitelisted();\n if (to == address(0)) revert ZeroAddress();\n\n unchecked {\n vaultIDCount += 1;\n }\n\n vaultID = vaultIDCount;\n _beforeTokenTransfer(address(0), to, vaultID);\n\n unchecked {\n _balances[to] += 1;\n }\n\n _owners[vaultID] = to;\n emit Transfer(address(0), to, vaultID);\n if (!_checkOnERC721Received(address(0), to, vaultID, \"\")) revert NonERC721Receiver();\n }\n\n /// @notice Destroys `vaultID`\n /// @dev `vaultID` must exist\n /// @dev Emits a {Transfer} event\n function _burn(uint256 vaultID) internal {\n address owner = _ownerOf(vaultID);\n\n _beforeTokenTransfer(owner, address(0), vaultID);\n // Clear approvals\n _approve(address(0), vaultID);\n // The following line cannot underflow as the owner's balance is necessarily\n // greater than 1\n unchecked {\n _balances[owner] -= 1;\n }\n delete _owners[vaultID];\n delete vaultData[vaultID];\n\n emit Transfer(owner, address(0), vaultID);\n }\n\n /// @notice Transfers `vaultID` from `from` to `to` as opposed to {transferFrom},\n /// this imposes no restrictions on msg.sender\n /// @dev `to` cannot be the zero address and `perpetualID` must be owned by `from`\n /// @dev Emits a {Transfer} event\n /// @dev A whitelist check is performed if necessary on the `to` address\n function _transfer(\n address from,\n address to,\n uint256 vaultID\n ) internal {\n if (_ownerOf(vaultID) != from) revert NotApproved();\n if (to == address(0)) revert ZeroAddress();\n if (whitelistingActivated && isWhitelisted[to] != 1) revert NotWhitelisted();\n\n _beforeTokenTransfer(from, to, vaultID);\n\n // Clear approvals from the previous owner\n _approve(address(0), vaultID);\n unchecked {\n _balances[from] -= 1;\n _balances[to] += 1;\n }\n _owners[vaultID] = to;\n\n emit Transfer(from, to, vaultID);\n }\n\n /// @notice Approves `to` to operate on `vaultID`\n function _approve(address to, uint256 vaultID) internal {\n _vaultApprovals[vaultID] = to;\n emit Approval(_ownerOf(vaultID), to, vaultID);\n }\n\n /// @notice Internal version of the `setApprovalForAll` function\n /// @dev It contains an `approver` field to be used in case someone signs a permit for a particular\n /// address, and this signature is given to the contract by another address (like a router)\n function _setApprovalForAll(\n address approver,\n address operator,\n bool approved\n ) internal {\n if (operator == approver) revert ApprovalToCaller();\n uint256 approval = approved ? 1 : 0;\n _operatorApprovals[approver][operator] = approval;\n emit ApprovalForAll(approver, operator, approved);\n }\n\n /// @notice Internal function to invoke {IERC721Receiver-onERC721Received} on a target address\n /// The call is not executed if the target address is not a contract\n /// @param from Address representing the previous owner of the given token ID\n /// @param to Target address that will receive the tokens\n /// @param vaultID ID of the token to be transferred\n /// @param _data Bytes optional data to send along with the call\n /// @return Bool whether the call correctly returned the expected value\n function _checkOnERC721Received(\n address from,\n address to,\n uint256 vaultID,\n bytes memory _data\n ) private returns (bool) {\n if (to.isContract()) {\n try IERC721ReceiverUpgradeable(to).onERC721Received(msg.sender, from, vaultID, _data) returns (\n bytes4 retval\n ) {\n return retval == IERC721ReceiverUpgradeable.onERC721Received.selector;\n } catch (bytes memory reason) {\n if (reason.length == 0) {\n revert NonERC721Receiver();\n } else {\n // solhint-disable-next-line no-inline-assembly\n assembly {\n revert(add(32, reason), mload(reason))\n }\n }\n }\n } else {\n return true;\n }\n }\n\n /// @notice Hook that is called before any token transfer. This includes minting and burning.\n /// Calling conditions:\n ///\n /// - When `from` and `to` are both non-zero, `from`'s `vaultID` will be\n /// transferred to `to`.\n /// - When `from` is zero, `vaultID` will be minted for `to`.\n /// - When `to` is zero, `from`'s `vaultID` will be burned.\n /// - `from` and `to` are never both zero.\n function _beforeTokenTransfer(\n address from,\n address to,\n uint256 vaultID\n ) internal virtual {}\n}\n" + }, + "contracts/interfaces/external/IERC1271.sol": { + "content": "// SPDX-License-Identifier: GPL-2.0-or-later\npragma solidity ^0.8.12;\n\n/// @title Interface for verifying contract-based account signatures\n/// @notice Interface that verifies provided signature for the data\n/// @dev Interface defined by EIP-1271\ninterface IERC1271 {\n /// @notice Returns whether the provided signature is valid for the provided data\n /// @dev MUST return the bytes4 magic value 0x1626ba7e when function passes.\n /// MUST NOT modify state (using STATICCALL for solc < 0.5, view modifier for solc > 0.5).\n /// MUST allow external calls.\n /// @param hash Hash of the data to be signed\n /// @param signature Signature byte array associated with _data\n /// @return magicValue The bytes4 magic value 0x1626ba7e\n function isValidSignature(bytes32 hash, bytes memory signature) external view returns (bytes4 magicValue);\n}\n" + }, + "contracts/vaultManager/VaultManagerStorage.sol": { + "content": "// SPDX-License-Identifier: GPL-3.0\n\npragma solidity ^0.8.12;\n\nimport \"@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol\";\nimport \"@openzeppelin/contracts-upgradeable/token/ERC20/extensions/draft-IERC20PermitUpgradeable.sol\";\nimport \"@openzeppelin/contracts-upgradeable/token/ERC721/IERC721ReceiverUpgradeable.sol\";\nimport \"@openzeppelin/contracts-upgradeable/interfaces/IERC721MetadataUpgradeable.sol\";\nimport \"@openzeppelin/contracts-upgradeable/utils/introspection/IERC165Upgradeable.sol\";\nimport \"@openzeppelin/contracts-upgradeable/utils/AddressUpgradeable.sol\";\nimport \"@openzeppelin/contracts-upgradeable/security/ReentrancyGuardUpgradeable.sol\";\nimport \"@openzeppelin/contracts/token/ERC20/extensions/IERC20Metadata.sol\";\nimport \"@openzeppelin/contracts/token/ERC20/IERC20.sol\";\nimport \"@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol\";\n\nimport \"../interfaces/IAgToken.sol\";\nimport \"../interfaces/IOracle.sol\";\nimport \"../interfaces/ISwapper.sol\";\nimport \"../interfaces/ITreasury.sol\";\nimport \"../interfaces/IVaultManager.sol\";\nimport \"../interfaces/governance/IVeBoostProxy.sol\";\n\n/// @title VaultManagerStorage\n/// @author Angle Labs, Inc.\n/// @dev Variables, references, parameters and events needed in the `VaultManager` contract\n// solhint-disable-next-line max-states-count\ncontract VaultManagerStorage is IVaultManagerStorage, Initializable, ReentrancyGuardUpgradeable {\n /// @notice Base used for parameter computation: almost all the parameters of this contract are set in `BASE_PARAMS`\n uint256 public constant BASE_PARAMS = 10**9;\n /// @notice Base used for interest rate computation\n uint256 public constant BASE_INTEREST = 10**27;\n /// @notice Used for interest rate computation\n uint256 public constant HALF_BASE_INTEREST = 10**27 / 2;\n\n // ================================= REFERENCES ================================\n\n /// @inheritdoc IVaultManagerStorage\n ITreasury public treasury;\n /// @inheritdoc IVaultManagerStorage\n IERC20 public collateral;\n /// @inheritdoc IVaultManagerStorage\n IAgToken public stablecoin;\n /// @inheritdoc IVaultManagerStorage\n IOracle public oracle;\n /// @notice Reference to the contract which computes adjusted veANGLE balances for liquidators boosts\n IVeBoostProxy public veBoostProxy;\n /// @notice Base of the collateral\n uint256 internal _collatBase;\n\n // ================================= PARAMETERS ================================\n // Unless specified otherwise, parameters of this contract are expressed in `BASE_PARAMS`\n\n /// @notice Maximum amount of stablecoins that can be issued with this contract (in `BASE_TOKENS`). This parameter should\n /// not be bigger than `type(uint256).max / BASE_INTEREST` otherwise there may be some overflows in the `increaseDebt` function\n uint256 public debtCeiling;\n /// @notice Threshold veANGLE balance values for the computation of the boost for liquidators: the length of this array\n /// should normally be 2. The base of the x-values in this array should be `BASE_TOKENS`\n uint256[] public xLiquidationBoost;\n /// @notice Values of the liquidation boost at the threshold values of x\n uint256[] public yLiquidationBoost;\n /// @inheritdoc IVaultManagerStorage\n uint64 public collateralFactor;\n /// @notice Maximum Health factor at which a vault can end up after a liquidation (unless it's fully liquidated)\n uint64 public targetHealthFactor;\n /// @notice Upfront fee taken when borrowing stablecoins: this fee is optional and should in practice not be used\n uint64 public borrowFee;\n /// @notice Upfront fee taken when repaying stablecoins: this fee is optional as well. It should be smaller\n /// than the liquidation surcharge (cf below) to avoid exploits where people voluntarily get liquidated at a 0\n /// discount to pay smaller repaying fees\n uint64 public repayFee;\n /// @notice Per second interest taken to borrowers taking agToken loans. Contrarily to other parameters, it is set in `BASE_INTEREST`\n /// that is to say in base 10**27\n uint64 public interestRate;\n /// @notice Fee taken by the protocol during a liquidation. Technically, this value is not the fee per se, it's 1 - fee.\n /// For instance for a 2% fee, `liquidationSurcharge` should be 98%\n uint64 public liquidationSurcharge;\n /// @notice Maximum discount given to liquidators\n uint64 public maxLiquidationDiscount;\n /// @notice Whether whitelisting is required to own a vault or not\n bool public whitelistingActivated;\n /// @notice Whether the contract is paused or not\n bool public paused;\n\n // ================================= VARIABLES =================================\n\n /// @notice Timestamp at which the `interestAccumulator` was updated\n uint256 public lastInterestAccumulatorUpdated;\n /// @inheritdoc IVaultManagerStorage\n uint256 public interestAccumulator;\n /// @inheritdoc IVaultManagerStorage\n uint256 public totalNormalizedDebt;\n /// @notice Surplus accumulated by the contract: surplus is always in stablecoins, and is then reset\n /// when the value is communicated to the treasury contract\n uint256 public surplus;\n /// @notice Bad debt made from liquidated vaults which ended up having no collateral and a positive amount\n /// of stablecoins\n uint256 public badDebt;\n\n // ================================== MAPPINGS =================================\n\n /// @inheritdoc IVaultManagerStorage\n mapping(uint256 => Vault) public vaultData;\n /// @notice Maps an address to 1 if it's whitelisted and can open or own a vault\n mapping(address => uint256) public isWhitelisted;\n\n // ================================ ERC721 DATA ================================\n\n /// @inheritdoc IVaultManagerStorage\n uint256 public vaultIDCount;\n\n /// @notice URI\n string internal _baseURI;\n\n // Mapping from `vaultID` to owner address\n mapping(uint256 => address) internal _owners;\n\n // Mapping from owner address to vault owned count\n mapping(address => uint256) internal _balances;\n\n // Mapping from `vaultID` to approved address\n mapping(uint256 => address) internal _vaultApprovals;\n\n // Mapping from owner to operator approvals\n mapping(address => mapping(address => uint256)) internal _operatorApprovals;\n\n uint256[50] private __gap;\n\n // =================================== EVENTS ==================================\n\n event AccruedToTreasury(uint256 surplusEndValue, uint256 badDebtEndValue);\n event CollateralAmountUpdated(uint256 vaultID, uint256 collateralAmount, uint8 isIncrease);\n event InterestAccumulatorUpdated(uint256 value, uint256 timestamp);\n event InternalDebtUpdated(uint256 vaultID, uint256 internalAmount, uint8 isIncrease);\n event FiledUint64(uint64 param, bytes32 what);\n event DebtCeilingUpdated(uint256 debtCeiling);\n event LiquidationBoostParametersUpdated(address indexed _veBoostProxy, uint256[] xBoost, uint256[] yBoost);\n event LiquidatedVaults(uint256[] vaultIDs);\n event DebtTransferred(uint256 srcVaultID, uint256 dstVaultID, address dstVaultManager, uint256 amount);\n\n // =================================== ERRORS ==================================\n\n error ApprovalToOwner();\n error ApprovalToCaller();\n error DustyLeftoverAmount();\n error DebtCeilingExceeded();\n error HealthyVault();\n error IncompatibleLengths();\n error InsolventVault();\n error InvalidParameterValue();\n error InvalidParameterType();\n error InvalidSetOfParameters();\n error InvalidTreasury();\n error NonERC721Receiver();\n error NonexistentVault();\n error NotApproved();\n error NotGovernor();\n error NotGovernorOrGuardian();\n error NotTreasury();\n error NotWhitelisted();\n error NotVaultManager();\n error Paused();\n error TooHighParameterValue();\n error TooSmallParameterValue();\n error ZeroAddress();\n\n /// @custom:oz-upgrades-unsafe-allow constructor\n constructor() initializer {}\n}\n" + }, + "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.7.0) (proxy/utils/Initializable.sol)\n\npragma solidity ^0.8.2;\n\nimport \"../../utils/AddressUpgradeable.sol\";\n\n/**\n * @dev This is a base contract to aid in writing upgradeable contracts, or any kind of contract that will be deployed\n * behind a proxy. Since proxied contracts do not make use of a constructor, it's common to move constructor logic to an\n * external initializer function, usually called `initialize`. It then becomes necessary to protect this initializer\n * function so it can only be called once. The {initializer} modifier provided by this contract will have this effect.\n *\n * The initialization functions use a version number. Once a version number is used, it is consumed and cannot be\n * reused. This mechanism prevents re-execution of each \"step\" but allows the creation of new initialization steps in\n * case an upgrade adds a module that needs to be initialized.\n *\n * For example:\n *\n * [.hljs-theme-light.nopadding]\n * ```\n * contract MyToken is ERC20Upgradeable {\n * function initialize() initializer public {\n * __ERC20_init(\"MyToken\", \"MTK\");\n * }\n * }\n * contract MyTokenV2 is MyToken, ERC20PermitUpgradeable {\n * function initializeV2() reinitializer(2) public {\n * __ERC20Permit_init(\"MyToken\");\n * }\n * }\n * ```\n *\n * TIP: To avoid leaving the proxy in an uninitialized state, the initializer function should be called as early as\n * possible by providing the encoded function call as the `_data` argument to {ERC1967Proxy-constructor}.\n *\n * CAUTION: When used with inheritance, manual care must be taken to not invoke a parent initializer twice, or to ensure\n * that all initializers are idempotent. This is not verified automatically as constructors are by Solidity.\n *\n * [CAUTION]\n * ====\n * Avoid leaving a contract uninitialized.\n *\n * An uninitialized contract can be taken over by an attacker. This applies to both a proxy and its implementation\n * contract, which may impact the proxy. To prevent the implementation contract from being used, you should invoke\n * the {_disableInitializers} function in the constructor to automatically lock it when it is deployed:\n *\n * [.hljs-theme-light.nopadding]\n * ```\n * /// @custom:oz-upgrades-unsafe-allow constructor\n * constructor() {\n * _disableInitializers();\n * }\n * ```\n * ====\n */\nabstract contract Initializable {\n /**\n * @dev Indicates that the contract has been initialized.\n * @custom:oz-retyped-from bool\n */\n uint8 private _initialized;\n\n /**\n * @dev Indicates that the contract is in the process of being initialized.\n */\n bool private _initializing;\n\n /**\n * @dev Triggered when the contract has been initialized or reinitialized.\n */\n event Initialized(uint8 version);\n\n /**\n * @dev A modifier that defines a protected initializer function that can be invoked at most once. In its scope,\n * `onlyInitializing` functions can be used to initialize parent contracts. Equivalent to `reinitializer(1)`.\n */\n modifier initializer() {\n bool isTopLevelCall = !_initializing;\n require(\n (isTopLevelCall && _initialized < 1) || (!AddressUpgradeable.isContract(address(this)) && _initialized == 1),\n \"Initializable: contract is already initialized\"\n );\n _initialized = 1;\n if (isTopLevelCall) {\n _initializing = true;\n }\n _;\n if (isTopLevelCall) {\n _initializing = false;\n emit Initialized(1);\n }\n }\n\n /**\n * @dev A modifier that defines a protected reinitializer function that can be invoked at most once, and only if the\n * contract hasn't been initialized to a greater version before. In its scope, `onlyInitializing` functions can be\n * used to initialize parent contracts.\n *\n * `initializer` is equivalent to `reinitializer(1)`, so a reinitializer may be used after the original\n * initialization step. This is essential to configure modules that are added through upgrades and that require\n * initialization.\n *\n * Note that versions can jump in increments greater than 1; this implies that if multiple reinitializers coexist in\n * a contract, executing them in the right order is up to the developer or operator.\n */\n modifier reinitializer(uint8 version) {\n require(!_initializing && _initialized < version, \"Initializable: contract is already initialized\");\n _initialized = version;\n _initializing = true;\n _;\n _initializing = false;\n emit Initialized(version);\n }\n\n /**\n * @dev Modifier to protect an initialization function so that it can only be invoked by functions with the\n * {initializer} and {reinitializer} modifiers, directly or indirectly.\n */\n modifier onlyInitializing() {\n require(_initializing, \"Initializable: contract is not initializing\");\n _;\n }\n\n /**\n * @dev Locks the contract, preventing any future reinitialization. This cannot be part of an initializer call.\n * Calling this in the constructor of a contract will prevent that contract from being initialized or reinitialized\n * to any version. It is recommended to use this to lock implementation contracts that are designed to be called\n * through proxies.\n */\n function _disableInitializers() internal virtual {\n require(!_initializing, \"Initializable: contract is initializing\");\n if (_initialized < type(uint8).max) {\n _initialized = type(uint8).max;\n emit Initialized(type(uint8).max);\n }\n }\n}\n" + }, + "@openzeppelin/contracts-upgradeable/token/ERC20/extensions/draft-IERC20PermitUpgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (token/ERC20/extensions/draft-IERC20Permit.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Interface of the ERC20 Permit extension allowing approvals to be made via signatures, as defined in\n * https://eips.ethereum.org/EIPS/eip-2612[EIP-2612].\n *\n * Adds the {permit} method, which can be used to change an account's ERC20 allowance (see {IERC20-allowance}) by\n * presenting a message signed by the account. By not relying on {IERC20-approve}, the token holder account doesn't\n * need to send a transaction, and thus is not required to hold Ether at all.\n */\ninterface IERC20PermitUpgradeable {\n /**\n * @dev Sets `value` as the allowance of `spender` over ``owner``'s tokens,\n * given ``owner``'s signed approval.\n *\n * IMPORTANT: The same issues {IERC20-approve} has related to transaction\n * ordering also apply here.\n *\n * Emits an {Approval} event.\n *\n * Requirements:\n *\n * - `spender` cannot be the zero address.\n * - `deadline` must be a timestamp in the future.\n * - `v`, `r` and `s` must be a valid `secp256k1` signature from `owner`\n * over the EIP712-formatted function arguments.\n * - the signature must use ``owner``'s current nonce (see {nonces}).\n *\n * For more information on the signature format, see the\n * https://eips.ethereum.org/EIPS/eip-2612#specification[relevant EIP\n * section].\n */\n function permit(\n address owner,\n address spender,\n uint256 value,\n uint256 deadline,\n uint8 v,\n bytes32 r,\n bytes32 s\n ) external;\n\n /**\n * @dev Returns the current nonce for `owner`. This value must be\n * included whenever a signature is generated for {permit}.\n *\n * Every successful call to {permit} increases ``owner``'s nonce by one. This\n * prevents a signature from being used multiple times.\n */\n function nonces(address owner) external view returns (uint256);\n\n /**\n * @dev Returns the domain separator used in the encoding of the signature for {permit}, as defined by {EIP712}.\n */\n // solhint-disable-next-line func-name-mixedcase\n function DOMAIN_SEPARATOR() external view returns (bytes32);\n}\n" + }, + "@openzeppelin/contracts-upgradeable/token/ERC721/IERC721ReceiverUpgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.6.0) (token/ERC721/IERC721Receiver.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @title ERC721 token receiver interface\n * @dev Interface for any contract that wants to support safeTransfers\n * from ERC721 asset contracts.\n */\ninterface IERC721ReceiverUpgradeable {\n /**\n * @dev Whenever an {IERC721} `tokenId` token is transferred to this contract via {IERC721-safeTransferFrom}\n * by `operator` from `from`, this function is called.\n *\n * It must return its Solidity selector to confirm the token transfer.\n * If any other value is returned or the interface is not implemented by the recipient, the transfer will be reverted.\n *\n * The selector can be obtained in Solidity with `IERC721Receiver.onERC721Received.selector`.\n */\n function onERC721Received(\n address operator,\n address from,\n uint256 tokenId,\n bytes calldata data\n ) external returns (bytes4);\n}\n" + }, + "@openzeppelin/contracts-upgradeable/interfaces/IERC721MetadataUpgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (interfaces/IERC721Metadata.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../token/ERC721/extensions/IERC721MetadataUpgradeable.sol\";\n" + }, + "@openzeppelin/contracts-upgradeable/utils/introspection/IERC165Upgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (utils/introspection/IERC165.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Interface of the ERC165 standard, as defined in the\n * https://eips.ethereum.org/EIPS/eip-165[EIP].\n *\n * Implementers can declare support of contract interfaces, which can then be\n * queried by others ({ERC165Checker}).\n *\n * For an implementation, see {ERC165}.\n */\ninterface IERC165Upgradeable {\n /**\n * @dev Returns true if this contract implements the interface defined by\n * `interfaceId`. See the corresponding\n * https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section]\n * to learn more about how these ids are created.\n *\n * This function call must use less than 30 000 gas.\n */\n function supportsInterface(bytes4 interfaceId) external view returns (bool);\n}\n" + }, + "@openzeppelin/contracts-upgradeable/utils/AddressUpgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.7.0) (utils/Address.sol)\n\npragma solidity ^0.8.1;\n\n/**\n * @dev Collection of functions related to the address type\n */\nlibrary AddressUpgradeable {\n /**\n * @dev Returns true if `account` is a contract.\n *\n * [IMPORTANT]\n * ====\n * It is unsafe to assume that an address for which this function returns\n * false is an externally-owned account (EOA) and not a contract.\n *\n * Among others, `isContract` will return false for the following\n * types of addresses:\n *\n * - an externally-owned account\n * - a contract in construction\n * - an address where a contract will be created\n * - an address where a contract lived, but was destroyed\n * ====\n *\n * [IMPORTANT]\n * ====\n * You shouldn't rely on `isContract` to protect against flash loan attacks!\n *\n * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets\n * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract\n * constructor.\n * ====\n */\n function isContract(address account) internal view returns (bool) {\n // This method relies on extcodesize/address.code.length, which returns 0\n // for contracts in construction, since the code is only stored at the end\n // of the constructor execution.\n\n return account.code.length > 0;\n }\n\n /**\n * @dev Replacement for Solidity's `transfer`: sends `amount` wei to\n * `recipient`, forwarding all available gas and reverting on errors.\n *\n * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost\n * of certain opcodes, possibly making contracts go over the 2300 gas limit\n * imposed by `transfer`, making them unable to receive funds via\n * `transfer`. {sendValue} removes this limitation.\n *\n * https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more].\n *\n * IMPORTANT: because control is transferred to `recipient`, care must be\n * taken to not create reentrancy vulnerabilities. Consider using\n * {ReentrancyGuard} or the\n * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].\n */\n function sendValue(address payable recipient, uint256 amount) internal {\n require(address(this).balance >= amount, \"Address: insufficient balance\");\n\n (bool success, ) = recipient.call{value: amount}(\"\");\n require(success, \"Address: unable to send value, recipient may have reverted\");\n }\n\n /**\n * @dev Performs a Solidity function call using a low level `call`. A\n * plain `call` is an unsafe replacement for a function call: use this\n * function instead.\n *\n * If `target` reverts with a revert reason, it is bubbled up by this\n * function (like regular Solidity function calls).\n *\n * Returns the raw returned data. To convert to the expected return value,\n * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].\n *\n * Requirements:\n *\n * - `target` must be a contract.\n * - calling `target` with `data` must not revert.\n *\n * _Available since v3.1._\n */\n function functionCall(address target, bytes memory data) internal returns (bytes memory) {\n return functionCall(target, data, \"Address: low-level call failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with\n * `errorMessage` as a fallback revert reason when `target` reverts.\n *\n * _Available since v3.1._\n */\n function functionCall(\n address target,\n bytes memory data,\n string memory errorMessage\n ) internal returns (bytes memory) {\n return functionCallWithValue(target, data, 0, errorMessage);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but also transferring `value` wei to `target`.\n *\n * Requirements:\n *\n * - the calling contract must have an ETH balance of at least `value`.\n * - the called Solidity function must be `payable`.\n *\n * _Available since v3.1._\n */\n function functionCallWithValue(\n address target,\n bytes memory data,\n uint256 value\n ) internal returns (bytes memory) {\n return functionCallWithValue(target, data, value, \"Address: low-level call with value failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but\n * with `errorMessage` as a fallback revert reason when `target` reverts.\n *\n * _Available since v3.1._\n */\n function functionCallWithValue(\n address target,\n bytes memory data,\n uint256 value,\n string memory errorMessage\n ) internal returns (bytes memory) {\n require(address(this).balance >= value, \"Address: insufficient balance for call\");\n require(isContract(target), \"Address: call to non-contract\");\n\n (bool success, bytes memory returndata) = target.call{value: value}(data);\n return verifyCallResult(success, returndata, errorMessage);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but performing a static call.\n *\n * _Available since v3.3._\n */\n function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {\n return functionStaticCall(target, data, \"Address: low-level static call failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\n * but performing a static call.\n *\n * _Available since v3.3._\n */\n function functionStaticCall(\n address target,\n bytes memory data,\n string memory errorMessage\n ) internal view returns (bytes memory) {\n require(isContract(target), \"Address: static call to non-contract\");\n\n (bool success, bytes memory returndata) = target.staticcall(data);\n return verifyCallResult(success, returndata, errorMessage);\n }\n\n /**\n * @dev Tool to verifies that a low level call was successful, and revert if it wasn't, either by bubbling the\n * revert reason using the provided one.\n *\n * _Available since v4.3._\n */\n function verifyCallResult(\n bool success,\n bytes memory returndata,\n string memory errorMessage\n ) internal pure returns (bytes memory) {\n if (success) {\n return returndata;\n } else {\n // Look for revert reason and bubble it up if present\n if (returndata.length > 0) {\n // The easiest way to bubble the revert reason is using memory via assembly\n /// @solidity memory-safe-assembly\n assembly {\n let returndata_size := mload(returndata)\n revert(add(32, returndata), returndata_size)\n }\n } else {\n revert(errorMessage);\n }\n }\n }\n}\n" + }, + "@openzeppelin/contracts-upgradeable/security/ReentrancyGuardUpgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (security/ReentrancyGuard.sol)\n\npragma solidity ^0.8.0;\nimport \"../proxy/utils/Initializable.sol\";\n\n/**\n * @dev Contract module that helps prevent reentrant calls to a function.\n *\n * Inheriting from `ReentrancyGuard` will make the {nonReentrant} modifier\n * available, which can be applied to functions to make sure there are no nested\n * (reentrant) calls to them.\n *\n * Note that because there is a single `nonReentrant` guard, functions marked as\n * `nonReentrant` may not call one another. This can be worked around by making\n * those functions `private`, and then adding `external` `nonReentrant` entry\n * points to them.\n *\n * TIP: If you would like to learn more about reentrancy and alternative ways\n * to protect against it, check out our blog post\n * https://blog.openzeppelin.com/reentrancy-after-istanbul/[Reentrancy After Istanbul].\n */\nabstract contract ReentrancyGuardUpgradeable is Initializable {\n // Booleans are more expensive than uint256 or any type that takes up a full\n // word because each write operation emits an extra SLOAD to first read the\n // slot's contents, replace the bits taken up by the boolean, and then write\n // back. This is the compiler's defense against contract upgrades and\n // pointer aliasing, and it cannot be disabled.\n\n // The values being non-zero value makes deployment a bit more expensive,\n // but in exchange the refund on every call to nonReentrant will be lower in\n // amount. Since refunds are capped to a percentage of the total\n // transaction's gas, it is best to keep them low in cases like this one, to\n // increase the likelihood of the full refund coming into effect.\n uint256 private constant _NOT_ENTERED = 1;\n uint256 private constant _ENTERED = 2;\n\n uint256 private _status;\n\n function __ReentrancyGuard_init() internal onlyInitializing {\n __ReentrancyGuard_init_unchained();\n }\n\n function __ReentrancyGuard_init_unchained() internal onlyInitializing {\n _status = _NOT_ENTERED;\n }\n\n /**\n * @dev Prevents a contract from calling itself, directly or indirectly.\n * Calling a `nonReentrant` function from another `nonReentrant`\n * function is not supported. It is possible to prevent this from happening\n * by making the `nonReentrant` function external, and making it call a\n * `private` function that does the actual work.\n */\n modifier nonReentrant() {\n // On the first call to nonReentrant, _notEntered will be true\n require(_status != _ENTERED, \"ReentrancyGuard: reentrant call\");\n\n // Any calls to nonReentrant after this point will fail\n _status = _ENTERED;\n\n _;\n\n // By storing the original value once again, a refund is triggered (see\n // https://eips.ethereum.org/EIPS/eip-2200)\n _status = _NOT_ENTERED;\n }\n\n /**\n * @dev This empty reserved space is put in place to allow future versions to add new\n * variables without shifting down storage in the inheritance chain.\n * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps\n */\n uint256[49] private __gap;\n}\n" + }, + "@openzeppelin/contracts/token/ERC20/extensions/IERC20Metadata.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (token/ERC20/extensions/IERC20Metadata.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../IERC20.sol\";\n\n/**\n * @dev Interface for the optional metadata functions from the ERC20 standard.\n *\n * _Available since v4.1._\n */\ninterface IERC20Metadata is IERC20 {\n /**\n * @dev Returns the name of the token.\n */\n function name() external view returns (string memory);\n\n /**\n * @dev Returns the symbol of the token.\n */\n function symbol() external view returns (string memory);\n\n /**\n * @dev Returns the decimals places of the token.\n */\n function decimals() external view returns (uint8);\n}\n" + }, + "@openzeppelin/contracts/token/ERC20/IERC20.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.6.0) (token/ERC20/IERC20.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Interface of the ERC20 standard as defined in the EIP.\n */\ninterface IERC20 {\n /**\n * @dev Emitted when `value` tokens are moved from one account (`from`) to\n * another (`to`).\n *\n * Note that `value` may be zero.\n */\n event Transfer(address indexed from, address indexed to, uint256 value);\n\n /**\n * @dev Emitted when the allowance of a `spender` for an `owner` is set by\n * a call to {approve}. `value` is the new allowance.\n */\n event Approval(address indexed owner, address indexed spender, uint256 value);\n\n /**\n * @dev Returns the amount of tokens in existence.\n */\n function totalSupply() external view returns (uint256);\n\n /**\n * @dev Returns the amount of tokens owned by `account`.\n */\n function balanceOf(address account) external view returns (uint256);\n\n /**\n * @dev Moves `amount` tokens from the caller's account to `to`.\n *\n * Returns a boolean value indicating whether the operation succeeded.\n *\n * Emits a {Transfer} event.\n */\n function transfer(address to, uint256 amount) external returns (bool);\n\n /**\n * @dev Returns the remaining number of tokens that `spender` will be\n * allowed to spend on behalf of `owner` through {transferFrom}. This is\n * zero by default.\n *\n * This value changes when {approve} or {transferFrom} are called.\n */\n function allowance(address owner, address spender) external view returns (uint256);\n\n /**\n * @dev Sets `amount` as the allowance of `spender` over the caller's tokens.\n *\n * Returns a boolean value indicating whether the operation succeeded.\n *\n * IMPORTANT: Beware that changing an allowance with this method brings the risk\n * that someone may use both the old and the new allowance by unfortunate\n * transaction ordering. One possible solution to mitigate this race\n * condition is to first reduce the spender's allowance to 0 and set the\n * desired value afterwards:\n * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729\n *\n * Emits an {Approval} event.\n */\n function approve(address spender, uint256 amount) external returns (bool);\n\n /**\n * @dev Moves `amount` tokens from `from` to `to` using the\n * allowance mechanism. `amount` is then deducted from the caller's\n * allowance.\n *\n * Returns a boolean value indicating whether the operation succeeded.\n *\n * Emits a {Transfer} event.\n */\n function transferFrom(\n address from,\n address to,\n uint256 amount\n ) external returns (bool);\n}\n" + }, + "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.7.0) (token/ERC20/utils/SafeERC20.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../IERC20.sol\";\nimport \"../extensions/draft-IERC20Permit.sol\";\nimport \"../../../utils/Address.sol\";\n\n/**\n * @title SafeERC20\n * @dev Wrappers around ERC20 operations that throw on failure (when the token\n * contract returns false). Tokens that return no value (and instead revert or\n * throw on failure) are also supported, non-reverting calls are assumed to be\n * successful.\n * To use this library you can add a `using SafeERC20 for IERC20;` statement to your contract,\n * which allows you to call the safe operations as `token.safeTransfer(...)`, etc.\n */\nlibrary SafeERC20 {\n using Address for address;\n\n function safeTransfer(\n IERC20 token,\n address to,\n uint256 value\n ) internal {\n _callOptionalReturn(token, abi.encodeWithSelector(token.transfer.selector, to, value));\n }\n\n function safeTransferFrom(\n IERC20 token,\n address from,\n address to,\n uint256 value\n ) internal {\n _callOptionalReturn(token, abi.encodeWithSelector(token.transferFrom.selector, from, to, value));\n }\n\n /**\n * @dev Deprecated. This function has issues similar to the ones found in\n * {IERC20-approve}, and its usage is discouraged.\n *\n * Whenever possible, use {safeIncreaseAllowance} and\n * {safeDecreaseAllowance} instead.\n */\n function safeApprove(\n IERC20 token,\n address spender,\n uint256 value\n ) internal {\n // safeApprove should only be called when setting an initial allowance,\n // or when resetting it to zero. To increase and decrease it, use\n // 'safeIncreaseAllowance' and 'safeDecreaseAllowance'\n require(\n (value == 0) || (token.allowance(address(this), spender) == 0),\n \"SafeERC20: approve from non-zero to non-zero allowance\"\n );\n _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, value));\n }\n\n function safeIncreaseAllowance(\n IERC20 token,\n address spender,\n uint256 value\n ) internal {\n uint256 newAllowance = token.allowance(address(this), spender) + value;\n _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));\n }\n\n function safeDecreaseAllowance(\n IERC20 token,\n address spender,\n uint256 value\n ) internal {\n unchecked {\n uint256 oldAllowance = token.allowance(address(this), spender);\n require(oldAllowance >= value, \"SafeERC20: decreased allowance below zero\");\n uint256 newAllowance = oldAllowance - value;\n _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));\n }\n }\n\n function safePermit(\n IERC20Permit token,\n address owner,\n address spender,\n uint256 value,\n uint256 deadline,\n uint8 v,\n bytes32 r,\n bytes32 s\n ) internal {\n uint256 nonceBefore = token.nonces(owner);\n token.permit(owner, spender, value, deadline, v, r, s);\n uint256 nonceAfter = token.nonces(owner);\n require(nonceAfter == nonceBefore + 1, \"SafeERC20: permit did not succeed\");\n }\n\n /**\n * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement\n * on the return value: the return value is optional (but if data is returned, it must not be false).\n * @param token The token targeted by the call.\n * @param data The call data (encoded using abi.encode or one of its variants).\n */\n function _callOptionalReturn(IERC20 token, bytes memory data) private {\n // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since\n // we're implementing it ourselves. We use {Address.functionCall} to perform this call, which verifies that\n // the target address contains contract code and also asserts for success in the low-level call.\n\n bytes memory returndata = address(token).functionCall(data, \"SafeERC20: low-level call failed\");\n if (returndata.length > 0) {\n // Return data is optional\n require(abi.decode(returndata, (bool)), \"SafeERC20: ERC20 operation did not succeed\");\n }\n }\n}\n" + }, + "contracts/interfaces/IAgToken.sol": { + "content": "// SPDX-License-Identifier: GPL-3.0\n\npragma solidity ^0.8.12;\n\nimport \"@openzeppelin/contracts-upgradeable/token/ERC20/IERC20Upgradeable.sol\";\n\n/// @title IAgToken\n/// @author Angle Labs, Inc.\n/// @notice Interface for the stablecoins `AgToken` contracts\n/// @dev This interface only contains functions of the `AgToken` contract which are called by other contracts\n/// of this module or of the first module of the Angle Protocol\ninterface IAgToken is IERC20Upgradeable {\n // ======================= Minter Role Only Functions ===========================\n\n /// @notice Lets the `StableMaster` contract or another whitelisted contract mint agTokens\n /// @param account Address to mint to\n /// @param amount Amount to mint\n /// @dev The contracts allowed to issue agTokens are the `StableMaster` contract, `VaultManager` contracts\n /// associated to this stablecoin as well as the flash loan module (if activated) and potentially contracts\n /// whitelisted by governance\n function mint(address account, uint256 amount) external;\n\n /// @notice Burns `amount` tokens from a `burner` address after being asked to by `sender`\n /// @param amount Amount of tokens to burn\n /// @param burner Address to burn from\n /// @param sender Address which requested the burn from `burner`\n /// @dev This method is to be called by a contract with the minter right after being requested\n /// to do so by a `sender` address willing to burn tokens from another `burner` address\n /// @dev The method checks the allowance between the `sender` and the `burner`\n function burnFrom(\n uint256 amount,\n address burner,\n address sender\n ) external;\n\n /// @notice Burns `amount` tokens from a `burner` address\n /// @param amount Amount of tokens to burn\n /// @param burner Address to burn from\n /// @dev This method is to be called by a contract with a minter right on the AgToken after being\n /// requested to do so by an address willing to burn tokens from its address\n function burnSelf(uint256 amount, address burner) external;\n\n // ========================= Treasury Only Functions ===========================\n\n /// @notice Adds a minter in the contract\n /// @param minter Minter address to add\n /// @dev Zero address checks are performed directly in the `Treasury` contract\n function addMinter(address minter) external;\n\n /// @notice Removes a minter from the contract\n /// @param minter Minter address to remove\n /// @dev This function can also be called by a minter wishing to revoke itself\n function removeMinter(address minter) external;\n\n /// @notice Sets a new treasury contract\n /// @param _treasury New treasury address\n function setTreasury(address _treasury) external;\n\n // ========================= External functions ================================\n\n /// @notice Checks whether an address has the right to mint agTokens\n /// @param minter Address for which the minting right should be checked\n /// @return Whether the address has the right to mint agTokens or not\n function isMinter(address minter) external view returns (bool);\n}\n" + }, + "contracts/interfaces/IOracle.sol": { + "content": "// SPDX-License-Identifier: GPL-3.0\n\npragma solidity ^0.8.12;\n\nimport \"./ITreasury.sol\";\n\n/// @title IOracle\n/// @author Angle Labs, Inc.\n/// @notice Interface for the `Oracle` contract\n/// @dev This interface only contains functions of the contract which are called by other contracts\n/// of this module\ninterface IOracle {\n /// @notice Reads the rate from the Chainlink circuit and other data provided\n /// @return quoteAmount The current rate between the in-currency and out-currency in the base\n /// of the out currency\n /// @dev For instance if the out currency is EUR (and hence agEUR), then the base of the returned\n /// value is 10**18\n function read() external view returns (uint256);\n\n /// @notice Changes the treasury contract\n /// @param _treasury Address of the new treasury contract\n /// @dev This function can be called by an approved `VaultManager` contract which can call\n /// this function after being requested to do so by a `treasury` contract\n /// @dev In some situations (like reactor contracts), the `VaultManager` may not directly be linked\n /// to the `oracle` contract and as such we may need governors to be able to call this function as well\n function setTreasury(address _treasury) external;\n\n /// @notice Reference to the `treasury` contract handling this `VaultManager`\n function treasury() external view returns (ITreasury treasury);\n}\n" + }, + "contracts/interfaces/ISwapper.sol": { + "content": "// SPDX-License-Identifier: GPL-3.0\n\npragma solidity ^0.8.12;\n\nimport \"@openzeppelin/contracts/token/ERC20/IERC20.sol\";\n\n/// @title ISwapper\n/// @author Angle Labs, Inc.\n/// @notice Interface for Swapper contracts\n/// @dev This interface defines the key functions `Swapper` contracts should have when interacting with\n/// Angle\ninterface ISwapper {\n /// @notice Notifies a contract that an address should be given `outToken` from `inToken`\n /// @param inToken Address of the token received\n /// @param outToken Address of the token to obtain\n /// @param outTokenRecipient Address to which the outToken should be sent\n /// @param outTokenOwed Minimum amount of outToken the `outTokenRecipient` address should have at the end of the call\n /// @param inTokenObtained Amount of collateral obtained by a related address prior\n /// to the call to this function\n /// @param data Extra data needed (to encode Uniswap swaps for instance)\n function swap(\n IERC20 inToken,\n IERC20 outToken,\n address outTokenRecipient,\n uint256 outTokenOwed,\n uint256 inTokenObtained,\n bytes calldata data\n ) external;\n}\n" + }, + "contracts/interfaces/ITreasury.sol": { + "content": "// SPDX-License-Identifier: GPL-3.0\n\npragma solidity ^0.8.12;\n\nimport \"./IAgToken.sol\";\nimport \"./ICoreBorrow.sol\";\nimport \"./IFlashAngle.sol\";\n\n/// @title ITreasury\n/// @author Angle Labs, Inc.\n/// @notice Interface for the `Treasury` contract\n/// @dev This interface only contains functions of the `Treasury` which are called by other contracts\n/// of this module\ninterface ITreasury {\n /// @notice Stablecoin handled by this `treasury` contract\n function stablecoin() external view returns (IAgToken);\n\n /// @notice Checks whether a given address has the governor role\n /// @param admin Address to check\n /// @return Whether the address has the governor role\n /// @dev Access control is only kept in the `CoreBorrow` contract\n function isGovernor(address admin) external view returns (bool);\n\n /// @notice Checks whether a given address has the guardian or the governor role\n /// @param admin Address to check\n /// @return Whether the address has the guardian or the governor role\n /// @dev Access control is only kept in the `CoreBorrow` contract which means that this function\n /// queries the `CoreBorrow` contract\n function isGovernorOrGuardian(address admin) external view returns (bool);\n\n /// @notice Checks whether a given address has well been initialized in this contract\n /// as a `VaultManager`\n /// @param _vaultManager Address to check\n /// @return Whether the address has been initialized or not\n function isVaultManager(address _vaultManager) external view returns (bool);\n\n /// @notice Sets a new flash loan module for this stablecoin\n /// @param _flashLoanModule Reference to the new flash loan module\n /// @dev This function removes the minting right to the old flash loan module and grants\n /// it to the new module\n function setFlashLoanModule(address _flashLoanModule) external;\n}\n" + }, + "contracts/interfaces/IVaultManager.sol": { + "content": "// SPDX-License-Identifier: GPL-3.0\n\npragma solidity ^0.8.12;\n\nimport \"@openzeppelin/contracts/interfaces/IERC721Metadata.sol\";\nimport \"@openzeppelin/contracts/token/ERC20/IERC20.sol\";\nimport \"./ITreasury.sol\";\nimport \"./IOracle.sol\";\n\n// ========================= Key Structs and Enums =============================\n\n/// @notice Parameters associated to a given `VaultManager` contract: these all correspond\n/// to parameters which signification is detailed in the `VaultManagerStorage` file\nstruct VaultParameters {\n uint256 debtCeiling;\n uint64 collateralFactor;\n uint64 targetHealthFactor;\n uint64 interestRate;\n uint64 liquidationSurcharge;\n uint64 maxLiquidationDiscount;\n bool whitelistingActivated;\n uint256 baseBoost;\n}\n\n/// @notice Data stored to track someone's loan (or equivalently called position)\nstruct Vault {\n // Amount of collateral deposited in the vault, in collateral decimals. For example, if the collateral\n // is USDC with 6 decimals, then `collateralAmount` will be in base 10**6\n uint256 collateralAmount;\n // Normalized value of the debt (that is to say of the stablecoins borrowed). It is expressed\n // in the base of Angle stablecoins (i.e. `BASE_TOKENS = 10**18`)\n uint256 normalizedDebt;\n}\n\n/// @notice For a given `vaultID`, this encodes a liquidation opportunity that is to say details about the maximum\n/// amount that could be repaid by liquidating the position\n/// @dev All the values are null in the case of a vault which cannot be liquidated under these conditions\nstruct LiquidationOpportunity {\n // Maximum stablecoin amount that can be repaid upon liquidating the vault\n uint256 maxStablecoinAmountToRepay;\n // Collateral amount given to the person in the case where the maximum amount to repay is given\n uint256 maxCollateralAmountGiven;\n // Threshold value of stablecoin amount to repay: it is ok for a liquidator to repay below threshold,\n // but if this threshold is non null and the liquidator wants to repay more than threshold, it should repay\n // the max stablecoin amount given in this vault\n uint256 thresholdRepayAmount;\n // Discount proposed to the liquidator on the collateral\n uint256 discount;\n // Amount of debt in the vault\n uint256 currentDebt;\n}\n\n/// @notice Data stored during a liquidation process to keep in memory what's due to a liquidator and some\n/// essential data for vaults being liquidated\nstruct LiquidatorData {\n // Current amount of stablecoins the liquidator should give to the contract\n uint256 stablecoinAmountToReceive;\n // Current amount of collateral the contract should give to the liquidator\n uint256 collateralAmountToGive;\n // Bad debt accrued across the liquidation process\n uint256 badDebtFromLiquidation;\n // Oracle value (in stablecoin base) at the time of the liquidation\n uint256 oracleValue;\n // Value of the `interestAccumulator` at the time of the call\n uint256 newInterestAccumulator;\n}\n\n/// @notice Data to track during a series of action the amount to give or receive in stablecoins and collateral\n/// to the caller or associated addresses\nstruct PaymentData {\n // Stablecoin amount the contract should give\n uint256 stablecoinAmountToGive;\n // Stablecoin amount owed to the contract\n uint256 stablecoinAmountToReceive;\n // Collateral amount the contract should give\n uint256 collateralAmountToGive;\n // Collateral amount owed to the contract\n uint256 collateralAmountToReceive;\n}\n\n/// @notice Actions possible when composing calls to the different entry functions proposed\nenum ActionType {\n createVault,\n closeVault,\n addCollateral,\n removeCollateral,\n repayDebt,\n borrow,\n getDebtIn,\n permit\n}\n\n// ========================= Interfaces =============================\n\n/// @title IVaultManagerFunctions\n/// @author Angle Labs, Inc.\n/// @notice Interface for the `VaultManager` contract\n/// @dev This interface only contains functions of the contract which are called by other contracts\n/// of this module (without getters)\ninterface IVaultManagerFunctions {\n /// @notice Accrues interest accumulated across all vaults to the surplus and sends the surplus to the treasury\n /// @return surplusValue Value of the surplus communicated to the `Treasury`\n /// @return badDebtValue Value of the bad debt communicated to the `Treasury`\n /// @dev `surplus` and `badDebt` should be reset to 0 once their current value have been given to the `treasury` contract\n function accrueInterestToTreasury() external returns (uint256 surplusValue, uint256 badDebtValue);\n\n /// @notice Removes debt from a vault after being requested to do so by another `VaultManager` contract\n /// @param vaultID ID of the vault to remove debt from\n /// @param amountStablecoins Amount of stablecoins to remove from the debt: this amount is to be converted to an\n /// internal debt amount\n /// @param senderBorrowFee Borrowing fees from the contract which requested this: this is to make sure that people are not\n /// arbitraging difference in minting fees\n /// @param senderRepayFee Repay fees from the contract which requested this: this is to make sure that people are not arbitraging\n /// differences in repay fees\n /// @dev This function can only be called from a vaultManager registered in the same Treasury\n function getDebtOut(\n uint256 vaultID,\n uint256 amountStablecoins,\n uint256 senderBorrowFee,\n uint256 senderRepayFee\n ) external;\n\n /// @notice Gets the current debt of a vault\n /// @param vaultID ID of the vault to check\n /// @return Debt of the vault\n function getVaultDebt(uint256 vaultID) external view returns (uint256);\n\n /// @notice Gets the total debt across all vaults\n /// @return Total debt across all vaults, taking into account the interest accumulated\n /// over time\n function getTotalDebt() external view returns (uint256);\n\n /// @notice Sets the treasury contract\n /// @param _treasury New treasury contract\n /// @dev All required checks when setting up a treasury contract are performed in the contract\n /// calling this function\n function setTreasury(address _treasury) external;\n\n /// @notice Creates a vault\n /// @param toVault Address for which the va\n /// @return vaultID ID of the vault created\n /// @dev This function just creates the vault without doing any collateral or\n function createVault(address toVault) external returns (uint256);\n\n /// @notice Allows composability between calls to the different entry points of this module. Any user calling\n /// this function can perform any of the allowed actions in the order of their choice\n /// @param actions Set of actions to perform\n /// @param datas Data to be decoded for each action: it can include like the `vaultID` or the `stablecoinAmount` to borrow\n /// @param from Address from which stablecoins will be taken if one action includes burning stablecoins. This address\n /// should either be the `msg.sender` or be approved by the latter\n /// @param to Address to which stablecoins and/or collateral will be sent in case of\n /// @param who Address of the contract to handle in case of repayment of stablecoins from received collateral\n /// @param repayData Data to pass to the repayment contract in case of\n /// @return paymentData Struct containing the accounting changes from the protocol's perspective (like how much of collateral\n /// or how much has been received). Note that the values in the struct are not aggregated and you could have in the output\n /// a positive amount of stablecoins to receive as well as a positive amount of stablecoins to give\n /// @dev This function is optimized to reduce gas cost due to payment from or to the user and that expensive calls\n /// or computations (like `oracleValue`) are done only once\n /// @dev When specifying `vaultID` in `data`, it is important to know that if you specify `vaultID = 0`, it will simply\n /// use the latest `vaultID`. This is the default behavior, and unless you're engaging into some complex protocol actions\n /// it is encouraged to use `vaultID = 0` only when the first action of the batch is `createVault`\n function angle(\n ActionType[] memory actions,\n bytes[] memory datas,\n address from,\n address to,\n address who,\n bytes memory repayData\n ) external returns (PaymentData memory paymentData);\n\n /// @notice This function is a wrapper built on top of the function above. It enables users to interact with the contract\n /// without having to provide `who` and `repayData` parameters\n function angle(\n ActionType[] memory actions,\n bytes[] memory datas,\n address from,\n address to\n ) external returns (PaymentData memory paymentData);\n\n /// @notice Initializes the `VaultManager` contract\n /// @param _treasury Treasury address handling the contract\n /// @param _collateral Collateral supported by this contract\n /// @param _oracle Oracle contract used\n /// @param _symbol Symbol used to define the `VaultManager` name and symbol\n /// @dev The parameters and the oracle are the only elements which could be modified once the\n /// contract has been initialized\n /// @dev For the contract to be fully initialized, governance needs to set the parameters for the liquidation\n /// boost\n function initialize(\n ITreasury _treasury,\n IERC20 _collateral,\n IOracle _oracle,\n VaultParameters calldata params,\n string memory _symbol\n ) external;\n\n /// @notice Minimum amount of debt a vault can have, expressed in `BASE_TOKENS` that is to say the base of the agTokens\n function dust() external view returns (uint256);\n}\n\n/// @title IVaultManagerStorage\n/// @author Angle Labs, Inc.\n/// @notice Interface for the `VaultManager` contract\n/// @dev This interface contains getters of the contract's public variables used by other contracts\n/// of this module\ninterface IVaultManagerStorage {\n /// @notice Encodes the maximum ratio stablecoin/collateral a vault can have before being liquidated. It's what\n /// determines the minimum collateral ratio of a position\n function collateralFactor() external view returns (uint64);\n\n /// @notice Stablecoin handled by this contract. Another `VaultManager` contract could have\n /// the same rights as this `VaultManager` on the stablecoin contract\n function stablecoin() external view returns (IAgToken);\n\n /// @notice Reference to the `treasury` contract handling this `VaultManager`\n function treasury() external view returns (ITreasury);\n\n /// @notice Oracle contract to get access to the price of the collateral with respect to the stablecoin\n function oracle() external view returns (IOracle);\n\n /// @notice The `interestAccumulator` variable keeps track of the interest that should accrue to the protocol.\n /// The stored value is not necessarily the true value: this one is recomputed every time an action takes place\n /// within the protocol. It is in base `BASE_INTEREST`\n function interestAccumulator() external view returns (uint256);\n\n /// @notice Reference to the collateral handled by this `VaultManager`\n function collateral() external view returns (IERC20);\n\n /// @notice Total normalized amount of stablecoins borrowed, not taking into account the potential bad debt accumulated\n /// This value is expressed in the base of Angle stablecoins (`BASE_TOKENS = 10**18`)\n function totalNormalizedDebt() external view returns (uint256);\n\n /// @notice Maximum amount of stablecoins that can be issued with this contract. It is expressed in `BASE_TOKENS`\n function debtCeiling() external view returns (uint256);\n\n /// @notice Maps a `vaultID` to its data (namely collateral amount and normalized debt)\n function vaultData(uint256 vaultID) external view returns (uint256 collateralAmount, uint256 normalizedDebt);\n\n /// @notice ID of the last vault created. The `vaultIDCount` variables serves as a counter to generate a unique\n /// `vaultID` for each vault: it is like `tokenID` in basic ERC721 contracts\n function vaultIDCount() external view returns (uint256);\n}\n\n/// @title IVaultManager\n/// @author Angle Labs, Inc.\n/// @notice Interface for the `VaultManager` contract\ninterface IVaultManager is IVaultManagerFunctions, IVaultManagerStorage, IERC721Metadata {\n function isApprovedOrOwner(address spender, uint256 vaultID) external view returns (bool);\n}\n\n/// @title IVaultManagerListing\n/// @author Angle Labs, Inc.\n/// @notice Interface for the `VaultManagerListing` contract\ninterface IVaultManagerListing is IVaultManager {\n /// @notice Get the collateral owned by `user` in the contract\n /// @dev This function effectively sums the collateral amounts of all the vaults owned by `user`\n function getUserCollateral(address user) external view returns (uint256);\n}\n" + }, + "contracts/interfaces/governance/IVeBoostProxy.sol": { + "content": "// SPDX-License-Identifier: GPL-3.0\n\npragma solidity ^0.8.12;\n\n/// @title IVeBoostProxy\n/// @author Angle Labs, Inc.\n/// @notice Interface for the `VeBoostProxy` contract\n/// @dev This interface only contains functions of the contract which are called by other contracts\n/// of this module\n/// @dev The `veBoostProxy` contract used by Angle is a full fork of Curve Finance implementation\ninterface IVeBoostProxy {\n /// @notice Reads the adjusted veANGLE balance of an address (adjusted by delegation)\n //solhint-disable-next-line\n function adjusted_balance_of(address) external view returns (uint256);\n}\n" + }, + "@openzeppelin/contracts-upgradeable/token/ERC721/extensions/IERC721MetadataUpgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (token/ERC721/extensions/IERC721Metadata.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../IERC721Upgradeable.sol\";\n\n/**\n * @title ERC-721 Non-Fungible Token Standard, optional metadata extension\n * @dev See https://eips.ethereum.org/EIPS/eip-721\n */\ninterface IERC721MetadataUpgradeable is IERC721Upgradeable {\n /**\n * @dev Returns the token collection name.\n */\n function name() external view returns (string memory);\n\n /**\n * @dev Returns the token collection symbol.\n */\n function symbol() external view returns (string memory);\n\n /**\n * @dev Returns the Uniform Resource Identifier (URI) for `tokenId` token.\n */\n function tokenURI(uint256 tokenId) external view returns (string memory);\n}\n" + }, + "@openzeppelin/contracts-upgradeable/token/ERC721/IERC721Upgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.7.0) (token/ERC721/IERC721.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../../utils/introspection/IERC165Upgradeable.sol\";\n\n/**\n * @dev Required interface of an ERC721 compliant contract.\n */\ninterface IERC721Upgradeable is IERC165Upgradeable {\n /**\n * @dev Emitted when `tokenId` token is transferred from `from` to `to`.\n */\n event Transfer(address indexed from, address indexed to, uint256 indexed tokenId);\n\n /**\n * @dev Emitted when `owner` enables `approved` to manage the `tokenId` token.\n */\n event Approval(address indexed owner, address indexed approved, uint256 indexed tokenId);\n\n /**\n * @dev Emitted when `owner` enables or disables (`approved`) `operator` to manage all of its assets.\n */\n event ApprovalForAll(address indexed owner, address indexed operator, bool approved);\n\n /**\n * @dev Returns the number of tokens in ``owner``'s account.\n */\n function balanceOf(address owner) external view returns (uint256 balance);\n\n /**\n * @dev Returns the owner of the `tokenId` token.\n *\n * Requirements:\n *\n * - `tokenId` must exist.\n */\n function ownerOf(uint256 tokenId) external view returns (address owner);\n\n /**\n * @dev Safely transfers `tokenId` token from `from` to `to`.\n *\n * Requirements:\n *\n * - `from` cannot be the zero address.\n * - `to` cannot be the zero address.\n * - `tokenId` token must exist and be owned by `from`.\n * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}.\n * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.\n *\n * Emits a {Transfer} event.\n */\n function safeTransferFrom(\n address from,\n address to,\n uint256 tokenId,\n bytes calldata data\n ) external;\n\n /**\n * @dev Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipients\n * are aware of the ERC721 protocol to prevent tokens from being forever locked.\n *\n * Requirements:\n *\n * - `from` cannot be the zero address.\n * - `to` cannot be the zero address.\n * - `tokenId` token must exist and be owned by `from`.\n * - If the caller is not `from`, it must have been allowed to move this token by either {approve} or {setApprovalForAll}.\n * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.\n *\n * Emits a {Transfer} event.\n */\n function safeTransferFrom(\n address from,\n address to,\n uint256 tokenId\n ) external;\n\n /**\n * @dev Transfers `tokenId` token from `from` to `to`.\n *\n * WARNING: Usage of this method is discouraged, use {safeTransferFrom} whenever possible.\n *\n * Requirements:\n *\n * - `from` cannot be the zero address.\n * - `to` cannot be the zero address.\n * - `tokenId` token must be owned by `from`.\n * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}.\n *\n * Emits a {Transfer} event.\n */\n function transferFrom(\n address from,\n address to,\n uint256 tokenId\n ) external;\n\n /**\n * @dev Gives permission to `to` to transfer `tokenId` token to another account.\n * The approval is cleared when the token is transferred.\n *\n * Only a single account can be approved at a time, so approving the zero address clears previous approvals.\n *\n * Requirements:\n *\n * - The caller must own the token or be an approved operator.\n * - `tokenId` must exist.\n *\n * Emits an {Approval} event.\n */\n function approve(address to, uint256 tokenId) external;\n\n /**\n * @dev Approve or remove `operator` as an operator for the caller.\n * Operators can call {transferFrom} or {safeTransferFrom} for any token owned by the caller.\n *\n * Requirements:\n *\n * - The `operator` cannot be the caller.\n *\n * Emits an {ApprovalForAll} event.\n */\n function setApprovalForAll(address operator, bool _approved) external;\n\n /**\n * @dev Returns the account approved for `tokenId` token.\n *\n * Requirements:\n *\n * - `tokenId` must exist.\n */\n function getApproved(uint256 tokenId) external view returns (address operator);\n\n /**\n * @dev Returns if the `operator` is allowed to manage all of the assets of `owner`.\n *\n * See {setApprovalForAll}\n */\n function isApprovedForAll(address owner, address operator) external view returns (bool);\n}\n" + }, + "@openzeppelin/contracts/token/ERC20/extensions/draft-IERC20Permit.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (token/ERC20/extensions/draft-IERC20Permit.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Interface of the ERC20 Permit extension allowing approvals to be made via signatures, as defined in\n * https://eips.ethereum.org/EIPS/eip-2612[EIP-2612].\n *\n * Adds the {permit} method, which can be used to change an account's ERC20 allowance (see {IERC20-allowance}) by\n * presenting a message signed by the account. By not relying on {IERC20-approve}, the token holder account doesn't\n * need to send a transaction, and thus is not required to hold Ether at all.\n */\ninterface IERC20Permit {\n /**\n * @dev Sets `value` as the allowance of `spender` over ``owner``'s tokens,\n * given ``owner``'s signed approval.\n *\n * IMPORTANT: The same issues {IERC20-approve} has related to transaction\n * ordering also apply here.\n *\n * Emits an {Approval} event.\n *\n * Requirements:\n *\n * - `spender` cannot be the zero address.\n * - `deadline` must be a timestamp in the future.\n * - `v`, `r` and `s` must be a valid `secp256k1` signature from `owner`\n * over the EIP712-formatted function arguments.\n * - the signature must use ``owner``'s current nonce (see {nonces}).\n *\n * For more information on the signature format, see the\n * https://eips.ethereum.org/EIPS/eip-2612#specification[relevant EIP\n * section].\n */\n function permit(\n address owner,\n address spender,\n uint256 value,\n uint256 deadline,\n uint8 v,\n bytes32 r,\n bytes32 s\n ) external;\n\n /**\n * @dev Returns the current nonce for `owner`. This value must be\n * included whenever a signature is generated for {permit}.\n *\n * Every successful call to {permit} increases ``owner``'s nonce by one. This\n * prevents a signature from being used multiple times.\n */\n function nonces(address owner) external view returns (uint256);\n\n /**\n * @dev Returns the domain separator used in the encoding of the signature for {permit}, as defined by {EIP712}.\n */\n // solhint-disable-next-line func-name-mixedcase\n function DOMAIN_SEPARATOR() external view returns (bytes32);\n}\n" + }, + "@openzeppelin/contracts/utils/Address.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.7.0) (utils/Address.sol)\n\npragma solidity ^0.8.1;\n\n/**\n * @dev Collection of functions related to the address type\n */\nlibrary Address {\n /**\n * @dev Returns true if `account` is a contract.\n *\n * [IMPORTANT]\n * ====\n * It is unsafe to assume that an address for which this function returns\n * false is an externally-owned account (EOA) and not a contract.\n *\n * Among others, `isContract` will return false for the following\n * types of addresses:\n *\n * - an externally-owned account\n * - a contract in construction\n * - an address where a contract will be created\n * - an address where a contract lived, but was destroyed\n * ====\n *\n * [IMPORTANT]\n * ====\n * You shouldn't rely on `isContract` to protect against flash loan attacks!\n *\n * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets\n * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract\n * constructor.\n * ====\n */\n function isContract(address account) internal view returns (bool) {\n // This method relies on extcodesize/address.code.length, which returns 0\n // for contracts in construction, since the code is only stored at the end\n // of the constructor execution.\n\n return account.code.length > 0;\n }\n\n /**\n * @dev Replacement for Solidity's `transfer`: sends `amount` wei to\n * `recipient`, forwarding all available gas and reverting on errors.\n *\n * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost\n * of certain opcodes, possibly making contracts go over the 2300 gas limit\n * imposed by `transfer`, making them unable to receive funds via\n * `transfer`. {sendValue} removes this limitation.\n *\n * https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more].\n *\n * IMPORTANT: because control is transferred to `recipient`, care must be\n * taken to not create reentrancy vulnerabilities. Consider using\n * {ReentrancyGuard} or the\n * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].\n */\n function sendValue(address payable recipient, uint256 amount) internal {\n require(address(this).balance >= amount, \"Address: insufficient balance\");\n\n (bool success, ) = recipient.call{value: amount}(\"\");\n require(success, \"Address: unable to send value, recipient may have reverted\");\n }\n\n /**\n * @dev Performs a Solidity function call using a low level `call`. A\n * plain `call` is an unsafe replacement for a function call: use this\n * function instead.\n *\n * If `target` reverts with a revert reason, it is bubbled up by this\n * function (like regular Solidity function calls).\n *\n * Returns the raw returned data. To convert to the expected return value,\n * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].\n *\n * Requirements:\n *\n * - `target` must be a contract.\n * - calling `target` with `data` must not revert.\n *\n * _Available since v3.1._\n */\n function functionCall(address target, bytes memory data) internal returns (bytes memory) {\n return functionCall(target, data, \"Address: low-level call failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with\n * `errorMessage` as a fallback revert reason when `target` reverts.\n *\n * _Available since v3.1._\n */\n function functionCall(\n address target,\n bytes memory data,\n string memory errorMessage\n ) internal returns (bytes memory) {\n return functionCallWithValue(target, data, 0, errorMessage);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but also transferring `value` wei to `target`.\n *\n * Requirements:\n *\n * - the calling contract must have an ETH balance of at least `value`.\n * - the called Solidity function must be `payable`.\n *\n * _Available since v3.1._\n */\n function functionCallWithValue(\n address target,\n bytes memory data,\n uint256 value\n ) internal returns (bytes memory) {\n return functionCallWithValue(target, data, value, \"Address: low-level call with value failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but\n * with `errorMessage` as a fallback revert reason when `target` reverts.\n *\n * _Available since v3.1._\n */\n function functionCallWithValue(\n address target,\n bytes memory data,\n uint256 value,\n string memory errorMessage\n ) internal returns (bytes memory) {\n require(address(this).balance >= value, \"Address: insufficient balance for call\");\n require(isContract(target), \"Address: call to non-contract\");\n\n (bool success, bytes memory returndata) = target.call{value: value}(data);\n return verifyCallResult(success, returndata, errorMessage);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but performing a static call.\n *\n * _Available since v3.3._\n */\n function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {\n return functionStaticCall(target, data, \"Address: low-level static call failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\n * but performing a static call.\n *\n * _Available since v3.3._\n */\n function functionStaticCall(\n address target,\n bytes memory data,\n string memory errorMessage\n ) internal view returns (bytes memory) {\n require(isContract(target), \"Address: static call to non-contract\");\n\n (bool success, bytes memory returndata) = target.staticcall(data);\n return verifyCallResult(success, returndata, errorMessage);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but performing a delegate call.\n *\n * _Available since v3.4._\n */\n function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {\n return functionDelegateCall(target, data, \"Address: low-level delegate call failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\n * but performing a delegate call.\n *\n * _Available since v3.4._\n */\n function functionDelegateCall(\n address target,\n bytes memory data,\n string memory errorMessage\n ) internal returns (bytes memory) {\n require(isContract(target), \"Address: delegate call to non-contract\");\n\n (bool success, bytes memory returndata) = target.delegatecall(data);\n return verifyCallResult(success, returndata, errorMessage);\n }\n\n /**\n * @dev Tool to verifies that a low level call was successful, and revert if it wasn't, either by bubbling the\n * revert reason using the provided one.\n *\n * _Available since v4.3._\n */\n function verifyCallResult(\n bool success,\n bytes memory returndata,\n string memory errorMessage\n ) internal pure returns (bytes memory) {\n if (success) {\n return returndata;\n } else {\n // Look for revert reason and bubble it up if present\n if (returndata.length > 0) {\n // The easiest way to bubble the revert reason is using memory via assembly\n /// @solidity memory-safe-assembly\n assembly {\n let returndata_size := mload(returndata)\n revert(add(32, returndata), returndata_size)\n }\n } else {\n revert(errorMessage);\n }\n }\n }\n}\n" + }, + "@openzeppelin/contracts-upgradeable/token/ERC20/IERC20Upgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.6.0) (token/ERC20/IERC20.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Interface of the ERC20 standard as defined in the EIP.\n */\ninterface IERC20Upgradeable {\n /**\n * @dev Emitted when `value` tokens are moved from one account (`from`) to\n * another (`to`).\n *\n * Note that `value` may be zero.\n */\n event Transfer(address indexed from, address indexed to, uint256 value);\n\n /**\n * @dev Emitted when the allowance of a `spender` for an `owner` is set by\n * a call to {approve}. `value` is the new allowance.\n */\n event Approval(address indexed owner, address indexed spender, uint256 value);\n\n /**\n * @dev Returns the amount of tokens in existence.\n */\n function totalSupply() external view returns (uint256);\n\n /**\n * @dev Returns the amount of tokens owned by `account`.\n */\n function balanceOf(address account) external view returns (uint256);\n\n /**\n * @dev Moves `amount` tokens from the caller's account to `to`.\n *\n * Returns a boolean value indicating whether the operation succeeded.\n *\n * Emits a {Transfer} event.\n */\n function transfer(address to, uint256 amount) external returns (bool);\n\n /**\n * @dev Returns the remaining number of tokens that `spender` will be\n * allowed to spend on behalf of `owner` through {transferFrom}. This is\n * zero by default.\n *\n * This value changes when {approve} or {transferFrom} are called.\n */\n function allowance(address owner, address spender) external view returns (uint256);\n\n /**\n * @dev Sets `amount` as the allowance of `spender` over the caller's tokens.\n *\n * Returns a boolean value indicating whether the operation succeeded.\n *\n * IMPORTANT: Beware that changing an allowance with this method brings the risk\n * that someone may use both the old and the new allowance by unfortunate\n * transaction ordering. One possible solution to mitigate this race\n * condition is to first reduce the spender's allowance to 0 and set the\n * desired value afterwards:\n * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729\n *\n * Emits an {Approval} event.\n */\n function approve(address spender, uint256 amount) external returns (bool);\n\n /**\n * @dev Moves `amount` tokens from `from` to `to` using the\n * allowance mechanism. `amount` is then deducted from the caller's\n * allowance.\n *\n * Returns a boolean value indicating whether the operation succeeded.\n *\n * Emits a {Transfer} event.\n */\n function transferFrom(\n address from,\n address to,\n uint256 amount\n ) external returns (bool);\n}\n" + }, + "contracts/interfaces/ICoreBorrow.sol": { + "content": "// SPDX-License-Identifier: GPL-3.0\n\npragma solidity ^0.8.12;\n\n/// @title ICoreBorrow\n/// @author Angle Labs, Inc.\n/// @notice Interface for the `CoreBorrow` contract\n/// @dev This interface only contains functions of the `CoreBorrow` contract which are called by other contracts\n/// of this module\ninterface ICoreBorrow {\n /// @notice Checks if an address corresponds to a treasury of a stablecoin with a flash loan\n /// module initialized on it\n /// @param treasury Address to check\n /// @return Whether the address has the `FLASHLOANER_TREASURY_ROLE` or not\n function isFlashLoanerTreasury(address treasury) external view returns (bool);\n\n /// @notice Checks whether an address is governor of the Angle Protocol or not\n /// @param admin Address to check\n /// @return Whether the address has the `GOVERNOR_ROLE` or not\n function isGovernor(address admin) external view returns (bool);\n\n /// @notice Checks whether an address is governor or a guardian of the Angle Protocol or not\n /// @param admin Address to check\n /// @return Whether the address has the `GUARDIAN_ROLE` or not\n /// @dev Governance should make sure when adding a governor to also give this governor the guardian\n /// role by calling the `addGovernor` function\n function isGovernorOrGuardian(address admin) external view returns (bool);\n}\n" + }, + "contracts/interfaces/IFlashAngle.sol": { + "content": "// SPDX-License-Identifier: GPL-3.0\n\npragma solidity ^0.8.12;\n\nimport \"./IAgToken.sol\";\nimport \"./ICoreBorrow.sol\";\n\n/// @title IFlashAngle\n/// @author Angle Labs, Inc.\n/// @notice Interface for the `FlashAngle` contract\n/// @dev This interface only contains functions of the contract which are called by other contracts\n/// of this module\ninterface IFlashAngle {\n /// @notice Reference to the `CoreBorrow` contract managing the FlashLoan module\n function core() external view returns (ICoreBorrow);\n\n /// @notice Sends the fees taken from flash loans to the treasury contract associated to the stablecoin\n /// @param stablecoin Stablecoin from which profits should be sent\n /// @return balance Amount of profits sent\n /// @dev This function can only be called by the treasury contract\n function accrueInterestToTreasury(IAgToken stablecoin) external returns (uint256 balance);\n\n /// @notice Adds support for a stablecoin\n /// @param _treasury Treasury associated to the stablecoin to add support for\n /// @dev This function can only be called by the `CoreBorrow` contract\n function addStablecoinSupport(address _treasury) external;\n\n /// @notice Removes support for a stablecoin\n /// @param _treasury Treasury associated to the stablecoin to remove support for\n /// @dev This function can only be called by the `CoreBorrow` contract\n function removeStablecoinSupport(address _treasury) external;\n\n /// @notice Sets a new core contract\n /// @param _core Core contract address to set\n /// @dev This function can only be called by the `CoreBorrow` contract\n function setCore(address _core) external;\n}\n" + }, + "@openzeppelin/contracts/interfaces/IERC721Metadata.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (interfaces/IERC721Metadata.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../token/ERC721/extensions/IERC721Metadata.sol\";\n" + }, + "@openzeppelin/contracts/token/ERC721/extensions/IERC721Metadata.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (token/ERC721/extensions/IERC721Metadata.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../IERC721.sol\";\n\n/**\n * @title ERC-721 Non-Fungible Token Standard, optional metadata extension\n * @dev See https://eips.ethereum.org/EIPS/eip-721\n */\ninterface IERC721Metadata is IERC721 {\n /**\n * @dev Returns the token collection name.\n */\n function name() external view returns (string memory);\n\n /**\n * @dev Returns the token collection symbol.\n */\n function symbol() external view returns (string memory);\n\n /**\n * @dev Returns the Uniform Resource Identifier (URI) for `tokenId` token.\n */\n function tokenURI(uint256 tokenId) external view returns (string memory);\n}\n" + }, + "@openzeppelin/contracts/token/ERC721/IERC721.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.7.0) (token/ERC721/IERC721.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../../utils/introspection/IERC165.sol\";\n\n/**\n * @dev Required interface of an ERC721 compliant contract.\n */\ninterface IERC721 is IERC165 {\n /**\n * @dev Emitted when `tokenId` token is transferred from `from` to `to`.\n */\n event Transfer(address indexed from, address indexed to, uint256 indexed tokenId);\n\n /**\n * @dev Emitted when `owner` enables `approved` to manage the `tokenId` token.\n */\n event Approval(address indexed owner, address indexed approved, uint256 indexed tokenId);\n\n /**\n * @dev Emitted when `owner` enables or disables (`approved`) `operator` to manage all of its assets.\n */\n event ApprovalForAll(address indexed owner, address indexed operator, bool approved);\n\n /**\n * @dev Returns the number of tokens in ``owner``'s account.\n */\n function balanceOf(address owner) external view returns (uint256 balance);\n\n /**\n * @dev Returns the owner of the `tokenId` token.\n *\n * Requirements:\n *\n * - `tokenId` must exist.\n */\n function ownerOf(uint256 tokenId) external view returns (address owner);\n\n /**\n * @dev Safely transfers `tokenId` token from `from` to `to`.\n *\n * Requirements:\n *\n * - `from` cannot be the zero address.\n * - `to` cannot be the zero address.\n * - `tokenId` token must exist and be owned by `from`.\n * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}.\n * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.\n *\n * Emits a {Transfer} event.\n */\n function safeTransferFrom(\n address from,\n address to,\n uint256 tokenId,\n bytes calldata data\n ) external;\n\n /**\n * @dev Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipients\n * are aware of the ERC721 protocol to prevent tokens from being forever locked.\n *\n * Requirements:\n *\n * - `from` cannot be the zero address.\n * - `to` cannot be the zero address.\n * - `tokenId` token must exist and be owned by `from`.\n * - If the caller is not `from`, it must have been allowed to move this token by either {approve} or {setApprovalForAll}.\n * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.\n *\n * Emits a {Transfer} event.\n */\n function safeTransferFrom(\n address from,\n address to,\n uint256 tokenId\n ) external;\n\n /**\n * @dev Transfers `tokenId` token from `from` to `to`.\n *\n * WARNING: Usage of this method is discouraged, use {safeTransferFrom} whenever possible.\n *\n * Requirements:\n *\n * - `from` cannot be the zero address.\n * - `to` cannot be the zero address.\n * - `tokenId` token must be owned by `from`.\n * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}.\n *\n * Emits a {Transfer} event.\n */\n function transferFrom(\n address from,\n address to,\n uint256 tokenId\n ) external;\n\n /**\n * @dev Gives permission to `to` to transfer `tokenId` token to another account.\n * The approval is cleared when the token is transferred.\n *\n * Only a single account can be approved at a time, so approving the zero address clears previous approvals.\n *\n * Requirements:\n *\n * - The caller must own the token or be an approved operator.\n * - `tokenId` must exist.\n *\n * Emits an {Approval} event.\n */\n function approve(address to, uint256 tokenId) external;\n\n /**\n * @dev Approve or remove `operator` as an operator for the caller.\n * Operators can call {transferFrom} or {safeTransferFrom} for any token owned by the caller.\n *\n * Requirements:\n *\n * - The `operator` cannot be the caller.\n *\n * Emits an {ApprovalForAll} event.\n */\n function setApprovalForAll(address operator, bool _approved) external;\n\n /**\n * @dev Returns the account approved for `tokenId` token.\n *\n * Requirements:\n *\n * - `tokenId` must exist.\n */\n function getApproved(uint256 tokenId) external view returns (address operator);\n\n /**\n * @dev Returns if the `operator` is allowed to manage all of the assets of `owner`.\n *\n * See {setApprovalForAll}\n */\n function isApprovedForAll(address owner, address operator) external view returns (bool);\n}\n" + }, + "@openzeppelin/contracts/utils/introspection/IERC165.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (utils/introspection/IERC165.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Interface of the ERC165 standard, as defined in the\n * https://eips.ethereum.org/EIPS/eip-165[EIP].\n *\n * Implementers can declare support of contract interfaces, which can then be\n * queried by others ({ERC165Checker}).\n *\n * For an implementation, see {ERC165}.\n */\ninterface IERC165 {\n /**\n * @dev Returns true if this contract implements the interface defined by\n * `interfaceId`. See the corresponding\n * https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section]\n * to learn more about how these ids are created.\n *\n * This function call must use less than 30 000 gas.\n */\n function supportsInterface(bytes4 interfaceId) external view returns (bool);\n}\n" + } + }, + "settings": { + "optimizer": { + "enabled": true, + "runs": 1 + }, + "outputSelection": { + "*": { + "*": [ + "abi", + "evm.bytecode", + "evm.deployedBytecode", + "evm.methodIdentifiers", + "metadata" + ], + "": [ + "ast" + ] + } + } + } +} \ No newline at end of file diff --git a/deployments/optimism/VaultManagerNoDust_Implementation.json b/deployments/optimism/VaultManagerNoDust_Implementation.json new file mode 100644 index 00000000..9bea82da --- /dev/null +++ b/deployments/optimism/VaultManagerNoDust_Implementation.json @@ -0,0 +1,1810 @@ +{ + "address": "0xFC48E39fed51F2937c8CE7eE95eD9181c2790ab1", + "abi": [ + { + "inputs": [], + "name": "ApprovalToCaller", + "type": "error" + }, + { + "inputs": [], + "name": "ApprovalToOwner", + "type": "error" + }, + { + "inputs": [], + "name": "DebtCeilingExceeded", + "type": "error" + }, + { + "inputs": [], + "name": "DustyLeftoverAmount", + "type": "error" + }, + { + "inputs": [], + "name": "ExpiredDeadline", + "type": "error" + }, + { + "inputs": [], + "name": "HealthyVault", + "type": "error" + }, + { + "inputs": [], + "name": "IncompatibleLengths", + "type": "error" + }, + { + "inputs": [], + "name": "InsolventVault", + "type": "error" + }, + { + "inputs": [], + "name": "InvalidParameterType", + "type": "error" + }, + { + "inputs": [], + "name": "InvalidParameterValue", + "type": "error" + }, + { + "inputs": [], + "name": "InvalidSetOfParameters", + "type": "error" + }, + { + "inputs": [], + "name": "InvalidSignature", + "type": "error" + }, + { + "inputs": [], + "name": "InvalidTreasury", + "type": "error" + }, + { + "inputs": [], + "name": "NonERC721Receiver", + "type": "error" + }, + { + "inputs": [], + "name": "NonexistentVault", + "type": "error" + }, + { + "inputs": [], + "name": "NotApproved", + "type": "error" + }, + { + "inputs": [], + "name": "NotGovernor", + "type": "error" + }, + { + "inputs": [], + "name": "NotGovernorOrGuardian", + "type": "error" + }, + { + "inputs": [], + "name": "NotTreasury", + "type": "error" + }, + { + "inputs": [], + "name": "NotVaultManager", + "type": "error" + }, + { + "inputs": [], + "name": "NotWhitelisted", + "type": "error" + }, + { + "inputs": [], + "name": "Paused", + "type": "error" + }, + { + "inputs": [], + "name": "TooHighParameterValue", + "type": "error" + }, + { + "inputs": [], + "name": "TooSmallParameterValue", + "type": "error" + }, + { + "inputs": [], + "name": "ZeroAddress", + "type": "error" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint256", + "name": "surplusEndValue", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "badDebtEndValue", + "type": "uint256" + } + ], + "name": "AccruedToTreasury", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "owner", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "approved", + "type": "address" + }, + { + "indexed": true, + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + } + ], + "name": "Approval", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "owner", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "operator", + "type": "address" + }, + { + "indexed": false, + "internalType": "bool", + "name": "approved", + "type": "bool" + } + ], + "name": "ApprovalForAll", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint256", + "name": "vaultID", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "collateralAmount", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint8", + "name": "isIncrease", + "type": "uint8" + } + ], + "name": "CollateralAmountUpdated", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint256", + "name": "debtCeiling", + "type": "uint256" + } + ], + "name": "DebtCeilingUpdated", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint256", + "name": "srcVaultID", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "dstVaultID", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "address", + "name": "dstVaultManager", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "DebtTransferred", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint64", + "name": "param", + "type": "uint64" + }, + { + "indexed": false, + "internalType": "bytes32", + "name": "what", + "type": "bytes32" + } + ], + "name": "FiledUint64", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint8", + "name": "version", + "type": "uint8" + } + ], + "name": "Initialized", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint256", + "name": "value", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "timestamp", + "type": "uint256" + } + ], + "name": "InterestAccumulatorUpdated", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint256", + "name": "vaultID", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "internalAmount", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint8", + "name": "isIncrease", + "type": "uint8" + } + ], + "name": "InternalDebtUpdated", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint256[]", + "name": "vaultIDs", + "type": "uint256[]" + } + ], + "name": "LiquidatedVaults", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "_veBoostProxy", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256[]", + "name": "xBoost", + "type": "uint256[]" + }, + { + "indexed": false, + "internalType": "uint256[]", + "name": "yBoost", + "type": "uint256[]" + } + ], + "name": "LiquidationBoostParametersUpdated", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "from", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "to", + "type": "address" + }, + { + "indexed": true, + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + } + ], + "name": "Transfer", + "type": "event" + }, + { + "inputs": [], + "name": "BASE_INTEREST", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "BASE_PARAMS", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "DOMAIN_SEPARATOR", + "outputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "HALF_BASE_INTEREST", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "accrueInterestToTreasury", + "outputs": [ + { + "internalType": "uint256", + "name": "surplusValue", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "badDebtValue", + "type": "uint256" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "enum ActionType[]", + "name": "actions", + "type": "uint8[]" + }, + { + "internalType": "bytes[]", + "name": "datas", + "type": "bytes[]" + }, + { + "internalType": "address", + "name": "from", + "type": "address" + }, + { + "internalType": "address", + "name": "to", + "type": "address" + } + ], + "name": "angle", + "outputs": [ + { + "components": [ + { + "internalType": "uint256", + "name": "stablecoinAmountToGive", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "stablecoinAmountToReceive", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "collateralAmountToGive", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "collateralAmountToReceive", + "type": "uint256" + } + ], + "internalType": "struct PaymentData", + "name": "", + "type": "tuple" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "enum ActionType[]", + "name": "actions", + "type": "uint8[]" + }, + { + "internalType": "bytes[]", + "name": "datas", + "type": "bytes[]" + }, + { + "internalType": "address", + "name": "from", + "type": "address" + }, + { + "internalType": "address", + "name": "to", + "type": "address" + }, + { + "internalType": "address", + "name": "who", + "type": "address" + }, + { + "internalType": "bytes", + "name": "repayData", + "type": "bytes" + } + ], + "name": "angle", + "outputs": [ + { + "components": [ + { + "internalType": "uint256", + "name": "stablecoinAmountToGive", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "stablecoinAmountToReceive", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "collateralAmountToGive", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "collateralAmountToReceive", + "type": "uint256" + } + ], + "internalType": "struct PaymentData", + "name": "paymentData", + "type": "tuple" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "to", + "type": "address" + }, + { + "internalType": "uint256", + "name": "vaultID", + "type": "uint256" + } + ], + "name": "approve", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "badDebt", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "owner", + "type": "address" + } + ], + "name": "balanceOf", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "borrowFee", + "outputs": [ + { + "internalType": "uint64", + "name": "", + "type": "uint64" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "vaultID", + "type": "uint256" + }, + { + "internalType": "address", + "name": "liquidator", + "type": "address" + } + ], + "name": "checkLiquidation", + "outputs": [ + { + "components": [ + { + "internalType": "uint256", + "name": "maxStablecoinAmountToRepay", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "maxCollateralAmountGiven", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "thresholdRepayAmount", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "discount", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "currentDebt", + "type": "uint256" + } + ], + "internalType": "struct LiquidationOpportunity", + "name": "liqOpp", + "type": "tuple" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "collateral", + "outputs": [ + { + "internalType": "contract IERC20", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "collateralFactor", + "outputs": [ + { + "internalType": "uint64", + "name": "", + "type": "uint64" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "toVault", + "type": "address" + } + ], + "name": "createVault", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "debtCeiling", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "dust", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "vaultID", + "type": "uint256" + } + ], + "name": "getApproved", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "vaultID", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "stablecoinAmount", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "senderBorrowFee", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "senderRepayFee", + "type": "uint256" + } + ], + "name": "getDebtOut", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "getTotalDebt", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "vaultID", + "type": "uint256" + } + ], + "name": "getVaultDebt", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "contract ITreasury", + "name": "_treasury", + "type": "address" + }, + { + "internalType": "contract IERC20", + "name": "_collateral", + "type": "address" + }, + { + "internalType": "contract IOracle", + "name": "_oracle", + "type": "address" + }, + { + "components": [ + { + "internalType": "uint256", + "name": "debtCeiling", + "type": "uint256" + }, + { + "internalType": "uint64", + "name": "collateralFactor", + "type": "uint64" + }, + { + "internalType": "uint64", + "name": "targetHealthFactor", + "type": "uint64" + }, + { + "internalType": "uint64", + "name": "interestRate", + "type": "uint64" + }, + { + "internalType": "uint64", + "name": "liquidationSurcharge", + "type": "uint64" + }, + { + "internalType": "uint64", + "name": "maxLiquidationDiscount", + "type": "uint64" + }, + { + "internalType": "bool", + "name": "whitelistingActivated", + "type": "bool" + }, + { + "internalType": "uint256", + "name": "baseBoost", + "type": "uint256" + } + ], + "internalType": "struct VaultParameters", + "name": "params", + "type": "tuple" + }, + { + "internalType": "string", + "name": "_symbol", + "type": "string" + } + ], + "name": "initialize", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "interestAccumulator", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "interestRate", + "outputs": [ + { + "internalType": "uint64", + "name": "", + "type": "uint64" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "owner", + "type": "address" + }, + { + "internalType": "address", + "name": "operator", + "type": "address" + } + ], + "name": "isApprovedForAll", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "spender", + "type": "address" + }, + { + "internalType": "uint256", + "name": "vaultID", + "type": "uint256" + } + ], + "name": "isApprovedOrOwner", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "name": "isWhitelisted", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "lastInterestAccumulatorUpdated", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256[]", + "name": "vaultIDs", + "type": "uint256[]" + }, + { + "internalType": "uint256[]", + "name": "amounts", + "type": "uint256[]" + }, + { + "internalType": "address", + "name": "from", + "type": "address" + }, + { + "internalType": "address", + "name": "to", + "type": "address" + }, + { + "internalType": "address", + "name": "who", + "type": "address" + }, + { + "internalType": "bytes", + "name": "data", + "type": "bytes" + } + ], + "name": "liquidate", + "outputs": [ + { + "components": [ + { + "internalType": "uint256", + "name": "stablecoinAmountToReceive", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "collateralAmountToGive", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "badDebtFromLiquidation", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "oracleValue", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "newInterestAccumulator", + "type": "uint256" + } + ], + "internalType": "struct LiquidatorData", + "name": "liqData", + "type": "tuple" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256[]", + "name": "vaultIDs", + "type": "uint256[]" + }, + { + "internalType": "uint256[]", + "name": "amounts", + "type": "uint256[]" + }, + { + "internalType": "address", + "name": "from", + "type": "address" + }, + { + "internalType": "address", + "name": "to", + "type": "address" + } + ], + "name": "liquidate", + "outputs": [ + { + "components": [ + { + "internalType": "uint256", + "name": "stablecoinAmountToReceive", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "collateralAmountToGive", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "badDebtFromLiquidation", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "oracleValue", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "newInterestAccumulator", + "type": "uint256" + } + ], + "internalType": "struct LiquidatorData", + "name": "", + "type": "tuple" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "liquidationSurcharge", + "outputs": [ + { + "internalType": "uint64", + "name": "", + "type": "uint64" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "maxLiquidationDiscount", + "outputs": [ + { + "internalType": "uint64", + "name": "", + "type": "uint64" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "name", + "outputs": [ + { + "internalType": "string", + "name": "", + "type": "string" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "owner", + "type": "address" + } + ], + "name": "nonces", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "oracle", + "outputs": [ + { + "internalType": "contract IOracle", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "vaultID", + "type": "uint256" + } + ], + "name": "ownerOf", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "paused", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "owner", + "type": "address" + }, + { + "internalType": "address", + "name": "spender", + "type": "address" + }, + { + "internalType": "bool", + "name": "approved", + "type": "bool" + }, + { + "internalType": "uint256", + "name": "deadline", + "type": "uint256" + }, + { + "internalType": "uint8", + "name": "v", + "type": "uint8" + }, + { + "internalType": "bytes32", + "name": "r", + "type": "bytes32" + }, + { + "internalType": "bytes32", + "name": "s", + "type": "bytes32" + } + ], + "name": "permit", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "repayFee", + "outputs": [ + { + "internalType": "uint64", + "name": "", + "type": "uint64" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "from", + "type": "address" + }, + { + "internalType": "address", + "name": "to", + "type": "address" + }, + { + "internalType": "uint256", + "name": "vaultID", + "type": "uint256" + } + ], + "name": "safeTransferFrom", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "from", + "type": "address" + }, + { + "internalType": "address", + "name": "to", + "type": "address" + }, + { + "internalType": "uint256", + "name": "vaultID", + "type": "uint256" + }, + { + "internalType": "bytes", + "name": "_data", + "type": "bytes" + } + ], + "name": "safeTransferFrom", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "operator", + "type": "address" + }, + { + "internalType": "bool", + "name": "approved", + "type": "bool" + } + ], + "name": "setApprovalForAll", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "string", + "name": "baseURI_", + "type": "string" + } + ], + "name": "setBaseURI", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "_debtCeiling", + "type": "uint256" + } + ], + "name": "setDebtCeiling", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "_dust", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "dustCollateral_", + "type": "uint256" + } + ], + "name": "setDusts", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_veBoostProxy", + "type": "address" + }, + { + "internalType": "uint256[]", + "name": "xBoost", + "type": "uint256[]" + }, + { + "internalType": "uint256[]", + "name": "yBoost", + "type": "uint256[]" + } + ], + "name": "setLiquidationBoostParameters", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_oracle", + "type": "address" + } + ], + "name": "setOracle", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_treasury", + "type": "address" + } + ], + "name": "setTreasury", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint64", + "name": "param", + "type": "uint64" + }, + { + "internalType": "bytes32", + "name": "what", + "type": "bytes32" + } + ], + "name": "setUint64", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "stablecoin", + "outputs": [ + { + "internalType": "contract IAgToken", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes4", + "name": "interfaceId", + "type": "bytes4" + } + ], + "name": "supportsInterface", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "pure", + "type": "function" + }, + { + "inputs": [], + "name": "surplus", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "symbol", + "outputs": [ + { + "internalType": "string", + "name": "", + "type": "string" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "targetHealthFactor", + "outputs": [ + { + "internalType": "uint64", + "name": "", + "type": "uint64" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "togglePause", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "target", + "type": "address" + } + ], + "name": "toggleWhitelist", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "vaultID", + "type": "uint256" + } + ], + "name": "tokenURI", + "outputs": [ + { + "internalType": "string", + "name": "", + "type": "string" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "totalNormalizedDebt", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "from", + "type": "address" + }, + { + "internalType": "address", + "name": "to", + "type": "address" + }, + { + "internalType": "uint256", + "name": "vaultID", + "type": "uint256" + } + ], + "name": "transferFrom", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "treasury", + "outputs": [ + { + "internalType": "contract ITreasury", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "name": "vaultData", + "outputs": [ + { + "internalType": "uint256", + "name": "collateralAmount", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "normalizedDebt", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "vaultIDCount", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "veBoostProxy", + "outputs": [ + { + "internalType": "contract IVeBoostProxy", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "whitelistingActivated", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "name": "xLiquidationBoost", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "name": "yLiquidationBoost", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + } + ], + "transactionHash": "0xb0fa9c01801f3b145acea27959ef0b95400c0417369d9a44a6943af8cac94f15", + "receipt": { + "to": null, + "from": "0xfdA462548Ce04282f4B6D6619823a7C64Fdc0185", + "contractAddress": "0xFC48E39fed51F2937c8CE7eE95eD9181c2790ab1", + "transactionIndex": 0, + "gasUsed": "5344056", + "logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000000000000000000000000000080000000000000000000001000000000000000000000000400000000000000000000000000000000100000000000000000000000000000040000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "blockHash": "0xfba77c72459655b0fa1873091ca30b59131f886c2c6db89ee247aeff75732d79", + "transactionHash": "0xb0fa9c01801f3b145acea27959ef0b95400c0417369d9a44a6943af8cac94f15", + "logs": [ + { + "transactionIndex": 0, + "blockNumber": 41859612, + "transactionHash": "0xb0fa9c01801f3b145acea27959ef0b95400c0417369d9a44a6943af8cac94f15", + "address": "0xFC48E39fed51F2937c8CE7eE95eD9181c2790ab1", + "topics": [ + "0x7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb3847402498" + ], + "data": "0x0000000000000000000000000000000000000000000000000000000000000001", + "logIndex": 0, + "blockHash": "0xfba77c72459655b0fa1873091ca30b59131f886c2c6db89ee247aeff75732d79" + } + ], + "blockNumber": 41859612, + "cumulativeGasUsed": "5344056", + "status": 1, + "byzantium": true + }, + "args": [], + "numDeployments": 1, + "solcInputHash": "dc345d3eed7216da5bac40699a727ed4", + "metadata": "{\"compiler\":{\"version\":\"0.8.12+commit.f00d7308\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[],\"name\":\"ApprovalToCaller\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"ApprovalToOwner\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"DebtCeilingExceeded\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"DustyLeftoverAmount\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"ExpiredDeadline\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"HealthyVault\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"IncompatibleLengths\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"InsolventVault\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"InvalidParameterType\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"InvalidParameterValue\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"InvalidSetOfParameters\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"InvalidSignature\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"InvalidTreasury\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"NonERC721Receiver\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"NonexistentVault\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"NotApproved\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"NotGovernor\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"NotGovernorOrGuardian\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"NotTreasury\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"NotVaultManager\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"NotWhitelisted\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"Paused\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"TooHighParameterValue\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"TooSmallParameterValue\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"ZeroAddress\",\"type\":\"error\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"surplusEndValue\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"badDebtEndValue\",\"type\":\"uint256\"}],\"name\":\"AccruedToTreasury\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"owner\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"approved\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"tokenId\",\"type\":\"uint256\"}],\"name\":\"Approval\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"owner\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"operator\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"bool\",\"name\":\"approved\",\"type\":\"bool\"}],\"name\":\"ApprovalForAll\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"vaultID\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"collateralAmount\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint8\",\"name\":\"isIncrease\",\"type\":\"uint8\"}],\"name\":\"CollateralAmountUpdated\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"debtCeiling\",\"type\":\"uint256\"}],\"name\":\"DebtCeilingUpdated\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"srcVaultID\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"dstVaultID\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"dstVaultManager\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"DebtTransferred\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint64\",\"name\":\"param\",\"type\":\"uint64\"},{\"indexed\":false,\"internalType\":\"bytes32\",\"name\":\"what\",\"type\":\"bytes32\"}],\"name\":\"FiledUint64\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint8\",\"name\":\"version\",\"type\":\"uint8\"}],\"name\":\"Initialized\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"value\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"timestamp\",\"type\":\"uint256\"}],\"name\":\"InterestAccumulatorUpdated\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"vaultID\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"internalAmount\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint8\",\"name\":\"isIncrease\",\"type\":\"uint8\"}],\"name\":\"InternalDebtUpdated\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256[]\",\"name\":\"vaultIDs\",\"type\":\"uint256[]\"}],\"name\":\"LiquidatedVaults\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"_veBoostProxy\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256[]\",\"name\":\"xBoost\",\"type\":\"uint256[]\"},{\"indexed\":false,\"internalType\":\"uint256[]\",\"name\":\"yBoost\",\"type\":\"uint256[]\"}],\"name\":\"LiquidationBoostParametersUpdated\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"from\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"to\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"tokenId\",\"type\":\"uint256\"}],\"name\":\"Transfer\",\"type\":\"event\"},{\"inputs\":[],\"name\":\"BASE_INTEREST\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"BASE_PARAMS\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"DOMAIN_SEPARATOR\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"HALF_BASE_INTEREST\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"accrueInterestToTreasury\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"surplusValue\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"badDebtValue\",\"type\":\"uint256\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"enum ActionType[]\",\"name\":\"actions\",\"type\":\"uint8[]\"},{\"internalType\":\"bytes[]\",\"name\":\"datas\",\"type\":\"bytes[]\"},{\"internalType\":\"address\",\"name\":\"from\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"to\",\"type\":\"address\"}],\"name\":\"angle\",\"outputs\":[{\"components\":[{\"internalType\":\"uint256\",\"name\":\"stablecoinAmountToGive\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"stablecoinAmountToReceive\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"collateralAmountToGive\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"collateralAmountToReceive\",\"type\":\"uint256\"}],\"internalType\":\"struct PaymentData\",\"name\":\"\",\"type\":\"tuple\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"enum ActionType[]\",\"name\":\"actions\",\"type\":\"uint8[]\"},{\"internalType\":\"bytes[]\",\"name\":\"datas\",\"type\":\"bytes[]\"},{\"internalType\":\"address\",\"name\":\"from\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"to\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"who\",\"type\":\"address\"},{\"internalType\":\"bytes\",\"name\":\"repayData\",\"type\":\"bytes\"}],\"name\":\"angle\",\"outputs\":[{\"components\":[{\"internalType\":\"uint256\",\"name\":\"stablecoinAmountToGive\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"stablecoinAmountToReceive\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"collateralAmountToGive\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"collateralAmountToReceive\",\"type\":\"uint256\"}],\"internalType\":\"struct PaymentData\",\"name\":\"paymentData\",\"type\":\"tuple\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"to\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"vaultID\",\"type\":\"uint256\"}],\"name\":\"approve\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"badDebt\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"owner\",\"type\":\"address\"}],\"name\":\"balanceOf\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"borrowFee\",\"outputs\":[{\"internalType\":\"uint64\",\"name\":\"\",\"type\":\"uint64\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"vaultID\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"liquidator\",\"type\":\"address\"}],\"name\":\"checkLiquidation\",\"outputs\":[{\"components\":[{\"internalType\":\"uint256\",\"name\":\"maxStablecoinAmountToRepay\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"maxCollateralAmountGiven\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"thresholdRepayAmount\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"discount\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"currentDebt\",\"type\":\"uint256\"}],\"internalType\":\"struct LiquidationOpportunity\",\"name\":\"liqOpp\",\"type\":\"tuple\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"collateral\",\"outputs\":[{\"internalType\":\"contract IERC20\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"collateralFactor\",\"outputs\":[{\"internalType\":\"uint64\",\"name\":\"\",\"type\":\"uint64\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"toVault\",\"type\":\"address\"}],\"name\":\"createVault\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"debtCeiling\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"dust\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"vaultID\",\"type\":\"uint256\"}],\"name\":\"getApproved\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"vaultID\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"stablecoinAmount\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"senderBorrowFee\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"senderRepayFee\",\"type\":\"uint256\"}],\"name\":\"getDebtOut\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"getTotalDebt\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"vaultID\",\"type\":\"uint256\"}],\"name\":\"getVaultDebt\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"contract ITreasury\",\"name\":\"_treasury\",\"type\":\"address\"},{\"internalType\":\"contract IERC20\",\"name\":\"_collateral\",\"type\":\"address\"},{\"internalType\":\"contract IOracle\",\"name\":\"_oracle\",\"type\":\"address\"},{\"components\":[{\"internalType\":\"uint256\",\"name\":\"debtCeiling\",\"type\":\"uint256\"},{\"internalType\":\"uint64\",\"name\":\"collateralFactor\",\"type\":\"uint64\"},{\"internalType\":\"uint64\",\"name\":\"targetHealthFactor\",\"type\":\"uint64\"},{\"internalType\":\"uint64\",\"name\":\"interestRate\",\"type\":\"uint64\"},{\"internalType\":\"uint64\",\"name\":\"liquidationSurcharge\",\"type\":\"uint64\"},{\"internalType\":\"uint64\",\"name\":\"maxLiquidationDiscount\",\"type\":\"uint64\"},{\"internalType\":\"bool\",\"name\":\"whitelistingActivated\",\"type\":\"bool\"},{\"internalType\":\"uint256\",\"name\":\"baseBoost\",\"type\":\"uint256\"}],\"internalType\":\"struct VaultParameters\",\"name\":\"params\",\"type\":\"tuple\"},{\"internalType\":\"string\",\"name\":\"_symbol\",\"type\":\"string\"}],\"name\":\"initialize\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"interestAccumulator\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"interestRate\",\"outputs\":[{\"internalType\":\"uint64\",\"name\":\"\",\"type\":\"uint64\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"owner\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"operator\",\"type\":\"address\"}],\"name\":\"isApprovedForAll\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"spender\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"vaultID\",\"type\":\"uint256\"}],\"name\":\"isApprovedOrOwner\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"name\":\"isWhitelisted\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"lastInterestAccumulatorUpdated\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256[]\",\"name\":\"vaultIDs\",\"type\":\"uint256[]\"},{\"internalType\":\"uint256[]\",\"name\":\"amounts\",\"type\":\"uint256[]\"},{\"internalType\":\"address\",\"name\":\"from\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"to\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"who\",\"type\":\"address\"},{\"internalType\":\"bytes\",\"name\":\"data\",\"type\":\"bytes\"}],\"name\":\"liquidate\",\"outputs\":[{\"components\":[{\"internalType\":\"uint256\",\"name\":\"stablecoinAmountToReceive\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"collateralAmountToGive\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"badDebtFromLiquidation\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"oracleValue\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"newInterestAccumulator\",\"type\":\"uint256\"}],\"internalType\":\"struct LiquidatorData\",\"name\":\"liqData\",\"type\":\"tuple\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256[]\",\"name\":\"vaultIDs\",\"type\":\"uint256[]\"},{\"internalType\":\"uint256[]\",\"name\":\"amounts\",\"type\":\"uint256[]\"},{\"internalType\":\"address\",\"name\":\"from\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"to\",\"type\":\"address\"}],\"name\":\"liquidate\",\"outputs\":[{\"components\":[{\"internalType\":\"uint256\",\"name\":\"stablecoinAmountToReceive\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"collateralAmountToGive\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"badDebtFromLiquidation\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"oracleValue\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"newInterestAccumulator\",\"type\":\"uint256\"}],\"internalType\":\"struct LiquidatorData\",\"name\":\"\",\"type\":\"tuple\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"liquidationSurcharge\",\"outputs\":[{\"internalType\":\"uint64\",\"name\":\"\",\"type\":\"uint64\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"maxLiquidationDiscount\",\"outputs\":[{\"internalType\":\"uint64\",\"name\":\"\",\"type\":\"uint64\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"name\",\"outputs\":[{\"internalType\":\"string\",\"name\":\"\",\"type\":\"string\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"owner\",\"type\":\"address\"}],\"name\":\"nonces\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"oracle\",\"outputs\":[{\"internalType\":\"contract IOracle\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"vaultID\",\"type\":\"uint256\"}],\"name\":\"ownerOf\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"paused\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"owner\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"spender\",\"type\":\"address\"},{\"internalType\":\"bool\",\"name\":\"approved\",\"type\":\"bool\"},{\"internalType\":\"uint256\",\"name\":\"deadline\",\"type\":\"uint256\"},{\"internalType\":\"uint8\",\"name\":\"v\",\"type\":\"uint8\"},{\"internalType\":\"bytes32\",\"name\":\"r\",\"type\":\"bytes32\"},{\"internalType\":\"bytes32\",\"name\":\"s\",\"type\":\"bytes32\"}],\"name\":\"permit\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"repayFee\",\"outputs\":[{\"internalType\":\"uint64\",\"name\":\"\",\"type\":\"uint64\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"from\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"to\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"vaultID\",\"type\":\"uint256\"}],\"name\":\"safeTransferFrom\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"from\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"to\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"vaultID\",\"type\":\"uint256\"},{\"internalType\":\"bytes\",\"name\":\"_data\",\"type\":\"bytes\"}],\"name\":\"safeTransferFrom\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"operator\",\"type\":\"address\"},{\"internalType\":\"bool\",\"name\":\"approved\",\"type\":\"bool\"}],\"name\":\"setApprovalForAll\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"string\",\"name\":\"baseURI_\",\"type\":\"string\"}],\"name\":\"setBaseURI\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_debtCeiling\",\"type\":\"uint256\"}],\"name\":\"setDebtCeiling\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_dust\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"dustCollateral_\",\"type\":\"uint256\"}],\"name\":\"setDusts\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_veBoostProxy\",\"type\":\"address\"},{\"internalType\":\"uint256[]\",\"name\":\"xBoost\",\"type\":\"uint256[]\"},{\"internalType\":\"uint256[]\",\"name\":\"yBoost\",\"type\":\"uint256[]\"}],\"name\":\"setLiquidationBoostParameters\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_oracle\",\"type\":\"address\"}],\"name\":\"setOracle\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_treasury\",\"type\":\"address\"}],\"name\":\"setTreasury\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint64\",\"name\":\"param\",\"type\":\"uint64\"},{\"internalType\":\"bytes32\",\"name\":\"what\",\"type\":\"bytes32\"}],\"name\":\"setUint64\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"stablecoin\",\"outputs\":[{\"internalType\":\"contract IAgToken\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes4\",\"name\":\"interfaceId\",\"type\":\"bytes4\"}],\"name\":\"supportsInterface\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"pure\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"surplus\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"symbol\",\"outputs\":[{\"internalType\":\"string\",\"name\":\"\",\"type\":\"string\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"targetHealthFactor\",\"outputs\":[{\"internalType\":\"uint64\",\"name\":\"\",\"type\":\"uint64\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"togglePause\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"target\",\"type\":\"address\"}],\"name\":\"toggleWhitelist\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"vaultID\",\"type\":\"uint256\"}],\"name\":\"tokenURI\",\"outputs\":[{\"internalType\":\"string\",\"name\":\"\",\"type\":\"string\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"totalNormalizedDebt\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"from\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"to\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"vaultID\",\"type\":\"uint256\"}],\"name\":\"transferFrom\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"treasury\",\"outputs\":[{\"internalType\":\"contract ITreasury\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"name\":\"vaultData\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"collateralAmount\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"normalizedDebt\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"vaultIDCount\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"veBoostProxy\",\"outputs\":[{\"internalType\":\"contract IVeBoostProxy\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"whitelistingActivated\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"name\":\"xLiquidationBoost\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"name\":\"yLiquidationBoost\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"}],\"devdoc\":{\"author\":\"Angle Labs, Inc.\",\"kind\":\"dev\",\"methods\":{\"accrueInterestToTreasury()\":{\"details\":\"`surplus` and `badDebt` should be reset to 0 once their current value have been given to the `treasury` contract\",\"returns\":{\"badDebtValue\":\"Value of the bad debt communicated to the `Treasury`\",\"surplusValue\":\"Value of the surplus communicated to the `Treasury`\"}},\"angle(uint8[],bytes[],address,address,address,bytes)\":{\"details\":\"This function is optimized to reduce gas cost due to payment from or to the user and that expensive calls or computations (like `oracleValue`) are done only onceWhen specifying `vaultID` in `data`, it is important to know that if you specify `vaultID = 0`, it will simply use the latest `vaultID`. This is the default behavior, and unless you're engaging into some complex protocol actions it is encouraged to use `vaultID = 0` only when the first action of the batch is `createVault`\",\"params\":{\"actions\":\"Set of actions to perform\",\"datas\":\"Data to be decoded for each action: it can include like the `vaultID` or the `stablecoinAmount` to borrow\",\"from\":\"Address from which stablecoins will be taken if one action includes burning stablecoins. This address should either be the `msg.sender` or be approved by the latter\",\"repayData\":\"Data to pass to the repayment contract in case of\",\"to\":\"Address to which stablecoins and/or collateral will be sent in case of\",\"who\":\"Address of the contract to handle in case of repayment of stablecoins from received collateral\"},\"returns\":{\"paymentData\":\"Struct containing the accounting changes from the protocol's perspective (like how much of collateral or how much has been received). Note that the values in the struct are not aggregated and you could have in the output a positive amount of stablecoins to receive as well as a positive amount of stablecoins to give\"}},\"approve(address,uint256)\":{\"details\":\"Gives permission to `to` to transfer `tokenId` token to another account. The approval is cleared when the token is transferred. Only a single account can be approved at a time, so approving the zero address clears previous approvals. Requirements: - The caller must own the token or be an approved operator. - `tokenId` must exist. Emits an {Approval} event.\"},\"balanceOf(address)\":{\"details\":\"Returns the number of tokens in ``owner``'s account.\"},\"checkLiquidation(uint256,address)\":{\"details\":\"This function will revert if it's called on a vault that does not exist\",\"params\":{\"liquidator\":\"Address of the liquidator which will be performing the liquidation\",\"vaultID\":\"ID of the vault to check\"},\"returns\":{\"liqOpp\":\"Description of the opportunity of liquidation\"}},\"createVault(address)\":{\"details\":\"This function just creates the vault without doing any collateral or\",\"params\":{\"toVault\":\"Address for which the va\"},\"returns\":{\"_0\":\"vaultID ID of the vault created\"}},\"getApproved(uint256)\":{\"details\":\"Returns the account approved for `tokenId` token. Requirements: - `tokenId` must exist.\"},\"getDebtOut(uint256,uint256,uint256,uint256)\":{\"details\":\"This function can only be called from a vaultManager registered in the same Treasury\",\"params\":{\"amountStablecoins\":\"Amount of stablecoins to remove from the debt: this amount is to be converted to an internal debt amount\",\"senderBorrowFee\":\"Borrowing fees from the contract which requested this: this is to make sure that people are not arbitraging difference in minting fees\",\"senderRepayFee\":\"Repay fees from the contract which requested this: this is to make sure that people are not arbitraging differences in repay fees\",\"vaultID\":\"ID of the vault to remove debt from\"}},\"getTotalDebt()\":{\"returns\":{\"_0\":\"Total debt across all vaults, taking into account the interest accumulated over time\"}},\"getVaultDebt(uint256)\":{\"params\":{\"vaultID\":\"ID of the vault to check\"},\"returns\":{\"_0\":\"Debt of the vault\"}},\"initialize(address,address,address,(uint256,uint64,uint64,uint64,uint64,uint64,bool,uint256),string)\":{\"details\":\"The parameters and the oracle are the only elements which could be modified once the contract has been initializedFor the contract to be fully initialized, governance needs to set the parameters for the liquidation boost\",\"params\":{\"_collateral\":\"Collateral supported by this contract\",\"_oracle\":\"Oracle contract used\",\"_symbol\":\"Symbol used to define the `VaultManager` name and symbol\",\"_treasury\":\"Treasury address handling the contract\"}},\"isApprovedForAll(address,address)\":{\"details\":\"Returns if the `operator` is allowed to manage all of the assets of `owner`. See {setApprovalForAll}\"},\"isApprovedOrOwner(address,uint256)\":{\"params\":{\"spender\":\"Address for which vault ownership should be checked\",\"vaultID\":\"ID of the vault to check\"},\"returns\":{\"_0\":\"Whether the `spender` address owns or is approved for `vaultID`\"}},\"liquidate(uint256[],uint256[],address,address)\":{\"details\":\"This function is a simplified wrapper of the function below. It is built to remove for liquidators the need to specify a `who` and a `data` parameter\"},\"liquidate(uint256[],uint256[],address,address,address,bytes)\":{\"details\":\"This function will revert if it's called on a vault that cannot be liquidated or that does not exist\",\"params\":{\"amounts\":\"Amount of stablecoin to bring for the liquidation of each vault\",\"data\":\"Data to pass to the repayment contract in case of. If empty, liquidators simply have to bring the exact amount of stablecoins to get the discounted collateral. If not, it is used by the repayment contract to swap a portion or all of the collateral received to stablecoins to be sent to the `from` address. More details in the `_handleRepay` function\",\"from\":\"Address from which the stablecoins for the liquidation should be taken: this address should be the `msg.sender` or have received an approval\",\"to\":\"Address to which discounted collateral should be sent\",\"vaultIDs\":\"List of the vaults to liquidate\",\"who\":\"Address of the contract to handle repayment of stablecoins from received collateral\"},\"returns\":{\"liqData\":\"Data about the liquidation process for the liquidator to track everything that has been going on (like how much stablecoins have been repaid, how much collateral has been received)\"}},\"ownerOf(uint256)\":{\"details\":\"Returns the owner of the `tokenId` token. Requirements: - `tokenId` must exist.\"},\"permit(address,address,bool,uint256,uint8,bytes32,bytes32)\":{\"details\":\"The `v`, `r`, and `s` parameters are used as signature data\",\"params\":{\"approved\":\"Whether to give or revoke the approval\",\"deadline\":\"Deadline parameter for the signature to be valid\",\"owner\":\"Address signing the permit and giving (or revoking) its approval for all the controlled vaults\",\"spender\":\"Address to give approval to\"}},\"safeTransferFrom(address,address,uint256)\":{\"details\":\"Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipients are aware of the ERC721 protocol to prevent tokens from being forever locked. Requirements: - `from` cannot be the zero address. - `to` cannot be the zero address. - `tokenId` token must exist and be owned by `from`. - If the caller is not `from`, it must have been allowed to move this token by either {approve} or {setApprovalForAll}. - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer. Emits a {Transfer} event.\"},\"safeTransferFrom(address,address,uint256,bytes)\":{\"details\":\"Safely transfers `tokenId` token from `from` to `to`. Requirements: - `from` cannot be the zero address. - `to` cannot be the zero address. - `tokenId` token must exist and be owned by `from`. - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}. - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer. Emits a {Transfer} event.\"},\"setApprovalForAll(address,bool)\":{\"details\":\"Approve or remove `operator` as an operator for the caller. Operators can call {transferFrom} or {safeTransferFrom} for any token owned by the caller. Requirements: - The `operator` cannot be the caller. Emits an {ApprovalForAll} event.\"},\"setDebtCeiling(uint256)\":{\"details\":\"`debtCeiling` should not be bigger than `type(uint256).max / 10**27` otherwise there could be overflows\",\"params\":{\"_debtCeiling\":\"New value for `debtCeiling`\"}},\"setDusts(uint256,uint256)\":{\"details\":\"dustCollateral_ is in stable value\",\"params\":{\"_dust\":\"New minimum debt allowed\",\"dustCollateral_\":\"New minimum collateral allowed in a vault after a liquidation\"}},\"setLiquidationBoostParameters(address,uint256[],uint256[])\":{\"details\":\"There are 2 modes: When boost is enabled, `xBoost` and `yBoost` should have a length of 2, but if they have a higher length contract will still work as expected. Contract will also work as expected if their length differ When boost is disabled, `_veBoostProxy` needs to be zero address and `yBoost[0]` is the base boost\",\"params\":{\"_veBoostProxy\":\"Address which queries veANGLE balances and adjusted balances from delegation\",\"xBoost\":\"Threshold values of veANGLE adjusted balances\",\"yBoost\":\"Values of the liquidation boost at the threshold values of x\"}},\"setOracle(address)\":{\"params\":{\"_oracle\":\"Reference to the oracle contract\"}},\"setTreasury(address)\":{\"details\":\"All required checks when setting up a treasury contract are performed in the contract calling this function\",\"params\":{\"_treasury\":\"New treasury contract\"}},\"setUint64(uint64,bytes32)\":{\"details\":\"This function performs the required checks when updating a parameterWhen setting parameters governance or the guardian should make sure that when `HF < CF/((1-surcharge)(1-discount))` and hence when liquidating a vault is going to decrease its health factor, `discount = max discount`. Otherwise, it may be profitable for the liquidator to liquidate in multiple times: as it will decrease the HF and therefore increase the discount between each time\",\"params\":{\"param\":\"Value for the parameter\",\"what\":\"Parameter to change\"}},\"supportsInterface(bytes4)\":{\"details\":\"Returns true if this contract implements the interface defined by `interfaceId`. See the corresponding https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section] to learn more about how these ids are created. This function call must use less than 30 000 gas.\"},\"toggleWhitelist(address)\":{\"details\":\"If the `target` address is the zero address then this function toggles whitelisting for all addresses\",\"params\":{\"target\":\"Address to toggle\"}},\"tokenURI(uint256)\":{\"details\":\"Returns the Uniform Resource Identifier (URI) for `tokenId` token.\"},\"transferFrom(address,address,uint256)\":{\"details\":\"Transfers `tokenId` token from `from` to `to`. WARNING: Usage of this method is discouraged, use {safeTransferFrom} whenever possible. Requirements: - `from` cannot be the zero address. - `to` cannot be the zero address. - `tokenId` token must be owned by `from`. - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}. Emits a {Transfer} event.\"}},\"title\":\"VaultManagerLiquidationBoost\",\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{\"BASE_INTEREST()\":{\"notice\":\"Base used for interest rate computation\"},\"BASE_PARAMS()\":{\"notice\":\"Base used for parameter computation: almost all the parameters of this contract are set in `BASE_PARAMS`\"},\"DOMAIN_SEPARATOR()\":{\"notice\":\"Returns the domain separator for the current chain.\"},\"HALF_BASE_INTEREST()\":{\"notice\":\"Used for interest rate computation\"},\"accrueInterestToTreasury()\":{\"notice\":\"Accrues interest accumulated across all vaults to the surplus and sends the surplus to the treasury\"},\"angle(uint8[],bytes[],address,address)\":{\"notice\":\"This function is a wrapper built on top of the function above. It enables users to interact with the contract without having to provide `who` and `repayData` parameters\"},\"angle(uint8[],bytes[],address,address,address,bytes)\":{\"notice\":\"Allows composability between calls to the different entry points of this module. Any user calling this function can perform any of the allowed actions in the order of their choice\"},\"badDebt()\":{\"notice\":\"Bad debt made from liquidated vaults which ended up having no collateral and a positive amount of stablecoins\"},\"borrowFee()\":{\"notice\":\"Upfront fee taken when borrowing stablecoins: this fee is optional and should in practice not be used\"},\"checkLiquidation(uint256,address)\":{\"notice\":\"Checks whether a given vault is liquidable and if yes gives information regarding its liquidation\"},\"collateral()\":{\"notice\":\"Reference to the collateral handled by this `VaultManager`\"},\"collateralFactor()\":{\"notice\":\"Encodes the maximum ratio stablecoin/collateral a vault can have before being liquidated. It's what determines the minimum collateral ratio of a position\"},\"createVault(address)\":{\"notice\":\"Creates a vault\"},\"debtCeiling()\":{\"notice\":\"Maximum amount of stablecoins that can be issued with this contract (in `BASE_TOKENS`). This parameter should not be bigger than `type(uint256).max / BASE_INTEREST` otherwise there may be some overflows in the `increaseDebt` function\"},\"dust()\":{\"notice\":\"Minimum amount of debt a vault can have, expressed in `BASE_TOKENS` that is to say the base of the agTokens\"},\"getDebtOut(uint256,uint256,uint256,uint256)\":{\"notice\":\"Removes debt from a vault after being requested to do so by another `VaultManager` contract\"},\"getTotalDebt()\":{\"notice\":\"Gets the total debt across all vaults\"},\"getVaultDebt(uint256)\":{\"notice\":\"Gets the current debt of a vault\"},\"initialize(address,address,address,(uint256,uint64,uint64,uint64,uint64,uint64,bool,uint256),string)\":{\"notice\":\"Initializes the `VaultManager` contract\"},\"interestAccumulator()\":{\"notice\":\"The `interestAccumulator` variable keeps track of the interest that should accrue to the protocol. The stored value is not necessarily the true value: this one is recomputed every time an action takes place within the protocol. It is in base `BASE_INTEREST`\"},\"interestRate()\":{\"notice\":\"Per second interest taken to borrowers taking agToken loans. Contrarily to other parameters, it is set in `BASE_INTEREST` that is to say in base 10**27\"},\"isApprovedOrOwner(address,uint256)\":{\"notice\":\"Checks whether a given address is approved for a vault or owns this vault\"},\"isWhitelisted(address)\":{\"notice\":\"Maps an address to 1 if it's whitelisted and can open or own a vault\"},\"lastInterestAccumulatorUpdated()\":{\"notice\":\"Timestamp at which the `interestAccumulator` was updated\"},\"liquidate(uint256[],uint256[],address,address)\":{\"notice\":\"Liquidates an ensemble of vaults specified by their IDs\"},\"liquidate(uint256[],uint256[],address,address,address,bytes)\":{\"notice\":\"Liquidates an ensemble of vaults specified by their IDs\"},\"liquidationSurcharge()\":{\"notice\":\"Fee taken by the protocol during a liquidation. Technically, this value is not the fee per se, it's 1 - fee. For instance for a 2% fee, `liquidationSurcharge` should be 98%\"},\"maxLiquidationDiscount()\":{\"notice\":\"Maximum discount given to liquidators\"},\"nonces(address)\":{\"notice\":\"Returns the current nonce for an `owner` address\"},\"oracle()\":{\"notice\":\"Oracle contract to get access to the price of the collateral with respect to the stablecoin\"},\"paused()\":{\"notice\":\"Whether the contract is paused or not\"},\"permit(address,address,bool,uint256,uint8,bytes32,bytes32)\":{\"notice\":\"Allows an address to give or revoke approval for all its vaults to another address\"},\"repayFee()\":{\"notice\":\"Upfront fee taken when repaying stablecoins: this fee is optional as well. It should be smaller than the liquidation surcharge (cf below) to avoid exploits where people voluntarily get liquidated at a 0 discount to pay smaller repaying fees\"},\"setBaseURI(string)\":{\"notice\":\"Changes the ERC721 metadata URI\"},\"setDebtCeiling(uint256)\":{\"notice\":\"Sets `debtCeiling`\"},\"setDusts(uint256,uint256)\":{\"notice\":\"Sets the dust variables\"},\"setLiquidationBoostParameters(address,uint256[],uint256[])\":{\"notice\":\"Sets the parameters for the liquidation booster which encodes the slope of the discount\"},\"setOracle(address)\":{\"notice\":\"Changes the reference to the oracle contract used to get the price of the oracle\"},\"setTreasury(address)\":{\"notice\":\"Sets the treasury contract\"},\"setUint64(uint64,bytes32)\":{\"notice\":\"Sets parameters encoded as uint64\"},\"stablecoin()\":{\"notice\":\"Stablecoin handled by this contract. Another `VaultManager` contract could have the same rights as this `VaultManager` on the stablecoin contract\"},\"surplus()\":{\"notice\":\"Surplus accumulated by the contract: surplus is always in stablecoins, and is then reset when the value is communicated to the treasury contract\"},\"targetHealthFactor()\":{\"notice\":\"Maximum Health factor at which a vault can end up after a liquidation (unless it's fully liquidated)\"},\"togglePause()\":{\"notice\":\"Pauses external permissionless functions of the contract\"},\"toggleWhitelist(address)\":{\"notice\":\"Changes the whitelisting of an address\"},\"totalNormalizedDebt()\":{\"notice\":\"Total normalized amount of stablecoins borrowed, not taking into account the potential bad debt accumulated This value is expressed in the base of Angle stablecoins (`BASE_TOKENS = 10**18`)\"},\"treasury()\":{\"notice\":\"Reference to the `treasury` contract handling this `VaultManager`\"},\"vaultData(uint256)\":{\"notice\":\"Maps a `vaultID` to its data (namely collateral amount and normalized debt)\"},\"vaultIDCount()\":{\"notice\":\"ID of the last vault created. The `vaultIDCount` variables serves as a counter to generate a unique `vaultID` for each vault: it is like `tokenID` in basic ERC721 contracts\"},\"veBoostProxy()\":{\"notice\":\"Reference to the contract which computes adjusted veANGLE balances for liquidators boosts\"},\"whitelistingActivated()\":{\"notice\":\"Whether whitelisting is required to own a vault or not\"},\"xLiquidationBoost(uint256)\":{\"notice\":\"Threshold veANGLE balance values for the computation of the boost for liquidators: the length of this array should normally be 2. The base of the x-values in this array should be `BASE_TOKENS`\"},\"yLiquidationBoost(uint256)\":{\"notice\":\"Values of the liquidation boost at the threshold values of x\"}},\"notice\":\"Liquidation discount depending also on the liquidator veANGLE balance\",\"version\":1}},\"settings\":{\"compilationTarget\":{\"contracts/vaultManager/VaultManagerLiquidationBoost.sol\":\"VaultManagerLiquidationBoost\"},\"evmVersion\":\"london\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\"},\"optimizer\":{\"enabled\":true,\"runs\":1},\"remappings\":[]},\"sources\":{\"@openzeppelin/contracts-upgradeable/interfaces/IERC721MetadataUpgradeable.sol\":{\"keccak256\":\"0xc0e1ac396ac591a4c38ddcdd220321128eb94424d73e41a573cf58d5c643af38\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://2bd729caa85e0c3740b2d3a28a91fac0fd1ef66e0907145005a37f1927ae7a22\",\"dweb:/ipfs/QmcfVoLnE2PZj3U6KbACk6ykqE5WXuAM3hsXLJxC2sxZGt\"]},\"@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol\":{\"keccak256\":\"0x0203dcadc5737d9ef2c211d6fa15d18ebc3b30dfa51903b64870b01a062b0b4e\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://6eb2fd1e9894dbe778f4b8131adecebe570689e63cf892f4e21257bfe1252497\",\"dweb:/ipfs/QmXgUGNfZvrn6N2miv3nooSs7Jm34A41qz94fu2GtDFcx8\"]},\"@openzeppelin/contracts-upgradeable/security/ReentrancyGuardUpgradeable.sol\":{\"keccak256\":\"0x8cc03c5ac17e8a7396e487cda41fc1f1dfdb91db7d528e6da84bee3b6dd7e167\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://607818f1b44548c2d8268176f73cdb290e1faed971b1061930d92698366e2a11\",\"dweb:/ipfs/QmQibMe3r5no95b6q7isGT5R75V8xSofWEDLXzp95b7LgZ\"]},\"@openzeppelin/contracts-upgradeable/token/ERC20/IERC20Upgradeable.sol\":{\"keccak256\":\"0x4e733d3164f73f461eaf9d8087a7ad1ea180bdc8ba0d3d61b0e1ae16d8e63dff\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://75b47c3aeca7b66ea6752f8be020ec5c1c502de6ec9065272dae23d3a52196e2\",\"dweb:/ipfs/QmUebPMHv16tYKFh5BmBQkMfRFb5b8UZ2RgVwdjxCeufVF\"]},\"@openzeppelin/contracts-upgradeable/token/ERC20/extensions/draft-IERC20PermitUpgradeable.sol\":{\"keccak256\":\"0xcc70d8e2281fb3ff69e8ab242500f10142cd0a7fa8dd9e45882be270d4d09024\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://17a4063bc918df0f7bb9cbf04c6f0bb4977afab3f2fc212bc138a178312a221d\",\"dweb:/ipfs/QmZMdvsHP5mDEAAdrK4bNeNh47TfmSFgN9qEBFTbie7zmm\"]},\"@openzeppelin/contracts-upgradeable/token/ERC721/IERC721ReceiverUpgradeable.sol\":{\"keccak256\":\"0xbb2ed8106d94aeae6858e2551a1e7174df73994b77b13ebd120ccaaef80155f5\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://8bc3c6a456dba727d8dd9fd33420febede490abb49a07469f61d2a3ace66a95a\",\"dweb:/ipfs/QmVAWtEVj7K5AbvgJa9Dz22KiDq9eoptCjnVZqsTMtKXyd\"]},\"@openzeppelin/contracts-upgradeable/token/ERC721/IERC721Upgradeable.sol\":{\"keccak256\":\"0x016298e66a5810253c6c905e61966bb31c8775c3f3517bf946ff56ee31d6c005\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://1723de5ae414f210db039b19e6487c19c2d643483c9be7c445cf481a80c199d2\",\"dweb:/ipfs/QmcBLbmPdZsNngYhA1KDadNUqQZoGACytFWuUH74RC4AXC\"]},\"@openzeppelin/contracts-upgradeable/token/ERC721/extensions/IERC721MetadataUpgradeable.sol\":{\"keccak256\":\"0x95a471796eb5f030fdc438660bebec121ad5d063763e64d92376ffb4b5ce8b70\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://4ffbd627e6958983d288801acdedbf3491ee0ebf1a430338bce47c96481ce9e3\",\"dweb:/ipfs/QmUM1vpmNgBV34sYf946SthDJNGhwwqjoRggmj4TUUQmdB\"]},\"@openzeppelin/contracts-upgradeable/utils/AddressUpgradeable.sol\":{\"keccak256\":\"0x611aa3f23e59cfdd1863c536776407b3e33d695152a266fa7cfb34440a29a8a3\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://9b4b2110b7f2b3eb32951bc08046fa90feccffa594e1176cb91cdfb0e94726b4\",\"dweb:/ipfs/QmSxLwYjicf9zWFuieRc8WQwE4FisA1Um5jp1iSa731TGt\"]},\"@openzeppelin/contracts-upgradeable/utils/introspection/IERC165Upgradeable.sol\":{\"keccak256\":\"0xc6cef87559d0aeffdf0a99803de655938a7779ec0a3cd5d4383483ad85565a09\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://92ad7e572cf44e6b4b37631b44b62f9eb9fb1cf14d9ce51c1504d5dc7ccaf758\",\"dweb:/ipfs/QmcnbqX85tsWnUXPmtuPLE4SczME2sJaTfmqEFkuAJvWhy\"]},\"@openzeppelin/contracts/interfaces/IERC721Metadata.sol\":{\"keccak256\":\"0x1e88abdf82fcbbf98f97be17ea56c924376350637896bc37366ec9f89b7c2628\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://c8eb8afc411b87c9718cfe5c68669d5210d7012a96890c520c0fc321f74f0992\",\"dweb:/ipfs/Qmcr74gEtRpWER5qjFN86AKUep66pGuzp9WDYueaNtt97n\"]},\"@openzeppelin/contracts/token/ERC20/IERC20.sol\":{\"keccak256\":\"0x9750c6b834f7b43000631af5cc30001c5f547b3ceb3635488f140f60e897ea6b\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://5a7d5b1ef5d8d5889ad2ed89d8619c09383b80b72ab226e0fe7bde1636481e34\",\"dweb:/ipfs/QmebXWgtEfumQGBdVeM6c71McLixYXQP5Bk6kKXuoY4Bmr\"]},\"@openzeppelin/contracts/token/ERC20/extensions/IERC20Metadata.sol\":{\"keccak256\":\"0x8de418a5503946cabe331f35fe242d3201a73f67f77aaeb7110acb1f30423aca\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://5a376d3dda2cb70536c0a45c208b29b34ac560c4cb4f513a42079f96ba47d2dd\",\"dweb:/ipfs/QmZQg6gn1sUpM8wHzwNvSnihumUCAhxD119MpXeKp8B9s8\"]},\"@openzeppelin/contracts/token/ERC20/extensions/draft-IERC20Permit.sol\":{\"keccak256\":\"0xf41ca991f30855bf80ffd11e9347856a517b977f0a6c2d52e6421a99b7840329\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://b2717fd2bdac99daa960a6de500754ea1b932093c946388c381da48658234b95\",\"dweb:/ipfs/QmP6QVMn6UeA3ByahyJbYQr5M6coHKBKsf3ySZSfbyA8R7\"]},\"@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol\":{\"keccak256\":\"0x032807210d1d7d218963d7355d62e021a84bf1b3339f4f50be2f63b53cccaf29\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://11756f42121f6541a35a8339ea899ee7514cfaa2e6d740625fcc844419296aa6\",\"dweb:/ipfs/QmekMuk6BY4DAjzeXr4MSbKdgoqqsZnA8JPtuyWc6CwXHf\"]},\"@openzeppelin/contracts/token/ERC721/IERC721.sol\":{\"keccak256\":\"0xed6a749c5373af398105ce6ee3ac4763aa450ea7285d268c85d9eeca809cdb1f\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://20a97f891d06f0fe91560ea1a142aaa26fdd22bed1b51606b7d48f670deeb50f\",\"dweb:/ipfs/QmTbCtZKChpaX5H2iRiTDMcSz29GSLCpTCDgJpcMR4wg8x\"]},\"@openzeppelin/contracts/token/ERC721/extensions/IERC721Metadata.sol\":{\"keccak256\":\"0x75b829ff2f26c14355d1cba20e16fe7b29ca58eb5fef665ede48bc0f9c6c74b9\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://a0a107160525724f9e1bbbab031defc2f298296dd9e331f16a6f7130cec32146\",\"dweb:/ipfs/QmemujxSd7gX8A9M8UwmNbz4Ms3U9FG9QfudUgxwvTmPWf\"]},\"@openzeppelin/contracts/utils/Address.sol\":{\"keccak256\":\"0xd6153ce99bcdcce22b124f755e72553295be6abcd63804cfdffceb188b8bef10\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://35c47bece3c03caaa07fab37dd2bb3413bfbca20db7bd9895024390e0a469487\",\"dweb:/ipfs/QmPGWT2x3QHcKxqe6gRmAkdakhbaRgx3DLzcakHz5M4eXG\"]},\"@openzeppelin/contracts/utils/introspection/IERC165.sol\":{\"keccak256\":\"0x447a5f3ddc18419d41ff92b3773fb86471b1db25773e07f877f548918a185bf1\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://be161e54f24e5c6fae81a12db1a8ae87bc5ae1b0ddc805d82a1440a68455088f\",\"dweb:/ipfs/QmP7C3CHdY9urF4dEMb9wmsp1wMxHF6nhA2yQE5SKiPAdy\"]},\"contracts/interfaces/IAgToken.sol\":{\"keccak256\":\"0x6dd62e6c5de3b2e6e7d08694c7b97bd7bdaa7dd53be12a7c2d8c279398b78d39\",\"license\":\"GPL-3.0\",\"urls\":[\"bzz-raw://6ea7608c4787711ccd11c0fc67c1c4997936d818ee59695624cd53493c2b703e\",\"dweb:/ipfs/QmRrhdCX6PXXMsBbJHE9GQ9kY1JHwZztttDoUHUsFW7tgE\"]},\"contracts/interfaces/ICoreBorrow.sol\":{\"keccak256\":\"0x10249210cbf522775f040baf981d7d037472168ce2746d87473ac7c29a34e62e\",\"license\":\"GPL-3.0\",\"urls\":[\"bzz-raw://5662508bcc221233db54b5b311c4e371bd8616b3c5c3572ae207c04060758b67\",\"dweb:/ipfs/QmZCQVyMFbWkBZJnwwB3vxLZkvSXGxEg3Hu1UFJQfpV9fi\"]},\"contracts/interfaces/IFlashAngle.sol\":{\"keccak256\":\"0x39b0097f695b9e934bccdc72676c91513f1077cc5d0fd151908fd25a7c5cfbe4\",\"license\":\"GPL-3.0\",\"urls\":[\"bzz-raw://5b0f3c3581f390b0242d8252a4a215dd04b4c5b74e1efb7396bbba72c3922a02\",\"dweb:/ipfs/Qmc7BxyifSkpKtneN2gMsKkworGPDwVfBdT2t66iGMDerm\"]},\"contracts/interfaces/IOracle.sol\":{\"keccak256\":\"0x94f9c32fbf4f360175d595122686d494a107e9dcbcb8b0b8850edd976204c387\",\"license\":\"GPL-3.0\",\"urls\":[\"bzz-raw://0a77c7a25e729bbf2d0c61f66680b6c9cdb29481fd876268e92aca52ac698fe4\",\"dweb:/ipfs/QmUcraMPnHBgokvPaXuyuVjsKmDJVEwVMfeqXqrMAEwwYp\"]},\"contracts/interfaces/ISwapper.sol\":{\"keccak256\":\"0x2c18883cbff92d1e558e670480f5e2f517bce8c95c202cc3f6602ac276222609\",\"license\":\"GPL-3.0\",\"urls\":[\"bzz-raw://948ebdaf95b08d6617f490aa0651a90d8cc3ef3d4c0b9edc3a50e4fe6df73013\",\"dweb:/ipfs/QmejFnT3zzN2StAUnVDHS62iFxZ4e5ZQBTQ3kghDPXRR9g\"]},\"contracts/interfaces/ITreasury.sol\":{\"keccak256\":\"0x624733dae1bfb98721ba994573aed10997f7448c893b791ed985300531c361fd\",\"license\":\"GPL-3.0\",\"urls\":[\"bzz-raw://8ef7cfe9121192bc39d0906c1585c288f1302237fdf8c0a1575395233d25b90a\",\"dweb:/ipfs/QmWCUt4VTope9mFQd1opjom4CnGpdV4yiG3AQpNkeAgsRp\"]},\"contracts/interfaces/IVaultManager.sol\":{\"keccak256\":\"0x9d2dca11dba2fa9d646ccf88b3c0929d7601de925f1a6270f9ef2bef9390e6e4\",\"license\":\"GPL-3.0\",\"urls\":[\"bzz-raw://8b4991cb79afa8a717f66e4d9ef0c92a619574706affd2462c2b48937ca3585e\",\"dweb:/ipfs/QmWAxyT7jJkuQeFdvQmLVjZbBpEHhZbtfyhijXaqHEdumW\"]},\"contracts/interfaces/external/IERC1271.sol\":{\"keccak256\":\"0x6887d50d488064e481dfba3a9c54c049430b1ffc0a5536387fa89ff5133e6479\",\"license\":\"GPL-2.0-or-later\",\"urls\":[\"bzz-raw://0b080810d65481a97abbb7306b31ed944cd01dd19cb27a7a8e779f81bd9b6d11\",\"dweb:/ipfs/QmZUoJgs3JxAeki6CkbFD8uxBypipefhMS8uuVkQcxnsug\"]},\"contracts/interfaces/governance/IVeBoostProxy.sol\":{\"keccak256\":\"0xce73b8dcafcfaba4d01216f02f49930c078617e11223290004c6f662fc900d6b\",\"license\":\"GPL-3.0\",\"urls\":[\"bzz-raw://eb1eec1ea1c000dc07fa89e4f5f8e7009c1777a03960d7e02dcf3fa6f1630333\",\"dweb:/ipfs/QmbMqqz6nBHQmY57EqfhQA5Ep8WVnQSjaejW79XWtowHzv\"]},\"contracts/vaultManager/VaultManager.sol\":{\"keccak256\":\"0x18cbfb818323a0e40f52aaefc1b940d4e11068f7dd5ceee9a5dc93f2efd9070b\",\"license\":\"GPL-3.0\",\"urls\":[\"bzz-raw://d9b13e669a257ef484528dcc7b0a55fb8885ceb8d3b5d70daa351ab14e01c9c2\",\"dweb:/ipfs/QmNe92AaSvMpYFp9ZwBYBmQAU3wKXYEXD38Xxex1pyevKK\"]},\"contracts/vaultManager/VaultManagerERC721.sol\":{\"keccak256\":\"0x9bb1a6093dc753bd8341e8257a895e764d2e02fccdb8a8b2da44f5268857611a\",\"license\":\"GPL-3.0\",\"urls\":[\"bzz-raw://cd915bd744a2aec9a5da0deec58b4ecec6033cb21aee3e21608e09b57a8ec54c\",\"dweb:/ipfs/QmNtfQsXo5YAz5igsKqHno3bKuk8vVUejK7gEEL9hx8MtF\"]},\"contracts/vaultManager/VaultManagerLiquidationBoost.sol\":{\"keccak256\":\"0xbe2a172d8bd96149ac6bd0113644d59337a40c99b8e9eff0a6393efc3ae8de81\",\"license\":\"GPL-3.0\",\"urls\":[\"bzz-raw://e114f045f071084f504b96d28796d391867346a95cf9004b3f47e10ce906bee1\",\"dweb:/ipfs/QmXSW6XnDTpCredi8KEjwNgntPL6kRPb1mMX5YF9QgHiXQ\"]},\"contracts/vaultManager/VaultManagerPermit.sol\":{\"keccak256\":\"0x1303785eb96597effcbf7d7969be0c5c40c0c7d5a5c6b5b2f7eb20325f07e61f\",\"license\":\"GPL-3.0\",\"urls\":[\"bzz-raw://e9c853c15dc80a49de107cb02788b55006a0797f4ac6c003ea7db2dc62b80ea5\",\"dweb:/ipfs/QmT1XyC5L8u95fYti9DnGTXsyWCQLBcvqGoEKmDazf8pog\"]},\"contracts/vaultManager/VaultManagerStorage.sol\":{\"keccak256\":\"0x612208b1e1f538968d270671f67d1e0e54183872d8a18ddb0f4d0ab3985e8bf3\",\"license\":\"GPL-3.0\",\"urls\":[\"bzz-raw://e78aaffe7506abe8ea1f1568e0f19091703bdd1a264ae59496415a4f53e76dcb\",\"dweb:/ipfs/QmSgEJaWmsRMwxuwviZuKM4s4BLCBfYAtHN6ak2PuAJLPc\"]}},\"version\":1}", + "bytecode": "0x60806040523480156200001157600080fd5b50600054610100900460ff1615808015620000335750600054600160ff909116105b8062000063575062000050306200013d60201b620033591760201c565b15801562000063575060005460ff166001145b620000cb5760405162461bcd60e51b815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201526d191e481a5b9a5d1a585b1a5e995960921b606482015260840160405180910390fd5b6000805460ff191660011790558015620000ef576000805461ff0019166101001790555b801562000136576000805461ff0019169055604051600181527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989060200160405180910390a15b506200014c565b6001600160a01b03163b151590565b615f2c806200015c6000396000f3fe608060405234801561001057600080fd5b50600436106102f65760003560e01c8063010db195146102fb57806301ffc9a71461032457806306fdde0314610347578063081812fc1461035c578063087a60071461036f578063095ea7b3146103865780630e198f221461039b57806313888565146103a457806323b872dd146103ad578063254cf439146103c0578063307439af146103f257806334ce998a1461041257806335836f151461041a5780633644e5151461042d57806339393ac91461043557806339eb4dc6146104485780633ae2325f1461045c5780633af32abf1461046f5780633c2e941b1461048f57806342842e0e14610498578063430c2081146104ab5780634f7e43df146104be57806355f804b3146104d85780635b84d88a146104eb5780635c975abb146104fe57806361d027b3146105125780636352211e1461052557806370a0823114610538578063741075431461054b5780637aacfffa1461055e5780637adbf9731461059a5780637c0f59f4146105ad5780637c3a00fd146105c75780637dc0d1d0146105da5780637e53bd97146105ed5780637e56d47c146106005780637ecebe0014610613578063835986b41461063c57806389050f1d1461064f57806395d89b41146106615780639a3b6f2f146106695780639f48118f146106af578063a22cb465146106ba578063af2c8c2e146106cd578063b1511cc9146106d6578063b4bd6f46146106e9578063b88d4fde146106fc578063bbcac5571461070f578063c4ae316814610718578063c66d8b0114610720578063c87b56dd1461073a578063d8dfeb451461074d578063d9b1cb5b14610760578063de1f776514610773578063de8fc69814610785578063df011c4114610798578063e182b883146107ab578063e1c84ea4146107be578063e626648a146107c7578063e985e9c5146107e1578063e9cbd822146107f4578063f0f4426014610807578063f51cc7dd1461081a578063fad9aba31461082d578063fc29b02114610836578063fd527cf814610849575b600080fd5b60375461030e906001600160a01b031681565b60405161031b9190614ee0565b60405180910390f35b610337610332366004614f0a565b610851565b604051901515815260200161031b565b61034f6108be565b60405161031b9190614f7f565b61030e61036a366004614f92565b61094c565b610378603f5481565b60405190815260200161031b565b610399610394366004614fc0565b61097d565b005b610378603e5481565b61037860415481565b6103996103bb366004614fec565b610a0a565b603c546103da90600160401b90046001600160401b031681565b6040516001600160401b03909116815260200161031b565b61040561040036600461502d565b610a45565b60405161031b919061505d565b610378610af7565b610378610428366004614f92565b610b29565b610378610b65565b610399610443366004615096565b610b6f565b603d5461033790600160c01b900460ff1681565b61037861046a366004614f92565b610c6f565b61037861047d366004615096565b60446020526000908152604090205481565b61037860455481565b6103996104a6366004614fec565b610c90565b6103376104b9366004614fc0565b610cab565b603d546103da90600160801b90046001600160401b031681565b6103996104e6366004615168565b610cb7565b6103996104f936600461519c565b610d5c565b603d5461033790600160c81b900460ff1681565b60335461030e906001600160a01b031681565b61030e610533366004614f92565b610df5565b610378610546366004615096565b610e00565b6103996105593660046151d5565b610e45565b61058561056c366004614f92565b6043602052600090815260409020805460019091015482565b6040805192835260208301919091520161031b565b6103996105a8366004615096565b611211565b603c546103da90600160c01b90046001600160401b031681565b603d546103da906001600160401b031681565b60365461030e906001600160a01b031681565b6103996105fb36600461527f565b611358565b61040561060e3660046152f4565b611549565b610378610621366004615096565b6001600160a01b03166000908152607f602052604090205490565b61039961064a3660046153b8565b611af6565b610378676765c793fa10079d601a1b81565b61034f611cae565b61067c6106773660046154d2565b611cbb565b60405161031b91908151815260208083015190820152604080830151908201526060918201519181019190915260800190565b610378633b9aca0081565b6103996106c8366004615568565b611cf0565b61037860405481565b6103996106e4366004614f92565b611cfb565b6103786106f7366004615096565b611dc4565b61039961070a366004615596565b611e00565b61037860425481565b610399611e3d565b603d546103da90600160401b90046001600160401b031681565b61034f610748366004614f92565b611eec565b60345461030e906001600160a01b031681565b61039961076e366004615601565b612041565b610378676765c793fa10079d601b1b81565b61067c610793366004615695565b6125ec565b603c546103da906001600160401b031681565b6103786107b9366004614f92565b612e73565b61037860395481565b603c546103da90600160801b90046001600160401b031681565b6103376107ef3660046156f3565b612e83565b60355461030e906001600160a01b031681565b610399610815366004615096565b612eb1565b610399610828366004615730565b612f51565b61037860b45481565b6104056108443660046157aa565b613210565b61058561323a565b60006001600160e01b03198216635b5e139f60e01b148061088257506001600160e01b031982166380ac58cd60e01b145b8061089d57506001600160e01b0319821663430c208160e01b145b806108b857506001600160e01b031982166301ffc9a760e01b145b92915050565b607d80546108cb90615806565b80601f01602080910402602001604051908101604052809291908181526020018280546108f790615806565b80156109445780601f1061091957610100808354040283529160200191610944565b820191906000526020600020905b81548152906001019060200180831161092757829003601f168201915b505050505081565b600061095782613368565b6109745760405163062a39dd60e11b815260040160405180910390fd5b6108b882613385565b6000610988826133a0565b9050806001600160a01b0316836001600160a01b031614156109bd576040516349fa8bc360e11b815260040160405180910390fd5b336001600160a01b038216148015906109dd57506109db8133612e83565b155b156109fb5760405163c19f17a960e01b815260040160405180910390fd5b610a0583836133d6565b505050565b3381610a168282613444565b610a335760405163c19f17a960e01b815260040160405180910390fd5b610a3e8585856134c2565b5050505050565b610a4d614db6565b60008381526043602090815260409182902082518084018452815481526001909101548183015260365483516315f789a960e21b81529351610af094929387936001600160a01b03909316926357de26a492600480830193928290030181865afa158015610abf573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610ae3919061583b565b610aeb6135e9565b61377e565b9392505050565b6000676765c793fa10079d601b1b610b0d6135e9565b604054610b1a919061586a565b610b24919061589f565b905090565b6000676765c793fa10079d601b1b610b3f6135e9565b600084815260436020526040902060010154610b5b919061586a565b6108b8919061589f565b6000610b24613ad0565b603354604051631c86b03760e31b81526001600160a01b039091169063e43581b890610b9f903390600401614ee0565b602060405180830381865afa158015610bbc573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610be091906158b3565b610bfd57604051633b8d9d7560e21b815260040160405180910390fd5b6001600160a01b03811615610c4c576001600160a01b038116600090815260446020526040902054610c309060016158d0565b6001600160a01b03821660009081526044602052604090205550565b603d805460ff60c01b198116600160c01b9182900460ff16159091021790555b50565b603b8181548110610c7f57600080fd5b600091825260209091200154905081565b610a0583838360405180602001604052806000815250611e00565b6000610af08383613444565b60335460405163521d4de960e01b81526001600160a01b039091169063521d4de990610ce7903390600401614ee0565b602060405180830381865afa158015610d04573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610d2891906158b3565b610d4557604051632678482f60e21b815260040160405180910390fd5b8051610d58906046906020840190614de5565b5050565b603354604051631c86b03760e31b81526001600160a01b039091169063e43581b890610d8c903390600401614ee0565b602060405180830381865afa158015610da9573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610dcd91906158b3565b610dea57604051633b8d9d7560e21b815260040160405180910390fd5b60b49190915560b555565b60006108b8826133a0565b60006001600160a01b038216610e295760405163d92e233d60e01b815260040160405180910390fd5b506001600160a01b031660009081526048602052604090205490565b60335460405163521d4de960e01b81526001600160a01b039091169063521d4de990610e75903390600401614ee0565b602060405180830381865afa158015610e92573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610eb691906158b3565b610ed357604051632678482f60e21b815260040160405180910390fd5b806121a360f11b1415610f3757603d546001600160401b03600160401b90910481169083161115610f1757604051637650e96360e11b815260040160405180910390fd5b603c80546001600160401b0319166001600160401b0384161790556111ca565b80622a242360e91b1415610f9c57633b9aca00826001600160401b03161015610f735760405163da6a17b960e01b815260040160405180910390fd5b603c8054600160401b600160801b031916600160401b6001600160401b038516021790556111ca565b8061212360f11b141561100057633b9aca00826001600160401b03161115610fd757604051637650e96360e11b815260040160405180910390fd5b603c8054600160801b600160c01b031916600160801b6001600160401b038516021790556111ca565b8061292360f11b141561107d57603d54633b9aca009061103090600160401b90046001600160401b0316846158e7565b6001600160401b0316111561105857604051637650e96360e11b815260040160405180910390fd5b603c80546001600160c01b0316600160c01b6001600160401b038516021790556111ca565b806124a960f11b14156110b357611092613b3c565b50603d80546001600160401b0319166001600160401b0384161790556111ca565b80614c5360f01b141561114c57603c546001600160401b03808416911611806111055750603c54633b9aca00906110fa90600160c01b90046001600160401b0316846158e7565b6001600160401b0316115b156111235760405163180d062b60e31b815260040160405180910390fd5b603d8054600160401b600160801b031916600160401b6001600160401b038516021790556111ca565b806213531160ea1b14156111b157633b9aca00826001600160401b0316111561118857604051637650e96360e11b815260040160405180910390fd5b603d8054600160801b600160c01b031916600160801b6001600160401b038516021790556111ca565b60405163e1daa9cf60e01b815260040160405180910390fd5b604080516001600160401b0384168152602081018390527f13b367dac93b85d1ed9b3d8961d8b48e1a677c9800bb1613b4b0416b2d5b61d091015b60405180910390a15050565b603354604051631c86b03760e31b81526001600160a01b039091169063e43581b890611241903390600401614ee0565b602060405180830381865afa15801561125e573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061128291906158b3565b61129f57604051633b8d9d7560e21b815260040160405180910390fd5b603354604080516361d027b360e01b815290516001600160a01b03928316928416916361d027b39160048083019260209291908290030181865afa1580156112eb573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061130f9190615912565b6001600160a01b031614611336576040516302979eb960e31b815260040160405180910390fd5b603680546001600160a01b0319166001600160a01b0392909216919091179055565b60335460405163521d4de960e01b81526001600160a01b039091169063521d4de990611388903390600401614ee0565b602060405180830381865afa1580156113a5573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906113c991906158b3565b6113e657604051632678482f60e21b815260040160405180910390fd5b805182511415806114115750806000815181106114055761140561592f565b60200260200101516000145b806114a057506001600160a01b038316158015906114a057508160008151811061143d5761143d61592f565b6020026020010151826001815181106114585761145861592f565b60200260200101511115806114a057508060008151811061147b5761147b61592f565b6020026020010151816001815181106114965761149661592f565b6020026020010151105b156114be57604051631746545d60e11b815260040160405180910390fd5b603780546001600160a01b0319166001600160a01b03851617905581516114ec90603a906020850190614e69565b50805161150090603b906020840190614e69565b50826001600160a01b03167feb74d4d9fea592587c926aeb35eb6a7893fb28db0c1c8eb2eb3c586e7164b76c838360405161153c929190615980565b60405180910390a2505050565b611551614db6565b603d54600160c81b900460ff161561157c576040516313d0ff5960e31b815260040160405180910390fd5b600260015414156115a85760405162461bcd60e51b815260040161159f906159a5565b60405180910390fd5b600260015586518651811415806115bd575080155b156115db576040516346282e8d60e01b815260040160405180910390fd5b603660009054906101000a90046001600160a01b03166001600160a01b03166357de26a46040518163ffffffff1660e01b8152600401602060405180830381865afa15801561162e573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611652919061583b565b606083015261165f613b3c565b60808301526040517f965a177723c641ee49150b583a0b9ad4730bb20d3474e00ae5a65e777c00d67b90611694908a906159dc565b60405180910390a160005b81811015611a66576000604360008b84815181106116bf576116bf61592f565b60200260200101518152602001908152602001600020604051806040016040529081600082015481526020016001820154815250509050600061170c82338760600151886080015161377e565b90508060400151600014158015611740575080604001518a84815181106117355761173561592f565b602002602001015110155b80611767575080600001518a848151811061175d5761175d61592f565b6020026020010151115b156117905780600001518a84815181106117835761178361592f565b6020026020010181815250505b6000856060015182606001516117a6919061586a565b603854633b9aca008d87815181106117c0576117c061592f565b60200260200101516117d2919061586a565b6117dc919061586a565b6117e6919061589f565b90506118148c85815181106117fd576117fd61592f565b60200260200101518285600001511115610c6c5750565b8251811061194a575081516020830151604080546000906118369084906158d0565b92505081905550604360008d86815181106118535761185361592f565b60209081029190910181015182528101919091526040016000908120818155600101819055603d548c51633b9aca0091600160401b90046001600160401b0316908e90889081106118a6576118a661592f565b60200260200101516118b8919061586a565b6118c2919061589f565b9050826080015181106118d65760006118e6565b8083608001516118e691906158d0565b876040018181516118f791906159ef565b905250508b51600080516020615e97833981519152908d908690811061191f5761191f61592f565b60200260200101518460200151600060405161193d93929190615a07565b60405180910390a1611a0b565b80604360008e87815181106119615761196161592f565b60200260200101518152602001908152602001600020600001600082825461198991906158d0565b92505081905550611a098c85815181106119a5576119a561592f565b6020026020010151633b9aca00603d60089054906101000a90046001600160401b03166001600160401b03168e88815181106119e3576119e361592f565b60200260200101516119f5919061586a565b6119ff919061589f565b8860800151613bdd565b505b8086602001818151611a1d91906159ef565b9052508a518b9085908110611a3457611a3461592f565b602002602001015186600001818151611a4d91906159ef565b905250611a5f9250839150615a209050565b905061169f565b50603d54633b9aca0090611a8a90600160401b90046001600160401b0316826158d0565b8351611a96919061586a565b611aa0919061589f565b60416000828254611ab191906159ef565b9091555050604082015160428054600090611acd9084906159ef565b909155505060208201518251611ae7919088888888613d0c565b50600180559695505050505050565b603d54600160c81b900460ff1615611b21576040516313d0ff5960e31b815260040160405180910390fd5b6033546040516333b52a9f60e11b81526001600160a01b039091169063676a553e90611b51903390600401614ee0565b602060405180830381865afa158015611b6e573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611b9291906158b3565b611baf5760405163027f480760e01b815260040160405180910390fd5b603c54600090600160c01b90046001600160401b0316821015611bed57603c54611bea908390600160c01b90046001600160401b03166158d0565b90505b603c54600090600160801b90046001600160401b0316841115611c2a57603c54611c2790600160801b90046001600160401b0316856158d0565b90505b6000611c3b6002633b9aca00615b1f565b611c4983633b9aca006158d0565b611c5785633b9aca006158d0565b611c61908961586a565b611c6b919061586a565b611c75919061589f565b9050611c8181876158d0565b60416000828254611c9291906159ef565b90915550611ca4905087826000613bdd565b5050505050505050565b607e80546108cb90615806565b611cc3614ea3565b60408051600080825260208201909252611ce5918791879187918791906125ec565b90505b949350505050565b610d58338383613e16565b60335460405163521d4de960e01b81526001600160a01b039091169063521d4de990611d2b903390600401614ee0565b602060405180830381865afa158015611d48573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611d6c91906158b3565b611d8957604051632678482f60e21b815260040160405180910390fd5b60398190556040518181527fdd63b3dcdbebad734892f7c7a26d0f647fbc7eec973e0775f5229018ac4ab47a9060200160405180910390a150565b603d54600090600160c81b900460ff1615611df2576040516313d0ff5960e31b815260040160405180910390fd5b6108b882613ecc565b919050565b3382611e0c8282613444565b611e295760405163c19f17a960e01b815260040160405180910390fd5b611e3586868686613ffa565b505050505050565b60335460405163521d4de960e01b81526001600160a01b039091169063521d4de990611e6d903390600401614ee0565b602060405180830381865afa158015611e8a573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611eae91906158b3565b611ecb57604051632678482f60e21b815260040160405180910390fd5b603d805460ff60c81b198116600160c81b9182900460ff1615909102179055565b6060611ef782613368565b611f145760405163062a39dd60e11b815260040160405180910390fd5b8160005b8115611f3b57611f2781615a20565b9050611f34600a8361589f565b9150611f18565b6000816001600160401b03811115611f5557611f556150b3565b6040519080825280601f01601f191660200182016040528015611f7f576020820181803683370190505b5090505b8415611fea57611f946001836158d0565b9150611fa1600a86615b2e565b611fac9060306159ef565b60f81b818381518110611fc157611fc161592f565b60200101906001600160f81b031916908160001a905350611fe3600a8661589f565b9450611f83565b60468054611ff790615806565b151590506120145760405180602001604052806000815250612038565b604681604051602001612028929190615b5e565b6040516020818303038152906040525b95945050505050565b600054610100900460ff16158080156120615750600054600160ff909116105b80612082575061207030613359565b158015612082575060005460ff166001145b6120e55760405162461bcd60e51b815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201526d191e481a5b9a5d1a585b1a5e995960921b606482015260840161159f565b6000805460ff191660011790558015612108576000805461ff0019166101001790555b856001600160a01b0316846001600160a01b03166361d027b36040518163ffffffff1660e01b8152600401602060405180830381865afa158015612150573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906121749190615912565b6001600160a01b03161461219b576040516302979eb960e31b815260040160405180910390fd5b603380546001600160a01b038089166001600160a01b0319928316179092556034805492881692909116821790556040805163313ce56760e01b8152905163313ce567916004808201926020929091908290030181865afa158015612204573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906122289190615bfc565b61223390600a615b1f565b603881905550856001600160a01b031663e9cbd8226040518163ffffffff1660e01b8152600401602060405180830381865afa158015612277573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061229b9190615912565b603580546001600160a01b03199081166001600160a01b0393841617909155603680549091169186169190911790556040516000906122de908490602001615c19565b60408051601f19818403018152919052805190915061230490607d906020840190614de5565b5061230e81614034565b8260405160200161231f9190615c60565b604051602081830303815290604052607e9080519060200190612343929190614de5565b50676765c793fa10079d601b1b603f5542603e5561236760a0850160808601615c8a565b6001600160401b03166123806040860160208701615c8a565b6001600160401b031611806123b05750633b9aca006123a560a0860160808701615c8a565b6001600160401b0316115b806123d657506123c66060850160408601615c8a565b6001600160401b0316633b9aca00115b806123fd5750633b9aca006123f160c0860160a08701615c8a565b6001600160401b031610155b8061240a575060e0840135155b1561242857604051631746545d60e11b815260040160405180910390fd5b833560395561243d6040850160208601615c8a565b603c80546001600160401b0319166001600160401b039290921691909117905561246d6060850160408601615c8a565b603c80546001600160401b0392909216600160401b02600160401b600160801b03199092169190911790556124a86080850160608601615c8a565b603d80546001600160401b0319166001600160401b03929092169190911790556124d860a0850160808601615c8a565b603d80546001600160401b0392909216600160401b02600160401b600160801b031990921691909117905561251360c0850160a08601615c8a565b603d80546001600160401b0392909216600160801b02600160801b600160c01b031990921691909117905561254e60e0850160c08601615ca5565b603d8054911515600160c01b0260ff60c01b19909216919091179055604080516020810190915260e0850135815261258a90603b906001614e69565b5050603d805460ff60c81b1916600160c81b1790558015611e35576000805461ff0019169055604051600181527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989060200160405180910390a1505050505050565b6125f4614ea3565b603d54600160c81b900460ff161561261f576040516313d0ff5960e31b815260040160405180910390fd5b600260015414156126425760405162461bcd60e51b815260040161159f906159a5565b60026001558551875114158061265757508651155b15612675576040516346282e8d60e01b815260040160405180910390fd5b6000806000806000805b8c51811015612bdc5760008d828151811061269c5761269c61592f565b60200260200101519050600060078111156126b9576126b9615cc2565b8160078111156126cb576126cb615cc2565b141561270c576127068d83815181106126e6576126e661592f565b60200260200101518060200190518101906127019190615912565b613ecc565b50612bcb565b600281600781111561272057612720615cc2565b1415612786578c82815181106127385761273861592f565b60200260200101518060200190518101906127539190615cd8565b95509250826127625760455492505b61276c838661410a565b848860600181815161277e91906159ef565b905250612bcb565b600781600781111561279a5761279a615cc2565b14156128735760008060008f85815181106127b7576127b761592f565b60200260200101518060200190518101906127d29190615cfc565b60345460405163d505accf60e01b81526001600160a01b038089166004830152306024830152604482018890526064820187905260ff8616608483015260a4820185905260c48201849052969f50939d50939b509497509550929350169063d505accf9060e401600060405180830381600087803b15801561285357600080fd5b505af1158015612867573d6000803e3d6000fd5b50505050505050612bcb565b8661288357612880613b3c565b96505b600481600781111561289757612897615cc2565b1415612963578c82815181106128af576128af61592f565b60200260200101518060200190518101906128ca9190615cd8565b94509250826128d95760455492505b6128e4838589613bdd565b603c5490945060009061290b90600160c01b90046001600160401b0316633b9aca006158d0565b612919633b9aca008761586a565b612923919061589f565b905061292f85826158d0565b6041600082825461294091906159ef565b92505081905550808960200181815161295991906159ef565b905250612bcb9050565b856129e257603660009054906101000a90046001600160a01b03166001600160a01b03166357de26a46040518163ffffffff1660e01b8152600401602060405180830381865afa1580156129bb573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906129df919061583b565b95505b60018160078111156129f6576129f6615cc2565b1415612a72578c8281518110612a0e57612a0e61592f565b6020026020010151806020019051810190612a29919061583b565b925082612a365760455492505b612a41838789614176565b80965081955050508488604001818151612a5b91906159ef565b90525060208801805185919061277e9083906159ef565b6003816007811115612a8657612a86615cc2565b1415612ae6578c8281518110612a9e57612a9e61592f565b6020026020010151806020019051810190612ab99190615cd8565b9550925082612ac85760455492505b612ad48386888a614296565b848860400181815161277e91906159ef565b6005816007811115612afa57612afa615cc2565b1415612b5c578c8281518110612b1257612b1261592f565b6020026020010151806020019051810190612b2d9190615cd8565b9450925082612b3c5760455492505b612b488385888a614370565b9350838860000181815161277e91906159ef565b6006816007811115612b7057612b70615cc2565b1415612bcb576000808e8481518110612b8b57612b8b61592f565b6020026020010151806020019051810190612ba69190615d4f565b98509196509250905084612bba5760455494505b612bc8858383898c8e61440b565b50505b50612bd581615a20565b905061267f565b508551602087015110612cd35785516020870151600091612bfc916158d0565b90508660600151876040015110612c3357612c2e87606001518860400151612c2491906158d0565b828d8d8d8d613d0c565b612ccd565b8015612ca057603554604051630d43af8160e21b81526001600160a01b039091169063350ebe0490612c6d9084908f903390600401615d8d565b600060405180830381600087803b158015612c8757600080fd5b505af1158015612c9b573d6000803e3d6000fd5b505050505b612ccd333089604001518a60600151612cb991906158d0565b6034546001600160a01b0316929190614547565b50612e5f565b60208601518651600091612ce6916158d0565b6035546040516340c10f1960e01b81529192506001600160a01b0316906340c10f1990612d19908d908590600401615dac565b600060405180830381600087803b158015612d3357600080fd5b505af1158015612d47573d6000803e3d6000fd5b50505050866060015187604001511115612d8b57612d868a88606001518960400151612d7391906158d0565b6034546001600160a01b031691906145b2565b612e5d565b600087604001518860600151612da191906158d0565b90508015612e5b57885115612e4357896001600160a01b031663a5d4096b603560009054906101000a90046001600160a01b0316603460009054906101000a90046001600160a01b03163385878f6040518763ffffffff1660e01b8152600401612e1096959493929190615dc5565b600060405180830381600087803b158015612e2a57600080fd5b505af1158015612e3e573d6000803e3d6000fd5b505050505b603454612e5b906001600160a01b0316333084614547565b505b505b505060018055509198975050505050505050565b603a8181548110610c7f57600080fd5b6001600160a01b039182166000908152604a6020908152604080832093909416825291909152205460011490565b6033546001600160a01b03163314612edc5760405163b90cdbb160e01b815260040160405180910390fd5b603380546001600160a01b0319166001600160a01b0383811691909117909155603654604051630787a21360e51b815291169063f0f4426090612f23908490600401614ee0565b600060405180830381600087803b158015612f3d57600080fd5b505af1158015610a3e573d6000803e3d6000fd5b83421115612f725760405163f87d927160e01b815260040160405180910390fd5b6fa2a8918ca85bafe22016d0b997e4df60600160ff1b03811180612fa957508260ff16601b14158015612fa957508260ff16601c14155b15612fc757604051638baa579f60e01b815260040160405180910390fd5b6000612fd1613ad0565b608254898989612fe08d6145d1565b6040805160208101969096526001600160a01b03948516908601529290911660608401521515608083015260a082015260c0810187905260e0016040516020818303038152906040528051906020012060405160200161305792919061190160f01b81526002810192909252602282015260420190565b604051602081830303815290604052805190602001209050613081886001600160a01b0316613359565b1561315d57604080516020810185905280820184905260f886901b6001600160f81b0319166060820152815160418183030181526061820192839052630b135d3f60e11b9092526001600160a01b038a1691631626ba7e916130e7918591606501615e07565b602060405180830381865afa158015613104573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906131289190615e20565b6001600160e01b031916631626ba7e60e01b1461315857604051638baa579f60e01b815260040160405180910390fd5b613205565b6040805160008082526020820180845284905260ff871692820192909252606081018590526080810184905260019060a0016020604051602081039080840390855afa1580156131b1573d6000803e3d6000fd5b505050602060405103519050886001600160a01b0316816001600160a01b03161415806131e557506001600160a01b038116155b1561320357604051638baa579f60e01b815260040160405180910390fd5b505b611ca4888888613e16565b613218614db6565b60408051600080825260208201909252611ce591879187918791879190611549565b60335460009081906001600160a01b0316331461326a5760405163b90cdbb160e01b815260040160405180910390fd5b613272613b3c565b50506041805460428054600093849055929055915080821061330b5761329881836158d0565b6035546033546040516340c10f1960e01b8152929450600093506001600160a01b03918216926340c10f19926132d49216908690600401615dac565b600060405180830381600087803b1580156132ee57600080fd5b505af1158015613302573d6000803e3d6000fd5b5050505061331c565b61331582826158d0565b9050600091505b60408051838152602081018390527ffeb12225c131aab793a00c5239afb778932d170fa28ce6e9d23703e4bd892121910160405180910390a19091565b6001600160a01b03163b151590565b6000908152604760205260409020546001600160a01b0316151590565b6000908152604960205260409020546001600160a01b031690565b6000818152604760205260409020546001600160a01b031680611dfb5760405163062a39dd60e11b815260040160405180910390fd5b600081815260496020526040902080546001600160a01b0319166001600160a01b038416908117909155819061340b826133a0565b6001600160a01b03167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92560405160405180910390a45050565b600080613450836133a0565b9050806001600160a01b0316846001600160a01b0316148061348b5750836001600160a01b031661348084613385565b6001600160a01b0316145b80611ce857506001600160a01b038082166000908152604a6020908152604080832093881683529290522054600114949350505050565b826001600160a01b03166134d5826133a0565b6001600160a01b0316146134fc5760405163c19f17a960e01b815260040160405180910390fd5b6001600160a01b0382166135235760405163d92e233d60e01b815260040160405180910390fd5b603d54600160c01b900460ff16801561355557506001600160a01b038216600090815260446020526040902054600114155b1561357357604051630b094f2760e31b815260040160405180910390fd5b61357e6000826133d6565b6001600160a01b038084166000818152604860209081526040808320805460001901905593861680835284832080546001019055858352604790915283822080546001600160a01b03191682179055925184939291600080516020615ed783398151915291a4505050565b600080603e54426135fa91906158d0565b603d549091506001600160401b0316811580613614575080155b1561362357603f549250505090565b60006136306001846158d0565b905060006002841161364357600061364e565b61364e6002856158d0565b90506000676765c793fa10079d601b1b676765c793fa10079d601a1b613674868061586a565b61367e91906159ef565b613688919061589f565b90506000676765c793fa10079d601b1b676765c793fa10079d601a1b6136ae878561586a565b6136b891906159ef565b6136c2919061589f565b905060006002836136d3878a61586a565b6136dd919061586a565b6136e7919061589f565b90506000600683866136f9898c61586a565b613703919061586a565b61370d919061586a565b613717919061589f565b9050676765c793fa10079d601b1b81836137318b8b61586a565b61374690676765c793fa10079d601b1b6159ef565b61375091906159ef565b61375a91906159ef565b603f54613767919061586a565b613771919061589f565b9850505050505050505090565b613786614db6565b6000806000613796888787614615565b925092509250633b9aca0083106137c0576040516315fe9b6160e21b815260040160405180910390fd5b6000633b9aca006137d185826158d0565b6137da8a61469e565b6137e4919061586a565b6137ee919061589f565b603d54909150600160801b90046001600160401b031681101561381e5761381981633b9aca006158d0565b61383f565b603d5461383f90600160801b90046001600160401b0316633b9aca006158d0565b603d54909150600160401b90046001600160401b03166000806138676002633b9aca00615b1f565b603c5461387d91906001600160401b031661586a565b83613888868a61586a565b613892919061586a565b10613a1b57603c546001600160401b03166138b26002633b9aca00615b1f565b6138bc919061586a565b603c5485906138db90600160401b90046001600160401b03168661586a565b6138e5919061586a565b6138ef91906158d0565b603c548590633b9aca009061390d906001600160401b03168961586a565b603c5461392b908b90600160401b90046001600160401b031661586a565b61393591906158d0565b61393f919061586a565b613949919061586a565b613953919061589f565b9150633b9aca0060b454613967919061586a565b613971848461586a565b61397b91906159ef565b613989633b9aca008861586a565b11613a16576139a3676765c793fa10079d601b1b8461586a565b633b9aca008a8e602001516139b8919061586a565b6139c2919061586a565b6139cc919061589f565b6139d79060016159ef565b915060b454861115613a125782633b9aca0060b454886139f791906158d0565b613a01919061586a565b613a0b919061589f565b9050613a7e565b5060015b613a7e565b603854613a2c90633b9aca0061586a565b8c518b90613a3b90879061586a565b613a45919061586a565b613a4f919061589f565b613a5a9060016159ef565b915060b554851115613a7a57633b9aca008460b554876139f791906158d0565b5060015b818852613a8b848b61586a565b603854613a9c633b9aca008561586a565b613aa6919061586a565b613ab0919061589f565b602089015260408801525050606085015250608083015250949350505050565b60808054608154604080517f8b73c3c69bb8fe3d512ecc4cf759cc79239f7b179b0ffacaa9a75d522b39400f602082015290810192909252606082015246918101919091523060a082015260009060c00160405160208183030381529060405280519060200120905090565b6000613b466135e9565b90506000676765c793fa10079d601b1b603f5483613b6491906158d0565b604054613b71919061586a565b613b7b919061589f565b90508060416000828254613b8f91906159ef565b9091555050603f82905542603e8190556040805184815260208101929092527fd1fa8ba00a3bf20274346919dce0de62d2a140af2c71fe7e29fa6472eea3bb9d910160405180910390a15090565b600081613bef57613bec613b3c565b91505b60008481526043602052604081206001015490676765c793fa10079d601b1b613c18858461586a565b613c22919061589f565b9050808510613c3357935080613c56565b83613c49676765c793fa10079d601b1b8761586a565b613c53919061589f565b90505b613c6081836158d0565b91508060406000828254613c7491906158d0565b90915550508115801590613ca95750676765c793fa10079d601b1b60b454613c9c919061586a565b613ca6858461586a565b11155b15613cc75760405163228af07f60e21b815260040160405180910390fd5b60008681526043602052604080822060010184905551600080516020615e9783398151915291613cfa9189918591615a07565b60405180910390a15092949350505050565b8515613d2957603454613d29906001600160a01b031684886145b2565b8415611e3557805115613da85760345460355460405163a5d4096b60e01b81526001600160a01b038086169363a5d4096b93613d759391831692169089908b908d908990600401615dc5565b600060405180830381600087803b158015613d8f57600080fd5b505af1158015613da3573d6000803e3d6000fd5b505050505b603554604051630d43af8160e21b81526001600160a01b039091169063350ebe0490613ddc90889088903390600401615d8d565b600060405180830381600087803b158015613df657600080fd5b505af1158015613e0a573d6000803e3d6000fd5b50505050505050505050565b826001600160a01b0316826001600160a01b03161415613e49576040516320c5195360e21b815260040160405180910390fd5b600081613e57576000613e5a565b60015b6001600160a01b038581166000818152604a602090815260408083209489168084529482529182902060ff959095169485905590518615158152939450919290917f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c31910160405180910390a350505050565b603d54600090600160c01b900460ff168015613f1b57506001600160a01b0382166000908152604460205260409020546001141580613f1b575033600090815260446020526040902054600114155b15613f3957604051630b094f2760e31b815260040160405180910390fd5b6001600160a01b038216613f605760405163d92e233d60e01b815260040160405180910390fd5b5060458054600101908190556001600160a01b038216600081815260486020908152604080832080546001019055848352604790915280822080546001600160a01b031916841790555183929190600080516020615ed7833981519152908290a4613fdd60008383604051806020016040528060008152506148cd565b611dfb576040516320149b4360e21b815260040160405180910390fd5b6140058484846134c2565b614011848484846148cd565b61402e576040516320149b4360e21b815260040160405180910390fd5b50505050565b600054610100900460ff1661409f5760405162461bcd60e51b815260206004820152602b60248201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960448201526a6e697469616c697a696e6760a81b606482015260840161159f565b7f3f43a9c6bafb5c7aab4e0cfe239dc5d4c15caf0381c6104188191f78a6640bd860825580516020918201206080556040805180820190915260018152603160f81b9101527fc89efdaa54c0f20c7adf612882df0950f5a951637e0307cdcb4c672f298b8bc6608155565b61411382613368565b6141305760405163062a39dd60e11b815260040160405180910390fd5b6000828152604360205260408120805483929061414e9084906159ef565b9091555050604051600080516020615eb7833981519152906112059084908490600190615a07565b60008033856141858282613444565b6141a25760405163c19f17a960e01b815260040160405180910390fd5b6000878152604360209081526040808320815180830190925280548252600101549181019190915290806141d7838a8a614615565b5091509150633b9aca00821161420057604051631527804d60e31b815260040160405180910390fd5b82602001516040600082825461421691906158d0565b9091555061422590508a6149d0565b603c5460009061424990600160c01b90046001600160401b0316633b9aca006158d0565b614257633b9aca008461586a565b614261919061589f565b905061426d82826158d0565b6041600082825461427e91906159ef565b90915550509251929a92995091975050505050505050565b33846142a28282613444565b6142bf5760405163c19f17a960e01b815260040160405180910390fd5b600086815260436020526040812080548792906142dd9084906158d0565b909155505060008681526043602090815260408083208151808301909252805482526001015491810191909152614315908686614615565b50509050633b9aca00811161433d57604051631527804d60e31b815260040160405180910390fd5b600080516020615eb78339815191528787600060405161435f93929190615a07565b60405180910390a150505050505050565b6000338561437e8282613444565b61439b5760405163c19f17a960e01b815260040160405180910390fd5b6143a787878787614a4f565b603c54909650600090633b9aca00906143d1908990600160801b90046001600160401b031661586a565b6143db919061589f565b905080604160008282546143ef91906159ef565b909155506143ff905081886158d0565b98975050505050505050565b33866144178282613444565b6144345760405163c19f17a960e01b815260040160405180910390fd5b60408051898152602081018890526001600160a01b038916818301526060810187905290517fddd3b70af631334f7552aadb582ed091018e62e103fa8b150ca66cc700d4dac69181900360800190a161448f88868686614a4f565b94506001600160a01b0387163014156144b3576144ad868685613bdd565b50611ca4565b603c546040516320d661ad60e21b815260048101889052602481018790526001600160401b03600160801b830481166044830152600160c01b90920490911660648201526001600160a01b0388169063835986b490608401600060405180830381600087803b15801561452557600080fd5b505af1158015614539573d6000803e3d6000fd5b505050505050505050505050565b6040516001600160a01b038085166024830152831660448201526064810182905261402e9085906323b872dd60e01b906084015b60408051601f198184030181529190526020810180516001600160e01b03166001600160e01b031990931692909217909152614be2565b610a058363a9059cbb60e01b848460405160240161457b929190615dac565b6001600160a01b0381166000908152607f60205260409020546145f58160016159ef565b6001600160a01b039092166000908152607f602052604090209190915590565b6000806000676765c793fa10079d601b1b848760200151614636919061586a565b614640919061589f565b9150603854858760000151614655919061586a565b61465f919061589f565b905081614670576000199250614695565b603c548290614688906001600160401b03168361586a565b614692919061589f565b92505b93509350939050565b6037546000906001600160a01b03166146d757603b6000815481106146c5576146c561592f565b90600052602060002001549050919050565b603754604051635dfba04560e11b81526000916001600160a01b03169063bbf7408a90614708908690600401614ee0565b602060405180830381865afa158015614725573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190614749919061583b565b9050603a60018154811061475f5761475f61592f565b9060005260206000200154811061479757603b6001815481106147845761478461592f565b9060005260206000200154915050919050565b603a6000815481106147ab576147ab61592f565b906000526020600020015481116147d057603b6000815481106147845761478461592f565b603a6000815481106147e4576147e461592f565b9060005260206000200154603a6001815481106148035761480361592f565b906000526020600020015461481891906158d0565b603a60008154811061482c5761482c61592f565b90600052602060002001548261484291906158d0565b603b6000815481106148565761485661592f565b9060005260206000200154603b6001815481106148755761487561592f565b906000526020600020015461488a91906158d0565b614894919061586a565b61489e919061589f565b603b6000815481106148b2576148b261592f565b9060005260206000200154610af091906159ef565b50919050565b60006148e1846001600160a01b0316613359565b156149c857604051630a85bd0160e11b81526001600160a01b0385169063150b7a0290614918903390899088908890600401615e3d565b6020604051808303816000875af1925050508015614953575060408051601f3d908101601f1916820190925261495091810190615e20565b60015b6149ae573d808015614981576040519150601f19603f3d011682016040523d82523d6000602084013e614986565b606091505b5080516149a6576040516320149b4360e21b815260040160405180910390fd5b805181602001fd5b6001600160e01b031916630a85bd0160e11b149050611ce8565b506001611ce8565b60006149db826133a0565b90506149e86000836133d6565b6001600160a01b038116600081815260486020908152604080832080546000190190558583526047825280832080546001600160a01b0319169055604390915280822082815560010182905551849290600080516020615ed7833981519152908390a45050565b60008082614a68676765c793fa10079d601b1b8761586a565b614a72919061589f565b600087815260436020526040902060010154909150614aad5760b4548511614aad5760405163228af07f60e21b815260040160405180910390fd5b60008681526043602052604081206001018054839290614ace9084906159ef565b925050819055508060406000828254614ae791906159ef565b9091555050603954614b0590676765c793fa10079d601b1b9061586a565b83604054614b13919061586a565b1115614b32576040516371239a6160e11b815260040160405180910390fd5b60008681526043602090815260408083208151808301909252805482526001015491810191909152614b65908686614615565b50509050633b9aca008111614b8d57604051631527804d60e31b815260040160405180910390fd5b600080516020615e9783398151915287836001604051614baf93929190615a07565b60405180910390a1676765c793fa10079d601b1b614bcd858461586a565b614bd7919061589f565b979650505050505050565b6000614c37826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b0316614cb49092919063ffffffff16565b805190915015610a055780806020019051810190614c5591906158b3565b610a055760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b606482015260840161159f565b6060611ce8848460008585614cc885613359565b614d145760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e7472616374000000604482015260640161159f565b600080866001600160a01b03168587604051614d309190615e7a565b60006040518083038185875af1925050503d8060008114614d6d576040519150601f19603f3d011682016040523d82523d6000602084013e614d72565b606091505b5091509150614bd782828660608315614d8c575081610af0565b825115614d9c5782518084602001fd5b8160405162461bcd60e51b815260040161159f9190614f7f565b6040518060a0016040528060008152602001600081526020016000815260200160008152602001600081525090565b828054614df190615806565b90600052602060002090601f016020900481019282614e135760008555614e59565b82601f10614e2c57805160ff1916838001178555614e59565b82800160010185558215614e59579182015b82811115614e59578251825591602001919060010190614e3e565b50614e65929150614ecb565b5090565b828054828255906000526020600020908101928215614e595791602002820182811115614e59578251825591602001919060010190614e3e565b6040518060800160405280600081526020016000815260200160008152602001600081525090565b5b80821115614e655760008155600101614ecc565b6001600160a01b0391909116815260200190565b6001600160e01b031981168114610c6c57600080fd5b600060208284031215614f1c57600080fd5b8135610af081614ef4565b60005b83811015614f42578181015183820152602001614f2a565b8381111561402e5750506000910152565b60008151808452614f6b816020860160208601614f27565b601f01601f19169290920160200192915050565b602081526000610af06020830184614f53565b600060208284031215614fa457600080fd5b5035919050565b6001600160a01b0381168114610c6c57600080fd5b60008060408385031215614fd357600080fd5b8235614fde81614fab565b946020939093013593505050565b60008060006060848603121561500157600080fd5b833561500c81614fab565b9250602084013561501c81614fab565b929592945050506040919091013590565b6000806040838503121561504057600080fd5b82359150602083013561505281614fab565b809150509250929050565b60a081016108b8828480518252602081015160208301526040810151604083015260608101516060830152608081015160808301525050565b6000602082840312156150a857600080fd5b8135610af081614fab565b634e487b7160e01b600052604160045260246000fd5b604051601f8201601f191681016001600160401b03811182821017156150f1576150f16150b3565b604052919050565b600082601f83011261510a57600080fd5b81356001600160401b03811115615123576151236150b3565b615136601f8201601f19166020016150c9565b81815284602083860101111561514b57600080fd5b816020850160208301376000918101602001919091529392505050565b60006020828403121561517a57600080fd5b81356001600160401b0381111561519057600080fd5b611ce8848285016150f9565b600080604083850312156151af57600080fd5b50508035926020909101359150565b80356001600160401b0381168114611dfb57600080fd5b600080604083850312156151e857600080fd5b614fde836151be565b60006001600160401b0382111561520a5761520a6150b3565b5060051b60200190565b600082601f83011261522557600080fd5b8135602061523a615235836151f1565b6150c9565b82815260059290921b8401810191818101908684111561525957600080fd5b8286015b84811015615274578035835291830191830161525d565b509695505050505050565b60008060006060848603121561529457600080fd5b833561529f81614fab565b925060208401356001600160401b03808211156152bb57600080fd5b6152c787838801615214565b935060408601359150808211156152dd57600080fd5b506152ea86828701615214565b9150509250925092565b60008060008060008060c0878903121561530d57600080fd5b86356001600160401b038082111561532457600080fd5b6153308a838b01615214565b9750602089013591508082111561534657600080fd5b6153528a838b01615214565b96506040890135915061536482614fab565b90945060608801359061537682614fab565b90935060808801359061538882614fab565b90925060a0880135908082111561539e57600080fd5b506153ab89828a016150f9565b9150509295509295509295565b600080600080608085870312156153ce57600080fd5b5050823594602084013594506040840135936060013592509050565b600082601f8301126153fb57600080fd5b8135602061540b615235836151f1565b82815260059290921b8401810191818101908684111561542a57600080fd5b8286015b84811015615274578035600881106154465760008081fd5b835291830191830161542e565b600082601f83011261546457600080fd5b81356020615474615235836151f1565b82815260059290921b8401810191818101908684111561549357600080fd5b8286015b848110156152745780356001600160401b038111156154b65760008081fd5b6154c48986838b01016150f9565b845250918301918301615497565b600080600080608085870312156154e857600080fd5b84356001600160401b03808211156154ff57600080fd5b61550b888389016153ea565b9550602087013591508082111561552157600080fd5b5061552e87828801615453565b935050604085013561553f81614fab565b9150606085013561554f81614fab565b939692955090935050565b8015158114610c6c57600080fd5b6000806040838503121561557b57600080fd5b823561558681614fab565b915060208301356150528161555a565b600080600080608085870312156155ac57600080fd5b84356155b781614fab565b935060208501356155c781614fab565b92506040850135915060608501356001600160401b038111156155e957600080fd5b6155f5878288016150f9565b91505092959194509250565b600080600080600085870361018081121561561b57600080fd5b863561562681614fab565b9550602087013561563681614fab565b9450604087013561564681614fab565b9350610100605f198201121561565b57600080fd5b506060860191506101608601356001600160401b0381111561567c57600080fd5b615688888289016150f9565b9150509295509295909350565b60008060008060008060c087890312156156ae57600080fd5b86356001600160401b03808211156156c557600080fd5b6156d18a838b016153ea565b975060208901359150808211156156e757600080fd5b6153528a838b01615453565b6000806040838503121561570657600080fd5b823561571181614fab565b9150602083013561505281614fab565b60ff81168114610c6c57600080fd5b600080600080600080600060e0888a03121561574b57600080fd5b873561575681614fab565b9650602088013561576681614fab565b955060408801356157768161555a565b945060608801359350608088013561578d81615721565b9699959850939692959460a0840135945060c09093013592915050565b600080600080608085870312156157c057600080fd5b84356001600160401b03808211156157d757600080fd5b6157e388838901615214565b955060208701359150808211156157f957600080fd5b5061552e87828801615214565b600181811c9082168061581a57607f821691505b602082108114156148c757634e487b7160e01b600052602260045260246000fd5b60006020828403121561584d57600080fd5b5051919050565b634e487b7160e01b600052601160045260246000fd5b600081600019048311821515161561588457615884615854565b500290565b634e487b7160e01b600052601260045260246000fd5b6000826158ae576158ae615889565b500490565b6000602082840312156158c557600080fd5b8151610af08161555a565b6000828210156158e2576158e2615854565b500390565b60006001600160401b0382811684821680830382111561590957615909615854565b01949350505050565b60006020828403121561592457600080fd5b8151610af081614fab565b634e487b7160e01b600052603260045260246000fd5b600081518084526020808501945080840160005b8381101561597557815187529582019590820190600101615959565b509495945050505050565b6040815260006159936040830185615945565b82810360208401526120388185615945565b6020808252601f908201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c00604082015260600190565b602081526000610af06020830184615945565b60008219821115615a0257615a02615854565b500190565b928352602083019190915260ff16604082015260600190565b6000600019821415615a3457615a34615854565b5060010190565b600181815b80851115615a76578160001904821115615a5c57615a5c615854565b80851615615a6957918102915b93841c9390800290615a40565b509250929050565b600082615a8d575060016108b8565b81615a9a575060006108b8565b8160018114615ab05760028114615aba57615ad6565b60019150506108b8565b60ff841115615acb57615acb615854565b50506001821b6108b8565b5060208310610133831016604e8410600b8410161715615af9575081810a6108b8565b615b038383615a3b565b8060001904821115615b1757615b17615854565b029392505050565b6000610af060ff841683615a7e565b600082615b3d57615b3d615889565b500690565b60008151615b54818560208601614f27565b9290920192915050565b600080845481600182811c915080831680615b7a57607f831692505b6020808410821415615b9a57634e487b7160e01b86526022600452602486fd5b818015615bae5760018114615bbf57615bec565b60ff19861689528489019650615bec565b60008b81526020902060005b86811015615be45781548b820152908501908301615bcb565b505084890196505b5050505050506120388185615b42565b600060208284031215615c0e57600080fd5b8151610af081615721565b6e020b733b63290283937ba37b1b7b61608d1b815260008251615c4381600f850160208701614f27565b650815985d5b1d60d21b600f939091019283015250601501919050565b60008251615c72818460208701614f27565b650b5d985d5b1d60d21b920191825250600601919050565b600060208284031215615c9c57600080fd5b610af0826151be565b600060208284031215615cb757600080fd5b8135610af08161555a565b634e487b7160e01b600052602160045260246000fd5b60008060408385031215615ceb57600080fd5b505080516020909101519092909150565b60008060008060008060c08789031215615d1557600080fd5b8651615d2081614fab565b6020880151604089015160608a015160808b015160a0909b0151939c929b509099909850965090945092505050565b60008060008060808587031215615d6557600080fd5b845193506020850151615d7781614fab565b6040860151606090960151949790965092505050565b9283526001600160a01b03918216602084015216604082015260600190565b6001600160a01b03929092168252602082015260400190565b6001600160a01b038781168252868116602083015285166040820152606081018490526080810183905260c060a082018190526000906143ff90830184614f53565b828152604060208201526000611ce86040830184614f53565b600060208284031215615e3257600080fd5b8151610af081614ef4565b6001600160a01b0385811682528416602082015260408101839052608060608201819052600090615e7090830184614f53565b9695505050505050565b60008251615e8c818460208701614f27565b919091019291505056fe70cf49afe7355562d5b022e594790f22b71ad8cc7eec902fa5feac7c67f71091722cb71fa87c947148cefc06dd890af5802a6a00207c5ddecf1191bf71ce3cd4ddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3efa264697066735822122004adf5a8fe3c52a612a81111fd6100f9eeb84fbeb3cfcc411a5bf2e9a14a72cb64736f6c634300080c0033", + "deployedBytecode": "0x608060405234801561001057600080fd5b50600436106102f65760003560e01c8063010db195146102fb57806301ffc9a71461032457806306fdde0314610347578063081812fc1461035c578063087a60071461036f578063095ea7b3146103865780630e198f221461039b57806313888565146103a457806323b872dd146103ad578063254cf439146103c0578063307439af146103f257806334ce998a1461041257806335836f151461041a5780633644e5151461042d57806339393ac91461043557806339eb4dc6146104485780633ae2325f1461045c5780633af32abf1461046f5780633c2e941b1461048f57806342842e0e14610498578063430c2081146104ab5780634f7e43df146104be57806355f804b3146104d85780635b84d88a146104eb5780635c975abb146104fe57806361d027b3146105125780636352211e1461052557806370a0823114610538578063741075431461054b5780637aacfffa1461055e5780637adbf9731461059a5780637c0f59f4146105ad5780637c3a00fd146105c75780637dc0d1d0146105da5780637e53bd97146105ed5780637e56d47c146106005780637ecebe0014610613578063835986b41461063c57806389050f1d1461064f57806395d89b41146106615780639a3b6f2f146106695780639f48118f146106af578063a22cb465146106ba578063af2c8c2e146106cd578063b1511cc9146106d6578063b4bd6f46146106e9578063b88d4fde146106fc578063bbcac5571461070f578063c4ae316814610718578063c66d8b0114610720578063c87b56dd1461073a578063d8dfeb451461074d578063d9b1cb5b14610760578063de1f776514610773578063de8fc69814610785578063df011c4114610798578063e182b883146107ab578063e1c84ea4146107be578063e626648a146107c7578063e985e9c5146107e1578063e9cbd822146107f4578063f0f4426014610807578063f51cc7dd1461081a578063fad9aba31461082d578063fc29b02114610836578063fd527cf814610849575b600080fd5b60375461030e906001600160a01b031681565b60405161031b9190614ee0565b60405180910390f35b610337610332366004614f0a565b610851565b604051901515815260200161031b565b61034f6108be565b60405161031b9190614f7f565b61030e61036a366004614f92565b61094c565b610378603f5481565b60405190815260200161031b565b610399610394366004614fc0565b61097d565b005b610378603e5481565b61037860415481565b6103996103bb366004614fec565b610a0a565b603c546103da90600160401b90046001600160401b031681565b6040516001600160401b03909116815260200161031b565b61040561040036600461502d565b610a45565b60405161031b919061505d565b610378610af7565b610378610428366004614f92565b610b29565b610378610b65565b610399610443366004615096565b610b6f565b603d5461033790600160c01b900460ff1681565b61037861046a366004614f92565b610c6f565b61037861047d366004615096565b60446020526000908152604090205481565b61037860455481565b6103996104a6366004614fec565b610c90565b6103376104b9366004614fc0565b610cab565b603d546103da90600160801b90046001600160401b031681565b6103996104e6366004615168565b610cb7565b6103996104f936600461519c565b610d5c565b603d5461033790600160c81b900460ff1681565b60335461030e906001600160a01b031681565b61030e610533366004614f92565b610df5565b610378610546366004615096565b610e00565b6103996105593660046151d5565b610e45565b61058561056c366004614f92565b6043602052600090815260409020805460019091015482565b6040805192835260208301919091520161031b565b6103996105a8366004615096565b611211565b603c546103da90600160c01b90046001600160401b031681565b603d546103da906001600160401b031681565b60365461030e906001600160a01b031681565b6103996105fb36600461527f565b611358565b61040561060e3660046152f4565b611549565b610378610621366004615096565b6001600160a01b03166000908152607f602052604090205490565b61039961064a3660046153b8565b611af6565b610378676765c793fa10079d601a1b81565b61034f611cae565b61067c6106773660046154d2565b611cbb565b60405161031b91908151815260208083015190820152604080830151908201526060918201519181019190915260800190565b610378633b9aca0081565b6103996106c8366004615568565b611cf0565b61037860405481565b6103996106e4366004614f92565b611cfb565b6103786106f7366004615096565b611dc4565b61039961070a366004615596565b611e00565b61037860425481565b610399611e3d565b603d546103da90600160401b90046001600160401b031681565b61034f610748366004614f92565b611eec565b60345461030e906001600160a01b031681565b61039961076e366004615601565b612041565b610378676765c793fa10079d601b1b81565b61067c610793366004615695565b6125ec565b603c546103da906001600160401b031681565b6103786107b9366004614f92565b612e73565b61037860395481565b603c546103da90600160801b90046001600160401b031681565b6103376107ef3660046156f3565b612e83565b60355461030e906001600160a01b031681565b610399610815366004615096565b612eb1565b610399610828366004615730565b612f51565b61037860b45481565b6104056108443660046157aa565b613210565b61058561323a565b60006001600160e01b03198216635b5e139f60e01b148061088257506001600160e01b031982166380ac58cd60e01b145b8061089d57506001600160e01b0319821663430c208160e01b145b806108b857506001600160e01b031982166301ffc9a760e01b145b92915050565b607d80546108cb90615806565b80601f01602080910402602001604051908101604052809291908181526020018280546108f790615806565b80156109445780601f1061091957610100808354040283529160200191610944565b820191906000526020600020905b81548152906001019060200180831161092757829003601f168201915b505050505081565b600061095782613368565b6109745760405163062a39dd60e11b815260040160405180910390fd5b6108b882613385565b6000610988826133a0565b9050806001600160a01b0316836001600160a01b031614156109bd576040516349fa8bc360e11b815260040160405180910390fd5b336001600160a01b038216148015906109dd57506109db8133612e83565b155b156109fb5760405163c19f17a960e01b815260040160405180910390fd5b610a0583836133d6565b505050565b3381610a168282613444565b610a335760405163c19f17a960e01b815260040160405180910390fd5b610a3e8585856134c2565b5050505050565b610a4d614db6565b60008381526043602090815260409182902082518084018452815481526001909101548183015260365483516315f789a960e21b81529351610af094929387936001600160a01b03909316926357de26a492600480830193928290030181865afa158015610abf573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610ae3919061583b565b610aeb6135e9565b61377e565b9392505050565b6000676765c793fa10079d601b1b610b0d6135e9565b604054610b1a919061586a565b610b24919061589f565b905090565b6000676765c793fa10079d601b1b610b3f6135e9565b600084815260436020526040902060010154610b5b919061586a565b6108b8919061589f565b6000610b24613ad0565b603354604051631c86b03760e31b81526001600160a01b039091169063e43581b890610b9f903390600401614ee0565b602060405180830381865afa158015610bbc573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610be091906158b3565b610bfd57604051633b8d9d7560e21b815260040160405180910390fd5b6001600160a01b03811615610c4c576001600160a01b038116600090815260446020526040902054610c309060016158d0565b6001600160a01b03821660009081526044602052604090205550565b603d805460ff60c01b198116600160c01b9182900460ff16159091021790555b50565b603b8181548110610c7f57600080fd5b600091825260209091200154905081565b610a0583838360405180602001604052806000815250611e00565b6000610af08383613444565b60335460405163521d4de960e01b81526001600160a01b039091169063521d4de990610ce7903390600401614ee0565b602060405180830381865afa158015610d04573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610d2891906158b3565b610d4557604051632678482f60e21b815260040160405180910390fd5b8051610d58906046906020840190614de5565b5050565b603354604051631c86b03760e31b81526001600160a01b039091169063e43581b890610d8c903390600401614ee0565b602060405180830381865afa158015610da9573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610dcd91906158b3565b610dea57604051633b8d9d7560e21b815260040160405180910390fd5b60b49190915560b555565b60006108b8826133a0565b60006001600160a01b038216610e295760405163d92e233d60e01b815260040160405180910390fd5b506001600160a01b031660009081526048602052604090205490565b60335460405163521d4de960e01b81526001600160a01b039091169063521d4de990610e75903390600401614ee0565b602060405180830381865afa158015610e92573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610eb691906158b3565b610ed357604051632678482f60e21b815260040160405180910390fd5b806121a360f11b1415610f3757603d546001600160401b03600160401b90910481169083161115610f1757604051637650e96360e11b815260040160405180910390fd5b603c80546001600160401b0319166001600160401b0384161790556111ca565b80622a242360e91b1415610f9c57633b9aca00826001600160401b03161015610f735760405163da6a17b960e01b815260040160405180910390fd5b603c8054600160401b600160801b031916600160401b6001600160401b038516021790556111ca565b8061212360f11b141561100057633b9aca00826001600160401b03161115610fd757604051637650e96360e11b815260040160405180910390fd5b603c8054600160801b600160c01b031916600160801b6001600160401b038516021790556111ca565b8061292360f11b141561107d57603d54633b9aca009061103090600160401b90046001600160401b0316846158e7565b6001600160401b0316111561105857604051637650e96360e11b815260040160405180910390fd5b603c80546001600160c01b0316600160c01b6001600160401b038516021790556111ca565b806124a960f11b14156110b357611092613b3c565b50603d80546001600160401b0319166001600160401b0384161790556111ca565b80614c5360f01b141561114c57603c546001600160401b03808416911611806111055750603c54633b9aca00906110fa90600160c01b90046001600160401b0316846158e7565b6001600160401b0316115b156111235760405163180d062b60e31b815260040160405180910390fd5b603d8054600160401b600160801b031916600160401b6001600160401b038516021790556111ca565b806213531160ea1b14156111b157633b9aca00826001600160401b0316111561118857604051637650e96360e11b815260040160405180910390fd5b603d8054600160801b600160c01b031916600160801b6001600160401b038516021790556111ca565b60405163e1daa9cf60e01b815260040160405180910390fd5b604080516001600160401b0384168152602081018390527f13b367dac93b85d1ed9b3d8961d8b48e1a677c9800bb1613b4b0416b2d5b61d091015b60405180910390a15050565b603354604051631c86b03760e31b81526001600160a01b039091169063e43581b890611241903390600401614ee0565b602060405180830381865afa15801561125e573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061128291906158b3565b61129f57604051633b8d9d7560e21b815260040160405180910390fd5b603354604080516361d027b360e01b815290516001600160a01b03928316928416916361d027b39160048083019260209291908290030181865afa1580156112eb573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061130f9190615912565b6001600160a01b031614611336576040516302979eb960e31b815260040160405180910390fd5b603680546001600160a01b0319166001600160a01b0392909216919091179055565b60335460405163521d4de960e01b81526001600160a01b039091169063521d4de990611388903390600401614ee0565b602060405180830381865afa1580156113a5573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906113c991906158b3565b6113e657604051632678482f60e21b815260040160405180910390fd5b805182511415806114115750806000815181106114055761140561592f565b60200260200101516000145b806114a057506001600160a01b038316158015906114a057508160008151811061143d5761143d61592f565b6020026020010151826001815181106114585761145861592f565b60200260200101511115806114a057508060008151811061147b5761147b61592f565b6020026020010151816001815181106114965761149661592f565b6020026020010151105b156114be57604051631746545d60e11b815260040160405180910390fd5b603780546001600160a01b0319166001600160a01b03851617905581516114ec90603a906020850190614e69565b50805161150090603b906020840190614e69565b50826001600160a01b03167feb74d4d9fea592587c926aeb35eb6a7893fb28db0c1c8eb2eb3c586e7164b76c838360405161153c929190615980565b60405180910390a2505050565b611551614db6565b603d54600160c81b900460ff161561157c576040516313d0ff5960e31b815260040160405180910390fd5b600260015414156115a85760405162461bcd60e51b815260040161159f906159a5565b60405180910390fd5b600260015586518651811415806115bd575080155b156115db576040516346282e8d60e01b815260040160405180910390fd5b603660009054906101000a90046001600160a01b03166001600160a01b03166357de26a46040518163ffffffff1660e01b8152600401602060405180830381865afa15801561162e573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611652919061583b565b606083015261165f613b3c565b60808301526040517f965a177723c641ee49150b583a0b9ad4730bb20d3474e00ae5a65e777c00d67b90611694908a906159dc565b60405180910390a160005b81811015611a66576000604360008b84815181106116bf576116bf61592f565b60200260200101518152602001908152602001600020604051806040016040529081600082015481526020016001820154815250509050600061170c82338760600151886080015161377e565b90508060400151600014158015611740575080604001518a84815181106117355761173561592f565b602002602001015110155b80611767575080600001518a848151811061175d5761175d61592f565b6020026020010151115b156117905780600001518a84815181106117835761178361592f565b6020026020010181815250505b6000856060015182606001516117a6919061586a565b603854633b9aca008d87815181106117c0576117c061592f565b60200260200101516117d2919061586a565b6117dc919061586a565b6117e6919061589f565b90506118148c85815181106117fd576117fd61592f565b60200260200101518285600001511115610c6c5750565b8251811061194a575081516020830151604080546000906118369084906158d0565b92505081905550604360008d86815181106118535761185361592f565b60209081029190910181015182528101919091526040016000908120818155600101819055603d548c51633b9aca0091600160401b90046001600160401b0316908e90889081106118a6576118a661592f565b60200260200101516118b8919061586a565b6118c2919061589f565b9050826080015181106118d65760006118e6565b8083608001516118e691906158d0565b876040018181516118f791906159ef565b905250508b51600080516020615e97833981519152908d908690811061191f5761191f61592f565b60200260200101518460200151600060405161193d93929190615a07565b60405180910390a1611a0b565b80604360008e87815181106119615761196161592f565b60200260200101518152602001908152602001600020600001600082825461198991906158d0565b92505081905550611a098c85815181106119a5576119a561592f565b6020026020010151633b9aca00603d60089054906101000a90046001600160401b03166001600160401b03168e88815181106119e3576119e361592f565b60200260200101516119f5919061586a565b6119ff919061589f565b8860800151613bdd565b505b8086602001818151611a1d91906159ef565b9052508a518b9085908110611a3457611a3461592f565b602002602001015186600001818151611a4d91906159ef565b905250611a5f9250839150615a209050565b905061169f565b50603d54633b9aca0090611a8a90600160401b90046001600160401b0316826158d0565b8351611a96919061586a565b611aa0919061589f565b60416000828254611ab191906159ef565b9091555050604082015160428054600090611acd9084906159ef565b909155505060208201518251611ae7919088888888613d0c565b50600180559695505050505050565b603d54600160c81b900460ff1615611b21576040516313d0ff5960e31b815260040160405180910390fd5b6033546040516333b52a9f60e11b81526001600160a01b039091169063676a553e90611b51903390600401614ee0565b602060405180830381865afa158015611b6e573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611b9291906158b3565b611baf5760405163027f480760e01b815260040160405180910390fd5b603c54600090600160c01b90046001600160401b0316821015611bed57603c54611bea908390600160c01b90046001600160401b03166158d0565b90505b603c54600090600160801b90046001600160401b0316841115611c2a57603c54611c2790600160801b90046001600160401b0316856158d0565b90505b6000611c3b6002633b9aca00615b1f565b611c4983633b9aca006158d0565b611c5785633b9aca006158d0565b611c61908961586a565b611c6b919061586a565b611c75919061589f565b9050611c8181876158d0565b60416000828254611c9291906159ef565b90915550611ca4905087826000613bdd565b5050505050505050565b607e80546108cb90615806565b611cc3614ea3565b60408051600080825260208201909252611ce5918791879187918791906125ec565b90505b949350505050565b610d58338383613e16565b60335460405163521d4de960e01b81526001600160a01b039091169063521d4de990611d2b903390600401614ee0565b602060405180830381865afa158015611d48573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611d6c91906158b3565b611d8957604051632678482f60e21b815260040160405180910390fd5b60398190556040518181527fdd63b3dcdbebad734892f7c7a26d0f647fbc7eec973e0775f5229018ac4ab47a9060200160405180910390a150565b603d54600090600160c81b900460ff1615611df2576040516313d0ff5960e31b815260040160405180910390fd5b6108b882613ecc565b919050565b3382611e0c8282613444565b611e295760405163c19f17a960e01b815260040160405180910390fd5b611e3586868686613ffa565b505050505050565b60335460405163521d4de960e01b81526001600160a01b039091169063521d4de990611e6d903390600401614ee0565b602060405180830381865afa158015611e8a573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611eae91906158b3565b611ecb57604051632678482f60e21b815260040160405180910390fd5b603d805460ff60c81b198116600160c81b9182900460ff1615909102179055565b6060611ef782613368565b611f145760405163062a39dd60e11b815260040160405180910390fd5b8160005b8115611f3b57611f2781615a20565b9050611f34600a8361589f565b9150611f18565b6000816001600160401b03811115611f5557611f556150b3565b6040519080825280601f01601f191660200182016040528015611f7f576020820181803683370190505b5090505b8415611fea57611f946001836158d0565b9150611fa1600a86615b2e565b611fac9060306159ef565b60f81b818381518110611fc157611fc161592f565b60200101906001600160f81b031916908160001a905350611fe3600a8661589f565b9450611f83565b60468054611ff790615806565b151590506120145760405180602001604052806000815250612038565b604681604051602001612028929190615b5e565b6040516020818303038152906040525b95945050505050565b600054610100900460ff16158080156120615750600054600160ff909116105b80612082575061207030613359565b158015612082575060005460ff166001145b6120e55760405162461bcd60e51b815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201526d191e481a5b9a5d1a585b1a5e995960921b606482015260840161159f565b6000805460ff191660011790558015612108576000805461ff0019166101001790555b856001600160a01b0316846001600160a01b03166361d027b36040518163ffffffff1660e01b8152600401602060405180830381865afa158015612150573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906121749190615912565b6001600160a01b03161461219b576040516302979eb960e31b815260040160405180910390fd5b603380546001600160a01b038089166001600160a01b0319928316179092556034805492881692909116821790556040805163313ce56760e01b8152905163313ce567916004808201926020929091908290030181865afa158015612204573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906122289190615bfc565b61223390600a615b1f565b603881905550856001600160a01b031663e9cbd8226040518163ffffffff1660e01b8152600401602060405180830381865afa158015612277573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061229b9190615912565b603580546001600160a01b03199081166001600160a01b0393841617909155603680549091169186169190911790556040516000906122de908490602001615c19565b60408051601f19818403018152919052805190915061230490607d906020840190614de5565b5061230e81614034565b8260405160200161231f9190615c60565b604051602081830303815290604052607e9080519060200190612343929190614de5565b50676765c793fa10079d601b1b603f5542603e5561236760a0850160808601615c8a565b6001600160401b03166123806040860160208701615c8a565b6001600160401b031611806123b05750633b9aca006123a560a0860160808701615c8a565b6001600160401b0316115b806123d657506123c66060850160408601615c8a565b6001600160401b0316633b9aca00115b806123fd5750633b9aca006123f160c0860160a08701615c8a565b6001600160401b031610155b8061240a575060e0840135155b1561242857604051631746545d60e11b815260040160405180910390fd5b833560395561243d6040850160208601615c8a565b603c80546001600160401b0319166001600160401b039290921691909117905561246d6060850160408601615c8a565b603c80546001600160401b0392909216600160401b02600160401b600160801b03199092169190911790556124a86080850160608601615c8a565b603d80546001600160401b0319166001600160401b03929092169190911790556124d860a0850160808601615c8a565b603d80546001600160401b0392909216600160401b02600160401b600160801b031990921691909117905561251360c0850160a08601615c8a565b603d80546001600160401b0392909216600160801b02600160801b600160c01b031990921691909117905561254e60e0850160c08601615ca5565b603d8054911515600160c01b0260ff60c01b19909216919091179055604080516020810190915260e0850135815261258a90603b906001614e69565b5050603d805460ff60c81b1916600160c81b1790558015611e35576000805461ff0019169055604051600181527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989060200160405180910390a1505050505050565b6125f4614ea3565b603d54600160c81b900460ff161561261f576040516313d0ff5960e31b815260040160405180910390fd5b600260015414156126425760405162461bcd60e51b815260040161159f906159a5565b60026001558551875114158061265757508651155b15612675576040516346282e8d60e01b815260040160405180910390fd5b6000806000806000805b8c51811015612bdc5760008d828151811061269c5761269c61592f565b60200260200101519050600060078111156126b9576126b9615cc2565b8160078111156126cb576126cb615cc2565b141561270c576127068d83815181106126e6576126e661592f565b60200260200101518060200190518101906127019190615912565b613ecc565b50612bcb565b600281600781111561272057612720615cc2565b1415612786578c82815181106127385761273861592f565b60200260200101518060200190518101906127539190615cd8565b95509250826127625760455492505b61276c838661410a565b848860600181815161277e91906159ef565b905250612bcb565b600781600781111561279a5761279a615cc2565b14156128735760008060008f85815181106127b7576127b761592f565b60200260200101518060200190518101906127d29190615cfc565b60345460405163d505accf60e01b81526001600160a01b038089166004830152306024830152604482018890526064820187905260ff8616608483015260a4820185905260c48201849052969f50939d50939b509497509550929350169063d505accf9060e401600060405180830381600087803b15801561285357600080fd5b505af1158015612867573d6000803e3d6000fd5b50505050505050612bcb565b8661288357612880613b3c565b96505b600481600781111561289757612897615cc2565b1415612963578c82815181106128af576128af61592f565b60200260200101518060200190518101906128ca9190615cd8565b94509250826128d95760455492505b6128e4838589613bdd565b603c5490945060009061290b90600160c01b90046001600160401b0316633b9aca006158d0565b612919633b9aca008761586a565b612923919061589f565b905061292f85826158d0565b6041600082825461294091906159ef565b92505081905550808960200181815161295991906159ef565b905250612bcb9050565b856129e257603660009054906101000a90046001600160a01b03166001600160a01b03166357de26a46040518163ffffffff1660e01b8152600401602060405180830381865afa1580156129bb573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906129df919061583b565b95505b60018160078111156129f6576129f6615cc2565b1415612a72578c8281518110612a0e57612a0e61592f565b6020026020010151806020019051810190612a29919061583b565b925082612a365760455492505b612a41838789614176565b80965081955050508488604001818151612a5b91906159ef565b90525060208801805185919061277e9083906159ef565b6003816007811115612a8657612a86615cc2565b1415612ae6578c8281518110612a9e57612a9e61592f565b6020026020010151806020019051810190612ab99190615cd8565b9550925082612ac85760455492505b612ad48386888a614296565b848860400181815161277e91906159ef565b6005816007811115612afa57612afa615cc2565b1415612b5c578c8281518110612b1257612b1261592f565b6020026020010151806020019051810190612b2d9190615cd8565b9450925082612b3c5760455492505b612b488385888a614370565b9350838860000181815161277e91906159ef565b6006816007811115612b7057612b70615cc2565b1415612bcb576000808e8481518110612b8b57612b8b61592f565b6020026020010151806020019051810190612ba69190615d4f565b98509196509250905084612bba5760455494505b612bc8858383898c8e61440b565b50505b50612bd581615a20565b905061267f565b508551602087015110612cd35785516020870151600091612bfc916158d0565b90508660600151876040015110612c3357612c2e87606001518860400151612c2491906158d0565b828d8d8d8d613d0c565b612ccd565b8015612ca057603554604051630d43af8160e21b81526001600160a01b039091169063350ebe0490612c6d9084908f903390600401615d8d565b600060405180830381600087803b158015612c8757600080fd5b505af1158015612c9b573d6000803e3d6000fd5b505050505b612ccd333089604001518a60600151612cb991906158d0565b6034546001600160a01b0316929190614547565b50612e5f565b60208601518651600091612ce6916158d0565b6035546040516340c10f1960e01b81529192506001600160a01b0316906340c10f1990612d19908d908590600401615dac565b600060405180830381600087803b158015612d3357600080fd5b505af1158015612d47573d6000803e3d6000fd5b50505050866060015187604001511115612d8b57612d868a88606001518960400151612d7391906158d0565b6034546001600160a01b031691906145b2565b612e5d565b600087604001518860600151612da191906158d0565b90508015612e5b57885115612e4357896001600160a01b031663a5d4096b603560009054906101000a90046001600160a01b0316603460009054906101000a90046001600160a01b03163385878f6040518763ffffffff1660e01b8152600401612e1096959493929190615dc5565b600060405180830381600087803b158015612e2a57600080fd5b505af1158015612e3e573d6000803e3d6000fd5b505050505b603454612e5b906001600160a01b0316333084614547565b505b505b505060018055509198975050505050505050565b603a8181548110610c7f57600080fd5b6001600160a01b039182166000908152604a6020908152604080832093909416825291909152205460011490565b6033546001600160a01b03163314612edc5760405163b90cdbb160e01b815260040160405180910390fd5b603380546001600160a01b0319166001600160a01b0383811691909117909155603654604051630787a21360e51b815291169063f0f4426090612f23908490600401614ee0565b600060405180830381600087803b158015612f3d57600080fd5b505af1158015610a3e573d6000803e3d6000fd5b83421115612f725760405163f87d927160e01b815260040160405180910390fd5b6fa2a8918ca85bafe22016d0b997e4df60600160ff1b03811180612fa957508260ff16601b14158015612fa957508260ff16601c14155b15612fc757604051638baa579f60e01b815260040160405180910390fd5b6000612fd1613ad0565b608254898989612fe08d6145d1565b6040805160208101969096526001600160a01b03948516908601529290911660608401521515608083015260a082015260c0810187905260e0016040516020818303038152906040528051906020012060405160200161305792919061190160f01b81526002810192909252602282015260420190565b604051602081830303815290604052805190602001209050613081886001600160a01b0316613359565b1561315d57604080516020810185905280820184905260f886901b6001600160f81b0319166060820152815160418183030181526061820192839052630b135d3f60e11b9092526001600160a01b038a1691631626ba7e916130e7918591606501615e07565b602060405180830381865afa158015613104573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906131289190615e20565b6001600160e01b031916631626ba7e60e01b1461315857604051638baa579f60e01b815260040160405180910390fd5b613205565b6040805160008082526020820180845284905260ff871692820192909252606081018590526080810184905260019060a0016020604051602081039080840390855afa1580156131b1573d6000803e3d6000fd5b505050602060405103519050886001600160a01b0316816001600160a01b03161415806131e557506001600160a01b038116155b1561320357604051638baa579f60e01b815260040160405180910390fd5b505b611ca4888888613e16565b613218614db6565b60408051600080825260208201909252611ce591879187918791879190611549565b60335460009081906001600160a01b0316331461326a5760405163b90cdbb160e01b815260040160405180910390fd5b613272613b3c565b50506041805460428054600093849055929055915080821061330b5761329881836158d0565b6035546033546040516340c10f1960e01b8152929450600093506001600160a01b03918216926340c10f19926132d49216908690600401615dac565b600060405180830381600087803b1580156132ee57600080fd5b505af1158015613302573d6000803e3d6000fd5b5050505061331c565b61331582826158d0565b9050600091505b60408051838152602081018390527ffeb12225c131aab793a00c5239afb778932d170fa28ce6e9d23703e4bd892121910160405180910390a19091565b6001600160a01b03163b151590565b6000908152604760205260409020546001600160a01b0316151590565b6000908152604960205260409020546001600160a01b031690565b6000818152604760205260409020546001600160a01b031680611dfb5760405163062a39dd60e11b815260040160405180910390fd5b600081815260496020526040902080546001600160a01b0319166001600160a01b038416908117909155819061340b826133a0565b6001600160a01b03167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92560405160405180910390a45050565b600080613450836133a0565b9050806001600160a01b0316846001600160a01b0316148061348b5750836001600160a01b031661348084613385565b6001600160a01b0316145b80611ce857506001600160a01b038082166000908152604a6020908152604080832093881683529290522054600114949350505050565b826001600160a01b03166134d5826133a0565b6001600160a01b0316146134fc5760405163c19f17a960e01b815260040160405180910390fd5b6001600160a01b0382166135235760405163d92e233d60e01b815260040160405180910390fd5b603d54600160c01b900460ff16801561355557506001600160a01b038216600090815260446020526040902054600114155b1561357357604051630b094f2760e31b815260040160405180910390fd5b61357e6000826133d6565b6001600160a01b038084166000818152604860209081526040808320805460001901905593861680835284832080546001019055858352604790915283822080546001600160a01b03191682179055925184939291600080516020615ed783398151915291a4505050565b600080603e54426135fa91906158d0565b603d549091506001600160401b0316811580613614575080155b1561362357603f549250505090565b60006136306001846158d0565b905060006002841161364357600061364e565b61364e6002856158d0565b90506000676765c793fa10079d601b1b676765c793fa10079d601a1b613674868061586a565b61367e91906159ef565b613688919061589f565b90506000676765c793fa10079d601b1b676765c793fa10079d601a1b6136ae878561586a565b6136b891906159ef565b6136c2919061589f565b905060006002836136d3878a61586a565b6136dd919061586a565b6136e7919061589f565b90506000600683866136f9898c61586a565b613703919061586a565b61370d919061586a565b613717919061589f565b9050676765c793fa10079d601b1b81836137318b8b61586a565b61374690676765c793fa10079d601b1b6159ef565b61375091906159ef565b61375a91906159ef565b603f54613767919061586a565b613771919061589f565b9850505050505050505090565b613786614db6565b6000806000613796888787614615565b925092509250633b9aca0083106137c0576040516315fe9b6160e21b815260040160405180910390fd5b6000633b9aca006137d185826158d0565b6137da8a61469e565b6137e4919061586a565b6137ee919061589f565b603d54909150600160801b90046001600160401b031681101561381e5761381981633b9aca006158d0565b61383f565b603d5461383f90600160801b90046001600160401b0316633b9aca006158d0565b603d54909150600160401b90046001600160401b03166000806138676002633b9aca00615b1f565b603c5461387d91906001600160401b031661586a565b83613888868a61586a565b613892919061586a565b10613a1b57603c546001600160401b03166138b26002633b9aca00615b1f565b6138bc919061586a565b603c5485906138db90600160401b90046001600160401b03168661586a565b6138e5919061586a565b6138ef91906158d0565b603c548590633b9aca009061390d906001600160401b03168961586a565b603c5461392b908b90600160401b90046001600160401b031661586a565b61393591906158d0565b61393f919061586a565b613949919061586a565b613953919061589f565b9150633b9aca0060b454613967919061586a565b613971848461586a565b61397b91906159ef565b613989633b9aca008861586a565b11613a16576139a3676765c793fa10079d601b1b8461586a565b633b9aca008a8e602001516139b8919061586a565b6139c2919061586a565b6139cc919061589f565b6139d79060016159ef565b915060b454861115613a125782633b9aca0060b454886139f791906158d0565b613a01919061586a565b613a0b919061589f565b9050613a7e565b5060015b613a7e565b603854613a2c90633b9aca0061586a565b8c518b90613a3b90879061586a565b613a45919061586a565b613a4f919061589f565b613a5a9060016159ef565b915060b554851115613a7a57633b9aca008460b554876139f791906158d0565b5060015b818852613a8b848b61586a565b603854613a9c633b9aca008561586a565b613aa6919061586a565b613ab0919061589f565b602089015260408801525050606085015250608083015250949350505050565b60808054608154604080517f8b73c3c69bb8fe3d512ecc4cf759cc79239f7b179b0ffacaa9a75d522b39400f602082015290810192909252606082015246918101919091523060a082015260009060c00160405160208183030381529060405280519060200120905090565b6000613b466135e9565b90506000676765c793fa10079d601b1b603f5483613b6491906158d0565b604054613b71919061586a565b613b7b919061589f565b90508060416000828254613b8f91906159ef565b9091555050603f82905542603e8190556040805184815260208101929092527fd1fa8ba00a3bf20274346919dce0de62d2a140af2c71fe7e29fa6472eea3bb9d910160405180910390a15090565b600081613bef57613bec613b3c565b91505b60008481526043602052604081206001015490676765c793fa10079d601b1b613c18858461586a565b613c22919061589f565b9050808510613c3357935080613c56565b83613c49676765c793fa10079d601b1b8761586a565b613c53919061589f565b90505b613c6081836158d0565b91508060406000828254613c7491906158d0565b90915550508115801590613ca95750676765c793fa10079d601b1b60b454613c9c919061586a565b613ca6858461586a565b11155b15613cc75760405163228af07f60e21b815260040160405180910390fd5b60008681526043602052604080822060010184905551600080516020615e9783398151915291613cfa9189918591615a07565b60405180910390a15092949350505050565b8515613d2957603454613d29906001600160a01b031684886145b2565b8415611e3557805115613da85760345460355460405163a5d4096b60e01b81526001600160a01b038086169363a5d4096b93613d759391831692169089908b908d908990600401615dc5565b600060405180830381600087803b158015613d8f57600080fd5b505af1158015613da3573d6000803e3d6000fd5b505050505b603554604051630d43af8160e21b81526001600160a01b039091169063350ebe0490613ddc90889088903390600401615d8d565b600060405180830381600087803b158015613df657600080fd5b505af1158015613e0a573d6000803e3d6000fd5b50505050505050505050565b826001600160a01b0316826001600160a01b03161415613e49576040516320c5195360e21b815260040160405180910390fd5b600081613e57576000613e5a565b60015b6001600160a01b038581166000818152604a602090815260408083209489168084529482529182902060ff959095169485905590518615158152939450919290917f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c31910160405180910390a350505050565b603d54600090600160c01b900460ff168015613f1b57506001600160a01b0382166000908152604460205260409020546001141580613f1b575033600090815260446020526040902054600114155b15613f3957604051630b094f2760e31b815260040160405180910390fd5b6001600160a01b038216613f605760405163d92e233d60e01b815260040160405180910390fd5b5060458054600101908190556001600160a01b038216600081815260486020908152604080832080546001019055848352604790915280822080546001600160a01b031916841790555183929190600080516020615ed7833981519152908290a4613fdd60008383604051806020016040528060008152506148cd565b611dfb576040516320149b4360e21b815260040160405180910390fd5b6140058484846134c2565b614011848484846148cd565b61402e576040516320149b4360e21b815260040160405180910390fd5b50505050565b600054610100900460ff1661409f5760405162461bcd60e51b815260206004820152602b60248201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960448201526a6e697469616c697a696e6760a81b606482015260840161159f565b7f3f43a9c6bafb5c7aab4e0cfe239dc5d4c15caf0381c6104188191f78a6640bd860825580516020918201206080556040805180820190915260018152603160f81b9101527fc89efdaa54c0f20c7adf612882df0950f5a951637e0307cdcb4c672f298b8bc6608155565b61411382613368565b6141305760405163062a39dd60e11b815260040160405180910390fd5b6000828152604360205260408120805483929061414e9084906159ef565b9091555050604051600080516020615eb7833981519152906112059084908490600190615a07565b60008033856141858282613444565b6141a25760405163c19f17a960e01b815260040160405180910390fd5b6000878152604360209081526040808320815180830190925280548252600101549181019190915290806141d7838a8a614615565b5091509150633b9aca00821161420057604051631527804d60e31b815260040160405180910390fd5b82602001516040600082825461421691906158d0565b9091555061422590508a6149d0565b603c5460009061424990600160c01b90046001600160401b0316633b9aca006158d0565b614257633b9aca008461586a565b614261919061589f565b905061426d82826158d0565b6041600082825461427e91906159ef565b90915550509251929a92995091975050505050505050565b33846142a28282613444565b6142bf5760405163c19f17a960e01b815260040160405180910390fd5b600086815260436020526040812080548792906142dd9084906158d0565b909155505060008681526043602090815260408083208151808301909252805482526001015491810191909152614315908686614615565b50509050633b9aca00811161433d57604051631527804d60e31b815260040160405180910390fd5b600080516020615eb78339815191528787600060405161435f93929190615a07565b60405180910390a150505050505050565b6000338561437e8282613444565b61439b5760405163c19f17a960e01b815260040160405180910390fd5b6143a787878787614a4f565b603c54909650600090633b9aca00906143d1908990600160801b90046001600160401b031661586a565b6143db919061589f565b905080604160008282546143ef91906159ef565b909155506143ff905081886158d0565b98975050505050505050565b33866144178282613444565b6144345760405163c19f17a960e01b815260040160405180910390fd5b60408051898152602081018890526001600160a01b038916818301526060810187905290517fddd3b70af631334f7552aadb582ed091018e62e103fa8b150ca66cc700d4dac69181900360800190a161448f88868686614a4f565b94506001600160a01b0387163014156144b3576144ad868685613bdd565b50611ca4565b603c546040516320d661ad60e21b815260048101889052602481018790526001600160401b03600160801b830481166044830152600160c01b90920490911660648201526001600160a01b0388169063835986b490608401600060405180830381600087803b15801561452557600080fd5b505af1158015614539573d6000803e3d6000fd5b505050505050505050505050565b6040516001600160a01b038085166024830152831660448201526064810182905261402e9085906323b872dd60e01b906084015b60408051601f198184030181529190526020810180516001600160e01b03166001600160e01b031990931692909217909152614be2565b610a058363a9059cbb60e01b848460405160240161457b929190615dac565b6001600160a01b0381166000908152607f60205260409020546145f58160016159ef565b6001600160a01b039092166000908152607f602052604090209190915590565b6000806000676765c793fa10079d601b1b848760200151614636919061586a565b614640919061589f565b9150603854858760000151614655919061586a565b61465f919061589f565b905081614670576000199250614695565b603c548290614688906001600160401b03168361586a565b614692919061589f565b92505b93509350939050565b6037546000906001600160a01b03166146d757603b6000815481106146c5576146c561592f565b90600052602060002001549050919050565b603754604051635dfba04560e11b81526000916001600160a01b03169063bbf7408a90614708908690600401614ee0565b602060405180830381865afa158015614725573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190614749919061583b565b9050603a60018154811061475f5761475f61592f565b9060005260206000200154811061479757603b6001815481106147845761478461592f565b9060005260206000200154915050919050565b603a6000815481106147ab576147ab61592f565b906000526020600020015481116147d057603b6000815481106147845761478461592f565b603a6000815481106147e4576147e461592f565b9060005260206000200154603a6001815481106148035761480361592f565b906000526020600020015461481891906158d0565b603a60008154811061482c5761482c61592f565b90600052602060002001548261484291906158d0565b603b6000815481106148565761485661592f565b9060005260206000200154603b6001815481106148755761487561592f565b906000526020600020015461488a91906158d0565b614894919061586a565b61489e919061589f565b603b6000815481106148b2576148b261592f565b9060005260206000200154610af091906159ef565b50919050565b60006148e1846001600160a01b0316613359565b156149c857604051630a85bd0160e11b81526001600160a01b0385169063150b7a0290614918903390899088908890600401615e3d565b6020604051808303816000875af1925050508015614953575060408051601f3d908101601f1916820190925261495091810190615e20565b60015b6149ae573d808015614981576040519150601f19603f3d011682016040523d82523d6000602084013e614986565b606091505b5080516149a6576040516320149b4360e21b815260040160405180910390fd5b805181602001fd5b6001600160e01b031916630a85bd0160e11b149050611ce8565b506001611ce8565b60006149db826133a0565b90506149e86000836133d6565b6001600160a01b038116600081815260486020908152604080832080546000190190558583526047825280832080546001600160a01b0319169055604390915280822082815560010182905551849290600080516020615ed7833981519152908390a45050565b60008082614a68676765c793fa10079d601b1b8761586a565b614a72919061589f565b600087815260436020526040902060010154909150614aad5760b4548511614aad5760405163228af07f60e21b815260040160405180910390fd5b60008681526043602052604081206001018054839290614ace9084906159ef565b925050819055508060406000828254614ae791906159ef565b9091555050603954614b0590676765c793fa10079d601b1b9061586a565b83604054614b13919061586a565b1115614b32576040516371239a6160e11b815260040160405180910390fd5b60008681526043602090815260408083208151808301909252805482526001015491810191909152614b65908686614615565b50509050633b9aca008111614b8d57604051631527804d60e31b815260040160405180910390fd5b600080516020615e9783398151915287836001604051614baf93929190615a07565b60405180910390a1676765c793fa10079d601b1b614bcd858461586a565b614bd7919061589f565b979650505050505050565b6000614c37826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b0316614cb49092919063ffffffff16565b805190915015610a055780806020019051810190614c5591906158b3565b610a055760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b606482015260840161159f565b6060611ce8848460008585614cc885613359565b614d145760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e7472616374000000604482015260640161159f565b600080866001600160a01b03168587604051614d309190615e7a565b60006040518083038185875af1925050503d8060008114614d6d576040519150601f19603f3d011682016040523d82523d6000602084013e614d72565b606091505b5091509150614bd782828660608315614d8c575081610af0565b825115614d9c5782518084602001fd5b8160405162461bcd60e51b815260040161159f9190614f7f565b6040518060a0016040528060008152602001600081526020016000815260200160008152602001600081525090565b828054614df190615806565b90600052602060002090601f016020900481019282614e135760008555614e59565b82601f10614e2c57805160ff1916838001178555614e59565b82800160010185558215614e59579182015b82811115614e59578251825591602001919060010190614e3e565b50614e65929150614ecb565b5090565b828054828255906000526020600020908101928215614e595791602002820182811115614e59578251825591602001919060010190614e3e565b6040518060800160405280600081526020016000815260200160008152602001600081525090565b5b80821115614e655760008155600101614ecc565b6001600160a01b0391909116815260200190565b6001600160e01b031981168114610c6c57600080fd5b600060208284031215614f1c57600080fd5b8135610af081614ef4565b60005b83811015614f42578181015183820152602001614f2a565b8381111561402e5750506000910152565b60008151808452614f6b816020860160208601614f27565b601f01601f19169290920160200192915050565b602081526000610af06020830184614f53565b600060208284031215614fa457600080fd5b5035919050565b6001600160a01b0381168114610c6c57600080fd5b60008060408385031215614fd357600080fd5b8235614fde81614fab565b946020939093013593505050565b60008060006060848603121561500157600080fd5b833561500c81614fab565b9250602084013561501c81614fab565b929592945050506040919091013590565b6000806040838503121561504057600080fd5b82359150602083013561505281614fab565b809150509250929050565b60a081016108b8828480518252602081015160208301526040810151604083015260608101516060830152608081015160808301525050565b6000602082840312156150a857600080fd5b8135610af081614fab565b634e487b7160e01b600052604160045260246000fd5b604051601f8201601f191681016001600160401b03811182821017156150f1576150f16150b3565b604052919050565b600082601f83011261510a57600080fd5b81356001600160401b03811115615123576151236150b3565b615136601f8201601f19166020016150c9565b81815284602083860101111561514b57600080fd5b816020850160208301376000918101602001919091529392505050565b60006020828403121561517a57600080fd5b81356001600160401b0381111561519057600080fd5b611ce8848285016150f9565b600080604083850312156151af57600080fd5b50508035926020909101359150565b80356001600160401b0381168114611dfb57600080fd5b600080604083850312156151e857600080fd5b614fde836151be565b60006001600160401b0382111561520a5761520a6150b3565b5060051b60200190565b600082601f83011261522557600080fd5b8135602061523a615235836151f1565b6150c9565b82815260059290921b8401810191818101908684111561525957600080fd5b8286015b84811015615274578035835291830191830161525d565b509695505050505050565b60008060006060848603121561529457600080fd5b833561529f81614fab565b925060208401356001600160401b03808211156152bb57600080fd5b6152c787838801615214565b935060408601359150808211156152dd57600080fd5b506152ea86828701615214565b9150509250925092565b60008060008060008060c0878903121561530d57600080fd5b86356001600160401b038082111561532457600080fd5b6153308a838b01615214565b9750602089013591508082111561534657600080fd5b6153528a838b01615214565b96506040890135915061536482614fab565b90945060608801359061537682614fab565b90935060808801359061538882614fab565b90925060a0880135908082111561539e57600080fd5b506153ab89828a016150f9565b9150509295509295509295565b600080600080608085870312156153ce57600080fd5b5050823594602084013594506040840135936060013592509050565b600082601f8301126153fb57600080fd5b8135602061540b615235836151f1565b82815260059290921b8401810191818101908684111561542a57600080fd5b8286015b84811015615274578035600881106154465760008081fd5b835291830191830161542e565b600082601f83011261546457600080fd5b81356020615474615235836151f1565b82815260059290921b8401810191818101908684111561549357600080fd5b8286015b848110156152745780356001600160401b038111156154b65760008081fd5b6154c48986838b01016150f9565b845250918301918301615497565b600080600080608085870312156154e857600080fd5b84356001600160401b03808211156154ff57600080fd5b61550b888389016153ea565b9550602087013591508082111561552157600080fd5b5061552e87828801615453565b935050604085013561553f81614fab565b9150606085013561554f81614fab565b939692955090935050565b8015158114610c6c57600080fd5b6000806040838503121561557b57600080fd5b823561558681614fab565b915060208301356150528161555a565b600080600080608085870312156155ac57600080fd5b84356155b781614fab565b935060208501356155c781614fab565b92506040850135915060608501356001600160401b038111156155e957600080fd5b6155f5878288016150f9565b91505092959194509250565b600080600080600085870361018081121561561b57600080fd5b863561562681614fab565b9550602087013561563681614fab565b9450604087013561564681614fab565b9350610100605f198201121561565b57600080fd5b506060860191506101608601356001600160401b0381111561567c57600080fd5b615688888289016150f9565b9150509295509295909350565b60008060008060008060c087890312156156ae57600080fd5b86356001600160401b03808211156156c557600080fd5b6156d18a838b016153ea565b975060208901359150808211156156e757600080fd5b6153528a838b01615453565b6000806040838503121561570657600080fd5b823561571181614fab565b9150602083013561505281614fab565b60ff81168114610c6c57600080fd5b600080600080600080600060e0888a03121561574b57600080fd5b873561575681614fab565b9650602088013561576681614fab565b955060408801356157768161555a565b945060608801359350608088013561578d81615721565b9699959850939692959460a0840135945060c09093013592915050565b600080600080608085870312156157c057600080fd5b84356001600160401b03808211156157d757600080fd5b6157e388838901615214565b955060208701359150808211156157f957600080fd5b5061552e87828801615214565b600181811c9082168061581a57607f821691505b602082108114156148c757634e487b7160e01b600052602260045260246000fd5b60006020828403121561584d57600080fd5b5051919050565b634e487b7160e01b600052601160045260246000fd5b600081600019048311821515161561588457615884615854565b500290565b634e487b7160e01b600052601260045260246000fd5b6000826158ae576158ae615889565b500490565b6000602082840312156158c557600080fd5b8151610af08161555a565b6000828210156158e2576158e2615854565b500390565b60006001600160401b0382811684821680830382111561590957615909615854565b01949350505050565b60006020828403121561592457600080fd5b8151610af081614fab565b634e487b7160e01b600052603260045260246000fd5b600081518084526020808501945080840160005b8381101561597557815187529582019590820190600101615959565b509495945050505050565b6040815260006159936040830185615945565b82810360208401526120388185615945565b6020808252601f908201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c00604082015260600190565b602081526000610af06020830184615945565b60008219821115615a0257615a02615854565b500190565b928352602083019190915260ff16604082015260600190565b6000600019821415615a3457615a34615854565b5060010190565b600181815b80851115615a76578160001904821115615a5c57615a5c615854565b80851615615a6957918102915b93841c9390800290615a40565b509250929050565b600082615a8d575060016108b8565b81615a9a575060006108b8565b8160018114615ab05760028114615aba57615ad6565b60019150506108b8565b60ff841115615acb57615acb615854565b50506001821b6108b8565b5060208310610133831016604e8410600b8410161715615af9575081810a6108b8565b615b038383615a3b565b8060001904821115615b1757615b17615854565b029392505050565b6000610af060ff841683615a7e565b600082615b3d57615b3d615889565b500690565b60008151615b54818560208601614f27565b9290920192915050565b600080845481600182811c915080831680615b7a57607f831692505b6020808410821415615b9a57634e487b7160e01b86526022600452602486fd5b818015615bae5760018114615bbf57615bec565b60ff19861689528489019650615bec565b60008b81526020902060005b86811015615be45781548b820152908501908301615bcb565b505084890196505b5050505050506120388185615b42565b600060208284031215615c0e57600080fd5b8151610af081615721565b6e020b733b63290283937ba37b1b7b61608d1b815260008251615c4381600f850160208701614f27565b650815985d5b1d60d21b600f939091019283015250601501919050565b60008251615c72818460208701614f27565b650b5d985d5b1d60d21b920191825250600601919050565b600060208284031215615c9c57600080fd5b610af0826151be565b600060208284031215615cb757600080fd5b8135610af08161555a565b634e487b7160e01b600052602160045260246000fd5b60008060408385031215615ceb57600080fd5b505080516020909101519092909150565b60008060008060008060c08789031215615d1557600080fd5b8651615d2081614fab565b6020880151604089015160608a015160808b015160a0909b0151939c929b509099909850965090945092505050565b60008060008060808587031215615d6557600080fd5b845193506020850151615d7781614fab565b6040860151606090960151949790965092505050565b9283526001600160a01b03918216602084015216604082015260600190565b6001600160a01b03929092168252602082015260400190565b6001600160a01b038781168252868116602083015285166040820152606081018490526080810183905260c060a082018190526000906143ff90830184614f53565b828152604060208201526000611ce86040830184614f53565b600060208284031215615e3257600080fd5b8151610af081614ef4565b6001600160a01b0385811682528416602082015260408101839052608060608201819052600090615e7090830184614f53565b9695505050505050565b60008251615e8c818460208701614f27565b919091019291505056fe70cf49afe7355562d5b022e594790f22b71ad8cc7eec902fa5feac7c67f71091722cb71fa87c947148cefc06dd890af5802a6a00207c5ddecf1191bf71ce3cd4ddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3efa264697066735822122004adf5a8fe3c52a612a81111fd6100f9eeb84fbeb3cfcc411a5bf2e9a14a72cb64736f6c634300080c0033" +} \ No newline at end of file diff --git a/deployments/optimism/solcInputs/dc345d3eed7216da5bac40699a727ed4.json b/deployments/optimism/solcInputs/dc345d3eed7216da5bac40699a727ed4.json new file mode 100644 index 00000000..07ab4718 --- /dev/null +++ b/deployments/optimism/solcInputs/dc345d3eed7216da5bac40699a727ed4.json @@ -0,0 +1,124 @@ +{ + "language": "Solidity", + "sources": { + "contracts/vaultManager/VaultManagerLiquidationBoost.sol": { + "content": "// SPDX-License-Identifier: GPL-3.0\n\npragma solidity ^0.8.12;\n\nimport \"./VaultManager.sol\";\n\n/// @title VaultManagerLiquidationBoost\n/// @author Angle Labs, Inc.\n/// @notice Liquidation discount depending also on the liquidator veANGLE balance\ncontract VaultManagerLiquidationBoost is VaultManager {\n using SafeERC20 for IERC20;\n using Address for address;\n\n // =================================== SETTER ==================================\n\n /// @inheritdoc VaultManager\n /// @param _veBoostProxy Address which queries veANGLE balances and adjusted balances from delegation\n /// @param xBoost Threshold values of veANGLE adjusted balances\n /// @param yBoost Values of the liquidation boost at the threshold values of x\n /// @dev There are 2 modes:\n /// When boost is enabled, `xBoost` and `yBoost` should have a length of 2, but if they have a\n /// higher length contract will still work as expected. Contract will also work as expected if their\n /// length differ\n /// When boost is disabled, `_veBoostProxy` needs to be zero address and `yBoost[0]` is the base boost\n function setLiquidationBoostParameters(\n address _veBoostProxy,\n uint256[] memory xBoost,\n uint256[] memory yBoost\n ) external override onlyGovernorOrGuardian {\n if (\n (xBoost.length != yBoost.length) ||\n (yBoost[0] == 0) ||\n ((_veBoostProxy != address(0)) && (xBoost[1] <= xBoost[0] || yBoost[1] < yBoost[0]))\n ) revert InvalidSetOfParameters();\n veBoostProxy = IVeBoostProxy(_veBoostProxy);\n xLiquidationBoost = xBoost;\n yLiquidationBoost = yBoost;\n emit LiquidationBoostParametersUpdated(_veBoostProxy, xBoost, yBoost);\n }\n\n // ======================== OVERRIDEN VIRTUAL FUNCTIONS ========================\n\n /// @inheritdoc VaultManager\n function _computeLiquidationBoost(address liquidator) internal view override returns (uint256) {\n if (address(veBoostProxy) == address(0)) {\n return yLiquidationBoost[0];\n } else {\n uint256 adjustedBalance = veBoostProxy.adjusted_balance_of(liquidator);\n if (adjustedBalance >= xLiquidationBoost[1]) return yLiquidationBoost[1];\n else if (adjustedBalance <= xLiquidationBoost[0]) return yLiquidationBoost[0];\n else\n return\n yLiquidationBoost[0] +\n ((yLiquidationBoost[1] - yLiquidationBoost[0]) * (adjustedBalance - xLiquidationBoost[0])) /\n (xLiquidationBoost[1] - xLiquidationBoost[0]);\n }\n }\n}\n" + }, + "contracts/vaultManager/VaultManager.sol": { + "content": "// SPDX-License-Identifier: GPL-3.0\n\npragma solidity ^0.8.12;\n\nimport \"./VaultManagerPermit.sol\";\n\n/// @title VaultManager\n/// @author Angle Labs, Inc.\n/// @notice This contract allows people to deposit collateral and open up loans of a given AgToken. It handles all the loan\n/// logic (fees and interest rate) as well as the liquidation logic\n/// @dev This implementation only supports non-rebasing ERC20 tokens as collateral\n/// @dev This contract is encoded as a NFT contract\ncontract VaultManager is VaultManagerPermit, IVaultManagerFunctions {\n using SafeERC20 for IERC20;\n using Address for address;\n\n /// @inheritdoc IVaultManagerFunctions\n uint256 public dust;\n\n /// @notice Minimum amount of collateral (in stablecoin value, e.g in `BASE_TOKENS = 10**18`) that can be left\n /// in a vault during a liquidation where the health factor function is decreasing\n uint256 internal _dustCollateral;\n\n uint256[48] private __gapVaultManager;\n\n /// @inheritdoc IVaultManagerFunctions\n function initialize(\n ITreasury _treasury,\n IERC20 _collateral,\n IOracle _oracle,\n VaultParameters calldata params,\n string memory _symbol\n ) external initializer {\n if (_oracle.treasury() != _treasury) revert InvalidTreasury();\n treasury = _treasury;\n collateral = _collateral;\n _collatBase = 10**(IERC20Metadata(address(collateral)).decimals());\n stablecoin = IAgToken(_treasury.stablecoin());\n oracle = _oracle;\n string memory _name = string.concat(\"Angle Protocol \", _symbol, \" Vault\");\n name = _name;\n __ERC721Permit_init(_name);\n symbol = string.concat(_symbol, \"-vault\");\n\n interestAccumulator = BASE_INTEREST;\n lastInterestAccumulatorUpdated = block.timestamp;\n\n // Checking if the parameters have been correctly initialized\n if (\n params.collateralFactor > params.liquidationSurcharge ||\n params.liquidationSurcharge > BASE_PARAMS ||\n BASE_PARAMS > params.targetHealthFactor ||\n params.maxLiquidationDiscount >= BASE_PARAMS ||\n params.baseBoost == 0\n ) revert InvalidSetOfParameters();\n\n debtCeiling = params.debtCeiling;\n collateralFactor = params.collateralFactor;\n targetHealthFactor = params.targetHealthFactor;\n interestRate = params.interestRate;\n liquidationSurcharge = params.liquidationSurcharge;\n maxLiquidationDiscount = params.maxLiquidationDiscount;\n whitelistingActivated = params.whitelistingActivated;\n yLiquidationBoost = [params.baseBoost];\n paused = true;\n }\n\n // ================================= MODIFIERS =================================\n\n /// @notice Checks whether the `msg.sender` has the governor role or not\n modifier onlyGovernor() {\n if (!treasury.isGovernor(msg.sender)) revert NotGovernor();\n _;\n }\n\n /// @notice Checks whether the `msg.sender` has the governor role or the guardian role\n modifier onlyGovernorOrGuardian() {\n if (!treasury.isGovernorOrGuardian(msg.sender)) revert NotGovernorOrGuardian();\n _;\n }\n\n /// @notice Checks whether the `msg.sender` is the treasury contract\n modifier onlyTreasury() {\n if (msg.sender != address(treasury)) revert NotTreasury();\n _;\n }\n\n /// @notice Checks whether the contract is paused\n modifier whenNotPaused() {\n if (paused) revert Paused();\n _;\n }\n\n // ============================== VAULT FUNCTIONS ==============================\n\n /// @inheritdoc IVaultManagerFunctions\n function createVault(address toVault) external whenNotPaused returns (uint256) {\n return _mint(toVault);\n }\n\n /// @inheritdoc IVaultManagerFunctions\n function angle(\n ActionType[] memory actions,\n bytes[] memory datas,\n address from,\n address to\n ) external returns (PaymentData memory) {\n return angle(actions, datas, from, to, address(0), new bytes(0));\n }\n\n /// @inheritdoc IVaultManagerFunctions\n function angle(\n ActionType[] memory actions,\n bytes[] memory datas,\n address from,\n address to,\n address who,\n bytes memory repayData\n ) public whenNotPaused nonReentrant returns (PaymentData memory paymentData) {\n if (actions.length != datas.length || actions.length == 0) revert IncompatibleLengths();\n // `newInterestAccumulator` and `oracleValue` are expensive to compute. Therefore, they are computed\n // only once inside the first action where they are necessary, then they are passed forward to further actions\n uint256 newInterestAccumulator;\n uint256 oracleValue;\n uint256 collateralAmount;\n uint256 stablecoinAmount;\n uint256 vaultID;\n for (uint256 i; i < actions.length; ++i) {\n ActionType action = actions[i];\n // Processing actions which do not need the value of the oracle or of the `interestAccumulator`\n if (action == ActionType.createVault) {\n _mint(abi.decode(datas[i], (address)));\n } else if (action == ActionType.addCollateral) {\n (vaultID, collateralAmount) = abi.decode(datas[i], (uint256, uint256));\n if (vaultID == 0) vaultID = vaultIDCount;\n _addCollateral(vaultID, collateralAmount);\n paymentData.collateralAmountToReceive += collateralAmount;\n } else if (action == ActionType.permit) {\n address owner;\n bytes32 r;\n bytes32 s;\n // Watch out naming conventions for permit are not respected to save some space and reduce the stack size\n // `vaultID` is used in place of the `deadline` parameter\n // Same for `collateralAmount` used in place of `value`\n // `stablecoinAmount` is used in place of the `v`\n (owner, collateralAmount, vaultID, stablecoinAmount, r, s) = abi.decode(\n datas[i],\n (address, uint256, uint256, uint256, bytes32, bytes32)\n );\n IERC20PermitUpgradeable(address(collateral)).permit(\n owner,\n address(this),\n collateralAmount,\n vaultID,\n uint8(stablecoinAmount),\n r,\n s\n );\n } else {\n // Processing actions which rely on the `interestAccumulator`: first accruing it to make\n // sure surplus is correctly taken into account between debt changes\n if (newInterestAccumulator == 0) newInterestAccumulator = _accrue();\n if (action == ActionType.repayDebt) {\n (vaultID, stablecoinAmount) = abi.decode(datas[i], (uint256, uint256));\n if (vaultID == 0) vaultID = vaultIDCount;\n stablecoinAmount = _repayDebt(vaultID, stablecoinAmount, newInterestAccumulator);\n uint256 stablecoinAmountPlusRepayFee = (stablecoinAmount * BASE_PARAMS) / (BASE_PARAMS - repayFee);\n surplus += stablecoinAmountPlusRepayFee - stablecoinAmount;\n paymentData.stablecoinAmountToReceive += stablecoinAmountPlusRepayFee;\n } else {\n // Processing actions which need the oracle value\n if (oracleValue == 0) oracleValue = oracle.read();\n if (action == ActionType.closeVault) {\n vaultID = abi.decode(datas[i], (uint256));\n if (vaultID == 0) vaultID = vaultIDCount;\n (stablecoinAmount, collateralAmount) = _closeVault(\n vaultID,\n oracleValue,\n newInterestAccumulator\n );\n paymentData.collateralAmountToGive += collateralAmount;\n paymentData.stablecoinAmountToReceive += stablecoinAmount;\n } else if (action == ActionType.removeCollateral) {\n (vaultID, collateralAmount) = abi.decode(datas[i], (uint256, uint256));\n if (vaultID == 0) vaultID = vaultIDCount;\n _removeCollateral(vaultID, collateralAmount, oracleValue, newInterestAccumulator);\n paymentData.collateralAmountToGive += collateralAmount;\n } else if (action == ActionType.borrow) {\n (vaultID, stablecoinAmount) = abi.decode(datas[i], (uint256, uint256));\n if (vaultID == 0) vaultID = vaultIDCount;\n stablecoinAmount = _borrow(vaultID, stablecoinAmount, oracleValue, newInterestAccumulator);\n paymentData.stablecoinAmountToGive += stablecoinAmount;\n } else if (action == ActionType.getDebtIn) {\n address vaultManager;\n uint256 dstVaultID;\n (vaultID, vaultManager, dstVaultID, stablecoinAmount) = abi.decode(\n datas[i],\n (uint256, address, uint256, uint256)\n );\n if (vaultID == 0) vaultID = vaultIDCount;\n _getDebtIn(\n vaultID,\n IVaultManager(vaultManager),\n dstVaultID,\n stablecoinAmount,\n oracleValue,\n newInterestAccumulator\n );\n }\n }\n }\n }\n\n // Processing the different cases for the repayment, there are 4 of them:\n // - (1) Stablecoins to receive + collateral to send\n // - (2) Stablecoins to receive + collateral to receive\n // - (3) Stablecoins to send + collateral to send\n // - (4) Stablecoins to send + collateral to receive\n if (paymentData.stablecoinAmountToReceive >= paymentData.stablecoinAmountToGive) {\n uint256 stablecoinPayment = paymentData.stablecoinAmountToReceive - paymentData.stablecoinAmountToGive;\n if (paymentData.collateralAmountToGive >= paymentData.collateralAmountToReceive) {\n // In the case where all amounts are null, the function will enter here and nothing will be done\n // for the repayment\n _handleRepay(\n // Collateral payment is the difference between what to give and what to receive\n paymentData.collateralAmountToGive - paymentData.collateralAmountToReceive,\n stablecoinPayment,\n from,\n to,\n who,\n repayData\n );\n } else {\n if (stablecoinPayment != 0) stablecoin.burnFrom(stablecoinPayment, from, msg.sender);\n // In this case the collateral amount is necessarily non null\n collateral.safeTransferFrom(\n msg.sender,\n address(this),\n paymentData.collateralAmountToReceive - paymentData.collateralAmountToGive\n );\n }\n } else {\n uint256 stablecoinPayment = paymentData.stablecoinAmountToGive - paymentData.stablecoinAmountToReceive;\n // `stablecoinPayment` is strictly positive in this case\n stablecoin.mint(to, stablecoinPayment);\n if (paymentData.collateralAmountToGive > paymentData.collateralAmountToReceive) {\n collateral.safeTransfer(to, paymentData.collateralAmountToGive - paymentData.collateralAmountToReceive);\n } else {\n uint256 collateralPayment = paymentData.collateralAmountToReceive - paymentData.collateralAmountToGive;\n if (collateralPayment != 0) {\n if (repayData.length != 0) {\n ISwapper(who).swap(\n IERC20(address(stablecoin)),\n collateral,\n msg.sender,\n // As per the `ISwapper` interface, we must first give the amount of token owed by the address before\n // the amount of token it (or another related address) obtained\n collateralPayment,\n stablecoinPayment,\n repayData\n );\n }\n collateral.safeTransferFrom(msg.sender, address(this), collateralPayment);\n }\n }\n }\n }\n\n /// @inheritdoc IVaultManagerFunctions\n function getDebtOut(\n uint256 vaultID,\n uint256 stablecoinAmount,\n uint256 senderBorrowFee,\n uint256 senderRepayFee\n ) external whenNotPaused {\n if (!treasury.isVaultManager(msg.sender)) revert NotVaultManager();\n // Getting debt out of a vault is equivalent to repaying a portion of your debt, and this could leave exploits:\n // someone could borrow from a vault and transfer its debt to a `VaultManager` contract where debt repayment will\n // be cheaper: in which case we're making people pay the delta\n uint256 _repayFee;\n if (repayFee > senderRepayFee) {\n _repayFee = repayFee - senderRepayFee;\n }\n // Checking the delta of borrow fees to eliminate the risk of exploits here: a similar thing could happen: people\n // could mint from where it is cheap to mint and then transfer their debt to places where it is more expensive\n // to mint\n uint256 _borrowFee;\n if (senderBorrowFee > borrowFee) {\n _borrowFee = senderBorrowFee - borrowFee;\n }\n\n uint256 stablecoinAmountLessFeePaid = (stablecoinAmount *\n (BASE_PARAMS - _repayFee) *\n (BASE_PARAMS - _borrowFee)) / (BASE_PARAMS**2);\n surplus += stablecoinAmount - stablecoinAmountLessFeePaid;\n _repayDebt(vaultID, stablecoinAmountLessFeePaid, 0);\n }\n\n // =============================== VIEW FUNCTIONS ==============================\n\n /// @inheritdoc IVaultManagerFunctions\n function getVaultDebt(uint256 vaultID) external view returns (uint256) {\n return (vaultData[vaultID].normalizedDebt * _calculateCurrentInterestAccumulator()) / BASE_INTEREST;\n }\n\n /// @inheritdoc IVaultManagerFunctions\n function getTotalDebt() external view returns (uint256) {\n return (totalNormalizedDebt * _calculateCurrentInterestAccumulator()) / BASE_INTEREST;\n }\n\n /// @notice Checks whether a given vault is liquidable and if yes gives information regarding its liquidation\n /// @param vaultID ID of the vault to check\n /// @param liquidator Address of the liquidator which will be performing the liquidation\n /// @return liqOpp Description of the opportunity of liquidation\n /// @dev This function will revert if it's called on a vault that does not exist\n function checkLiquidation(uint256 vaultID, address liquidator)\n external\n view\n returns (LiquidationOpportunity memory liqOpp)\n {\n liqOpp = _checkLiquidation(\n vaultData[vaultID],\n liquidator,\n oracle.read(),\n _calculateCurrentInterestAccumulator()\n );\n }\n\n // ====================== INTERNAL UTILITY VIEW FUNCTIONS ======================\n\n /// @notice Computes the health factor of a given vault. This can later be used to check whether a given vault is solvent\n /// (i.e. should be liquidated or not)\n /// @param vault Data of the vault to check\n /// @param oracleValue Oracle value at the time of the call (it is in the base of the stablecoin, that is for agTokens 10**18)\n /// @param newInterestAccumulator Value of the `interestAccumulator` at the time of the call\n /// @return healthFactor Health factor of the vault: if it's inferior to 1 (`BASE_PARAMS` in fact) this means that the vault can be liquidated\n /// @return currentDebt Current value of the debt of the vault (taking into account interest)\n /// @return collateralAmountInStable Collateral in the vault expressed in stablecoin value\n function _isSolvent(\n Vault memory vault,\n uint256 oracleValue,\n uint256 newInterestAccumulator\n )\n internal\n view\n returns (\n uint256 healthFactor,\n uint256 currentDebt,\n uint256 collateralAmountInStable\n )\n {\n currentDebt = (vault.normalizedDebt * newInterestAccumulator) / BASE_INTEREST;\n collateralAmountInStable = (vault.collateralAmount * oracleValue) / _collatBase;\n if (currentDebt == 0) healthFactor = type(uint256).max;\n else healthFactor = (collateralAmountInStable * collateralFactor) / currentDebt;\n }\n\n /// @notice Calculates the current value of the `interestAccumulator` without updating the value\n /// in storage\n /// @dev This function avoids expensive exponentiation and the calculation is performed using a binomial approximation\n /// (1+x)^n = 1+n*x+[n/2*(n-1)]*x^2+[n/6*(n-1)*(n-2)*x^3...\n /// @dev The approximation slightly undercharges borrowers with the advantage of a great gas cost reduction\n /// @dev This function was mostly inspired from Aave implementation\n function _calculateCurrentInterestAccumulator() internal view returns (uint256) {\n uint256 exp = block.timestamp - lastInterestAccumulatorUpdated;\n uint256 ratePerSecond = interestRate;\n if (exp == 0 || ratePerSecond == 0) return interestAccumulator;\n uint256 expMinusOne = exp - 1;\n uint256 expMinusTwo = exp > 2 ? exp - 2 : 0;\n uint256 basePowerTwo = (ratePerSecond * ratePerSecond + HALF_BASE_INTEREST) / BASE_INTEREST;\n uint256 basePowerThree = (basePowerTwo * ratePerSecond + HALF_BASE_INTEREST) / BASE_INTEREST;\n uint256 secondTerm = (exp * expMinusOne * basePowerTwo) / 2;\n uint256 thirdTerm = (exp * expMinusOne * expMinusTwo * basePowerThree) / 6;\n return (interestAccumulator * (BASE_INTEREST + ratePerSecond * exp + secondTerm + thirdTerm)) / BASE_INTEREST;\n }\n\n // ================= INTERNAL UTILITY STATE-MODIFYING FUNCTIONS ================\n\n /// @notice Closes a vault without handling the repayment of the concerned address\n /// @param vaultID ID of the vault to close\n /// @param oracleValue Oracle value at the start of the call\n /// @param newInterestAccumulator Interest rate accumulator value at the start of the call\n /// @return Current debt of the vault to be repaid\n /// @return Value of the collateral in the vault to reimburse\n /// @dev The returned values are here to facilitate composability between calls\n function _closeVault(\n uint256 vaultID,\n uint256 oracleValue,\n uint256 newInterestAccumulator\n ) internal onlyApprovedOrOwner(msg.sender, vaultID) returns (uint256, uint256) {\n Vault memory vault = vaultData[vaultID];\n (uint256 healthFactor, uint256 currentDebt, ) = _isSolvent(vault, oracleValue, newInterestAccumulator);\n if (healthFactor <= BASE_PARAMS) revert InsolventVault();\n totalNormalizedDebt -= vault.normalizedDebt;\n _burn(vaultID);\n uint256 currentDebtPlusRepayFee = (currentDebt * BASE_PARAMS) / (BASE_PARAMS - repayFee);\n surplus += currentDebtPlusRepayFee - currentDebt;\n return (currentDebtPlusRepayFee, vault.collateralAmount);\n }\n\n /// @notice Increases the collateral balance of a vault\n /// @param vaultID ID of the vault to increase the collateral balance of\n /// @param collateralAmount Amount by which increasing the collateral balance of\n function _addCollateral(uint256 vaultID, uint256 collateralAmount) internal {\n if (!_exists(vaultID)) revert NonexistentVault();\n _checkpointCollateral(vaultID, collateralAmount, true);\n vaultData[vaultID].collateralAmount += collateralAmount;\n emit CollateralAmountUpdated(vaultID, collateralAmount, 1);\n }\n\n /// @notice Decreases the collateral balance from a vault (without proceeding to collateral transfers)\n /// @param vaultID ID of the vault to decrease the collateral balance of\n /// @param collateralAmount Amount of collateral to reduce the balance of\n /// @param oracleValue Oracle value at the start of the call (given here to avoid double computations)\n /// @param interestAccumulator_ Value of the interest rate accumulator (potentially zero if it has not been\n /// computed yet)\n function _removeCollateral(\n uint256 vaultID,\n uint256 collateralAmount,\n uint256 oracleValue,\n uint256 interestAccumulator_\n ) internal onlyApprovedOrOwner(msg.sender, vaultID) {\n _checkpointCollateral(vaultID, collateralAmount, false);\n vaultData[vaultID].collateralAmount -= collateralAmount;\n (uint256 healthFactor, , ) = _isSolvent(vaultData[vaultID], oracleValue, interestAccumulator_);\n if (healthFactor <= BASE_PARAMS) revert InsolventVault();\n emit CollateralAmountUpdated(vaultID, collateralAmount, 0);\n }\n\n /// @notice Increases the debt balance of a vault and takes into account borrowing fees\n /// @param vaultID ID of the vault to increase borrow balance of\n /// @param stablecoinAmount Amount of stablecoins to borrow\n /// @param oracleValue Oracle value at the start of the call\n /// @param newInterestAccumulator Value of the interest rate accumulator\n /// @return toMint Amount of stablecoins to mint\n function _borrow(\n uint256 vaultID,\n uint256 stablecoinAmount,\n uint256 oracleValue,\n uint256 newInterestAccumulator\n ) internal onlyApprovedOrOwner(msg.sender, vaultID) returns (uint256 toMint) {\n stablecoinAmount = _increaseDebt(vaultID, stablecoinAmount, oracleValue, newInterestAccumulator);\n uint256 borrowFeePaid = (borrowFee * stablecoinAmount) / BASE_PARAMS;\n surplus += borrowFeePaid;\n toMint = stablecoinAmount - borrowFeePaid;\n }\n\n /// @notice Gets debt in a vault from another vault potentially in another `VaultManager` contract\n /// @param srcVaultID ID of the vault from this contract for which growing debt\n /// @param vaultManager Address of the `VaultManager` where the targeted vault is\n /// @param dstVaultID ID of the vault in the target contract\n /// @param stablecoinAmount Amount of stablecoins to grow the debt of. This amount will be converted\n /// to a normalized value in both `VaultManager` contracts\n /// @param oracleValue Oracle value at the start of the call (potentially zero if it has not been computed yet)\n /// @param newInterestAccumulator Value of the interest rate accumulator (potentially zero if it has not been\n /// computed yet)\n /// @dev A solvency check is performed after the debt increase in the source `vaultID`\n /// @dev Only approved addresses by the source vault owner can perform this action, however any vault\n /// from any vaultManager contract can see its debt reduced by this means\n function _getDebtIn(\n uint256 srcVaultID,\n IVaultManager vaultManager,\n uint256 dstVaultID,\n uint256 stablecoinAmount,\n uint256 oracleValue,\n uint256 newInterestAccumulator\n ) internal onlyApprovedOrOwner(msg.sender, srcVaultID) {\n emit DebtTransferred(srcVaultID, dstVaultID, address(vaultManager), stablecoinAmount);\n // The `stablecoinAmount` needs to be rounded down in the `_increaseDebt` function to reduce the room for exploits\n stablecoinAmount = _increaseDebt(srcVaultID, stablecoinAmount, oracleValue, newInterestAccumulator);\n if (address(vaultManager) == address(this)) {\n // No repayFees taken in this case, otherwise the same stablecoin may end up paying fees twice\n _repayDebt(dstVaultID, stablecoinAmount, newInterestAccumulator);\n } else {\n // No need to check the integrity of `VaultManager` here because `_getDebtIn` can be entered only through the\n // `angle` function which is non reentrant. Also, `getDebtOut` failing would be at the attacker loss, as they\n // would get their debt increasing in the current vault without decreasing it in the remote vault.\n vaultManager.getDebtOut(dstVaultID, stablecoinAmount, borrowFee, repayFee);\n }\n }\n\n /// @notice Increases the debt of a given vault and verifies that this vault is still solvent\n /// @param vaultID ID of the vault to increase the debt of\n /// @param stablecoinAmount Amount of stablecoin to increase the debt of: this amount is converted in\n /// normalized debt using the pre-computed (or not) `newInterestAccumulator` value\n /// @param oracleValue Oracle value at the start of the call (given here to avoid double computations)\n /// @param newInterestAccumulator Value of the interest rate accumulator (potentially zero if it has not been\n /// computed yet)\n /// @return Amount of stablecoins to issue from this debt increase\n /// @dev The `stablecoinAmount` outputted need to be rounded down with respect to the change amount so that\n /// amount of stablecoins minted is smaller than the debt increase\n function _increaseDebt(\n uint256 vaultID,\n uint256 stablecoinAmount,\n uint256 oracleValue,\n uint256 newInterestAccumulator\n ) internal returns (uint256) {\n // We normalize the amount by dividing it by `newInterestAccumulator`. This makes accounting easier, since\n // it allows us to process all (past and future) debts like debts created at the inception of the contract.\n uint256 changeAmount = (stablecoinAmount * BASE_INTEREST) / newInterestAccumulator;\n // if there was no previous debt, we have to check that the debt creation will be higher than `dust`\n if (vaultData[vaultID].normalizedDebt == 0)\n if (stablecoinAmount <= dust) revert DustyLeftoverAmount();\n vaultData[vaultID].normalizedDebt += changeAmount;\n totalNormalizedDebt += changeAmount;\n if (totalNormalizedDebt * newInterestAccumulator > debtCeiling * BASE_INTEREST) revert DebtCeilingExceeded();\n (uint256 healthFactor, , ) = _isSolvent(vaultData[vaultID], oracleValue, newInterestAccumulator);\n if (healthFactor <= BASE_PARAMS) revert InsolventVault();\n emit InternalDebtUpdated(vaultID, changeAmount, 1);\n return (changeAmount * newInterestAccumulator) / BASE_INTEREST;\n }\n\n /// @notice Decreases the debt of a given vault and verifies that this vault still has an amount of debt superior\n /// to a dusty amount or no debt at all\n /// @param vaultID ID of the vault to decrease the debt of\n /// @param stablecoinAmount Amount of stablecoin to decrease the debt of: this amount is converted in\n /// normalized debt using the pre-computed (or not) `newInterestAccumulator` value\n /// To repay the whole debt, one can pass `type(uint256).max`\n /// @param newInterestAccumulator Value of the interest rate accumulator (potentially zero if it has not been\n /// computed yet, like in `getDebtOut`)\n /// @return Amount of stablecoins to be burnt to correctly repay the debt\n /// @dev If `stablecoinAmount` is `type(uint256).max`, this function will repay all the debt of the vault\n function _repayDebt(\n uint256 vaultID,\n uint256 stablecoinAmount,\n uint256 newInterestAccumulator\n ) internal returns (uint256) {\n if (newInterestAccumulator == 0) newInterestAccumulator = _accrue();\n uint256 newVaultNormalizedDebt = vaultData[vaultID].normalizedDebt;\n // To save one variable declaration, `changeAmount` is first expressed in stablecoin amount before being converted\n // to a normalized amount. Here we first store the maximum amount that can be repaid given the current debt\n uint256 changeAmount = (newVaultNormalizedDebt * newInterestAccumulator) / BASE_INTEREST;\n // In some situations (e.g. liquidations), the `stablecoinAmount` is rounded above and we want to make\n // sure to avoid underflows in all situations\n if (stablecoinAmount >= changeAmount) {\n stablecoinAmount = changeAmount;\n changeAmount = newVaultNormalizedDebt;\n } else {\n changeAmount = (stablecoinAmount * BASE_INTEREST) / newInterestAccumulator;\n }\n newVaultNormalizedDebt -= changeAmount;\n totalNormalizedDebt -= changeAmount;\n if (newVaultNormalizedDebt != 0 && newVaultNormalizedDebt * newInterestAccumulator <= dust * BASE_INTEREST)\n revert DustyLeftoverAmount();\n vaultData[vaultID].normalizedDebt = newVaultNormalizedDebt;\n emit InternalDebtUpdated(vaultID, changeAmount, 0);\n return stablecoinAmount;\n }\n\n /// @notice Handles the simultaneous repayment of stablecoins with a transfer of collateral\n /// @param collateralAmountToGive Amount of collateral the contract should give\n /// @param stableAmountToRepay Amount of stablecoins the contract should burn from the call\n /// @param from Address from which stablecoins should be burnt: it should be the `msg.sender` or at least\n /// approved by it\n /// @param to Address to which collateral should be sent\n /// @param who Address which should be notified if needed of the transfer\n /// @param data Data to pass to the `who` contract for it to successfully give the correct amount of stablecoins\n /// to the `from` address\n /// @dev This function allows for capital-efficient liquidations and repayments of loans\n function _handleRepay(\n uint256 collateralAmountToGive,\n uint256 stableAmountToRepay,\n address from,\n address to,\n address who,\n bytes memory data\n ) internal {\n if (collateralAmountToGive != 0) collateral.safeTransfer(to, collateralAmountToGive);\n if (stableAmountToRepay != 0) {\n if (data.length != 0) {\n ISwapper(who).swap(\n collateral,\n IERC20(address(stablecoin)),\n from,\n stableAmountToRepay,\n collateralAmountToGive,\n data\n );\n }\n stablecoin.burnFrom(stableAmountToRepay, from, msg.sender);\n }\n }\n\n // ====================== TREASURY RELATIONSHIP FUNCTIONS ======================\n\n /// @inheritdoc IVaultManagerFunctions\n function accrueInterestToTreasury() external onlyTreasury returns (uint256 surplusValue, uint256 badDebtValue) {\n _accrue();\n surplusValue = surplus;\n badDebtValue = badDebt;\n surplus = 0;\n badDebt = 0;\n if (surplusValue >= badDebtValue) {\n surplusValue -= badDebtValue;\n badDebtValue = 0;\n stablecoin.mint(address(treasury), surplusValue);\n } else {\n badDebtValue -= surplusValue;\n surplusValue = 0;\n }\n emit AccruedToTreasury(surplusValue, badDebtValue);\n }\n\n /// @notice Accrues interest accumulated across all vaults to the surplus and updates the `interestAccumulator`\n /// @return newInterestAccumulator Computed value of the interest accumulator\n /// @dev It should also be called when updating the value of the per second interest rate or when the `totalNormalizedDebt`\n /// value is about to change\n function _accrue() internal returns (uint256 newInterestAccumulator) {\n newInterestAccumulator = _calculateCurrentInterestAccumulator();\n uint256 interestAccrued = (totalNormalizedDebt * (newInterestAccumulator - interestAccumulator)) /\n BASE_INTEREST;\n surplus += interestAccrued;\n interestAccumulator = newInterestAccumulator;\n lastInterestAccumulatorUpdated = block.timestamp;\n emit InterestAccumulatorUpdated(newInterestAccumulator, block.timestamp);\n return newInterestAccumulator;\n }\n\n // ================================ LIQUIDATIONS ===============================\n\n /// @notice Liquidates an ensemble of vaults specified by their IDs\n /// @dev This function is a simplified wrapper of the function below. It is built to remove for liquidators the need to specify\n /// a `who` and a `data` parameter\n function liquidate(\n uint256[] memory vaultIDs,\n uint256[] memory amounts,\n address from,\n address to\n ) external returns (LiquidatorData memory) {\n return liquidate(vaultIDs, amounts, from, to, address(0), new bytes(0));\n }\n\n /// @notice Liquidates an ensemble of vaults specified by their IDs\n /// @param vaultIDs List of the vaults to liquidate\n /// @param amounts Amount of stablecoin to bring for the liquidation of each vault\n /// @param from Address from which the stablecoins for the liquidation should be taken: this address should be the `msg.sender`\n /// or have received an approval\n /// @param to Address to which discounted collateral should be sent\n /// @param who Address of the contract to handle repayment of stablecoins from received collateral\n /// @param data Data to pass to the repayment contract in case of. If empty, liquidators simply have to bring the exact amount of\n /// stablecoins to get the discounted collateral. If not, it is used by the repayment contract to swap a portion or all\n /// of the collateral received to stablecoins to be sent to the `from` address. More details in the `_handleRepay` function\n /// @return liqData Data about the liquidation process for the liquidator to track everything that has been going on (like how much\n /// stablecoins have been repaid, how much collateral has been received)\n /// @dev This function will revert if it's called on a vault that cannot be liquidated or that does not exist\n function liquidate(\n uint256[] memory vaultIDs,\n uint256[] memory amounts,\n address from,\n address to,\n address who,\n bytes memory data\n ) public whenNotPaused nonReentrant returns (LiquidatorData memory liqData) {\n uint256 vaultIDsLength = vaultIDs.length;\n if (vaultIDsLength != amounts.length || vaultIDsLength == 0) revert IncompatibleLengths();\n // Stores all the data about an ongoing liquidation of multiple vaults\n liqData.oracleValue = oracle.read();\n liqData.newInterestAccumulator = _accrue();\n emit LiquidatedVaults(vaultIDs);\n for (uint256 i; i < vaultIDsLength; ++i) {\n Vault memory vault = vaultData[vaultIDs[i]];\n // Computing if liquidation can take place for a vault\n LiquidationOpportunity memory liqOpp = _checkLiquidation(\n vault,\n msg.sender,\n liqData.oracleValue,\n liqData.newInterestAccumulator\n );\n\n // Makes sure not to leave a dusty amount in the vault by either not liquidating too much\n // or everything\n if (\n (liqOpp.thresholdRepayAmount != 0 && amounts[i] >= liqOpp.thresholdRepayAmount) ||\n amounts[i] > liqOpp.maxStablecoinAmountToRepay\n ) amounts[i] = liqOpp.maxStablecoinAmountToRepay;\n\n // liqOpp.discount stores in fact `1-discount`\n uint256 collateralReleased = (amounts[i] * BASE_PARAMS * _collatBase) /\n (liqOpp.discount * liqData.oracleValue);\n\n _checkpointCollateral(\n vaultIDs[i],\n vault.collateralAmount <= collateralReleased ? vault.collateralAmount : collateralReleased,\n false\n );\n // Because we're rounding up in some divisions, `collateralReleased` can be greater than the `collateralAmount` of the vault\n // In this case, `stablecoinAmountToReceive` is still rounded up\n if (vault.collateralAmount <= collateralReleased) {\n collateralReleased = vault.collateralAmount;\n // Remove all the vault's debt (debt repayed + bad debt) from VaultManager totalDebt\n totalNormalizedDebt -= vault.normalizedDebt;\n // Reinitializing the `vaultID`: we're not burning the vault in this case for integration purposes\n delete vaultData[vaultIDs[i]];\n {\n uint256 debtReimbursed = (amounts[i] * liquidationSurcharge) / BASE_PARAMS;\n liqData.badDebtFromLiquidation += debtReimbursed < liqOpp.currentDebt\n ? liqOpp.currentDebt - debtReimbursed\n : 0;\n }\n // There may be an edge case in which: `amounts[i] = (currentDebt * BASE_PARAMS) / surcharge + 1`\n // In this case, as long as `surcharge < BASE_PARAMS`, there cannot be any underflow in the operation\n // above\n emit InternalDebtUpdated(vaultIDs[i], vault.normalizedDebt, 0);\n } else {\n vaultData[vaultIDs[i]].collateralAmount -= collateralReleased;\n _repayDebt(\n vaultIDs[i],\n (amounts[i] * liquidationSurcharge) / BASE_PARAMS,\n liqData.newInterestAccumulator\n );\n }\n liqData.collateralAmountToGive += collateralReleased;\n liqData.stablecoinAmountToReceive += amounts[i];\n }\n // Normalization of good and bad debt is already handled in the `accrueInterestToTreasury` function\n surplus += (liqData.stablecoinAmountToReceive * (BASE_PARAMS - liquidationSurcharge)) / BASE_PARAMS;\n badDebt += liqData.badDebtFromLiquidation;\n _handleRepay(liqData.collateralAmountToGive, liqData.stablecoinAmountToReceive, from, to, who, data);\n }\n\n /// @notice Internal version of the `checkLiquidation` function\n /// @dev This function takes two additional parameters as when entering this function `oracleValue`\n /// and `newInterestAccumulator` should have always been computed\n function _checkLiquidation(\n Vault memory vault,\n address liquidator,\n uint256 oracleValue,\n uint256 newInterestAccumulator\n ) internal view returns (LiquidationOpportunity memory liqOpp) {\n // Checking if the vault can be liquidated\n (uint256 healthFactor, uint256 currentDebt, uint256 collateralAmountInStable) = _isSolvent(\n vault,\n oracleValue,\n newInterestAccumulator\n );\n // Health factor of a vault that does not exist is `type(uint256).max`\n if (healthFactor >= BASE_PARAMS) revert HealthyVault();\n\n uint256 liquidationDiscount = (_computeLiquidationBoost(liquidator) * (BASE_PARAMS - healthFactor)) /\n BASE_PARAMS;\n // In fact `liquidationDiscount` is stored here as 1 minus discount to save some computation costs\n // This value is necessarily != 0 as `maxLiquidationDiscount < BASE_PARAMS`\n liquidationDiscount = liquidationDiscount >= maxLiquidationDiscount\n ? BASE_PARAMS - maxLiquidationDiscount\n : BASE_PARAMS - liquidationDiscount;\n // Same for the surcharge here: it's in fact 1 - the fee taken by the protocol\n uint256 surcharge = liquidationSurcharge;\n // Checking if we're in a situation where the health factor is an increasing or a decreasing function of the\n // amount repaid\n uint256 maxAmountToRepay;\n uint256 thresholdRepayAmount;\n // In the first case, the health factor is an increasing function of the stablecoin amount to repay,\n // this means that the liquidator can bring the vault to the target health ratio\n if (healthFactor * liquidationDiscount * surcharge >= collateralFactor * BASE_PARAMS**2) {\n // This is the max amount to repay that will bring the person to the target health factor\n // Denom is always positive when a vault gets liquidated in this case and when the health factor\n // is an increasing function of the amount of stablecoins repaid\n // And given that most parameters are in base 9, the numerator can very hardly overflow here\n maxAmountToRepay =\n ((targetHealthFactor * currentDebt - collateralAmountInStable * collateralFactor) *\n BASE_PARAMS *\n liquidationDiscount) /\n (surcharge * targetHealthFactor * liquidationDiscount - (BASE_PARAMS**2) * collateralFactor);\n // The quantity below tends to be rounded in the above direction, which means that governance or guardians should\n // set the `targetHealthFactor` accordingly\n // Need to check for the dust: liquidating should not leave a dusty amount in the vault\n if (currentDebt * BASE_PARAMS <= maxAmountToRepay * surcharge + dust * BASE_PARAMS) {\n // If liquidating to the target threshold would leave a dusty amount: the liquidator can repay all\n // We're rounding up the max amount to repay to make sure all the debt ends up being paid\n // and we're computing again the real value of the debt to avoid propagation of rounding errors\n maxAmountToRepay =\n (vault.normalizedDebt * newInterestAccumulator * BASE_PARAMS) /\n (surcharge * BASE_INTEREST) +\n 1;\n // In this case the threshold amount is such that it leaves just enough dust: amount is rounded\n // down such that if a liquidator repays this amount then there would be more than `dust` left in\n // the liquidated vault\n if (currentDebt > dust)\n thresholdRepayAmount = ((currentDebt - dust) * BASE_PARAMS) / surcharge;\n // If there is from the beginning a dusty debt (because of an implementation upgrade), then\n // liquidator should repay everything that's left\n else thresholdRepayAmount = 1;\n }\n } else {\n // In all cases the liquidator can repay stablecoins such that they'll end up getting exactly the collateral\n // in the liquidated vault\n // Rounding up to make sure all gets liquidated in this case: the liquidator will never get more than the collateral\n // amount in the vault however: we're performing the computation of the `collateralAmountInStable` again to avoid\n // propagation of rounding errors\n maxAmountToRepay =\n (vault.collateralAmount * liquidationDiscount * oracleValue) /\n (BASE_PARAMS * _collatBase) +\n 1;\n // It should however make sure not to leave a dusty amount of collateral (in stablecoin value) in the vault\n if (collateralAmountInStable > _dustCollateral)\n // There's no issue with this amount being rounded down\n thresholdRepayAmount =\n ((collateralAmountInStable - _dustCollateral) * liquidationDiscount) /\n BASE_PARAMS;\n // If there is from the beginning a dusty amount of collateral, liquidator should repay everything that's left\n else thresholdRepayAmount = 1;\n }\n liqOpp.maxStablecoinAmountToRepay = maxAmountToRepay;\n liqOpp.maxCollateralAmountGiven =\n (maxAmountToRepay * BASE_PARAMS * _collatBase) /\n (oracleValue * liquidationDiscount);\n liqOpp.thresholdRepayAmount = thresholdRepayAmount;\n liqOpp.discount = liquidationDiscount;\n liqOpp.currentDebt = currentDebt;\n }\n\n // ================================== SETTERS ==================================\n\n /// @notice Sets parameters encoded as uint64\n /// @param param Value for the parameter\n /// @param what Parameter to change\n /// @dev This function performs the required checks when updating a parameter\n /// @dev When setting parameters governance or the guardian should make sure that when `HF < CF/((1-surcharge)(1-discount))`\n /// and hence when liquidating a vault is going to decrease its health factor, `discount = max discount`.\n /// Otherwise, it may be profitable for the liquidator to liquidate in multiple times: as it will decrease\n /// the HF and therefore increase the discount between each time\n function setUint64(uint64 param, bytes32 what) external onlyGovernorOrGuardian {\n if (what == \"CF\") {\n if (param > liquidationSurcharge) revert TooHighParameterValue();\n collateralFactor = param;\n } else if (what == \"THF\") {\n if (param < BASE_PARAMS) revert TooSmallParameterValue();\n targetHealthFactor = param;\n } else if (what == \"BF\") {\n if (param > BASE_PARAMS) revert TooHighParameterValue();\n borrowFee = param;\n } else if (what == \"RF\") {\n // As liquidation surcharge is stored as `1-fee` and as we need `repayFee` to be smaller\n // then the liquidation surcharge, then we need to have:\n // `liquidationSurcharge <= BASE_PARAMS - repayFee` and as such `liquidationSurcharge + repayFee <= BASE_PARAMS`\n if (param + liquidationSurcharge > BASE_PARAMS) revert TooHighParameterValue();\n repayFee = param;\n } else if (what == \"IR\") {\n _accrue();\n interestRate = param;\n } else if (what == \"LS\") {\n if (collateralFactor > param || param + repayFee > BASE_PARAMS) revert InvalidParameterValue();\n liquidationSurcharge = param;\n } else if (what == \"MLD\") {\n if (param > BASE_PARAMS) revert TooHighParameterValue();\n maxLiquidationDiscount = param;\n } else {\n revert InvalidParameterType();\n }\n emit FiledUint64(param, what);\n }\n\n /// @notice Sets `debtCeiling`\n /// @param _debtCeiling New value for `debtCeiling`\n /// @dev `debtCeiling` should not be bigger than `type(uint256).max / 10**27` otherwise there could be overflows\n function setDebtCeiling(uint256 _debtCeiling) external onlyGovernorOrGuardian {\n debtCeiling = _debtCeiling;\n emit DebtCeilingUpdated(_debtCeiling);\n }\n\n /// @notice Sets the parameters for the liquidation booster which encodes the slope of the discount\n function setLiquidationBoostParameters(\n address _veBoostProxy,\n uint256[] memory xBoost,\n uint256[] memory yBoost\n ) external virtual onlyGovernorOrGuardian {\n if (yBoost[0] == 0) revert InvalidSetOfParameters();\n yLiquidationBoost = yBoost;\n emit LiquidationBoostParametersUpdated(_veBoostProxy, xBoost, yBoost);\n }\n\n /// @notice Pauses external permissionless functions of the contract\n function togglePause() external onlyGovernorOrGuardian {\n paused = !paused;\n }\n\n /// @notice Changes the ERC721 metadata URI\n function setBaseURI(string memory baseURI_) external onlyGovernorOrGuardian {\n _baseURI = baseURI_;\n }\n\n /// @notice Changes the whitelisting of an address\n /// @param target Address to toggle\n /// @dev If the `target` address is the zero address then this function toggles whitelisting\n /// for all addresses\n function toggleWhitelist(address target) external onlyGovernor {\n if (target != address(0)) {\n isWhitelisted[target] = 1 - isWhitelisted[target];\n } else {\n whitelistingActivated = !whitelistingActivated;\n }\n }\n\n /// @notice Changes the reference to the oracle contract used to get the price of the oracle\n /// @param _oracle Reference to the oracle contract\n function setOracle(address _oracle) external onlyGovernor {\n if (IOracle(_oracle).treasury() != treasury) revert InvalidTreasury();\n oracle = IOracle(_oracle);\n }\n\n /// @notice Sets the dust variables\n /// @param _dust New minimum debt allowed\n /// @param dustCollateral_ New minimum collateral allowed in a vault after a liquidation\n /// @dev dustCollateral_ is in stable value\n function setDusts(uint256 _dust, uint256 dustCollateral_) external onlyGovernor {\n dust = _dust;\n _dustCollateral = dustCollateral_;\n }\n\n /// @inheritdoc IVaultManagerFunctions\n function setTreasury(address _treasury) external onlyTreasury {\n treasury = ITreasury(_treasury);\n // This function makes sure to propagate the change to the associated contract\n // even though a single oracle contract could be used in different places\n oracle.setTreasury(_treasury);\n }\n\n // ============================= VIRTUAL FUNCTIONS =============================\n\n /// @notice Computes the liquidation boost of a given address, that is the slope of the discount function\n /// @return The slope of the discount function\n function _computeLiquidationBoost(address) internal view virtual returns (uint256) {\n return yLiquidationBoost[0];\n }\n\n /// @notice Hook called before any collateral internal changes\n /// @param vaultID Vault which sees its collateral amount changed\n /// @param amount Collateral amount balance of the owner of vaultID increase/decrease\n /// @param add Whether the balance should be increased/decreased\n /// @param vaultID Vault which sees its collateral amount changed\n function _checkpointCollateral(\n uint256 vaultID,\n uint256 amount,\n bool add\n ) internal virtual {}\n}\n" + }, + "contracts/vaultManager/VaultManagerPermit.sol": { + "content": "// SPDX-License-Identifier: GPL-3.0\n\npragma solidity ^0.8.12;\n\nimport \"./VaultManagerERC721.sol\";\nimport \"../interfaces/external/IERC1271.sol\";\n\n/// @title VaultManagerPermit\n/// @author Angle Labs, Inc.\n/// @dev Base Implementation of permit functions for the `VaultManager` contract\nabstract contract VaultManagerPermit is Initializable, VaultManagerERC721 {\n using Address for address;\n\n mapping(address => uint256) private _nonces;\n /* solhint-disable var-name-mixedcase */\n bytes32 private _HASHED_NAME;\n bytes32 private _HASHED_VERSION;\n bytes32 private _PERMIT_TYPEHASH;\n /* solhint-enable var-name-mixedcase */\n\n error ExpiredDeadline();\n error InvalidSignature();\n\n //solhint-disable-next-line\n function __ERC721Permit_init(string memory _name) internal onlyInitializing {\n _PERMIT_TYPEHASH = keccak256(\n \"Permit(address owner,address spender,bool approved,uint256 nonce,uint256 deadline)\"\n );\n _HASHED_NAME = keccak256(bytes(_name));\n _HASHED_VERSION = keccak256(bytes(\"1\"));\n }\n\n /// @notice Allows an address to give or revoke approval for all its vaults to another address\n /// @param owner Address signing the permit and giving (or revoking) its approval for all the controlled vaults\n /// @param spender Address to give approval to\n /// @param approved Whether to give or revoke the approval\n /// @param deadline Deadline parameter for the signature to be valid\n /// @dev The `v`, `r`, and `s` parameters are used as signature data\n function permit(\n address owner,\n address spender,\n bool approved,\n uint256 deadline,\n uint8 v,\n bytes32 r,\n bytes32 s\n ) external {\n if (block.timestamp > deadline) revert ExpiredDeadline();\n // Additional signature checks performed in the `ECDSAUpgradeable.recover` function\n if (uint256(s) > 0x7FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF5D576E7357A4501DDFE92F46681B20A0 || (v != 27 && v != 28))\n revert InvalidSignature();\n\n bytes32 digest = keccak256(\n abi.encodePacked(\n \"\\x19\\x01\",\n _domainSeparatorV4(),\n keccak256(\n abi.encode(\n _PERMIT_TYPEHASH,\n // 0x3f43a9c6bafb5c7aab4e0cfe239dc5d4c15caf0381c6104188191f78a6640bd8,\n owner,\n spender,\n approved,\n _useNonce(owner),\n deadline\n )\n )\n )\n );\n if (owner.isContract()) {\n if (IERC1271(owner).isValidSignature(digest, abi.encodePacked(r, s, v)) != 0x1626ba7e)\n revert InvalidSignature();\n } else {\n address signer = ecrecover(digest, v, r, s);\n if (signer != owner || signer == address(0)) revert InvalidSignature();\n }\n\n _setApprovalForAll(owner, spender, approved);\n }\n\n /// @notice Returns the current nonce for an `owner` address\n function nonces(address owner) public view returns (uint256) {\n return _nonces[owner];\n }\n\n /// @notice Returns the domain separator for the current chain.\n // solhint-disable-next-line func-name-mixedcase\n function DOMAIN_SEPARATOR() external view returns (bytes32) {\n return _domainSeparatorV4();\n }\n\n /// @notice Internal version of the `DOMAIN_SEPARATOR` function\n function _domainSeparatorV4() internal view returns (bytes32) {\n return\n keccak256(\n abi.encode(\n // keccak256('EIP712Domain(string name,string version,uint256 chainId,address verifyingContract)')\n 0x8b73c3c69bb8fe3d512ecc4cf759cc79239f7b179b0ffacaa9a75d522b39400f,\n _HASHED_NAME,\n _HASHED_VERSION,\n block.chainid,\n address(this)\n )\n );\n }\n\n /// @notice Consumes a nonce for an address: returns the current value and increments it\n function _useNonce(address owner) internal returns (uint256 current) {\n current = _nonces[owner];\n _nonces[owner] = current + 1;\n }\n\n uint256[49] private __gap;\n}\n" + }, + "contracts/vaultManager/VaultManagerERC721.sol": { + "content": "// SPDX-License-Identifier: GPL-3.0\n\npragma solidity ^0.8.12;\n\nimport \"./VaultManagerStorage.sol\";\n\n/// @title VaultManagerERC721\n/// @author Angle Labs, Inc.\n/// @dev Base ERC721 Implementation of VaultManager\nabstract contract VaultManagerERC721 is IERC721MetadataUpgradeable, VaultManagerStorage {\n using SafeERC20 for IERC20;\n using Address for address;\n\n /// @inheritdoc IERC721MetadataUpgradeable\n string public name;\n /// @inheritdoc IERC721MetadataUpgradeable\n string public symbol;\n\n // ================================= MODIFIERS =================================\n\n /// @notice Checks if the person interacting with the vault with `vaultID` is approved\n /// @param caller Address of the person seeking to interact with the vault\n /// @param vaultID ID of the concerned vault\n modifier onlyApprovedOrOwner(address caller, uint256 vaultID) {\n if (!_isApprovedOrOwner(caller, vaultID)) revert NotApproved();\n _;\n }\n\n // ================================ ERC721 LOGIC ===============================\n\n /// @notice Checks whether a given address is approved for a vault or owns this vault\n /// @param spender Address for which vault ownership should be checked\n /// @param vaultID ID of the vault to check\n /// @return Whether the `spender` address owns or is approved for `vaultID`\n function isApprovedOrOwner(address spender, uint256 vaultID) external view returns (bool) {\n return _isApprovedOrOwner(spender, vaultID);\n }\n\n /// @inheritdoc IERC721MetadataUpgradeable\n function tokenURI(uint256 vaultID) external view returns (string memory) {\n if (!_exists(vaultID)) revert NonexistentVault();\n // There is no vault with `vaultID` equal to 0, so the following variable is\n // always greater than zero\n uint256 temp = vaultID;\n uint256 digits;\n while (temp != 0) {\n ++digits;\n temp /= 10;\n }\n bytes memory buffer = new bytes(digits);\n while (vaultID != 0) {\n digits -= 1;\n buffer[digits] = bytes1(uint8(48 + uint256(vaultID % 10)));\n vaultID /= 10;\n }\n return bytes(_baseURI).length != 0 ? string(abi.encodePacked(_baseURI, string(buffer))) : \"\";\n }\n\n /// @inheritdoc IERC721Upgradeable\n function balanceOf(address owner) external view returns (uint256) {\n if (owner == address(0)) revert ZeroAddress();\n return _balances[owner];\n }\n\n /// @inheritdoc IERC721Upgradeable\n function ownerOf(uint256 vaultID) external view returns (address) {\n return _ownerOf(vaultID);\n }\n\n /// @inheritdoc IERC721Upgradeable\n function approve(address to, uint256 vaultID) external {\n address owner = _ownerOf(vaultID);\n if (to == owner) revert ApprovalToOwner();\n if (msg.sender != owner && !isApprovedForAll(owner, msg.sender)) revert NotApproved();\n\n _approve(to, vaultID);\n }\n\n /// @inheritdoc IERC721Upgradeable\n function getApproved(uint256 vaultID) external view returns (address) {\n if (!_exists(vaultID)) revert NonexistentVault();\n return _getApproved(vaultID);\n }\n\n /// @inheritdoc IERC721Upgradeable\n function setApprovalForAll(address operator, bool approved) external {\n _setApprovalForAll(msg.sender, operator, approved);\n }\n\n /// @inheritdoc IERC721Upgradeable\n function isApprovedForAll(address owner, address operator) public view returns (bool) {\n return _operatorApprovals[owner][operator] == 1;\n }\n\n /// @inheritdoc IERC721Upgradeable\n function transferFrom(\n address from,\n address to,\n uint256 vaultID\n ) external onlyApprovedOrOwner(msg.sender, vaultID) {\n _transfer(from, to, vaultID);\n }\n\n /// @inheritdoc IERC721Upgradeable\n function safeTransferFrom(\n address from,\n address to,\n uint256 vaultID\n ) external {\n safeTransferFrom(from, to, vaultID, \"\");\n }\n\n /// @inheritdoc IERC721Upgradeable\n function safeTransferFrom(\n address from,\n address to,\n uint256 vaultID,\n bytes memory _data\n ) public onlyApprovedOrOwner(msg.sender, vaultID) {\n _safeTransfer(from, to, vaultID, _data);\n }\n\n // ================================ ERC165 LOGIC ===============================\n\n /// @inheritdoc IERC165Upgradeable\n function supportsInterface(bytes4 interfaceId) external pure returns (bool) {\n return\n interfaceId == type(IERC721MetadataUpgradeable).interfaceId ||\n interfaceId == type(IERC721Upgradeable).interfaceId ||\n interfaceId == type(IVaultManager).interfaceId ||\n interfaceId == type(IERC165Upgradeable).interfaceId;\n }\n\n // ================== INTERNAL FUNCTIONS FOR THE ERC721 LOGIC ==================\n\n /// @notice Internal version of the `ownerOf` function\n function _ownerOf(uint256 vaultID) internal view returns (address owner) {\n owner = _owners[vaultID];\n if (owner == address(0)) revert NonexistentVault();\n }\n\n /// @notice Internal version of the `getApproved` function\n function _getApproved(uint256 vaultID) internal view returns (address) {\n return _vaultApprovals[vaultID];\n }\n\n /// @notice Internal version of the `safeTransferFrom` function (with the data parameter)\n function _safeTransfer(\n address from,\n address to,\n uint256 vaultID,\n bytes memory _data\n ) internal {\n _transfer(from, to, vaultID);\n if (!_checkOnERC721Received(from, to, vaultID, _data)) revert NonERC721Receiver();\n }\n\n /// @notice Checks whether a vault exists\n /// @param vaultID ID of the vault to check\n /// @return Whether `vaultID` has been created\n function _exists(uint256 vaultID) internal view returns (bool) {\n return _owners[vaultID] != address(0);\n }\n\n /// @notice Internal version of the `isApprovedOrOwner` function\n function _isApprovedOrOwner(address spender, uint256 vaultID) internal view returns (bool) {\n // The following checks if the vault exists\n address owner = _ownerOf(vaultID);\n return (spender == owner || _getApproved(vaultID) == spender || _operatorApprovals[owner][spender] == 1);\n }\n\n /// @notice Internal version of the `createVault` function\n /// Mints `vaultID` and transfers it to `to`\n /// @dev This method is equivalent to the `_safeMint` method used in OpenZeppelin ERC721 contract\n /// @dev Emits a {Transfer} event\n function _mint(address to) internal returns (uint256 vaultID) {\n if (whitelistingActivated && (isWhitelisted[to] != 1 || isWhitelisted[msg.sender] != 1))\n revert NotWhitelisted();\n if (to == address(0)) revert ZeroAddress();\n\n unchecked {\n vaultIDCount += 1;\n }\n\n vaultID = vaultIDCount;\n _beforeTokenTransfer(address(0), to, vaultID);\n\n unchecked {\n _balances[to] += 1;\n }\n\n _owners[vaultID] = to;\n emit Transfer(address(0), to, vaultID);\n if (!_checkOnERC721Received(address(0), to, vaultID, \"\")) revert NonERC721Receiver();\n }\n\n /// @notice Destroys `vaultID`\n /// @dev `vaultID` must exist\n /// @dev Emits a {Transfer} event\n function _burn(uint256 vaultID) internal {\n address owner = _ownerOf(vaultID);\n\n _beforeTokenTransfer(owner, address(0), vaultID);\n // Clear approvals\n _approve(address(0), vaultID);\n // The following line cannot underflow as the owner's balance is necessarily\n // greater than 1\n unchecked {\n _balances[owner] -= 1;\n }\n delete _owners[vaultID];\n delete vaultData[vaultID];\n\n emit Transfer(owner, address(0), vaultID);\n }\n\n /// @notice Transfers `vaultID` from `from` to `to` as opposed to {transferFrom},\n /// this imposes no restrictions on msg.sender\n /// @dev `to` cannot be the zero address and `perpetualID` must be owned by `from`\n /// @dev Emits a {Transfer} event\n /// @dev A whitelist check is performed if necessary on the `to` address\n function _transfer(\n address from,\n address to,\n uint256 vaultID\n ) internal {\n if (_ownerOf(vaultID) != from) revert NotApproved();\n if (to == address(0)) revert ZeroAddress();\n if (whitelistingActivated && isWhitelisted[to] != 1) revert NotWhitelisted();\n\n _beforeTokenTransfer(from, to, vaultID);\n\n // Clear approvals from the previous owner\n _approve(address(0), vaultID);\n unchecked {\n _balances[from] -= 1;\n _balances[to] += 1;\n }\n _owners[vaultID] = to;\n\n emit Transfer(from, to, vaultID);\n }\n\n /// @notice Approves `to` to operate on `vaultID`\n function _approve(address to, uint256 vaultID) internal {\n _vaultApprovals[vaultID] = to;\n emit Approval(_ownerOf(vaultID), to, vaultID);\n }\n\n /// @notice Internal version of the `setApprovalForAll` function\n /// @dev It contains an `approver` field to be used in case someone signs a permit for a particular\n /// address, and this signature is given to the contract by another address (like a router)\n function _setApprovalForAll(\n address approver,\n address operator,\n bool approved\n ) internal {\n if (operator == approver) revert ApprovalToCaller();\n uint256 approval = approved ? 1 : 0;\n _operatorApprovals[approver][operator] = approval;\n emit ApprovalForAll(approver, operator, approved);\n }\n\n /// @notice Internal function to invoke {IERC721Receiver-onERC721Received} on a target address\n /// The call is not executed if the target address is not a contract\n /// @param from Address representing the previous owner of the given token ID\n /// @param to Target address that will receive the tokens\n /// @param vaultID ID of the token to be transferred\n /// @param _data Bytes optional data to send along with the call\n /// @return Bool whether the call correctly returned the expected value\n function _checkOnERC721Received(\n address from,\n address to,\n uint256 vaultID,\n bytes memory _data\n ) private returns (bool) {\n if (to.isContract()) {\n try IERC721ReceiverUpgradeable(to).onERC721Received(msg.sender, from, vaultID, _data) returns (\n bytes4 retval\n ) {\n return retval == IERC721ReceiverUpgradeable.onERC721Received.selector;\n } catch (bytes memory reason) {\n if (reason.length == 0) {\n revert NonERC721Receiver();\n } else {\n // solhint-disable-next-line no-inline-assembly\n assembly {\n revert(add(32, reason), mload(reason))\n }\n }\n }\n } else {\n return true;\n }\n }\n\n /// @notice Hook that is called before any token transfer. This includes minting and burning.\n /// Calling conditions:\n ///\n /// - When `from` and `to` are both non-zero, `from`'s `vaultID` will be\n /// transferred to `to`.\n /// - When `from` is zero, `vaultID` will be minted for `to`.\n /// - When `to` is zero, `from`'s `vaultID` will be burned.\n /// - `from` and `to` are never both zero.\n function _beforeTokenTransfer(\n address from,\n address to,\n uint256 vaultID\n ) internal virtual {}\n}\n" + }, + "contracts/interfaces/external/IERC1271.sol": { + "content": "// SPDX-License-Identifier: GPL-2.0-or-later\npragma solidity ^0.8.12;\n\n/// @title Interface for verifying contract-based account signatures\n/// @notice Interface that verifies provided signature for the data\n/// @dev Interface defined by EIP-1271\ninterface IERC1271 {\n /// @notice Returns whether the provided signature is valid for the provided data\n /// @dev MUST return the bytes4 magic value 0x1626ba7e when function passes.\n /// MUST NOT modify state (using STATICCALL for solc < 0.5, view modifier for solc > 0.5).\n /// MUST allow external calls.\n /// @param hash Hash of the data to be signed\n /// @param signature Signature byte array associated with _data\n /// @return magicValue The bytes4 magic value 0x1626ba7e\n function isValidSignature(bytes32 hash, bytes memory signature) external view returns (bytes4 magicValue);\n}\n" + }, + "contracts/vaultManager/VaultManagerStorage.sol": { + "content": "// SPDX-License-Identifier: GPL-3.0\n\npragma solidity ^0.8.12;\n\nimport \"@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol\";\nimport \"@openzeppelin/contracts-upgradeable/token/ERC20/extensions/draft-IERC20PermitUpgradeable.sol\";\nimport \"@openzeppelin/contracts-upgradeable/token/ERC721/IERC721ReceiverUpgradeable.sol\";\nimport \"@openzeppelin/contracts-upgradeable/interfaces/IERC721MetadataUpgradeable.sol\";\nimport \"@openzeppelin/contracts-upgradeable/utils/introspection/IERC165Upgradeable.sol\";\nimport \"@openzeppelin/contracts-upgradeable/utils/AddressUpgradeable.sol\";\nimport \"@openzeppelin/contracts-upgradeable/security/ReentrancyGuardUpgradeable.sol\";\nimport \"@openzeppelin/contracts/token/ERC20/extensions/IERC20Metadata.sol\";\nimport \"@openzeppelin/contracts/token/ERC20/IERC20.sol\";\nimport \"@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol\";\n\nimport \"../interfaces/IAgToken.sol\";\nimport \"../interfaces/IOracle.sol\";\nimport \"../interfaces/ISwapper.sol\";\nimport \"../interfaces/ITreasury.sol\";\nimport \"../interfaces/IVaultManager.sol\";\nimport \"../interfaces/governance/IVeBoostProxy.sol\";\n\n/// @title VaultManagerStorage\n/// @author Angle Labs, Inc.\n/// @dev Variables, references, parameters and events needed in the `VaultManager` contract\n// solhint-disable-next-line max-states-count\ncontract VaultManagerStorage is IVaultManagerStorage, Initializable, ReentrancyGuardUpgradeable {\n /// @notice Base used for parameter computation: almost all the parameters of this contract are set in `BASE_PARAMS`\n uint256 public constant BASE_PARAMS = 10**9;\n /// @notice Base used for interest rate computation\n uint256 public constant BASE_INTEREST = 10**27;\n /// @notice Used for interest rate computation\n uint256 public constant HALF_BASE_INTEREST = 10**27 / 2;\n\n // ================================= REFERENCES ================================\n\n /// @inheritdoc IVaultManagerStorage\n ITreasury public treasury;\n /// @inheritdoc IVaultManagerStorage\n IERC20 public collateral;\n /// @inheritdoc IVaultManagerStorage\n IAgToken public stablecoin;\n /// @inheritdoc IVaultManagerStorage\n IOracle public oracle;\n /// @notice Reference to the contract which computes adjusted veANGLE balances for liquidators boosts\n IVeBoostProxy public veBoostProxy;\n /// @notice Base of the collateral\n uint256 internal _collatBase;\n\n // ================================= PARAMETERS ================================\n // Unless specified otherwise, parameters of this contract are expressed in `BASE_PARAMS`\n\n /// @notice Maximum amount of stablecoins that can be issued with this contract (in `BASE_TOKENS`). This parameter should\n /// not be bigger than `type(uint256).max / BASE_INTEREST` otherwise there may be some overflows in the `increaseDebt` function\n uint256 public debtCeiling;\n /// @notice Threshold veANGLE balance values for the computation of the boost for liquidators: the length of this array\n /// should normally be 2. The base of the x-values in this array should be `BASE_TOKENS`\n uint256[] public xLiquidationBoost;\n /// @notice Values of the liquidation boost at the threshold values of x\n uint256[] public yLiquidationBoost;\n /// @inheritdoc IVaultManagerStorage\n uint64 public collateralFactor;\n /// @notice Maximum Health factor at which a vault can end up after a liquidation (unless it's fully liquidated)\n uint64 public targetHealthFactor;\n /// @notice Upfront fee taken when borrowing stablecoins: this fee is optional and should in practice not be used\n uint64 public borrowFee;\n /// @notice Upfront fee taken when repaying stablecoins: this fee is optional as well. It should be smaller\n /// than the liquidation surcharge (cf below) to avoid exploits where people voluntarily get liquidated at a 0\n /// discount to pay smaller repaying fees\n uint64 public repayFee;\n /// @notice Per second interest taken to borrowers taking agToken loans. Contrarily to other parameters, it is set in `BASE_INTEREST`\n /// that is to say in base 10**27\n uint64 public interestRate;\n /// @notice Fee taken by the protocol during a liquidation. Technically, this value is not the fee per se, it's 1 - fee.\n /// For instance for a 2% fee, `liquidationSurcharge` should be 98%\n uint64 public liquidationSurcharge;\n /// @notice Maximum discount given to liquidators\n uint64 public maxLiquidationDiscount;\n /// @notice Whether whitelisting is required to own a vault or not\n bool public whitelistingActivated;\n /// @notice Whether the contract is paused or not\n bool public paused;\n\n // ================================= VARIABLES =================================\n\n /// @notice Timestamp at which the `interestAccumulator` was updated\n uint256 public lastInterestAccumulatorUpdated;\n /// @inheritdoc IVaultManagerStorage\n uint256 public interestAccumulator;\n /// @inheritdoc IVaultManagerStorage\n uint256 public totalNormalizedDebt;\n /// @notice Surplus accumulated by the contract: surplus is always in stablecoins, and is then reset\n /// when the value is communicated to the treasury contract\n uint256 public surplus;\n /// @notice Bad debt made from liquidated vaults which ended up having no collateral and a positive amount\n /// of stablecoins\n uint256 public badDebt;\n\n // ================================== MAPPINGS =================================\n\n /// @inheritdoc IVaultManagerStorage\n mapping(uint256 => Vault) public vaultData;\n /// @notice Maps an address to 1 if it's whitelisted and can open or own a vault\n mapping(address => uint256) public isWhitelisted;\n\n // ================================ ERC721 DATA ================================\n\n /// @inheritdoc IVaultManagerStorage\n uint256 public vaultIDCount;\n\n /// @notice URI\n string internal _baseURI;\n\n // Mapping from `vaultID` to owner address\n mapping(uint256 => address) internal _owners;\n\n // Mapping from owner address to vault owned count\n mapping(address => uint256) internal _balances;\n\n // Mapping from `vaultID` to approved address\n mapping(uint256 => address) internal _vaultApprovals;\n\n // Mapping from owner to operator approvals\n mapping(address => mapping(address => uint256)) internal _operatorApprovals;\n\n uint256[50] private __gap;\n\n // =================================== EVENTS ==================================\n\n event AccruedToTreasury(uint256 surplusEndValue, uint256 badDebtEndValue);\n event CollateralAmountUpdated(uint256 vaultID, uint256 collateralAmount, uint8 isIncrease);\n event InterestAccumulatorUpdated(uint256 value, uint256 timestamp);\n event InternalDebtUpdated(uint256 vaultID, uint256 internalAmount, uint8 isIncrease);\n event FiledUint64(uint64 param, bytes32 what);\n event DebtCeilingUpdated(uint256 debtCeiling);\n event LiquidationBoostParametersUpdated(address indexed _veBoostProxy, uint256[] xBoost, uint256[] yBoost);\n event LiquidatedVaults(uint256[] vaultIDs);\n event DebtTransferred(uint256 srcVaultID, uint256 dstVaultID, address dstVaultManager, uint256 amount);\n\n // =================================== ERRORS ==================================\n\n error ApprovalToOwner();\n error ApprovalToCaller();\n error DustyLeftoverAmount();\n error DebtCeilingExceeded();\n error HealthyVault();\n error IncompatibleLengths();\n error InsolventVault();\n error InvalidParameterValue();\n error InvalidParameterType();\n error InvalidSetOfParameters();\n error InvalidTreasury();\n error NonERC721Receiver();\n error NonexistentVault();\n error NotApproved();\n error NotGovernor();\n error NotGovernorOrGuardian();\n error NotTreasury();\n error NotWhitelisted();\n error NotVaultManager();\n error Paused();\n error TooHighParameterValue();\n error TooSmallParameterValue();\n error ZeroAddress();\n\n /// @custom:oz-upgrades-unsafe-allow constructor\n constructor() initializer {}\n}\n" + }, + "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.7.0) (proxy/utils/Initializable.sol)\n\npragma solidity ^0.8.2;\n\nimport \"../../utils/AddressUpgradeable.sol\";\n\n/**\n * @dev This is a base contract to aid in writing upgradeable contracts, or any kind of contract that will be deployed\n * behind a proxy. Since proxied contracts do not make use of a constructor, it's common to move constructor logic to an\n * external initializer function, usually called `initialize`. It then becomes necessary to protect this initializer\n * function so it can only be called once. The {initializer} modifier provided by this contract will have this effect.\n *\n * The initialization functions use a version number. Once a version number is used, it is consumed and cannot be\n * reused. This mechanism prevents re-execution of each \"step\" but allows the creation of new initialization steps in\n * case an upgrade adds a module that needs to be initialized.\n *\n * For example:\n *\n * [.hljs-theme-light.nopadding]\n * ```\n * contract MyToken is ERC20Upgradeable {\n * function initialize() initializer public {\n * __ERC20_init(\"MyToken\", \"MTK\");\n * }\n * }\n * contract MyTokenV2 is MyToken, ERC20PermitUpgradeable {\n * function initializeV2() reinitializer(2) public {\n * __ERC20Permit_init(\"MyToken\");\n * }\n * }\n * ```\n *\n * TIP: To avoid leaving the proxy in an uninitialized state, the initializer function should be called as early as\n * possible by providing the encoded function call as the `_data` argument to {ERC1967Proxy-constructor}.\n *\n * CAUTION: When used with inheritance, manual care must be taken to not invoke a parent initializer twice, or to ensure\n * that all initializers are idempotent. This is not verified automatically as constructors are by Solidity.\n *\n * [CAUTION]\n * ====\n * Avoid leaving a contract uninitialized.\n *\n * An uninitialized contract can be taken over by an attacker. This applies to both a proxy and its implementation\n * contract, which may impact the proxy. To prevent the implementation contract from being used, you should invoke\n * the {_disableInitializers} function in the constructor to automatically lock it when it is deployed:\n *\n * [.hljs-theme-light.nopadding]\n * ```\n * /// @custom:oz-upgrades-unsafe-allow constructor\n * constructor() {\n * _disableInitializers();\n * }\n * ```\n * ====\n */\nabstract contract Initializable {\n /**\n * @dev Indicates that the contract has been initialized.\n * @custom:oz-retyped-from bool\n */\n uint8 private _initialized;\n\n /**\n * @dev Indicates that the contract is in the process of being initialized.\n */\n bool private _initializing;\n\n /**\n * @dev Triggered when the contract has been initialized or reinitialized.\n */\n event Initialized(uint8 version);\n\n /**\n * @dev A modifier that defines a protected initializer function that can be invoked at most once. In its scope,\n * `onlyInitializing` functions can be used to initialize parent contracts. Equivalent to `reinitializer(1)`.\n */\n modifier initializer() {\n bool isTopLevelCall = !_initializing;\n require(\n (isTopLevelCall && _initialized < 1) || (!AddressUpgradeable.isContract(address(this)) && _initialized == 1),\n \"Initializable: contract is already initialized\"\n );\n _initialized = 1;\n if (isTopLevelCall) {\n _initializing = true;\n }\n _;\n if (isTopLevelCall) {\n _initializing = false;\n emit Initialized(1);\n }\n }\n\n /**\n * @dev A modifier that defines a protected reinitializer function that can be invoked at most once, and only if the\n * contract hasn't been initialized to a greater version before. In its scope, `onlyInitializing` functions can be\n * used to initialize parent contracts.\n *\n * `initializer` is equivalent to `reinitializer(1)`, so a reinitializer may be used after the original\n * initialization step. This is essential to configure modules that are added through upgrades and that require\n * initialization.\n *\n * Note that versions can jump in increments greater than 1; this implies that if multiple reinitializers coexist in\n * a contract, executing them in the right order is up to the developer or operator.\n */\n modifier reinitializer(uint8 version) {\n require(!_initializing && _initialized < version, \"Initializable: contract is already initialized\");\n _initialized = version;\n _initializing = true;\n _;\n _initializing = false;\n emit Initialized(version);\n }\n\n /**\n * @dev Modifier to protect an initialization function so that it can only be invoked by functions with the\n * {initializer} and {reinitializer} modifiers, directly or indirectly.\n */\n modifier onlyInitializing() {\n require(_initializing, \"Initializable: contract is not initializing\");\n _;\n }\n\n /**\n * @dev Locks the contract, preventing any future reinitialization. This cannot be part of an initializer call.\n * Calling this in the constructor of a contract will prevent that contract from being initialized or reinitialized\n * to any version. It is recommended to use this to lock implementation contracts that are designed to be called\n * through proxies.\n */\n function _disableInitializers() internal virtual {\n require(!_initializing, \"Initializable: contract is initializing\");\n if (_initialized < type(uint8).max) {\n _initialized = type(uint8).max;\n emit Initialized(type(uint8).max);\n }\n }\n}\n" + }, + "@openzeppelin/contracts-upgradeable/token/ERC20/extensions/draft-IERC20PermitUpgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (token/ERC20/extensions/draft-IERC20Permit.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Interface of the ERC20 Permit extension allowing approvals to be made via signatures, as defined in\n * https://eips.ethereum.org/EIPS/eip-2612[EIP-2612].\n *\n * Adds the {permit} method, which can be used to change an account's ERC20 allowance (see {IERC20-allowance}) by\n * presenting a message signed by the account. By not relying on {IERC20-approve}, the token holder account doesn't\n * need to send a transaction, and thus is not required to hold Ether at all.\n */\ninterface IERC20PermitUpgradeable {\n /**\n * @dev Sets `value` as the allowance of `spender` over ``owner``'s tokens,\n * given ``owner``'s signed approval.\n *\n * IMPORTANT: The same issues {IERC20-approve} has related to transaction\n * ordering also apply here.\n *\n * Emits an {Approval} event.\n *\n * Requirements:\n *\n * - `spender` cannot be the zero address.\n * - `deadline` must be a timestamp in the future.\n * - `v`, `r` and `s` must be a valid `secp256k1` signature from `owner`\n * over the EIP712-formatted function arguments.\n * - the signature must use ``owner``'s current nonce (see {nonces}).\n *\n * For more information on the signature format, see the\n * https://eips.ethereum.org/EIPS/eip-2612#specification[relevant EIP\n * section].\n */\n function permit(\n address owner,\n address spender,\n uint256 value,\n uint256 deadline,\n uint8 v,\n bytes32 r,\n bytes32 s\n ) external;\n\n /**\n * @dev Returns the current nonce for `owner`. This value must be\n * included whenever a signature is generated for {permit}.\n *\n * Every successful call to {permit} increases ``owner``'s nonce by one. This\n * prevents a signature from being used multiple times.\n */\n function nonces(address owner) external view returns (uint256);\n\n /**\n * @dev Returns the domain separator used in the encoding of the signature for {permit}, as defined by {EIP712}.\n */\n // solhint-disable-next-line func-name-mixedcase\n function DOMAIN_SEPARATOR() external view returns (bytes32);\n}\n" + }, + "@openzeppelin/contracts-upgradeable/token/ERC721/IERC721ReceiverUpgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.6.0) (token/ERC721/IERC721Receiver.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @title ERC721 token receiver interface\n * @dev Interface for any contract that wants to support safeTransfers\n * from ERC721 asset contracts.\n */\ninterface IERC721ReceiverUpgradeable {\n /**\n * @dev Whenever an {IERC721} `tokenId` token is transferred to this contract via {IERC721-safeTransferFrom}\n * by `operator` from `from`, this function is called.\n *\n * It must return its Solidity selector to confirm the token transfer.\n * If any other value is returned or the interface is not implemented by the recipient, the transfer will be reverted.\n *\n * The selector can be obtained in Solidity with `IERC721Receiver.onERC721Received.selector`.\n */\n function onERC721Received(\n address operator,\n address from,\n uint256 tokenId,\n bytes calldata data\n ) external returns (bytes4);\n}\n" + }, + "@openzeppelin/contracts-upgradeable/interfaces/IERC721MetadataUpgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (interfaces/IERC721Metadata.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../token/ERC721/extensions/IERC721MetadataUpgradeable.sol\";\n" + }, + "@openzeppelin/contracts-upgradeable/utils/introspection/IERC165Upgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (utils/introspection/IERC165.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Interface of the ERC165 standard, as defined in the\n * https://eips.ethereum.org/EIPS/eip-165[EIP].\n *\n * Implementers can declare support of contract interfaces, which can then be\n * queried by others ({ERC165Checker}).\n *\n * For an implementation, see {ERC165}.\n */\ninterface IERC165Upgradeable {\n /**\n * @dev Returns true if this contract implements the interface defined by\n * `interfaceId`. See the corresponding\n * https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section]\n * to learn more about how these ids are created.\n *\n * This function call must use less than 30 000 gas.\n */\n function supportsInterface(bytes4 interfaceId) external view returns (bool);\n}\n" + }, + "@openzeppelin/contracts-upgradeable/utils/AddressUpgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.7.0) (utils/Address.sol)\n\npragma solidity ^0.8.1;\n\n/**\n * @dev Collection of functions related to the address type\n */\nlibrary AddressUpgradeable {\n /**\n * @dev Returns true if `account` is a contract.\n *\n * [IMPORTANT]\n * ====\n * It is unsafe to assume that an address for which this function returns\n * false is an externally-owned account (EOA) and not a contract.\n *\n * Among others, `isContract` will return false for the following\n * types of addresses:\n *\n * - an externally-owned account\n * - a contract in construction\n * - an address where a contract will be created\n * - an address where a contract lived, but was destroyed\n * ====\n *\n * [IMPORTANT]\n * ====\n * You shouldn't rely on `isContract` to protect against flash loan attacks!\n *\n * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets\n * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract\n * constructor.\n * ====\n */\n function isContract(address account) internal view returns (bool) {\n // This method relies on extcodesize/address.code.length, which returns 0\n // for contracts in construction, since the code is only stored at the end\n // of the constructor execution.\n\n return account.code.length > 0;\n }\n\n /**\n * @dev Replacement for Solidity's `transfer`: sends `amount` wei to\n * `recipient`, forwarding all available gas and reverting on errors.\n *\n * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost\n * of certain opcodes, possibly making contracts go over the 2300 gas limit\n * imposed by `transfer`, making them unable to receive funds via\n * `transfer`. {sendValue} removes this limitation.\n *\n * https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more].\n *\n * IMPORTANT: because control is transferred to `recipient`, care must be\n * taken to not create reentrancy vulnerabilities. Consider using\n * {ReentrancyGuard} or the\n * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].\n */\n function sendValue(address payable recipient, uint256 amount) internal {\n require(address(this).balance >= amount, \"Address: insufficient balance\");\n\n (bool success, ) = recipient.call{value: amount}(\"\");\n require(success, \"Address: unable to send value, recipient may have reverted\");\n }\n\n /**\n * @dev Performs a Solidity function call using a low level `call`. A\n * plain `call` is an unsafe replacement for a function call: use this\n * function instead.\n *\n * If `target` reverts with a revert reason, it is bubbled up by this\n * function (like regular Solidity function calls).\n *\n * Returns the raw returned data. To convert to the expected return value,\n * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].\n *\n * Requirements:\n *\n * - `target` must be a contract.\n * - calling `target` with `data` must not revert.\n *\n * _Available since v3.1._\n */\n function functionCall(address target, bytes memory data) internal returns (bytes memory) {\n return functionCall(target, data, \"Address: low-level call failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with\n * `errorMessage` as a fallback revert reason when `target` reverts.\n *\n * _Available since v3.1._\n */\n function functionCall(\n address target,\n bytes memory data,\n string memory errorMessage\n ) internal returns (bytes memory) {\n return functionCallWithValue(target, data, 0, errorMessage);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but also transferring `value` wei to `target`.\n *\n * Requirements:\n *\n * - the calling contract must have an ETH balance of at least `value`.\n * - the called Solidity function must be `payable`.\n *\n * _Available since v3.1._\n */\n function functionCallWithValue(\n address target,\n bytes memory data,\n uint256 value\n ) internal returns (bytes memory) {\n return functionCallWithValue(target, data, value, \"Address: low-level call with value failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but\n * with `errorMessage` as a fallback revert reason when `target` reverts.\n *\n * _Available since v3.1._\n */\n function functionCallWithValue(\n address target,\n bytes memory data,\n uint256 value,\n string memory errorMessage\n ) internal returns (bytes memory) {\n require(address(this).balance >= value, \"Address: insufficient balance for call\");\n require(isContract(target), \"Address: call to non-contract\");\n\n (bool success, bytes memory returndata) = target.call{value: value}(data);\n return verifyCallResult(success, returndata, errorMessage);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but performing a static call.\n *\n * _Available since v3.3._\n */\n function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {\n return functionStaticCall(target, data, \"Address: low-level static call failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\n * but performing a static call.\n *\n * _Available since v3.3._\n */\n function functionStaticCall(\n address target,\n bytes memory data,\n string memory errorMessage\n ) internal view returns (bytes memory) {\n require(isContract(target), \"Address: static call to non-contract\");\n\n (bool success, bytes memory returndata) = target.staticcall(data);\n return verifyCallResult(success, returndata, errorMessage);\n }\n\n /**\n * @dev Tool to verifies that a low level call was successful, and revert if it wasn't, either by bubbling the\n * revert reason using the provided one.\n *\n * _Available since v4.3._\n */\n function verifyCallResult(\n bool success,\n bytes memory returndata,\n string memory errorMessage\n ) internal pure returns (bytes memory) {\n if (success) {\n return returndata;\n } else {\n // Look for revert reason and bubble it up if present\n if (returndata.length > 0) {\n // The easiest way to bubble the revert reason is using memory via assembly\n /// @solidity memory-safe-assembly\n assembly {\n let returndata_size := mload(returndata)\n revert(add(32, returndata), returndata_size)\n }\n } else {\n revert(errorMessage);\n }\n }\n }\n}\n" + }, + "@openzeppelin/contracts-upgradeable/security/ReentrancyGuardUpgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (security/ReentrancyGuard.sol)\n\npragma solidity ^0.8.0;\nimport \"../proxy/utils/Initializable.sol\";\n\n/**\n * @dev Contract module that helps prevent reentrant calls to a function.\n *\n * Inheriting from `ReentrancyGuard` will make the {nonReentrant} modifier\n * available, which can be applied to functions to make sure there are no nested\n * (reentrant) calls to them.\n *\n * Note that because there is a single `nonReentrant` guard, functions marked as\n * `nonReentrant` may not call one another. This can be worked around by making\n * those functions `private`, and then adding `external` `nonReentrant` entry\n * points to them.\n *\n * TIP: If you would like to learn more about reentrancy and alternative ways\n * to protect against it, check out our blog post\n * https://blog.openzeppelin.com/reentrancy-after-istanbul/[Reentrancy After Istanbul].\n */\nabstract contract ReentrancyGuardUpgradeable is Initializable {\n // Booleans are more expensive than uint256 or any type that takes up a full\n // word because each write operation emits an extra SLOAD to first read the\n // slot's contents, replace the bits taken up by the boolean, and then write\n // back. This is the compiler's defense against contract upgrades and\n // pointer aliasing, and it cannot be disabled.\n\n // The values being non-zero value makes deployment a bit more expensive,\n // but in exchange the refund on every call to nonReentrant will be lower in\n // amount. Since refunds are capped to a percentage of the total\n // transaction's gas, it is best to keep them low in cases like this one, to\n // increase the likelihood of the full refund coming into effect.\n uint256 private constant _NOT_ENTERED = 1;\n uint256 private constant _ENTERED = 2;\n\n uint256 private _status;\n\n function __ReentrancyGuard_init() internal onlyInitializing {\n __ReentrancyGuard_init_unchained();\n }\n\n function __ReentrancyGuard_init_unchained() internal onlyInitializing {\n _status = _NOT_ENTERED;\n }\n\n /**\n * @dev Prevents a contract from calling itself, directly or indirectly.\n * Calling a `nonReentrant` function from another `nonReentrant`\n * function is not supported. It is possible to prevent this from happening\n * by making the `nonReentrant` function external, and making it call a\n * `private` function that does the actual work.\n */\n modifier nonReentrant() {\n // On the first call to nonReentrant, _notEntered will be true\n require(_status != _ENTERED, \"ReentrancyGuard: reentrant call\");\n\n // Any calls to nonReentrant after this point will fail\n _status = _ENTERED;\n\n _;\n\n // By storing the original value once again, a refund is triggered (see\n // https://eips.ethereum.org/EIPS/eip-2200)\n _status = _NOT_ENTERED;\n }\n\n /**\n * @dev This empty reserved space is put in place to allow future versions to add new\n * variables without shifting down storage in the inheritance chain.\n * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps\n */\n uint256[49] private __gap;\n}\n" + }, + "@openzeppelin/contracts/token/ERC20/extensions/IERC20Metadata.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (token/ERC20/extensions/IERC20Metadata.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../IERC20.sol\";\n\n/**\n * @dev Interface for the optional metadata functions from the ERC20 standard.\n *\n * _Available since v4.1._\n */\ninterface IERC20Metadata is IERC20 {\n /**\n * @dev Returns the name of the token.\n */\n function name() external view returns (string memory);\n\n /**\n * @dev Returns the symbol of the token.\n */\n function symbol() external view returns (string memory);\n\n /**\n * @dev Returns the decimals places of the token.\n */\n function decimals() external view returns (uint8);\n}\n" + }, + "@openzeppelin/contracts/token/ERC20/IERC20.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.6.0) (token/ERC20/IERC20.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Interface of the ERC20 standard as defined in the EIP.\n */\ninterface IERC20 {\n /**\n * @dev Emitted when `value` tokens are moved from one account (`from`) to\n * another (`to`).\n *\n * Note that `value` may be zero.\n */\n event Transfer(address indexed from, address indexed to, uint256 value);\n\n /**\n * @dev Emitted when the allowance of a `spender` for an `owner` is set by\n * a call to {approve}. `value` is the new allowance.\n */\n event Approval(address indexed owner, address indexed spender, uint256 value);\n\n /**\n * @dev Returns the amount of tokens in existence.\n */\n function totalSupply() external view returns (uint256);\n\n /**\n * @dev Returns the amount of tokens owned by `account`.\n */\n function balanceOf(address account) external view returns (uint256);\n\n /**\n * @dev Moves `amount` tokens from the caller's account to `to`.\n *\n * Returns a boolean value indicating whether the operation succeeded.\n *\n * Emits a {Transfer} event.\n */\n function transfer(address to, uint256 amount) external returns (bool);\n\n /**\n * @dev Returns the remaining number of tokens that `spender` will be\n * allowed to spend on behalf of `owner` through {transferFrom}. This is\n * zero by default.\n *\n * This value changes when {approve} or {transferFrom} are called.\n */\n function allowance(address owner, address spender) external view returns (uint256);\n\n /**\n * @dev Sets `amount` as the allowance of `spender` over the caller's tokens.\n *\n * Returns a boolean value indicating whether the operation succeeded.\n *\n * IMPORTANT: Beware that changing an allowance with this method brings the risk\n * that someone may use both the old and the new allowance by unfortunate\n * transaction ordering. One possible solution to mitigate this race\n * condition is to first reduce the spender's allowance to 0 and set the\n * desired value afterwards:\n * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729\n *\n * Emits an {Approval} event.\n */\n function approve(address spender, uint256 amount) external returns (bool);\n\n /**\n * @dev Moves `amount` tokens from `from` to `to` using the\n * allowance mechanism. `amount` is then deducted from the caller's\n * allowance.\n *\n * Returns a boolean value indicating whether the operation succeeded.\n *\n * Emits a {Transfer} event.\n */\n function transferFrom(\n address from,\n address to,\n uint256 amount\n ) external returns (bool);\n}\n" + }, + "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.7.0) (token/ERC20/utils/SafeERC20.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../IERC20.sol\";\nimport \"../extensions/draft-IERC20Permit.sol\";\nimport \"../../../utils/Address.sol\";\n\n/**\n * @title SafeERC20\n * @dev Wrappers around ERC20 operations that throw on failure (when the token\n * contract returns false). Tokens that return no value (and instead revert or\n * throw on failure) are also supported, non-reverting calls are assumed to be\n * successful.\n * To use this library you can add a `using SafeERC20 for IERC20;` statement to your contract,\n * which allows you to call the safe operations as `token.safeTransfer(...)`, etc.\n */\nlibrary SafeERC20 {\n using Address for address;\n\n function safeTransfer(\n IERC20 token,\n address to,\n uint256 value\n ) internal {\n _callOptionalReturn(token, abi.encodeWithSelector(token.transfer.selector, to, value));\n }\n\n function safeTransferFrom(\n IERC20 token,\n address from,\n address to,\n uint256 value\n ) internal {\n _callOptionalReturn(token, abi.encodeWithSelector(token.transferFrom.selector, from, to, value));\n }\n\n /**\n * @dev Deprecated. This function has issues similar to the ones found in\n * {IERC20-approve}, and its usage is discouraged.\n *\n * Whenever possible, use {safeIncreaseAllowance} and\n * {safeDecreaseAllowance} instead.\n */\n function safeApprove(\n IERC20 token,\n address spender,\n uint256 value\n ) internal {\n // safeApprove should only be called when setting an initial allowance,\n // or when resetting it to zero. To increase and decrease it, use\n // 'safeIncreaseAllowance' and 'safeDecreaseAllowance'\n require(\n (value == 0) || (token.allowance(address(this), spender) == 0),\n \"SafeERC20: approve from non-zero to non-zero allowance\"\n );\n _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, value));\n }\n\n function safeIncreaseAllowance(\n IERC20 token,\n address spender,\n uint256 value\n ) internal {\n uint256 newAllowance = token.allowance(address(this), spender) + value;\n _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));\n }\n\n function safeDecreaseAllowance(\n IERC20 token,\n address spender,\n uint256 value\n ) internal {\n unchecked {\n uint256 oldAllowance = token.allowance(address(this), spender);\n require(oldAllowance >= value, \"SafeERC20: decreased allowance below zero\");\n uint256 newAllowance = oldAllowance - value;\n _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));\n }\n }\n\n function safePermit(\n IERC20Permit token,\n address owner,\n address spender,\n uint256 value,\n uint256 deadline,\n uint8 v,\n bytes32 r,\n bytes32 s\n ) internal {\n uint256 nonceBefore = token.nonces(owner);\n token.permit(owner, spender, value, deadline, v, r, s);\n uint256 nonceAfter = token.nonces(owner);\n require(nonceAfter == nonceBefore + 1, \"SafeERC20: permit did not succeed\");\n }\n\n /**\n * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement\n * on the return value: the return value is optional (but if data is returned, it must not be false).\n * @param token The token targeted by the call.\n * @param data The call data (encoded using abi.encode or one of its variants).\n */\n function _callOptionalReturn(IERC20 token, bytes memory data) private {\n // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since\n // we're implementing it ourselves. We use {Address.functionCall} to perform this call, which verifies that\n // the target address contains contract code and also asserts for success in the low-level call.\n\n bytes memory returndata = address(token).functionCall(data, \"SafeERC20: low-level call failed\");\n if (returndata.length > 0) {\n // Return data is optional\n require(abi.decode(returndata, (bool)), \"SafeERC20: ERC20 operation did not succeed\");\n }\n }\n}\n" + }, + "contracts/interfaces/IAgToken.sol": { + "content": "// SPDX-License-Identifier: GPL-3.0\n\npragma solidity ^0.8.12;\n\nimport \"@openzeppelin/contracts-upgradeable/token/ERC20/IERC20Upgradeable.sol\";\n\n/// @title IAgToken\n/// @author Angle Labs, Inc.\n/// @notice Interface for the stablecoins `AgToken` contracts\n/// @dev This interface only contains functions of the `AgToken` contract which are called by other contracts\n/// of this module or of the first module of the Angle Protocol\ninterface IAgToken is IERC20Upgradeable {\n // ======================= Minter Role Only Functions ===========================\n\n /// @notice Lets the `StableMaster` contract or another whitelisted contract mint agTokens\n /// @param account Address to mint to\n /// @param amount Amount to mint\n /// @dev The contracts allowed to issue agTokens are the `StableMaster` contract, `VaultManager` contracts\n /// associated to this stablecoin as well as the flash loan module (if activated) and potentially contracts\n /// whitelisted by governance\n function mint(address account, uint256 amount) external;\n\n /// @notice Burns `amount` tokens from a `burner` address after being asked to by `sender`\n /// @param amount Amount of tokens to burn\n /// @param burner Address to burn from\n /// @param sender Address which requested the burn from `burner`\n /// @dev This method is to be called by a contract with the minter right after being requested\n /// to do so by a `sender` address willing to burn tokens from another `burner` address\n /// @dev The method checks the allowance between the `sender` and the `burner`\n function burnFrom(\n uint256 amount,\n address burner,\n address sender\n ) external;\n\n /// @notice Burns `amount` tokens from a `burner` address\n /// @param amount Amount of tokens to burn\n /// @param burner Address to burn from\n /// @dev This method is to be called by a contract with a minter right on the AgToken after being\n /// requested to do so by an address willing to burn tokens from its address\n function burnSelf(uint256 amount, address burner) external;\n\n // ========================= Treasury Only Functions ===========================\n\n /// @notice Adds a minter in the contract\n /// @param minter Minter address to add\n /// @dev Zero address checks are performed directly in the `Treasury` contract\n function addMinter(address minter) external;\n\n /// @notice Removes a minter from the contract\n /// @param minter Minter address to remove\n /// @dev This function can also be called by a minter wishing to revoke itself\n function removeMinter(address minter) external;\n\n /// @notice Sets a new treasury contract\n /// @param _treasury New treasury address\n function setTreasury(address _treasury) external;\n\n // ========================= External functions ================================\n\n /// @notice Checks whether an address has the right to mint agTokens\n /// @param minter Address for which the minting right should be checked\n /// @return Whether the address has the right to mint agTokens or not\n function isMinter(address minter) external view returns (bool);\n}\n" + }, + "contracts/interfaces/IOracle.sol": { + "content": "// SPDX-License-Identifier: GPL-3.0\n\npragma solidity ^0.8.12;\n\nimport \"./ITreasury.sol\";\n\n/// @title IOracle\n/// @author Angle Labs, Inc.\n/// @notice Interface for the `Oracle` contract\n/// @dev This interface only contains functions of the contract which are called by other contracts\n/// of this module\ninterface IOracle {\n /// @notice Reads the rate from the Chainlink circuit and other data provided\n /// @return quoteAmount The current rate between the in-currency and out-currency in the base\n /// of the out currency\n /// @dev For instance if the out currency is EUR (and hence agEUR), then the base of the returned\n /// value is 10**18\n function read() external view returns (uint256);\n\n /// @notice Changes the treasury contract\n /// @param _treasury Address of the new treasury contract\n /// @dev This function can be called by an approved `VaultManager` contract which can call\n /// this function after being requested to do so by a `treasury` contract\n /// @dev In some situations (like reactor contracts), the `VaultManager` may not directly be linked\n /// to the `oracle` contract and as such we may need governors to be able to call this function as well\n function setTreasury(address _treasury) external;\n\n /// @notice Reference to the `treasury` contract handling this `VaultManager`\n function treasury() external view returns (ITreasury treasury);\n}\n" + }, + "contracts/interfaces/ISwapper.sol": { + "content": "// SPDX-License-Identifier: GPL-3.0\n\npragma solidity ^0.8.12;\n\nimport \"@openzeppelin/contracts/token/ERC20/IERC20.sol\";\n\n/// @title ISwapper\n/// @author Angle Labs, Inc.\n/// @notice Interface for Swapper contracts\n/// @dev This interface defines the key functions `Swapper` contracts should have when interacting with\n/// Angle\ninterface ISwapper {\n /// @notice Notifies a contract that an address should be given `outToken` from `inToken`\n /// @param inToken Address of the token received\n /// @param outToken Address of the token to obtain\n /// @param outTokenRecipient Address to which the outToken should be sent\n /// @param outTokenOwed Minimum amount of outToken the `outTokenRecipient` address should have at the end of the call\n /// @param inTokenObtained Amount of collateral obtained by a related address prior\n /// to the call to this function\n /// @param data Extra data needed (to encode Uniswap swaps for instance)\n function swap(\n IERC20 inToken,\n IERC20 outToken,\n address outTokenRecipient,\n uint256 outTokenOwed,\n uint256 inTokenObtained,\n bytes calldata data\n ) external;\n}\n" + }, + "contracts/interfaces/ITreasury.sol": { + "content": "// SPDX-License-Identifier: GPL-3.0\n\npragma solidity ^0.8.12;\n\nimport \"./IAgToken.sol\";\nimport \"./ICoreBorrow.sol\";\nimport \"./IFlashAngle.sol\";\n\n/// @title ITreasury\n/// @author Angle Labs, Inc.\n/// @notice Interface for the `Treasury` contract\n/// @dev This interface only contains functions of the `Treasury` which are called by other contracts\n/// of this module\ninterface ITreasury {\n /// @notice Stablecoin handled by this `treasury` contract\n function stablecoin() external view returns (IAgToken);\n\n /// @notice Checks whether a given address has the governor role\n /// @param admin Address to check\n /// @return Whether the address has the governor role\n /// @dev Access control is only kept in the `CoreBorrow` contract\n function isGovernor(address admin) external view returns (bool);\n\n /// @notice Checks whether a given address has the guardian or the governor role\n /// @param admin Address to check\n /// @return Whether the address has the guardian or the governor role\n /// @dev Access control is only kept in the `CoreBorrow` contract which means that this function\n /// queries the `CoreBorrow` contract\n function isGovernorOrGuardian(address admin) external view returns (bool);\n\n /// @notice Checks whether a given address has well been initialized in this contract\n /// as a `VaultManager`\n /// @param _vaultManager Address to check\n /// @return Whether the address has been initialized or not\n function isVaultManager(address _vaultManager) external view returns (bool);\n\n /// @notice Sets a new flash loan module for this stablecoin\n /// @param _flashLoanModule Reference to the new flash loan module\n /// @dev This function removes the minting right to the old flash loan module and grants\n /// it to the new module\n function setFlashLoanModule(address _flashLoanModule) external;\n}\n" + }, + "contracts/interfaces/IVaultManager.sol": { + "content": "// SPDX-License-Identifier: GPL-3.0\n\npragma solidity ^0.8.12;\n\nimport \"@openzeppelin/contracts/interfaces/IERC721Metadata.sol\";\nimport \"@openzeppelin/contracts/token/ERC20/IERC20.sol\";\nimport \"./ITreasury.sol\";\nimport \"./IOracle.sol\";\n\n// ========================= Key Structs and Enums =============================\n\n/// @notice Parameters associated to a given `VaultManager` contract: these all correspond\n/// to parameters which signification is detailed in the `VaultManagerStorage` file\nstruct VaultParameters {\n uint256 debtCeiling;\n uint64 collateralFactor;\n uint64 targetHealthFactor;\n uint64 interestRate;\n uint64 liquidationSurcharge;\n uint64 maxLiquidationDiscount;\n bool whitelistingActivated;\n uint256 baseBoost;\n}\n\n/// @notice Data stored to track someone's loan (or equivalently called position)\nstruct Vault {\n // Amount of collateral deposited in the vault, in collateral decimals. For example, if the collateral\n // is USDC with 6 decimals, then `collateralAmount` will be in base 10**6\n uint256 collateralAmount;\n // Normalized value of the debt (that is to say of the stablecoins borrowed). It is expressed\n // in the base of Angle stablecoins (i.e. `BASE_TOKENS = 10**18`)\n uint256 normalizedDebt;\n}\n\n/// @notice For a given `vaultID`, this encodes a liquidation opportunity that is to say details about the maximum\n/// amount that could be repaid by liquidating the position\n/// @dev All the values are null in the case of a vault which cannot be liquidated under these conditions\nstruct LiquidationOpportunity {\n // Maximum stablecoin amount that can be repaid upon liquidating the vault\n uint256 maxStablecoinAmountToRepay;\n // Collateral amount given to the person in the case where the maximum amount to repay is given\n uint256 maxCollateralAmountGiven;\n // Threshold value of stablecoin amount to repay: it is ok for a liquidator to repay below threshold,\n // but if this threshold is non null and the liquidator wants to repay more than threshold, it should repay\n // the max stablecoin amount given in this vault\n uint256 thresholdRepayAmount;\n // Discount proposed to the liquidator on the collateral\n uint256 discount;\n // Amount of debt in the vault\n uint256 currentDebt;\n}\n\n/// @notice Data stored during a liquidation process to keep in memory what's due to a liquidator and some\n/// essential data for vaults being liquidated\nstruct LiquidatorData {\n // Current amount of stablecoins the liquidator should give to the contract\n uint256 stablecoinAmountToReceive;\n // Current amount of collateral the contract should give to the liquidator\n uint256 collateralAmountToGive;\n // Bad debt accrued across the liquidation process\n uint256 badDebtFromLiquidation;\n // Oracle value (in stablecoin base) at the time of the liquidation\n uint256 oracleValue;\n // Value of the `interestAccumulator` at the time of the call\n uint256 newInterestAccumulator;\n}\n\n/// @notice Data to track during a series of action the amount to give or receive in stablecoins and collateral\n/// to the caller or associated addresses\nstruct PaymentData {\n // Stablecoin amount the contract should give\n uint256 stablecoinAmountToGive;\n // Stablecoin amount owed to the contract\n uint256 stablecoinAmountToReceive;\n // Collateral amount the contract should give\n uint256 collateralAmountToGive;\n // Collateral amount owed to the contract\n uint256 collateralAmountToReceive;\n}\n\n/// @notice Actions possible when composing calls to the different entry functions proposed\nenum ActionType {\n createVault,\n closeVault,\n addCollateral,\n removeCollateral,\n repayDebt,\n borrow,\n getDebtIn,\n permit\n}\n\n// ========================= Interfaces =============================\n\n/// @title IVaultManagerFunctions\n/// @author Angle Labs, Inc.\n/// @notice Interface for the `VaultManager` contract\n/// @dev This interface only contains functions of the contract which are called by other contracts\n/// of this module (without getters)\ninterface IVaultManagerFunctions {\n /// @notice Accrues interest accumulated across all vaults to the surplus and sends the surplus to the treasury\n /// @return surplusValue Value of the surplus communicated to the `Treasury`\n /// @return badDebtValue Value of the bad debt communicated to the `Treasury`\n /// @dev `surplus` and `badDebt` should be reset to 0 once their current value have been given to the `treasury` contract\n function accrueInterestToTreasury() external returns (uint256 surplusValue, uint256 badDebtValue);\n\n /// @notice Removes debt from a vault after being requested to do so by another `VaultManager` contract\n /// @param vaultID ID of the vault to remove debt from\n /// @param amountStablecoins Amount of stablecoins to remove from the debt: this amount is to be converted to an\n /// internal debt amount\n /// @param senderBorrowFee Borrowing fees from the contract which requested this: this is to make sure that people are not\n /// arbitraging difference in minting fees\n /// @param senderRepayFee Repay fees from the contract which requested this: this is to make sure that people are not arbitraging\n /// differences in repay fees\n /// @dev This function can only be called from a vaultManager registered in the same Treasury\n function getDebtOut(\n uint256 vaultID,\n uint256 amountStablecoins,\n uint256 senderBorrowFee,\n uint256 senderRepayFee\n ) external;\n\n /// @notice Gets the current debt of a vault\n /// @param vaultID ID of the vault to check\n /// @return Debt of the vault\n function getVaultDebt(uint256 vaultID) external view returns (uint256);\n\n /// @notice Gets the total debt across all vaults\n /// @return Total debt across all vaults, taking into account the interest accumulated\n /// over time\n function getTotalDebt() external view returns (uint256);\n\n /// @notice Sets the treasury contract\n /// @param _treasury New treasury contract\n /// @dev All required checks when setting up a treasury contract are performed in the contract\n /// calling this function\n function setTreasury(address _treasury) external;\n\n /// @notice Creates a vault\n /// @param toVault Address for which the va\n /// @return vaultID ID of the vault created\n /// @dev This function just creates the vault without doing any collateral or\n function createVault(address toVault) external returns (uint256);\n\n /// @notice Allows composability between calls to the different entry points of this module. Any user calling\n /// this function can perform any of the allowed actions in the order of their choice\n /// @param actions Set of actions to perform\n /// @param datas Data to be decoded for each action: it can include like the `vaultID` or the `stablecoinAmount` to borrow\n /// @param from Address from which stablecoins will be taken if one action includes burning stablecoins. This address\n /// should either be the `msg.sender` or be approved by the latter\n /// @param to Address to which stablecoins and/or collateral will be sent in case of\n /// @param who Address of the contract to handle in case of repayment of stablecoins from received collateral\n /// @param repayData Data to pass to the repayment contract in case of\n /// @return paymentData Struct containing the accounting changes from the protocol's perspective (like how much of collateral\n /// or how much has been received). Note that the values in the struct are not aggregated and you could have in the output\n /// a positive amount of stablecoins to receive as well as a positive amount of stablecoins to give\n /// @dev This function is optimized to reduce gas cost due to payment from or to the user and that expensive calls\n /// or computations (like `oracleValue`) are done only once\n /// @dev When specifying `vaultID` in `data`, it is important to know that if you specify `vaultID = 0`, it will simply\n /// use the latest `vaultID`. This is the default behavior, and unless you're engaging into some complex protocol actions\n /// it is encouraged to use `vaultID = 0` only when the first action of the batch is `createVault`\n function angle(\n ActionType[] memory actions,\n bytes[] memory datas,\n address from,\n address to,\n address who,\n bytes memory repayData\n ) external returns (PaymentData memory paymentData);\n\n /// @notice This function is a wrapper built on top of the function above. It enables users to interact with the contract\n /// without having to provide `who` and `repayData` parameters\n function angle(\n ActionType[] memory actions,\n bytes[] memory datas,\n address from,\n address to\n ) external returns (PaymentData memory paymentData);\n\n /// @notice Initializes the `VaultManager` contract\n /// @param _treasury Treasury address handling the contract\n /// @param _collateral Collateral supported by this contract\n /// @param _oracle Oracle contract used\n /// @param _symbol Symbol used to define the `VaultManager` name and symbol\n /// @dev The parameters and the oracle are the only elements which could be modified once the\n /// contract has been initialized\n /// @dev For the contract to be fully initialized, governance needs to set the parameters for the liquidation\n /// boost\n function initialize(\n ITreasury _treasury,\n IERC20 _collateral,\n IOracle _oracle,\n VaultParameters calldata params,\n string memory _symbol\n ) external;\n\n /// @notice Minimum amount of debt a vault can have, expressed in `BASE_TOKENS` that is to say the base of the agTokens\n function dust() external view returns (uint256);\n}\n\n/// @title IVaultManagerStorage\n/// @author Angle Labs, Inc.\n/// @notice Interface for the `VaultManager` contract\n/// @dev This interface contains getters of the contract's public variables used by other contracts\n/// of this module\ninterface IVaultManagerStorage {\n /// @notice Encodes the maximum ratio stablecoin/collateral a vault can have before being liquidated. It's what\n /// determines the minimum collateral ratio of a position\n function collateralFactor() external view returns (uint64);\n\n /// @notice Stablecoin handled by this contract. Another `VaultManager` contract could have\n /// the same rights as this `VaultManager` on the stablecoin contract\n function stablecoin() external view returns (IAgToken);\n\n /// @notice Reference to the `treasury` contract handling this `VaultManager`\n function treasury() external view returns (ITreasury);\n\n /// @notice Oracle contract to get access to the price of the collateral with respect to the stablecoin\n function oracle() external view returns (IOracle);\n\n /// @notice The `interestAccumulator` variable keeps track of the interest that should accrue to the protocol.\n /// The stored value is not necessarily the true value: this one is recomputed every time an action takes place\n /// within the protocol. It is in base `BASE_INTEREST`\n function interestAccumulator() external view returns (uint256);\n\n /// @notice Reference to the collateral handled by this `VaultManager`\n function collateral() external view returns (IERC20);\n\n /// @notice Total normalized amount of stablecoins borrowed, not taking into account the potential bad debt accumulated\n /// This value is expressed in the base of Angle stablecoins (`BASE_TOKENS = 10**18`)\n function totalNormalizedDebt() external view returns (uint256);\n\n /// @notice Maximum amount of stablecoins that can be issued with this contract. It is expressed in `BASE_TOKENS`\n function debtCeiling() external view returns (uint256);\n\n /// @notice Maps a `vaultID` to its data (namely collateral amount and normalized debt)\n function vaultData(uint256 vaultID) external view returns (uint256 collateralAmount, uint256 normalizedDebt);\n\n /// @notice ID of the last vault created. The `vaultIDCount` variables serves as a counter to generate a unique\n /// `vaultID` for each vault: it is like `tokenID` in basic ERC721 contracts\n function vaultIDCount() external view returns (uint256);\n}\n\n/// @title IVaultManager\n/// @author Angle Labs, Inc.\n/// @notice Interface for the `VaultManager` contract\ninterface IVaultManager is IVaultManagerFunctions, IVaultManagerStorage, IERC721Metadata {\n function isApprovedOrOwner(address spender, uint256 vaultID) external view returns (bool);\n}\n\n/// @title IVaultManagerListing\n/// @author Angle Labs, Inc.\n/// @notice Interface for the `VaultManagerListing` contract\ninterface IVaultManagerListing is IVaultManager {\n /// @notice Get the collateral owned by `user` in the contract\n /// @dev This function effectively sums the collateral amounts of all the vaults owned by `user`\n function getUserCollateral(address user) external view returns (uint256);\n}\n" + }, + "contracts/interfaces/governance/IVeBoostProxy.sol": { + "content": "// SPDX-License-Identifier: GPL-3.0\n\npragma solidity ^0.8.12;\n\n/// @title IVeBoostProxy\n/// @author Angle Labs, Inc.\n/// @notice Interface for the `VeBoostProxy` contract\n/// @dev This interface only contains functions of the contract which are called by other contracts\n/// of this module\n/// @dev The `veBoostProxy` contract used by Angle is a full fork of Curve Finance implementation\ninterface IVeBoostProxy {\n /// @notice Reads the adjusted veANGLE balance of an address (adjusted by delegation)\n //solhint-disable-next-line\n function adjusted_balance_of(address) external view returns (uint256);\n}\n" + }, + "@openzeppelin/contracts-upgradeable/token/ERC721/extensions/IERC721MetadataUpgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (token/ERC721/extensions/IERC721Metadata.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../IERC721Upgradeable.sol\";\n\n/**\n * @title ERC-721 Non-Fungible Token Standard, optional metadata extension\n * @dev See https://eips.ethereum.org/EIPS/eip-721\n */\ninterface IERC721MetadataUpgradeable is IERC721Upgradeable {\n /**\n * @dev Returns the token collection name.\n */\n function name() external view returns (string memory);\n\n /**\n * @dev Returns the token collection symbol.\n */\n function symbol() external view returns (string memory);\n\n /**\n * @dev Returns the Uniform Resource Identifier (URI) for `tokenId` token.\n */\n function tokenURI(uint256 tokenId) external view returns (string memory);\n}\n" + }, + "@openzeppelin/contracts-upgradeable/token/ERC721/IERC721Upgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.7.0) (token/ERC721/IERC721.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../../utils/introspection/IERC165Upgradeable.sol\";\n\n/**\n * @dev Required interface of an ERC721 compliant contract.\n */\ninterface IERC721Upgradeable is IERC165Upgradeable {\n /**\n * @dev Emitted when `tokenId` token is transferred from `from` to `to`.\n */\n event Transfer(address indexed from, address indexed to, uint256 indexed tokenId);\n\n /**\n * @dev Emitted when `owner` enables `approved` to manage the `tokenId` token.\n */\n event Approval(address indexed owner, address indexed approved, uint256 indexed tokenId);\n\n /**\n * @dev Emitted when `owner` enables or disables (`approved`) `operator` to manage all of its assets.\n */\n event ApprovalForAll(address indexed owner, address indexed operator, bool approved);\n\n /**\n * @dev Returns the number of tokens in ``owner``'s account.\n */\n function balanceOf(address owner) external view returns (uint256 balance);\n\n /**\n * @dev Returns the owner of the `tokenId` token.\n *\n * Requirements:\n *\n * - `tokenId` must exist.\n */\n function ownerOf(uint256 tokenId) external view returns (address owner);\n\n /**\n * @dev Safely transfers `tokenId` token from `from` to `to`.\n *\n * Requirements:\n *\n * - `from` cannot be the zero address.\n * - `to` cannot be the zero address.\n * - `tokenId` token must exist and be owned by `from`.\n * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}.\n * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.\n *\n * Emits a {Transfer} event.\n */\n function safeTransferFrom(\n address from,\n address to,\n uint256 tokenId,\n bytes calldata data\n ) external;\n\n /**\n * @dev Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipients\n * are aware of the ERC721 protocol to prevent tokens from being forever locked.\n *\n * Requirements:\n *\n * - `from` cannot be the zero address.\n * - `to` cannot be the zero address.\n * - `tokenId` token must exist and be owned by `from`.\n * - If the caller is not `from`, it must have been allowed to move this token by either {approve} or {setApprovalForAll}.\n * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.\n *\n * Emits a {Transfer} event.\n */\n function safeTransferFrom(\n address from,\n address to,\n uint256 tokenId\n ) external;\n\n /**\n * @dev Transfers `tokenId` token from `from` to `to`.\n *\n * WARNING: Usage of this method is discouraged, use {safeTransferFrom} whenever possible.\n *\n * Requirements:\n *\n * - `from` cannot be the zero address.\n * - `to` cannot be the zero address.\n * - `tokenId` token must be owned by `from`.\n * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}.\n *\n * Emits a {Transfer} event.\n */\n function transferFrom(\n address from,\n address to,\n uint256 tokenId\n ) external;\n\n /**\n * @dev Gives permission to `to` to transfer `tokenId` token to another account.\n * The approval is cleared when the token is transferred.\n *\n * Only a single account can be approved at a time, so approving the zero address clears previous approvals.\n *\n * Requirements:\n *\n * - The caller must own the token or be an approved operator.\n * - `tokenId` must exist.\n *\n * Emits an {Approval} event.\n */\n function approve(address to, uint256 tokenId) external;\n\n /**\n * @dev Approve or remove `operator` as an operator for the caller.\n * Operators can call {transferFrom} or {safeTransferFrom} for any token owned by the caller.\n *\n * Requirements:\n *\n * - The `operator` cannot be the caller.\n *\n * Emits an {ApprovalForAll} event.\n */\n function setApprovalForAll(address operator, bool _approved) external;\n\n /**\n * @dev Returns the account approved for `tokenId` token.\n *\n * Requirements:\n *\n * - `tokenId` must exist.\n */\n function getApproved(uint256 tokenId) external view returns (address operator);\n\n /**\n * @dev Returns if the `operator` is allowed to manage all of the assets of `owner`.\n *\n * See {setApprovalForAll}\n */\n function isApprovedForAll(address owner, address operator) external view returns (bool);\n}\n" + }, + "@openzeppelin/contracts/token/ERC20/extensions/draft-IERC20Permit.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (token/ERC20/extensions/draft-IERC20Permit.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Interface of the ERC20 Permit extension allowing approvals to be made via signatures, as defined in\n * https://eips.ethereum.org/EIPS/eip-2612[EIP-2612].\n *\n * Adds the {permit} method, which can be used to change an account's ERC20 allowance (see {IERC20-allowance}) by\n * presenting a message signed by the account. By not relying on {IERC20-approve}, the token holder account doesn't\n * need to send a transaction, and thus is not required to hold Ether at all.\n */\ninterface IERC20Permit {\n /**\n * @dev Sets `value` as the allowance of `spender` over ``owner``'s tokens,\n * given ``owner``'s signed approval.\n *\n * IMPORTANT: The same issues {IERC20-approve} has related to transaction\n * ordering also apply here.\n *\n * Emits an {Approval} event.\n *\n * Requirements:\n *\n * - `spender` cannot be the zero address.\n * - `deadline` must be a timestamp in the future.\n * - `v`, `r` and `s` must be a valid `secp256k1` signature from `owner`\n * over the EIP712-formatted function arguments.\n * - the signature must use ``owner``'s current nonce (see {nonces}).\n *\n * For more information on the signature format, see the\n * https://eips.ethereum.org/EIPS/eip-2612#specification[relevant EIP\n * section].\n */\n function permit(\n address owner,\n address spender,\n uint256 value,\n uint256 deadline,\n uint8 v,\n bytes32 r,\n bytes32 s\n ) external;\n\n /**\n * @dev Returns the current nonce for `owner`. This value must be\n * included whenever a signature is generated for {permit}.\n *\n * Every successful call to {permit} increases ``owner``'s nonce by one. This\n * prevents a signature from being used multiple times.\n */\n function nonces(address owner) external view returns (uint256);\n\n /**\n * @dev Returns the domain separator used in the encoding of the signature for {permit}, as defined by {EIP712}.\n */\n // solhint-disable-next-line func-name-mixedcase\n function DOMAIN_SEPARATOR() external view returns (bytes32);\n}\n" + }, + "@openzeppelin/contracts/utils/Address.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.7.0) (utils/Address.sol)\n\npragma solidity ^0.8.1;\n\n/**\n * @dev Collection of functions related to the address type\n */\nlibrary Address {\n /**\n * @dev Returns true if `account` is a contract.\n *\n * [IMPORTANT]\n * ====\n * It is unsafe to assume that an address for which this function returns\n * false is an externally-owned account (EOA) and not a contract.\n *\n * Among others, `isContract` will return false for the following\n * types of addresses:\n *\n * - an externally-owned account\n * - a contract in construction\n * - an address where a contract will be created\n * - an address where a contract lived, but was destroyed\n * ====\n *\n * [IMPORTANT]\n * ====\n * You shouldn't rely on `isContract` to protect against flash loan attacks!\n *\n * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets\n * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract\n * constructor.\n * ====\n */\n function isContract(address account) internal view returns (bool) {\n // This method relies on extcodesize/address.code.length, which returns 0\n // for contracts in construction, since the code is only stored at the end\n // of the constructor execution.\n\n return account.code.length > 0;\n }\n\n /**\n * @dev Replacement for Solidity's `transfer`: sends `amount` wei to\n * `recipient`, forwarding all available gas and reverting on errors.\n *\n * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost\n * of certain opcodes, possibly making contracts go over the 2300 gas limit\n * imposed by `transfer`, making them unable to receive funds via\n * `transfer`. {sendValue} removes this limitation.\n *\n * https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more].\n *\n * IMPORTANT: because control is transferred to `recipient`, care must be\n * taken to not create reentrancy vulnerabilities. Consider using\n * {ReentrancyGuard} or the\n * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].\n */\n function sendValue(address payable recipient, uint256 amount) internal {\n require(address(this).balance >= amount, \"Address: insufficient balance\");\n\n (bool success, ) = recipient.call{value: amount}(\"\");\n require(success, \"Address: unable to send value, recipient may have reverted\");\n }\n\n /**\n * @dev Performs a Solidity function call using a low level `call`. A\n * plain `call` is an unsafe replacement for a function call: use this\n * function instead.\n *\n * If `target` reverts with a revert reason, it is bubbled up by this\n * function (like regular Solidity function calls).\n *\n * Returns the raw returned data. To convert to the expected return value,\n * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].\n *\n * Requirements:\n *\n * - `target` must be a contract.\n * - calling `target` with `data` must not revert.\n *\n * _Available since v3.1._\n */\n function functionCall(address target, bytes memory data) internal returns (bytes memory) {\n return functionCall(target, data, \"Address: low-level call failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with\n * `errorMessage` as a fallback revert reason when `target` reverts.\n *\n * _Available since v3.1._\n */\n function functionCall(\n address target,\n bytes memory data,\n string memory errorMessage\n ) internal returns (bytes memory) {\n return functionCallWithValue(target, data, 0, errorMessage);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but also transferring `value` wei to `target`.\n *\n * Requirements:\n *\n * - the calling contract must have an ETH balance of at least `value`.\n * - the called Solidity function must be `payable`.\n *\n * _Available since v3.1._\n */\n function functionCallWithValue(\n address target,\n bytes memory data,\n uint256 value\n ) internal returns (bytes memory) {\n return functionCallWithValue(target, data, value, \"Address: low-level call with value failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but\n * with `errorMessage` as a fallback revert reason when `target` reverts.\n *\n * _Available since v3.1._\n */\n function functionCallWithValue(\n address target,\n bytes memory data,\n uint256 value,\n string memory errorMessage\n ) internal returns (bytes memory) {\n require(address(this).balance >= value, \"Address: insufficient balance for call\");\n require(isContract(target), \"Address: call to non-contract\");\n\n (bool success, bytes memory returndata) = target.call{value: value}(data);\n return verifyCallResult(success, returndata, errorMessage);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but performing a static call.\n *\n * _Available since v3.3._\n */\n function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {\n return functionStaticCall(target, data, \"Address: low-level static call failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\n * but performing a static call.\n *\n * _Available since v3.3._\n */\n function functionStaticCall(\n address target,\n bytes memory data,\n string memory errorMessage\n ) internal view returns (bytes memory) {\n require(isContract(target), \"Address: static call to non-contract\");\n\n (bool success, bytes memory returndata) = target.staticcall(data);\n return verifyCallResult(success, returndata, errorMessage);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but performing a delegate call.\n *\n * _Available since v3.4._\n */\n function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {\n return functionDelegateCall(target, data, \"Address: low-level delegate call failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\n * but performing a delegate call.\n *\n * _Available since v3.4._\n */\n function functionDelegateCall(\n address target,\n bytes memory data,\n string memory errorMessage\n ) internal returns (bytes memory) {\n require(isContract(target), \"Address: delegate call to non-contract\");\n\n (bool success, bytes memory returndata) = target.delegatecall(data);\n return verifyCallResult(success, returndata, errorMessage);\n }\n\n /**\n * @dev Tool to verifies that a low level call was successful, and revert if it wasn't, either by bubbling the\n * revert reason using the provided one.\n *\n * _Available since v4.3._\n */\n function verifyCallResult(\n bool success,\n bytes memory returndata,\n string memory errorMessage\n ) internal pure returns (bytes memory) {\n if (success) {\n return returndata;\n } else {\n // Look for revert reason and bubble it up if present\n if (returndata.length > 0) {\n // The easiest way to bubble the revert reason is using memory via assembly\n /// @solidity memory-safe-assembly\n assembly {\n let returndata_size := mload(returndata)\n revert(add(32, returndata), returndata_size)\n }\n } else {\n revert(errorMessage);\n }\n }\n }\n}\n" + }, + "@openzeppelin/contracts-upgradeable/token/ERC20/IERC20Upgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.6.0) (token/ERC20/IERC20.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Interface of the ERC20 standard as defined in the EIP.\n */\ninterface IERC20Upgradeable {\n /**\n * @dev Emitted when `value` tokens are moved from one account (`from`) to\n * another (`to`).\n *\n * Note that `value` may be zero.\n */\n event Transfer(address indexed from, address indexed to, uint256 value);\n\n /**\n * @dev Emitted when the allowance of a `spender` for an `owner` is set by\n * a call to {approve}. `value` is the new allowance.\n */\n event Approval(address indexed owner, address indexed spender, uint256 value);\n\n /**\n * @dev Returns the amount of tokens in existence.\n */\n function totalSupply() external view returns (uint256);\n\n /**\n * @dev Returns the amount of tokens owned by `account`.\n */\n function balanceOf(address account) external view returns (uint256);\n\n /**\n * @dev Moves `amount` tokens from the caller's account to `to`.\n *\n * Returns a boolean value indicating whether the operation succeeded.\n *\n * Emits a {Transfer} event.\n */\n function transfer(address to, uint256 amount) external returns (bool);\n\n /**\n * @dev Returns the remaining number of tokens that `spender` will be\n * allowed to spend on behalf of `owner` through {transferFrom}. This is\n * zero by default.\n *\n * This value changes when {approve} or {transferFrom} are called.\n */\n function allowance(address owner, address spender) external view returns (uint256);\n\n /**\n * @dev Sets `amount` as the allowance of `spender` over the caller's tokens.\n *\n * Returns a boolean value indicating whether the operation succeeded.\n *\n * IMPORTANT: Beware that changing an allowance with this method brings the risk\n * that someone may use both the old and the new allowance by unfortunate\n * transaction ordering. One possible solution to mitigate this race\n * condition is to first reduce the spender's allowance to 0 and set the\n * desired value afterwards:\n * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729\n *\n * Emits an {Approval} event.\n */\n function approve(address spender, uint256 amount) external returns (bool);\n\n /**\n * @dev Moves `amount` tokens from `from` to `to` using the\n * allowance mechanism. `amount` is then deducted from the caller's\n * allowance.\n *\n * Returns a boolean value indicating whether the operation succeeded.\n *\n * Emits a {Transfer} event.\n */\n function transferFrom(\n address from,\n address to,\n uint256 amount\n ) external returns (bool);\n}\n" + }, + "contracts/interfaces/ICoreBorrow.sol": { + "content": "// SPDX-License-Identifier: GPL-3.0\n\npragma solidity ^0.8.12;\n\n/// @title ICoreBorrow\n/// @author Angle Labs, Inc.\n/// @notice Interface for the `CoreBorrow` contract\n/// @dev This interface only contains functions of the `CoreBorrow` contract which are called by other contracts\n/// of this module\ninterface ICoreBorrow {\n /// @notice Checks if an address corresponds to a treasury of a stablecoin with a flash loan\n /// module initialized on it\n /// @param treasury Address to check\n /// @return Whether the address has the `FLASHLOANER_TREASURY_ROLE` or not\n function isFlashLoanerTreasury(address treasury) external view returns (bool);\n\n /// @notice Checks whether an address is governor of the Angle Protocol or not\n /// @param admin Address to check\n /// @return Whether the address has the `GOVERNOR_ROLE` or not\n function isGovernor(address admin) external view returns (bool);\n\n /// @notice Checks whether an address is governor or a guardian of the Angle Protocol or not\n /// @param admin Address to check\n /// @return Whether the address has the `GUARDIAN_ROLE` or not\n /// @dev Governance should make sure when adding a governor to also give this governor the guardian\n /// role by calling the `addGovernor` function\n function isGovernorOrGuardian(address admin) external view returns (bool);\n}\n" + }, + "contracts/interfaces/IFlashAngle.sol": { + "content": "// SPDX-License-Identifier: GPL-3.0\n\npragma solidity ^0.8.12;\n\nimport \"./IAgToken.sol\";\nimport \"./ICoreBorrow.sol\";\n\n/// @title IFlashAngle\n/// @author Angle Labs, Inc.\n/// @notice Interface for the `FlashAngle` contract\n/// @dev This interface only contains functions of the contract which are called by other contracts\n/// of this module\ninterface IFlashAngle {\n /// @notice Reference to the `CoreBorrow` contract managing the FlashLoan module\n function core() external view returns (ICoreBorrow);\n\n /// @notice Sends the fees taken from flash loans to the treasury contract associated to the stablecoin\n /// @param stablecoin Stablecoin from which profits should be sent\n /// @return balance Amount of profits sent\n /// @dev This function can only be called by the treasury contract\n function accrueInterestToTreasury(IAgToken stablecoin) external returns (uint256 balance);\n\n /// @notice Adds support for a stablecoin\n /// @param _treasury Treasury associated to the stablecoin to add support for\n /// @dev This function can only be called by the `CoreBorrow` contract\n function addStablecoinSupport(address _treasury) external;\n\n /// @notice Removes support for a stablecoin\n /// @param _treasury Treasury associated to the stablecoin to remove support for\n /// @dev This function can only be called by the `CoreBorrow` contract\n function removeStablecoinSupport(address _treasury) external;\n\n /// @notice Sets a new core contract\n /// @param _core Core contract address to set\n /// @dev This function can only be called by the `CoreBorrow` contract\n function setCore(address _core) external;\n}\n" + }, + "@openzeppelin/contracts/interfaces/IERC721Metadata.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (interfaces/IERC721Metadata.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../token/ERC721/extensions/IERC721Metadata.sol\";\n" + }, + "@openzeppelin/contracts/token/ERC721/extensions/IERC721Metadata.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (token/ERC721/extensions/IERC721Metadata.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../IERC721.sol\";\n\n/**\n * @title ERC-721 Non-Fungible Token Standard, optional metadata extension\n * @dev See https://eips.ethereum.org/EIPS/eip-721\n */\ninterface IERC721Metadata is IERC721 {\n /**\n * @dev Returns the token collection name.\n */\n function name() external view returns (string memory);\n\n /**\n * @dev Returns the token collection symbol.\n */\n function symbol() external view returns (string memory);\n\n /**\n * @dev Returns the Uniform Resource Identifier (URI) for `tokenId` token.\n */\n function tokenURI(uint256 tokenId) external view returns (string memory);\n}\n" + }, + "@openzeppelin/contracts/token/ERC721/IERC721.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.7.0) (token/ERC721/IERC721.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../../utils/introspection/IERC165.sol\";\n\n/**\n * @dev Required interface of an ERC721 compliant contract.\n */\ninterface IERC721 is IERC165 {\n /**\n * @dev Emitted when `tokenId` token is transferred from `from` to `to`.\n */\n event Transfer(address indexed from, address indexed to, uint256 indexed tokenId);\n\n /**\n * @dev Emitted when `owner` enables `approved` to manage the `tokenId` token.\n */\n event Approval(address indexed owner, address indexed approved, uint256 indexed tokenId);\n\n /**\n * @dev Emitted when `owner` enables or disables (`approved`) `operator` to manage all of its assets.\n */\n event ApprovalForAll(address indexed owner, address indexed operator, bool approved);\n\n /**\n * @dev Returns the number of tokens in ``owner``'s account.\n */\n function balanceOf(address owner) external view returns (uint256 balance);\n\n /**\n * @dev Returns the owner of the `tokenId` token.\n *\n * Requirements:\n *\n * - `tokenId` must exist.\n */\n function ownerOf(uint256 tokenId) external view returns (address owner);\n\n /**\n * @dev Safely transfers `tokenId` token from `from` to `to`.\n *\n * Requirements:\n *\n * - `from` cannot be the zero address.\n * - `to` cannot be the zero address.\n * - `tokenId` token must exist and be owned by `from`.\n * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}.\n * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.\n *\n * Emits a {Transfer} event.\n */\n function safeTransferFrom(\n address from,\n address to,\n uint256 tokenId,\n bytes calldata data\n ) external;\n\n /**\n * @dev Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipients\n * are aware of the ERC721 protocol to prevent tokens from being forever locked.\n *\n * Requirements:\n *\n * - `from` cannot be the zero address.\n * - `to` cannot be the zero address.\n * - `tokenId` token must exist and be owned by `from`.\n * - If the caller is not `from`, it must have been allowed to move this token by either {approve} or {setApprovalForAll}.\n * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.\n *\n * Emits a {Transfer} event.\n */\n function safeTransferFrom(\n address from,\n address to,\n uint256 tokenId\n ) external;\n\n /**\n * @dev Transfers `tokenId` token from `from` to `to`.\n *\n * WARNING: Usage of this method is discouraged, use {safeTransferFrom} whenever possible.\n *\n * Requirements:\n *\n * - `from` cannot be the zero address.\n * - `to` cannot be the zero address.\n * - `tokenId` token must be owned by `from`.\n * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}.\n *\n * Emits a {Transfer} event.\n */\n function transferFrom(\n address from,\n address to,\n uint256 tokenId\n ) external;\n\n /**\n * @dev Gives permission to `to` to transfer `tokenId` token to another account.\n * The approval is cleared when the token is transferred.\n *\n * Only a single account can be approved at a time, so approving the zero address clears previous approvals.\n *\n * Requirements:\n *\n * - The caller must own the token or be an approved operator.\n * - `tokenId` must exist.\n *\n * Emits an {Approval} event.\n */\n function approve(address to, uint256 tokenId) external;\n\n /**\n * @dev Approve or remove `operator` as an operator for the caller.\n * Operators can call {transferFrom} or {safeTransferFrom} for any token owned by the caller.\n *\n * Requirements:\n *\n * - The `operator` cannot be the caller.\n *\n * Emits an {ApprovalForAll} event.\n */\n function setApprovalForAll(address operator, bool _approved) external;\n\n /**\n * @dev Returns the account approved for `tokenId` token.\n *\n * Requirements:\n *\n * - `tokenId` must exist.\n */\n function getApproved(uint256 tokenId) external view returns (address operator);\n\n /**\n * @dev Returns if the `operator` is allowed to manage all of the assets of `owner`.\n *\n * See {setApprovalForAll}\n */\n function isApprovedForAll(address owner, address operator) external view returns (bool);\n}\n" + }, + "@openzeppelin/contracts/utils/introspection/IERC165.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (utils/introspection/IERC165.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Interface of the ERC165 standard, as defined in the\n * https://eips.ethereum.org/EIPS/eip-165[EIP].\n *\n * Implementers can declare support of contract interfaces, which can then be\n * queried by others ({ERC165Checker}).\n *\n * For an implementation, see {ERC165}.\n */\ninterface IERC165 {\n /**\n * @dev Returns true if this contract implements the interface defined by\n * `interfaceId`. See the corresponding\n * https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section]\n * to learn more about how these ids are created.\n *\n * This function call must use less than 30 000 gas.\n */\n function supportsInterface(bytes4 interfaceId) external view returns (bool);\n}\n" + } + }, + "settings": { + "optimizer": { + "enabled": true, + "runs": 1 + }, + "outputSelection": { + "*": { + "*": [ + "abi", + "evm.bytecode", + "evm.deployedBytecode", + "evm.methodIdentifiers", + "metadata" + ], + "": [ + "ast" + ] + } + } + } +} \ No newline at end of file diff --git a/deployments/polygon/VaultManagerNoDust_Implementation.json b/deployments/polygon/VaultManagerNoDust_Implementation.json index 381d1a43..5cbca079 100644 --- a/deployments/polygon/VaultManagerNoDust_Implementation.json +++ b/deployments/polygon/VaultManagerNoDust_Implementation.json @@ -1,22 +1,6 @@ { - "address": "0xF929345E5A5Ac2f86c7a5802c1CE4aa46f524b28", + "address": "0x3Ec81ceBC9b5ec70852279E195b21bF0AD89b8fE", "abi": [ - { - "inputs": [ - { - "internalType": "uint256", - "name": "dust_", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "dustCollateral_", - "type": "uint256" - } - ], - "stateMutability": "nonpayable", - "type": "constructor" - }, { "inputs": [], "name": "ApprovalToCaller", @@ -299,6 +283,19 @@ "name": "FiledUint64", "type": "event" }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint8", + "name": "version", + "type": "uint8" + } + ], + "name": "Initialized", + "type": "event" + }, { "anonymous": false, "inputs": [ @@ -783,19 +780,6 @@ "stateMutability": "view", "type": "function" }, - { - "inputs": [], - "name": "dustOverride", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, { "inputs": [ { @@ -1446,12 +1430,12 @@ "inputs": [ { "internalType": "uint256", - "name": "newDust", + "name": "_dust", "type": "uint256" }, { "internalType": "uint256", - "name": "newDustCollateral", + "name": "dustCollateral_", "type": "uint256" } ], @@ -1788,45 +1772,54 @@ "type": "function" } ], - "transactionHash": "0xd9c8be3f319b09b384b83704bb7a17c98e8dc911fb4aaceb526bb15a365cb301", + "transactionHash": "0xa1becfbb72371d8a02e9ba82b8f16c596bf2218bcf16bc61f2ec9595176da9a1", "receipt": { "to": null, "from": "0xfdA462548Ce04282f4B6D6619823a7C64Fdc0185", - "contractAddress": "0xF929345E5A5Ac2f86c7a5802c1CE4aa46f524b28", - "transactionIndex": 4, - "gasUsed": "5334111", - "logsBloom": "0x00000000000000000000000000000000000000000000000000000000040000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000000000000800000000000000000000100000000000000000000000000000000000000000000000000000000000080000000000000000000000000000000000000000000000000000002000000000000000000000000200000000000000000000000000000000000000000000000000000200000005000000000000000000001000000000000000800000000000000100000000000000000000000000000000000000000000002000000000000000000000000100000", - "blockHash": "0x145944e49cda91b0e6bbacbdfec1eceadc937c9cb1eef86e9991bbcd0b75e3a9", - "transactionHash": "0xd9c8be3f319b09b384b83704bb7a17c98e8dc911fb4aaceb526bb15a365cb301", + "contractAddress": "0x3Ec81ceBC9b5ec70852279E195b21bF0AD89b8fE", + "transactionIndex": 1, + "gasUsed": "5344056", + "logsBloom": "0x00000000000000000000000080000000000000000000000000000000000000040000000000000000000000000000000000008000000000000000000000000000000000000000000000000000000000800000000080000000000100000000000000000000000000020000000000000000000000000000008080000000000000000000000000000000000000000000000000000002000080000000000000000000200000000000000000000000000400000000000000000000000000000000005000000000000000000001000000040000000800000000000002100000000000000000000000000000000000000000000000000000000000000000000000100000", + "blockHash": "0x29f2e560987831968950519e51dc69e27bf85dec9680358b756ff041bf412f7c", + "transactionHash": "0xa1becfbb72371d8a02e9ba82b8f16c596bf2218bcf16bc61f2ec9595176da9a1", "logs": [ { - "transactionIndex": 4, - "blockNumber": 35594816, - "transactionHash": "0xd9c8be3f319b09b384b83704bb7a17c98e8dc911fb4aaceb526bb15a365cb301", + "transactionIndex": 1, + "blockNumber": 36018788, + "transactionHash": "0xa1becfbb72371d8a02e9ba82b8f16c596bf2218bcf16bc61f2ec9595176da9a1", + "address": "0x3Ec81ceBC9b5ec70852279E195b21bF0AD89b8fE", + "topics": [ + "0x7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb3847402498" + ], + "data": "0x0000000000000000000000000000000000000000000000000000000000000001", + "logIndex": 3, + "blockHash": "0x29f2e560987831968950519e51dc69e27bf85dec9680358b756ff041bf412f7c" + }, + { + "transactionIndex": 1, + "blockNumber": 36018788, + "transactionHash": "0xa1becfbb72371d8a02e9ba82b8f16c596bf2218bcf16bc61f2ec9595176da9a1", "address": "0x0000000000000000000000000000000000001010", "topics": [ "0x4dfe1bbbcf077ddc3e01291eea2d5c70c2b422b415d95645b9adcfd678cb1d63", "0x0000000000000000000000000000000000000000000000000000000000001010", "0x000000000000000000000000fda462548ce04282f4b6d6619823a7c64fdc0185", - "0x000000000000000000000000ef46d5fe753c988606e6f703260d816af53b03eb" + "0x000000000000000000000000de8da1ee512529b6c61fe7c769affc160308dea2" ], - "data": "0x0000000000000000000000000000000000000000000000000e813915adbc8715000000000000000000000000000000000000000000000005200c39a5c4d29ba6000000000000000000000000000000000000000000003bdea59eaa0eeeeec2da000000000000000000000000000000000000000000000005118b009017161491000000000000000000000000000000000000000000003bdeb41fe3249cab49ef", - "logIndex": 14, - "blockHash": "0x145944e49cda91b0e6bbacbdfec1eceadc937c9cb1eef86e9991bbcd0b75e3a9" + "data": "0x0000000000000000000000000000000000000000000000000ed52e1e3c568608000000000000000000000000000000000000000000000004cca7854186861087000000000000000000000000000000000000000000001930429740f11b51ef68000000000000000000000000000000000000000000000004bdd257234a2f8a7f000000000000000000000000000000000000000000001930516c6f0f57a87570", + "logIndex": 4, + "blockHash": "0x29f2e560987831968950519e51dc69e27bf85dec9680358b756ff041bf412f7c" } ], - "blockNumber": 35594816, - "cumulativeGasUsed": "5720899", + "blockNumber": 36018788, + "cumulativeGasUsed": "5404325", "status": 1, "byzantium": true }, - "args": [ - 0, - 0 - ], + "args": [], "numDeployments": 1, - "solcInputHash": "97428e5cc1402a581bde2d79fd2b13fe", - "metadata": "{\"compiler\":{\"version\":\"0.8.12+commit.f00d7308\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"dust_\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"dustCollateral_\",\"type\":\"uint256\"}],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"inputs\":[],\"name\":\"ApprovalToCaller\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"ApprovalToOwner\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"DebtCeilingExceeded\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"DustyLeftoverAmount\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"ExpiredDeadline\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"HealthyVault\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"IncompatibleLengths\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"InsolventVault\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"InvalidParameterType\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"InvalidParameterValue\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"InvalidSetOfParameters\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"InvalidSignature\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"InvalidTreasury\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"NonERC721Receiver\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"NonexistentVault\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"NotApproved\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"NotGovernor\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"NotGovernorOrGuardian\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"NotTreasury\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"NotVaultManager\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"NotWhitelisted\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"Paused\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"TooHighParameterValue\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"TooSmallParameterValue\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"ZeroAddress\",\"type\":\"error\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"surplusEndValue\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"badDebtEndValue\",\"type\":\"uint256\"}],\"name\":\"AccruedToTreasury\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"owner\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"approved\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"tokenId\",\"type\":\"uint256\"}],\"name\":\"Approval\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"owner\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"operator\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"bool\",\"name\":\"approved\",\"type\":\"bool\"}],\"name\":\"ApprovalForAll\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"vaultID\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"collateralAmount\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint8\",\"name\":\"isIncrease\",\"type\":\"uint8\"}],\"name\":\"CollateralAmountUpdated\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"debtCeiling\",\"type\":\"uint256\"}],\"name\":\"DebtCeilingUpdated\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"srcVaultID\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"dstVaultID\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"dstVaultManager\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"DebtTransferred\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint64\",\"name\":\"param\",\"type\":\"uint64\"},{\"indexed\":false,\"internalType\":\"bytes32\",\"name\":\"what\",\"type\":\"bytes32\"}],\"name\":\"FiledUint64\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"value\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"timestamp\",\"type\":\"uint256\"}],\"name\":\"InterestAccumulatorUpdated\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"vaultID\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"internalAmount\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint8\",\"name\":\"isIncrease\",\"type\":\"uint8\"}],\"name\":\"InternalDebtUpdated\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256[]\",\"name\":\"vaultIDs\",\"type\":\"uint256[]\"}],\"name\":\"LiquidatedVaults\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"_veBoostProxy\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256[]\",\"name\":\"xBoost\",\"type\":\"uint256[]\"},{\"indexed\":false,\"internalType\":\"uint256[]\",\"name\":\"yBoost\",\"type\":\"uint256[]\"}],\"name\":\"LiquidationBoostParametersUpdated\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"from\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"to\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"tokenId\",\"type\":\"uint256\"}],\"name\":\"Transfer\",\"type\":\"event\"},{\"inputs\":[],\"name\":\"BASE_INTEREST\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"BASE_PARAMS\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"DOMAIN_SEPARATOR\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"HALF_BASE_INTEREST\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"accrueInterestToTreasury\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"surplusValue\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"badDebtValue\",\"type\":\"uint256\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"enum ActionType[]\",\"name\":\"actions\",\"type\":\"uint8[]\"},{\"internalType\":\"bytes[]\",\"name\":\"datas\",\"type\":\"bytes[]\"},{\"internalType\":\"address\",\"name\":\"from\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"to\",\"type\":\"address\"}],\"name\":\"angle\",\"outputs\":[{\"components\":[{\"internalType\":\"uint256\",\"name\":\"stablecoinAmountToGive\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"stablecoinAmountToReceive\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"collateralAmountToGive\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"collateralAmountToReceive\",\"type\":\"uint256\"}],\"internalType\":\"struct PaymentData\",\"name\":\"\",\"type\":\"tuple\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"enum ActionType[]\",\"name\":\"actions\",\"type\":\"uint8[]\"},{\"internalType\":\"bytes[]\",\"name\":\"datas\",\"type\":\"bytes[]\"},{\"internalType\":\"address\",\"name\":\"from\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"to\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"who\",\"type\":\"address\"},{\"internalType\":\"bytes\",\"name\":\"repayData\",\"type\":\"bytes\"}],\"name\":\"angle\",\"outputs\":[{\"components\":[{\"internalType\":\"uint256\",\"name\":\"stablecoinAmountToGive\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"stablecoinAmountToReceive\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"collateralAmountToGive\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"collateralAmountToReceive\",\"type\":\"uint256\"}],\"internalType\":\"struct PaymentData\",\"name\":\"paymentData\",\"type\":\"tuple\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"to\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"vaultID\",\"type\":\"uint256\"}],\"name\":\"approve\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"badDebt\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"owner\",\"type\":\"address\"}],\"name\":\"balanceOf\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"borrowFee\",\"outputs\":[{\"internalType\":\"uint64\",\"name\":\"\",\"type\":\"uint64\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"vaultID\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"liquidator\",\"type\":\"address\"}],\"name\":\"checkLiquidation\",\"outputs\":[{\"components\":[{\"internalType\":\"uint256\",\"name\":\"maxStablecoinAmountToRepay\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"maxCollateralAmountGiven\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"thresholdRepayAmount\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"discount\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"currentDebt\",\"type\":\"uint256\"}],\"internalType\":\"struct LiquidationOpportunity\",\"name\":\"liqOpp\",\"type\":\"tuple\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"collateral\",\"outputs\":[{\"internalType\":\"contract IERC20\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"collateralFactor\",\"outputs\":[{\"internalType\":\"uint64\",\"name\":\"\",\"type\":\"uint64\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"toVault\",\"type\":\"address\"}],\"name\":\"createVault\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"debtCeiling\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"dust\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"dustOverride\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"vaultID\",\"type\":\"uint256\"}],\"name\":\"getApproved\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"vaultID\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"stablecoinAmount\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"senderBorrowFee\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"senderRepayFee\",\"type\":\"uint256\"}],\"name\":\"getDebtOut\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"getTotalDebt\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"vaultID\",\"type\":\"uint256\"}],\"name\":\"getVaultDebt\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"contract ITreasury\",\"name\":\"_treasury\",\"type\":\"address\"},{\"internalType\":\"contract IERC20\",\"name\":\"_collateral\",\"type\":\"address\"},{\"internalType\":\"contract IOracle\",\"name\":\"_oracle\",\"type\":\"address\"},{\"components\":[{\"internalType\":\"uint256\",\"name\":\"debtCeiling\",\"type\":\"uint256\"},{\"internalType\":\"uint64\",\"name\":\"collateralFactor\",\"type\":\"uint64\"},{\"internalType\":\"uint64\",\"name\":\"targetHealthFactor\",\"type\":\"uint64\"},{\"internalType\":\"uint64\",\"name\":\"interestRate\",\"type\":\"uint64\"},{\"internalType\":\"uint64\",\"name\":\"liquidationSurcharge\",\"type\":\"uint64\"},{\"internalType\":\"uint64\",\"name\":\"maxLiquidationDiscount\",\"type\":\"uint64\"},{\"internalType\":\"bool\",\"name\":\"whitelistingActivated\",\"type\":\"bool\"},{\"internalType\":\"uint256\",\"name\":\"baseBoost\",\"type\":\"uint256\"}],\"internalType\":\"struct VaultParameters\",\"name\":\"params\",\"type\":\"tuple\"},{\"internalType\":\"string\",\"name\":\"_symbol\",\"type\":\"string\"}],\"name\":\"initialize\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"interestAccumulator\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"interestRate\",\"outputs\":[{\"internalType\":\"uint64\",\"name\":\"\",\"type\":\"uint64\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"owner\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"operator\",\"type\":\"address\"}],\"name\":\"isApprovedForAll\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"spender\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"vaultID\",\"type\":\"uint256\"}],\"name\":\"isApprovedOrOwner\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"name\":\"isWhitelisted\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"lastInterestAccumulatorUpdated\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256[]\",\"name\":\"vaultIDs\",\"type\":\"uint256[]\"},{\"internalType\":\"uint256[]\",\"name\":\"amounts\",\"type\":\"uint256[]\"},{\"internalType\":\"address\",\"name\":\"from\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"to\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"who\",\"type\":\"address\"},{\"internalType\":\"bytes\",\"name\":\"data\",\"type\":\"bytes\"}],\"name\":\"liquidate\",\"outputs\":[{\"components\":[{\"internalType\":\"uint256\",\"name\":\"stablecoinAmountToReceive\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"collateralAmountToGive\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"badDebtFromLiquidation\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"oracleValue\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"newInterestAccumulator\",\"type\":\"uint256\"}],\"internalType\":\"struct LiquidatorData\",\"name\":\"liqData\",\"type\":\"tuple\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256[]\",\"name\":\"vaultIDs\",\"type\":\"uint256[]\"},{\"internalType\":\"uint256[]\",\"name\":\"amounts\",\"type\":\"uint256[]\"},{\"internalType\":\"address\",\"name\":\"from\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"to\",\"type\":\"address\"}],\"name\":\"liquidate\",\"outputs\":[{\"components\":[{\"internalType\":\"uint256\",\"name\":\"stablecoinAmountToReceive\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"collateralAmountToGive\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"badDebtFromLiquidation\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"oracleValue\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"newInterestAccumulator\",\"type\":\"uint256\"}],\"internalType\":\"struct LiquidatorData\",\"name\":\"\",\"type\":\"tuple\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"liquidationSurcharge\",\"outputs\":[{\"internalType\":\"uint64\",\"name\":\"\",\"type\":\"uint64\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"maxLiquidationDiscount\",\"outputs\":[{\"internalType\":\"uint64\",\"name\":\"\",\"type\":\"uint64\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"name\",\"outputs\":[{\"internalType\":\"string\",\"name\":\"\",\"type\":\"string\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"owner\",\"type\":\"address\"}],\"name\":\"nonces\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"oracle\",\"outputs\":[{\"internalType\":\"contract IOracle\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"vaultID\",\"type\":\"uint256\"}],\"name\":\"ownerOf\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"paused\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"owner\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"spender\",\"type\":\"address\"},{\"internalType\":\"bool\",\"name\":\"approved\",\"type\":\"bool\"},{\"internalType\":\"uint256\",\"name\":\"deadline\",\"type\":\"uint256\"},{\"internalType\":\"uint8\",\"name\":\"v\",\"type\":\"uint8\"},{\"internalType\":\"bytes32\",\"name\":\"r\",\"type\":\"bytes32\"},{\"internalType\":\"bytes32\",\"name\":\"s\",\"type\":\"bytes32\"}],\"name\":\"permit\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"repayFee\",\"outputs\":[{\"internalType\":\"uint64\",\"name\":\"\",\"type\":\"uint64\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"from\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"to\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"vaultID\",\"type\":\"uint256\"}],\"name\":\"safeTransferFrom\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"from\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"to\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"vaultID\",\"type\":\"uint256\"},{\"internalType\":\"bytes\",\"name\":\"_data\",\"type\":\"bytes\"}],\"name\":\"safeTransferFrom\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"operator\",\"type\":\"address\"},{\"internalType\":\"bool\",\"name\":\"approved\",\"type\":\"bool\"}],\"name\":\"setApprovalForAll\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"string\",\"name\":\"baseURI_\",\"type\":\"string\"}],\"name\":\"setBaseURI\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_debtCeiling\",\"type\":\"uint256\"}],\"name\":\"setDebtCeiling\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"newDust\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"newDustCollateral\",\"type\":\"uint256\"}],\"name\":\"setDusts\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_veBoostProxy\",\"type\":\"address\"},{\"internalType\":\"uint256[]\",\"name\":\"xBoost\",\"type\":\"uint256[]\"},{\"internalType\":\"uint256[]\",\"name\":\"yBoost\",\"type\":\"uint256[]\"}],\"name\":\"setLiquidationBoostParameters\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_oracle\",\"type\":\"address\"}],\"name\":\"setOracle\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_treasury\",\"type\":\"address\"}],\"name\":\"setTreasury\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint64\",\"name\":\"param\",\"type\":\"uint64\"},{\"internalType\":\"bytes32\",\"name\":\"what\",\"type\":\"bytes32\"}],\"name\":\"setUint64\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"stablecoin\",\"outputs\":[{\"internalType\":\"contract IAgToken\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes4\",\"name\":\"interfaceId\",\"type\":\"bytes4\"}],\"name\":\"supportsInterface\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"pure\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"surplus\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"symbol\",\"outputs\":[{\"internalType\":\"string\",\"name\":\"\",\"type\":\"string\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"targetHealthFactor\",\"outputs\":[{\"internalType\":\"uint64\",\"name\":\"\",\"type\":\"uint64\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"togglePause\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"target\",\"type\":\"address\"}],\"name\":\"toggleWhitelist\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"vaultID\",\"type\":\"uint256\"}],\"name\":\"tokenURI\",\"outputs\":[{\"internalType\":\"string\",\"name\":\"\",\"type\":\"string\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"totalNormalizedDebt\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"from\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"to\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"vaultID\",\"type\":\"uint256\"}],\"name\":\"transferFrom\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"treasury\",\"outputs\":[{\"internalType\":\"contract ITreasury\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"name\":\"vaultData\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"collateralAmount\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"normalizedDebt\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"vaultIDCount\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"veBoostProxy\",\"outputs\":[{\"internalType\":\"contract IVeBoostProxy\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"whitelistingActivated\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"name\":\"xLiquidationBoost\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"name\":\"yLiquidationBoost\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"}],\"devdoc\":{\"author\":\"Angle Core Team\",\"kind\":\"dev\",\"methods\":{\"accrueInterestToTreasury()\":{\"details\":\"`surplus` and `badDebt` should be reset to 0 once their current value have been given to the `treasury` contract\",\"returns\":{\"badDebtValue\":\"Value of the bad debt communicated to the `Treasury`\",\"surplusValue\":\"Value of the surplus communicated to the `Treasury`\"}},\"angle(uint8[],bytes[],address,address,address,bytes)\":{\"details\":\"This function is optimized to reduce gas cost due to payment from or to the user and that expensive calls or computations (like `oracleValue`) are done only onceWhen specifying `vaultID` in `data`, it is important to know that if you specify `vaultID = 0`, it will simply use the latest `vaultID`. This is the default behavior, and unless you're engaging into some complex protocol actions it is encouraged to use `vaultID = 0` only when the first action of the batch is `createVault`\",\"params\":{\"actions\":\"Set of actions to perform\",\"datas\":\"Data to be decoded for each action: it can include like the `vaultID` or the `stablecoinAmount` to borrow\",\"from\":\"Address from which stablecoins will be taken if one action includes burning stablecoins. This address should either be the `msg.sender` or be approved by the latter\",\"repayData\":\"Data to pass to the repayment contract in case of\",\"to\":\"Address to which stablecoins and/or collateral will be sent in case of\",\"who\":\"Address of the contract to handle in case of repayment of stablecoins from received collateral\"},\"returns\":{\"paymentData\":\"Struct containing the accounting changes from the protocol's perspective (like how much of collateral or how much has been received). Note that the values in the struct are not aggregated and you could have in the output a positive amount of stablecoins to receive as well as a positive amount of stablecoins to give\"}},\"approve(address,uint256)\":{\"details\":\"Gives permission to `to` to transfer `tokenId` token to another account. The approval is cleared when the token is transferred. Only a single account can be approved at a time, so approving the zero address clears previous approvals. Requirements: - The caller must own the token or be an approved operator. - `tokenId` must exist. Emits an {Approval} event.\"},\"balanceOf(address)\":{\"details\":\"Returns the number of tokens in ``owner``'s account.\"},\"checkLiquidation(uint256,address)\":{\"details\":\"This function will revert if it's called on a vault that does not exist\",\"params\":{\"liquidator\":\"Address of the liquidator which will be performing the liquidation\",\"vaultID\":\"ID of the vault to check\"},\"returns\":{\"liqOpp\":\"Description of the opportunity of liquidation\"}},\"constructor\":{\"custom:oz-upgrades-unsafe-allow\":\"constructor\"},\"createVault(address)\":{\"details\":\"This function just creates the vault without doing any collateral or\",\"params\":{\"toVault\":\"Address for which the va\"},\"returns\":{\"_0\":\"vaultID ID of the vault created\"}},\"getApproved(uint256)\":{\"details\":\"Returns the account approved for `tokenId` token. Requirements: - `tokenId` must exist.\"},\"getDebtOut(uint256,uint256,uint256,uint256)\":{\"details\":\"This function can only be called from a vaultManager registered in the same Treasury\",\"params\":{\"amountStablecoins\":\"Amount of stablecoins to remove from the debt: this amount is to be converted to an internal debt amount\",\"senderBorrowFee\":\"Borrowing fees from the contract which requested this: this is to make sure that people are not arbitraging difference in minting fees\",\"senderRepayFee\":\"Repay fees from the contract which requested this: this is to make sure that people are not arbitraging differences in repay fees\",\"vaultID\":\"ID of the vault to remove debt from\"}},\"getTotalDebt()\":{\"returns\":{\"_0\":\"Total debt across all vaults, taking into account the interest accumulated over time\"}},\"getVaultDebt(uint256)\":{\"params\":{\"vaultID\":\"ID of the vault to check\"},\"returns\":{\"_0\":\"Debt of the vault\"}},\"initialize(address,address,address,(uint256,uint64,uint64,uint64,uint64,uint64,bool,uint256),string)\":{\"details\":\"The parameters and the oracle are the only elements which could be modified once the contract has been initializedFor the contract to be fully initialized, governance needs to set the parameters for the liquidation boost\",\"params\":{\"_collateral\":\"Collateral supported by this contract\",\"_oracle\":\"Oracle contract used\",\"_symbol\":\"Symbol used to define the `VaultManager` name and symbol\",\"_treasury\":\"Treasury address handling the contract\"}},\"isApprovedForAll(address,address)\":{\"details\":\"Returns if the `operator` is allowed to manage all of the assets of `owner`. See {setApprovalForAll}\"},\"isApprovedOrOwner(address,uint256)\":{\"params\":{\"spender\":\"Address for which vault ownership should be checked\",\"vaultID\":\"ID of the vault to check\"},\"returns\":{\"_0\":\"Whether the `spender` address owns or is approved for `vaultID`\"}},\"liquidate(uint256[],uint256[],address,address)\":{\"details\":\"This function is a simplified wrapper of the function below. It is built to remove for liquidators the need to specify a `who` and a `data` parameter\"},\"liquidate(uint256[],uint256[],address,address,address,bytes)\":{\"details\":\"This function will revert if it's called on a vault that cannot be liquidated or that does not exist\",\"params\":{\"amounts\":\"Amount of stablecoin to bring for the liquidation of each vault\",\"data\":\"Data to pass to the repayment contract in case of. If empty, liquidators simply have to bring the exact amount of stablecoins to get the discounted collateral. If not, it is used by the repayment contract to swap a portion or all of the collateral received to stablecoins to be sent to the `from` address. More details in the `_handleRepay` function\",\"from\":\"Address from which the stablecoins for the liquidation should be taken: this address should be the `msg.sender` or have received an approval\",\"to\":\"Address to which discounted collateral should be sent\",\"vaultIDs\":\"List of the vaults to liquidate\",\"who\":\"Address of the contract to handle repayment of stablecoins from received collateral\"},\"returns\":{\"liqData\":\"Data about the liquidation process for the liquidator to track everything that has been going on (like how much stablecoins have been repaid, how much collateral has been received)\"}},\"ownerOf(uint256)\":{\"details\":\"Returns the owner of the `tokenId` token. Requirements: - `tokenId` must exist.\"},\"permit(address,address,bool,uint256,uint8,bytes32,bytes32)\":{\"details\":\"The `v`, `r`, and `s` parameters are used as signature data\",\"params\":{\"approved\":\"Whether to give or revoke the approval\",\"deadline\":\"Deadline parameter for the signature to be valid\",\"owner\":\"Address signing the permit and giving (or revoking) its approval for all the controlled vaults\",\"spender\":\"Address to give approval to\"}},\"safeTransferFrom(address,address,uint256)\":{\"details\":\"Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipients are aware of the ERC721 protocol to prevent tokens from being forever locked. Requirements: - `from` cannot be the zero address. - `to` cannot be the zero address. - `tokenId` token must exist and be owned by `from`. - If the caller is not `from`, it must be have been allowed to move this token by either {approve} or {setApprovalForAll}. - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer. Emits a {Transfer} event.\"},\"safeTransferFrom(address,address,uint256,bytes)\":{\"details\":\"Safely transfers `tokenId` token from `from` to `to`. Requirements: - `from` cannot be the zero address. - `to` cannot be the zero address. - `tokenId` token must exist and be owned by `from`. - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}. - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer. Emits a {Transfer} event.\"},\"setApprovalForAll(address,bool)\":{\"details\":\"Approve or remove `operator` as an operator for the caller. Operators can call {transferFrom} or {safeTransferFrom} for any token owned by the caller. Requirements: - The `operator` cannot be the caller. Emits an {ApprovalForAll} event.\"},\"setDebtCeiling(uint256)\":{\"details\":\"`debtCeiling` should not be bigger than `type(uint256).max / 10**27` otherwise there could be overflows\",\"params\":{\"_debtCeiling\":\"New value for `debtCeiling`\"}},\"setDusts(uint256,uint256)\":{\"details\":\"These variables are not taken into account in all circumstances as the actual dust variables\"},\"setLiquidationBoostParameters(address,uint256[],uint256[])\":{\"details\":\"There are 2 modes: When boost is enabled, `xBoost` and `yBoost` should have a length of 2, but if they have a higher length contract will still work as expected. Contract will also work as expected if their length differ When boost is disabled, `_veBoostProxy` needs to be zero address and `yBoost[0]` is the base boost\",\"params\":{\"_veBoostProxy\":\"Address which queries veANGLE balances and adjusted balances from delegation\",\"xBoost\":\"Threshold values of veANGLE adjusted balances\",\"yBoost\":\"Values of the liquidation boost at the threshold values of x\"}},\"setOracle(address)\":{\"params\":{\"_oracle\":\"Reference to the oracle contract\"}},\"setTreasury(address)\":{\"details\":\"All required checks when setting up a treasury contract are performed in the contract calling this function\",\"params\":{\"_treasury\":\"New treasury contract\"}},\"setUint64(uint64,bytes32)\":{\"details\":\"This function performs the required checks when updating a parameterWhen setting parameters governance or the guardian should make sure that when `HF < CF/((1-surcharge)(1-discount))` and hence when liquidating a vault is going to decrease its health factor, `discount = max discount`. Otherwise, it may be profitable for the liquidator to liquidate in multiple times: as it will decrease the HF and therefore increase the discount between each time\",\"params\":{\"param\":\"Value for the parameter\",\"what\":\"Parameter to change\"}},\"supportsInterface(bytes4)\":{\"details\":\"Returns true if this contract implements the interface defined by `interfaceId`. See the corresponding https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section] to learn more about how these ids are created. This function call must use less than 30 000 gas.\"},\"toggleWhitelist(address)\":{\"details\":\"If the `target` address is the zero address then this function toggles whitelisting for all addresses\",\"params\":{\"target\":\"Address to toggle\"}},\"tokenURI(uint256)\":{\"details\":\"Returns the Uniform Resource Identifier (URI) for `tokenId` token.\"},\"transferFrom(address,address,uint256)\":{\"details\":\"Transfers `tokenId` token from `from` to `to`. WARNING: Usage of this method is discouraged, use {safeTransferFrom} whenever possible. Requirements: - `from` cannot be the zero address. - `to` cannot be the zero address. - `tokenId` token must be owned by `from`. - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}. Emits a {Transfer} event.\"}},\"title\":\"VaultManagerLiquidationBoost\",\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{\"BASE_INTEREST()\":{\"notice\":\"Base used for interest rate computation\"},\"BASE_PARAMS()\":{\"notice\":\"Base used for parameter computation: almost all the parameters of this contract are set in `BASE_PARAMS`\"},\"DOMAIN_SEPARATOR()\":{\"notice\":\"Returns the domain separator for the current chain.\"},\"HALF_BASE_INTEREST()\":{\"notice\":\"Used for interest rate computation\"},\"accrueInterestToTreasury()\":{\"notice\":\"Accrues interest accumulated across all vaults to the surplus and sends the surplus to the treasury\"},\"angle(uint8[],bytes[],address,address)\":{\"notice\":\"This function is a wrapper built on top of the function above. It enables users to interact with the contract without having to provide `who` and `repayData` parameters\"},\"angle(uint8[],bytes[],address,address,address,bytes)\":{\"notice\":\"Allows composability between calls to the different entry points of this module. Any user calling this function can perform any of the allowed actions in the order of their choice\"},\"badDebt()\":{\"notice\":\"Bad debt made from liquidated vaults which ended up having no collateral and a positive amount of stablecoins\"},\"borrowFee()\":{\"notice\":\"Upfront fee taken when borrowing stablecoins: this fee is optional and should in practice not be used\"},\"checkLiquidation(uint256,address)\":{\"notice\":\"Checks whether a given vault is liquidable and if yes gives information regarding its liquidation\"},\"collateral()\":{\"notice\":\"Reference to the collateral handled by this `VaultManager`\"},\"collateralFactor()\":{\"notice\":\"Encodes the maximum ratio stablecoin/collateral a vault can have before being liquidated. It's what determines the minimum collateral ratio of a position\"},\"createVault(address)\":{\"notice\":\"Creates a vault\"},\"debtCeiling()\":{\"notice\":\"Maximum amount of stablecoins that can be issued with this contract (in `BASE_TOKENS`). This parameter should not be bigger than `type(uint256).max / BASE_INTEREST` otherwise there may be some overflows in the `increaseDebt` function\"},\"dust()\":{\"notice\":\"Minimum amount of debt a vault can have, expressed in `BASE_TOKENS` that is to say the base of the agTokens\"},\"dustOverride()\":{\"notice\":\"Variable to potentially override the immutable `dust`\"},\"getDebtOut(uint256,uint256,uint256,uint256)\":{\"notice\":\"Removes debt from a vault after being requested to do so by another `VaultManager` contract\"},\"getTotalDebt()\":{\"notice\":\"Gets the total debt across all vaults\"},\"getVaultDebt(uint256)\":{\"notice\":\"Gets the current debt of a vault\"},\"initialize(address,address,address,(uint256,uint64,uint64,uint64,uint64,uint64,bool,uint256),string)\":{\"notice\":\"Initializes the `VaultManager` contract\"},\"interestAccumulator()\":{\"notice\":\"The `interestAccumulator` variable keeps track of the interest that should accrue to the protocol. The stored value is not necessarily the true value: this one is recomputed every time an action takes place within the protocol. It is in base `BASE_INTEREST`\"},\"interestRate()\":{\"notice\":\"Per second interest taken to borrowers taking agToken loans. Contrarily to other parameters, it is set in `BASE_INTEREST` that is to say in base 10**27\"},\"isApprovedOrOwner(address,uint256)\":{\"notice\":\"Checks whether a given address is approved for a vault or owns this vault\"},\"isWhitelisted(address)\":{\"notice\":\"Maps an address to 1 if it's whitelisted and can open or own a vault\"},\"lastInterestAccumulatorUpdated()\":{\"notice\":\"Timestamp at which the `interestAccumulator` was updated\"},\"liquidate(uint256[],uint256[],address,address)\":{\"notice\":\"Liquidates an ensemble of vaults specified by their IDs\"},\"liquidate(uint256[],uint256[],address,address,address,bytes)\":{\"notice\":\"Liquidates an ensemble of vaults specified by their IDs\"},\"liquidationSurcharge()\":{\"notice\":\"Fee taken by the protocol during a liquidation. Technically, this value is not the fee per se, it's 1 - fee. For instance for a 2% fee, `liquidationSurcharge` should be 98%\"},\"maxLiquidationDiscount()\":{\"notice\":\"Maximum discount given to liquidators\"},\"nonces(address)\":{\"notice\":\"Returns the current nonce for an `owner` address\"},\"oracle()\":{\"notice\":\"Oracle contract to get access to the price of the collateral with respect to the stablecoin\"},\"paused()\":{\"notice\":\"Whether the contract is paused or not\"},\"permit(address,address,bool,uint256,uint8,bytes32,bytes32)\":{\"notice\":\"Allows an address to give or revoke approval for all its vaults to another address\"},\"repayFee()\":{\"notice\":\"Upfront fee taken when repaying stablecoins: this fee is optional as well. It should be smaller than the liquidation surcharge (cf below) to avoid exploits where people voluntarily get liquidated at a 0 discount to pay smaller repaying fees\"},\"setBaseURI(string)\":{\"notice\":\"Changes the ERC721 metadata URI\"},\"setDebtCeiling(uint256)\":{\"notice\":\"Sets `debtCeiling`\"},\"setDusts(uint256,uint256)\":{\"notice\":\"Sets the dust variables\"},\"setLiquidationBoostParameters(address,uint256[],uint256[])\":{\"notice\":\"Sets the parameters for the liquidation booster which encodes the slope of the discount\"},\"setOracle(address)\":{\"notice\":\"Changes the reference to the oracle contract used to get the price of the oracle\"},\"setTreasury(address)\":{\"notice\":\"Sets the treasury contract\"},\"setUint64(uint64,bytes32)\":{\"notice\":\"Sets parameters encoded as uint64\"},\"stablecoin()\":{\"notice\":\"Stablecoin handled by this contract. Another `VaultManager` contract could have the same rights as this `VaultManager` on the stablecoin contract\"},\"surplus()\":{\"notice\":\"Surplus accumulated by the contract: surplus is always in stablecoins, and is then reset when the value is communicated to the treasury contract\"},\"targetHealthFactor()\":{\"notice\":\"Maximum Health factor at which a vault can end up after a liquidation (unless it's fully liquidated)\"},\"togglePause()\":{\"notice\":\"Pauses external permissionless functions of the contract\"},\"toggleWhitelist(address)\":{\"notice\":\"Changes the whitelisting of an address\"},\"totalNormalizedDebt()\":{\"notice\":\"Total normalized amount of stablecoins borrowed, not taking into account the potential bad debt accumulated This value is expressed in the base of Angle stablecoins (`BASE_TOKENS = 10**18`)\"},\"treasury()\":{\"notice\":\"Reference to the `treasury` contract handling this `VaultManager`\"},\"vaultData(uint256)\":{\"notice\":\"Maps a `vaultID` to its data (namely collateral amount and normalized debt)\"},\"vaultIDCount()\":{\"notice\":\"ID of the last vault created. The `vaultIDCount` variables serves as a counter to generate a unique `vaultID` for each vault: it is like `tokenID` in basic ERC721 contracts\"},\"veBoostProxy()\":{\"notice\":\"Reference to the contract which computes adjusted veANGLE balances for liquidators boosts\"},\"whitelistingActivated()\":{\"notice\":\"Whether whitelisting is required to own a vault or not\"},\"xLiquidationBoost(uint256)\":{\"notice\":\"Threshold veANGLE balance values for the computation of the boost for liquidators: the length of this array should normally be 2. The base of the x-values in this array should be `BASE_TOKENS`\"},\"yLiquidationBoost(uint256)\":{\"notice\":\"Values of the liquidation boost at the threshold values of x\"}},\"notice\":\"Liquidation discount depending also on the liquidator veANGLE balance\",\"version\":1}},\"settings\":{\"compilationTarget\":{\"contracts/vaultManager/VaultManagerLiquidationBoost.sol\":\"VaultManagerLiquidationBoost\"},\"evmVersion\":\"london\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\"},\"optimizer\":{\"enabled\":true,\"runs\":1},\"remappings\":[]},\"sources\":{\"@openzeppelin/contracts-upgradeable/interfaces/IERC721MetadataUpgradeable.sol\":{\"keccak256\":\"0xc0e1ac396ac591a4c38ddcdd220321128eb94424d73e41a573cf58d5c643af38\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://2bd729caa85e0c3740b2d3a28a91fac0fd1ef66e0907145005a37f1927ae7a22\",\"dweb:/ipfs/QmcfVoLnE2PZj3U6KbACk6ykqE5WXuAM3hsXLJxC2sxZGt\"]},\"@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol\":{\"keccak256\":\"0x68861bcc80cacbd498efde75aab6c74a486cc48262660d326c8d7530d9752097\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://5beb2713aca05976562500789329e8c41320d00bd68ea9247856ec73894c3e3f\",\"dweb:/ipfs/QmQKwkpofsZYAzMZs7uNL7Qq58zVBuhoZCGpD6bJdUwyqy\"]},\"@openzeppelin/contracts-upgradeable/security/ReentrancyGuardUpgradeable.sol\":{\"keccak256\":\"0xf3a9b766b0d0456f79d9402db4b49bb16c414f3f9d65244475c0704b6c66dcf1\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://2be836e0695ca8a93f81a4bb6a7f74469ba97fb6e33948739c7f65a5f4110e4f\",\"dweb:/ipfs/QmTcsEpD8XJHtA5vjJ2mbrgYyDYQoMF3zuAEMTu6KFSXjX\"]},\"@openzeppelin/contracts-upgradeable/token/ERC20/IERC20Upgradeable.sol\":{\"keccak256\":\"0x5ca0eb1120133a6d0799752532d4638048391823a2b623c4fe9ff46e262266fb\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://439a76e6c35f75a7253f1ff68c99f399094233b0ddecac6bd19093f0d18980c4\",\"dweb:/ipfs/QmYGY3jR6A4k8KWzHjGG249EWR6KtoENzdPGv6MZRFhdEW\"]},\"@openzeppelin/contracts-upgradeable/token/ERC20/extensions/draft-IERC20PermitUpgradeable.sol\":{\"keccak256\":\"0xcc70d8e2281fb3ff69e8ab242500f10142cd0a7fa8dd9e45882be270d4d09024\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://17a4063bc918df0f7bb9cbf04c6f0bb4977afab3f2fc212bc138a178312a221d\",\"dweb:/ipfs/QmZMdvsHP5mDEAAdrK4bNeNh47TfmSFgN9qEBFTbie7zmm\"]},\"@openzeppelin/contracts-upgradeable/token/ERC721/IERC721ReceiverUpgradeable.sol\":{\"keccak256\":\"0x2f359f9d5c56394e60d74401487ab55d8ef0012907b07c9abbb8f998bf5ddfec\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://47d1408f0b62a24a9c2abd7678665178916fc147b8f23153d61e21353f0205e4\",\"dweb:/ipfs/QmWis4pCq81JzNTqdCoiMqjEtcwp3NGRnCz4nYPYp2jEKd\"]},\"@openzeppelin/contracts-upgradeable/token/ERC721/IERC721Upgradeable.sol\":{\"keccak256\":\"0x714a33fd66816f608f6eda908da24eb6009eee50adf4062c86639d4fe508a7b6\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://1222806a46ee6d877cff1f609cdb548271a0ae85228716c8d1427462a16bd59b\",\"dweb:/ipfs/QmZVjwuTFqhoFBuug3fvHFVC5Y9ompwdHMwUy5upevMfJ5\"]},\"@openzeppelin/contracts-upgradeable/token/ERC721/extensions/IERC721MetadataUpgradeable.sol\":{\"keccak256\":\"0x95a471796eb5f030fdc438660bebec121ad5d063763e64d92376ffb4b5ce8b70\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://4ffbd627e6958983d288801acdedbf3491ee0ebf1a430338bce47c96481ce9e3\",\"dweb:/ipfs/QmUM1vpmNgBV34sYf946SthDJNGhwwqjoRggmj4TUUQmdB\"]},\"@openzeppelin/contracts-upgradeable/utils/AddressUpgradeable.sol\":{\"keccak256\":\"0x3f0f878c796dfc7feba6d3c4e3e526c14c7deae8b7bfc71088e3f38fab0d77b3\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://69bf7d357ce97852f4fb71045919b1bb2c0ad0c820e3f06b9dd4451b2dc5a343\",\"dweb:/ipfs/QmWt96ZviufDu2qqS7Ln6UCJjfLyoFKbo6YKn54ao3o94z\"]},\"@openzeppelin/contracts-upgradeable/utils/introspection/IERC165Upgradeable.sol\":{\"keccak256\":\"0xc6cef87559d0aeffdf0a99803de655938a7779ec0a3cd5d4383483ad85565a09\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://92ad7e572cf44e6b4b37631b44b62f9eb9fb1cf14d9ce51c1504d5dc7ccaf758\",\"dweb:/ipfs/QmcnbqX85tsWnUXPmtuPLE4SczME2sJaTfmqEFkuAJvWhy\"]},\"@openzeppelin/contracts/interfaces/IERC721Metadata.sol\":{\"keccak256\":\"0x1e88abdf82fcbbf98f97be17ea56c924376350637896bc37366ec9f89b7c2628\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://c8eb8afc411b87c9718cfe5c68669d5210d7012a96890c520c0fc321f74f0992\",\"dweb:/ipfs/Qmcr74gEtRpWER5qjFN86AKUep66pGuzp9WDYueaNtt97n\"]},\"@openzeppelin/contracts/token/ERC20/IERC20.sol\":{\"keccak256\":\"0x61437cb513a887a1bbad006e7b1c8b414478427d33de47c5600af3c748f108da\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://2c3d0973630ed74f2b5ce3944677a885dc70ec32fc83b35f55045a10224da32b\",\"dweb:/ipfs/QmbefZ5RoEZKNHXCALfh683PnaNYzKPcKMFjyY1DVAgq8A\"]},\"@openzeppelin/contracts/token/ERC20/extensions/IERC20Metadata.sol\":{\"keccak256\":\"0x8de418a5503946cabe331f35fe242d3201a73f67f77aaeb7110acb1f30423aca\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://5a376d3dda2cb70536c0a45c208b29b34ac560c4cb4f513a42079f96ba47d2dd\",\"dweb:/ipfs/QmZQg6gn1sUpM8wHzwNvSnihumUCAhxD119MpXeKp8B9s8\"]},\"@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol\":{\"keccak256\":\"0xc3d946432c0ddbb1f846a0d3985be71299df331b91d06732152117f62f0be2b5\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://4632c341a06ba5c079b51ca5a915efab4e6ab57735b37839b3e8365ff806a43e\",\"dweb:/ipfs/QmTHT3xHYed2wajEoA5qu7ii2BxLpPhQZHwAhtLK5Z7ANK\"]},\"@openzeppelin/contracts/token/ERC721/IERC721.sol\":{\"keccak256\":\"0x516a22876c1fab47f49b1bc22b4614491cd05338af8bd2e7b382da090a079990\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://a439187f7126d31add4557f82d8aed6be0162007cd7182c48fd934dbab8f3849\",\"dweb:/ipfs/QmRPLguRFvrRJS7r6F1bcLvsx6q1VrgjEpZafyeL8D7xZh\"]},\"@openzeppelin/contracts/token/ERC721/extensions/IERC721Metadata.sol\":{\"keccak256\":\"0x75b829ff2f26c14355d1cba20e16fe7b29ca58eb5fef665ede48bc0f9c6c74b9\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://a0a107160525724f9e1bbbab031defc2f298296dd9e331f16a6f7130cec32146\",\"dweb:/ipfs/QmemujxSd7gX8A9M8UwmNbz4Ms3U9FG9QfudUgxwvTmPWf\"]},\"@openzeppelin/contracts/utils/Address.sol\":{\"keccak256\":\"0x51b758a8815ecc9596c66c37d56b1d33883a444631a3f916b9fe65cb863ef7c4\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://997ca03557985b3c6f9143a18b6c3a710b3bc1c7f189ee956d305a966ecfb922\",\"dweb:/ipfs/QmQaD3Wb62F88SHqmpLttvF6wKuPDQep2LLUcKPekeRzvz\"]},\"@openzeppelin/contracts/utils/introspection/IERC165.sol\":{\"keccak256\":\"0x447a5f3ddc18419d41ff92b3773fb86471b1db25773e07f877f548918a185bf1\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://be161e54f24e5c6fae81a12db1a8ae87bc5ae1b0ddc805d82a1440a68455088f\",\"dweb:/ipfs/QmP7C3CHdY9urF4dEMb9wmsp1wMxHF6nhA2yQE5SKiPAdy\"]},\"contracts/interfaces/IAgToken.sol\":{\"keccak256\":\"0xcd50d86128e457543483981ea6127cb8dac03584b919614352aa89d7e991405c\",\"license\":\"GPL-3.0\",\"urls\":[\"bzz-raw://bb6868cb86cd44401b1bf1b65b3f44092ef39e68a44af66f2424e744bef8a1fa\",\"dweb:/ipfs/QmR9aMfNCQiWWTYQFA88Vv4XeqZReYgYohPeoZ2AHYU7eU\"]},\"contracts/interfaces/ICoreBorrow.sol\":{\"keccak256\":\"0x25b65b3f506ca91745a444502a36f0556585d82d9d60f4bd32fbcaabc12840d4\",\"license\":\"GPL-3.0\",\"urls\":[\"bzz-raw://a32f4726c09eaa4f8fd6f40c9bdb25e154852d62d76c0cdc0c42bd12454dca5c\",\"dweb:/ipfs/QmaCfibrHC9HULzYqXw12DdNk9RTPZqerN4Ld1dyGCoUFa\"]},\"contracts/interfaces/IFlashAngle.sol\":{\"keccak256\":\"0xc17654e512897efe41e3f1173c07dd4676e8c699a72b859d14b473d1e8300e45\",\"license\":\"GPL-3.0\",\"urls\":[\"bzz-raw://2155889f592887eaf45a7f8df4d0328312918dfbf03508500c20927496d54ea8\",\"dweb:/ipfs/QmWRW2r8oUCbNprXY5G8ZDYxR9ssDCP7T2FMPS2h56Fq6N\"]},\"contracts/interfaces/IOracle.sol\":{\"keccak256\":\"0x90fc39ba314b05884005b9deb1d949ca20f7fc5158fa0a7e41f1c798fb0c0a43\",\"license\":\"GPL-3.0\",\"urls\":[\"bzz-raw://aad639fa57c2553dc4bbbdb4007bddf9f3ace49eb83f99595fe5408a6329588b\",\"dweb:/ipfs/QmPiLrpwuQ7bUVB1fxnPKV8xGZR69X4yXttYspx89UoSYk\"]},\"contracts/interfaces/ISwapper.sol\":{\"keccak256\":\"0x8f9abab47966d41ca36eb9e8bb8b39bd5ba262d66ed141d001084f64f186c525\",\"license\":\"GPL-3.0\",\"urls\":[\"bzz-raw://71a48cc8df422d5860af1985596990fc71d30e1a0b7373676e4cfd9492bf7e4a\",\"dweb:/ipfs/QmcMfpqJEbcYEbGbTv2Fm9BP8mqTBDnruGUihDVuz1HdJW\"]},\"contracts/interfaces/ITreasury.sol\":{\"keccak256\":\"0x795cdb939e8958ba29fcd76c0f6c8101a5d367e72c07438b2c5860b9c4a27013\",\"license\":\"GPL-3.0\",\"urls\":[\"bzz-raw://b47ac25cb1c1285b70d3c68097e05c0015688bafbbdc8ed2e48a0c69b6865966\",\"dweb:/ipfs/QmeKdwUmqwU2pf9fcNAtTcHu7DzbPmp8RQ5C4tMWgiKT89\"]},\"contracts/interfaces/IVaultManager.sol\":{\"keccak256\":\"0xa5ef23f07897288bff816c0df37182e55e90ea8ce4db092a23700c0ebcfdeffe\",\"license\":\"GPL-3.0\",\"urls\":[\"bzz-raw://c1d8ac1164bf861c72b145ad7a692c450506b07a9a4d0523a295e46fb02ea53f\",\"dweb:/ipfs/QmNTSPYJjT6eTP9KQvt4uhps444P3CB6yAEyPL7NxGAovh\"]},\"contracts/interfaces/external/IERC1271.sol\":{\"keccak256\":\"0xdb92e9d322d403b39f53be53cefbb560253def674128144786e7244a306ccfa5\",\"license\":\"GPL-2.0-or-later\",\"urls\":[\"bzz-raw://83fe1ef24f594848a27daf09959cb3157876938c9e5193194224a4f5e2233dc3\",\"dweb:/ipfs/QmPA7KxdoSCsedPYZdZw9pNGvyYGLCED8Baj3W4NpX7r1A\"]},\"contracts/interfaces/governance/IVeBoostProxy.sol\":{\"keccak256\":\"0x3225addd919f109d6178d0bbc9b53b25589a015283815dfed34d3d2b3029aff7\",\"license\":\"GPL-3.0\",\"urls\":[\"bzz-raw://0282f869b843734adbf954103768a111925267653ed8b1772bb703e0989d1846\",\"dweb:/ipfs/QmTAddu4gxA9abj5wp7jXqyGCd5YCYZCn9NGuYLf2vEVpd\"]},\"contracts/vaultManager/VaultManager.sol\":{\"keccak256\":\"0xf98e8e77657204564b4eb000271453f7557f182f8b8af36456feb728414cc895\",\"license\":\"GPL-3.0\",\"urls\":[\"bzz-raw://7ad79a928b8b5cc83952fbcd71a942ad6dda824d435383b5e8a5b1de6a1b3b54\",\"dweb:/ipfs/QmSYeBMUhzFwt1vT9fsYrmbe2FpJn1M9n8HzNNEp4sGJa7\"]},\"contracts/vaultManager/VaultManagerERC721.sol\":{\"keccak256\":\"0xeef355be781d26a3ea0055ba01e6342922221ff440d75bb2afe0ca4b2eef3c08\",\"license\":\"GPL-3.0\",\"urls\":[\"bzz-raw://bc7d3af8e343087c5fd2ce26309e636885f89d66d4a56ee96fddb7589139bf7a\",\"dweb:/ipfs/QmTUjsw6LRhQmzFAzUrqv3qQdFwrYKsEwbTR3SQXn4yNyN\"]},\"contracts/vaultManager/VaultManagerLiquidationBoost.sol\":{\"keccak256\":\"0x7e235e5e325430d78f8af56527eb8b8baa1f8c0becff974f24373771057134ab\",\"license\":\"GPL-3.0\",\"urls\":[\"bzz-raw://bef0253529aff1bf1b3f097a00e8a8a6fc4b0f98e9e25e0cee553e6b2966a950\",\"dweb:/ipfs/QmNPci9YYWfrzvXt2wcZYhzLPpzrfHmnW1KWxzbbAPZpkE\"]},\"contracts/vaultManager/VaultManagerPermit.sol\":{\"keccak256\":\"0x4f97de1875f9a341b3e1eb1745a72e78edd1a2fffb3e3d9e1fe8dd1e00835d28\",\"license\":\"GPL-3.0\",\"urls\":[\"bzz-raw://4e9dd5c023c1f21885aa2f41af11e149bde93ec0684a1bbe8e56bf94f621d0f2\",\"dweb:/ipfs/QmXJ9f7eMjScrgNDaNTLLqF3YmTaxBThGp8YKqgmDXfcKA\"]},\"contracts/vaultManager/VaultManagerStorage.sol\":{\"keccak256\":\"0x6e9345444632eeef0416b14057e929eb5f7aeb31499f2c29abd51c54c4bfad7b\",\"license\":\"GPL-3.0\",\"urls\":[\"bzz-raw://f5913b2189835ab0ba3527e5ca7f6138733b122fb12e3ad1e736decb116422b0\",\"dweb:/ipfs/QmanKBCLb6VQVMnvH85n3FdxPfHEffK4dqjqw4bcUS75jB\"]}},\"version\":1}", - "bytecode": "0x60c06040523480156200001157600080fd5b50604051620060853803806200608583398101604081905262000034916200013d565b81818181600060019054906101000a900460ff166200005a5760005460ff161562000064565b6200006462000119565b620000cc5760405162461bcd60e51b815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201526d191e481a5b9a5d1a585b1a5e995960921b606482015260840160405180910390fd5b600054610100900460ff16158015620000ef576000805461ffff19166101011790555b608083905260a082905280156200010c576000805461ff00191690555b5050505050505062000162565b600062000131306200013760201b620033221760201c565b15905090565b3b151590565b600080604083850312156200015157600080fd5b505080516020909101519092909150565b60805160a051615f00620001856000396000505060006108460152615f006000f3fe608060405234801561001057600080fd5b50600436106103015760003560e01c8063010db1951461030657806301ffc9a71461032f57806306fdde0314610352578063081812fc14610367578063087a60071461037a578063095ea7b3146103915780630e198f22146103a657806313888565146103af57806323b872dd146103b8578063254cf439146103cb578063307439af146103fd57806334ce998a1461041d57806335836f15146104255780633644e5151461043857806339393ac91461044057806339eb4dc6146104535780633ae2325f146104675780633af32abf1461047a5780633c2e941b1461049a57806342842e0e146104a3578063430c2081146104b65780634f7e43df146104c957806355f804b3146104e35780635b84d88a146104f65780635c975abb1461050957806361d027b31461051d5780636352211e1461053057806370a082311461054357806374107543146105565780637aacfffa146105695780637adbf973146105a55780637c0f59f4146105b85780637c3a00fd146105d25780637dc0d1d0146105e55780637e53bd97146105f85780637e56d47c1461060b5780637ecebe001461061e578063835986b41461064757806389050f1d1461065a57806395d89b411461066c5780639a3b6f2f146106745780639f48118f146106ba578063a172923a146106c5578063a22cb465146106ce578063af2c8c2e146106e1578063b1511cc9146106ea578063b4bd6f46146106fd578063b88d4fde14610710578063bbcac55714610723578063c4ae31681461072c578063c66d8b0114610734578063c87b56dd1461074e578063d8dfeb4514610761578063d9b1cb5b14610774578063de1f776514610787578063de8fc69814610799578063df011c41146107ac578063e182b883146107bf578063e1c84ea4146107d2578063e626648a146107db578063e985e9c5146107f5578063e9cbd82214610808578063f0f442601461081b578063f51cc7dd1461082e578063fad9aba314610841578063fc29b02114610868578063fd527cf81461087b575b600080fd5b603754610319906001600160a01b031681565b6040516103269190614eb4565b60405180910390f35b61034261033d366004614ede565b610883565b6040519015158152602001610326565b61035a6108f0565b6040516103269190614f53565b610319610375366004614f66565b61097e565b610383603f5481565b604051908152602001610326565b6103a461039f366004614f94565b6109af565b005b610383603e5481565b61038360415481565b6103a46103c6366004614fc0565b610a3c565b603c546103e590600160401b90046001600160401b031681565b6040516001600160401b039091168152602001610326565b61041061040b366004615001565b610a77565b6040516103269190615031565b610383610b29565b610383610433366004614f66565b610b5b565b610383610b97565b6103a461044e36600461506a565b610ba1565b603d5461034290600160c01b900460ff1681565b610383610475366004614f66565b610ca1565b61038361048836600461506a565b60446020526000908152604090205481565b61038360455481565b6103a46104b1366004614fc0565b610cc2565b6103426104c4366004614f94565b610cdd565b603d546103e590600160801b90046001600160401b031681565b6103a46104f136600461513c565b610ce9565b6103a4610504366004615170565b610d8e565b603d5461034290600160c81b900460ff1681565b603354610319906001600160a01b031681565b61031961053e366004614f66565b610e27565b61038361055136600461506a565b610e32565b6103a46105643660046151a9565b610e77565b610590610577366004614f66565b6043602052600090815260409020805460019091015482565b60408051928352602083019190915201610326565b6103a46105b336600461506a565b611243565b603c546103e590600160c01b90046001600160401b031681565b603d546103e5906001600160401b031681565b603654610319906001600160a01b031681565b6103a4610606366004615253565b61138a565b6104106106193660046152c8565b61157b565b61038361062c36600461506a565b6001600160a01b03166000908152607f602052604090205490565b6103a461065536600461538c565b611b11565b610383676765c793fa10079d601a1b81565b61035a611cc9565b6106876106823660046154a6565b611cd6565b60405161032691908151815260208083015190820152604080830151908201526060918201519181019190915260800190565b610383633b9aca0081565b61038360b45481565b6103a46106dc36600461553c565b611d0b565b61038360405481565b6103a46106f8366004614f66565b611d16565b61038361070b36600461506a565b611ddf565b6103a461071e36600461556a565b611e1b565b61038360425481565b6103a4611e58565b603d546103e590600160401b90046001600160401b031681565b61035a61075c366004614f66565b611f07565b603454610319906001600160a01b031681565b6103a46107823660046155d5565b612060565b610383676765c793fa10079d601b1b81565b6106876107a7366004615669565b6125b4565b603c546103e5906001600160401b031681565b6103836107cd366004614f66565b612e3b565b61038360395481565b603c546103e590600160801b90046001600160401b031681565b6103426108033660046156c7565b612e4b565b603554610319906001600160a01b031681565b6103a461082936600461506a565b612e79565b6103a461083c366004615704565b612f19565b6103837f000000000000000000000000000000000000000000000000000000000000000081565b61041061087636600461577e565b6131d9565b610590613203565b60006001600160e01b03198216635b5e139f60e01b14806108b457506001600160e01b031982166380ac58cd60e01b145b806108cf57506001600160e01b0319821663430c208160e01b145b806108ea57506001600160e01b031982166301ffc9a760e01b145b92915050565b607d80546108fd906157da565b80601f0160208091040260200160405190810160405280929190818152602001828054610929906157da565b80156109765780601f1061094b57610100808354040283529160200191610976565b820191906000526020600020905b81548152906001019060200180831161095957829003601f168201915b505050505081565b600061098982613328565b6109a65760405163062a39dd60e11b815260040160405180910390fd5b6108ea82613345565b60006109ba82613360565b9050806001600160a01b0316836001600160a01b031614156109ef576040516349fa8bc360e11b815260040160405180910390fd5b336001600160a01b03821614801590610a0f5750610a0d8133612e4b565b155b15610a2d5760405163c19f17a960e01b815260040160405180910390fd5b610a378383613396565b505050565b3381610a488282613404565b610a655760405163c19f17a960e01b815260040160405180910390fd5b610a70858585613482565b5050505050565b610a7f614d8a565b60008381526043602090815260409182902082518084018452815481526001909101548183015260365483516315f789a960e21b81529351610b2294929387936001600160a01b03909316926357de26a492600480830193928290030181865afa158015610af1573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610b15919061580f565b610b1d6135a9565b61373e565b9392505050565b6000676765c793fa10079d601b1b610b3f6135a9565b604054610b4c919061583e565b610b569190615873565b905090565b6000676765c793fa10079d601b1b610b716135a9565b600084815260436020526040902060010154610b8d919061583e565b6108ea9190615873565b6000610b56613aac565b603354604051631c86b03760e31b81526001600160a01b039091169063e43581b890610bd1903390600401614eb4565b602060405180830381865afa158015610bee573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610c129190615887565b610c2f57604051633b8d9d7560e21b815260040160405180910390fd5b6001600160a01b03811615610c7e576001600160a01b038116600090815260446020526040902054610c629060016158a4565b6001600160a01b03821660009081526044602052604090205550565b603d805460ff60c01b198116600160c01b9182900460ff16159091021790555b50565b603b8181548110610cb157600080fd5b600091825260209091200154905081565b610a3783838360405180602001604052806000815250611e1b565b6000610b228383613404565b60335460405163521d4de960e01b81526001600160a01b039091169063521d4de990610d19903390600401614eb4565b602060405180830381865afa158015610d36573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610d5a9190615887565b610d7757604051632678482f60e21b815260040160405180910390fd5b8051610d8a906046906020840190614db9565b5050565b603354604051631c86b03760e31b81526001600160a01b039091169063e43581b890610dbe903390600401614eb4565b602060405180830381865afa158015610ddb573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610dff9190615887565b610e1c57604051633b8d9d7560e21b815260040160405180910390fd5b60b49190915560b555565b60006108ea82613360565b60006001600160a01b038216610e5b5760405163d92e233d60e01b815260040160405180910390fd5b506001600160a01b031660009081526048602052604090205490565b60335460405163521d4de960e01b81526001600160a01b039091169063521d4de990610ea7903390600401614eb4565b602060405180830381865afa158015610ec4573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610ee89190615887565b610f0557604051632678482f60e21b815260040160405180910390fd5b806121a360f11b1415610f6957603d546001600160401b03600160401b90910481169083161115610f4957604051637650e96360e11b815260040160405180910390fd5b603c80546001600160401b0319166001600160401b0384161790556111fc565b80622a242360e91b1415610fce57633b9aca00826001600160401b03161015610fa55760405163da6a17b960e01b815260040160405180910390fd5b603c8054600160401b600160801b031916600160401b6001600160401b038516021790556111fc565b8061212360f11b141561103257633b9aca00826001600160401b0316111561100957604051637650e96360e11b815260040160405180910390fd5b603c8054600160801b600160c01b031916600160801b6001600160401b038516021790556111fc565b8061292360f11b14156110af57603d54633b9aca009061106290600160401b90046001600160401b0316846158bb565b6001600160401b0316111561108a57604051637650e96360e11b815260040160405180910390fd5b603c80546001600160c01b0316600160c01b6001600160401b038516021790556111fc565b806124a960f11b14156110e5576110c4613b18565b50603d80546001600160401b0319166001600160401b0384161790556111fc565b80614c5360f01b141561117e57603c546001600160401b03808416911611806111375750603c54633b9aca009061112c90600160c01b90046001600160401b0316846158bb565b6001600160401b0316115b156111555760405163180d062b60e31b815260040160405180910390fd5b603d8054600160401b600160801b031916600160401b6001600160401b038516021790556111fc565b806213531160ea1b14156111e357633b9aca00826001600160401b031611156111ba57604051637650e96360e11b815260040160405180910390fd5b603d8054600160801b600160c01b031916600160801b6001600160401b038516021790556111fc565b60405163e1daa9cf60e01b815260040160405180910390fd5b604080516001600160401b0384168152602081018390527f13b367dac93b85d1ed9b3d8961d8b48e1a677c9800bb1613b4b0416b2d5b61d091015b60405180910390a15050565b603354604051631c86b03760e31b81526001600160a01b039091169063e43581b890611273903390600401614eb4565b602060405180830381865afa158015611290573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906112b49190615887565b6112d157604051633b8d9d7560e21b815260040160405180910390fd5b603354604080516361d027b360e01b815290516001600160a01b03928316928416916361d027b39160048083019260209291908290030181865afa15801561131d573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061134191906158e6565b6001600160a01b031614611368576040516302979eb960e31b815260040160405180910390fd5b603680546001600160a01b0319166001600160a01b0392909216919091179055565b60335460405163521d4de960e01b81526001600160a01b039091169063521d4de9906113ba903390600401614eb4565b602060405180830381865afa1580156113d7573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906113fb9190615887565b61141857604051632678482f60e21b815260040160405180910390fd5b8051825114158061144357508060008151811061143757611437615903565b60200260200101516000145b806114d257506001600160a01b038316158015906114d257508160008151811061146f5761146f615903565b60200260200101518260018151811061148a5761148a615903565b60200260200101511115806114d25750806000815181106114ad576114ad615903565b6020026020010151816001815181106114c8576114c8615903565b6020026020010151105b156114f057604051631746545d60e11b815260040160405180910390fd5b603780546001600160a01b0319166001600160a01b038516179055815161151e90603a906020850190614e3d565b50805161153290603b906020840190614e3d565b50826001600160a01b03167feb74d4d9fea592587c926aeb35eb6a7893fb28db0c1c8eb2eb3c586e7164b76c838360405161156e929190615954565b60405180910390a2505050565b611583614d8a565b603d54600160c81b900460ff16156115ae576040516313d0ff5960e31b815260040160405180910390fd5b600260015414156115da5760405162461bcd60e51b81526004016115d190615979565b60405180910390fd5b6002600155855187511415806115ef57508551155b1561160d576040516346282e8d60e01b815260040160405180910390fd5b603660009054906101000a90046001600160a01b03166001600160a01b03166357de26a46040518163ffffffff1660e01b8152600401602060405180830381865afa158015611660573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611684919061580f565b6060820152611691613b18565b60808201526040517f965a177723c641ee49150b583a0b9ad4730bb20d3474e00ae5a65e777c00d67b906116c69089906159b0565b60405180910390a160005b8751811015611a82576000604360008a84815181106116f2576116f2615903565b60200260200101518152602001908152602001600020604051806040016040529081600082015481526020016001820154815250509050600061173f82338660600151876080015161373e565b9050600081604001511180156117715750806040015189848151811061176757611767615903565b6020026020010151115b806117985750806000015189848151811061178e5761178e615903565b6020026020010151115b156117c15780600001518984815181106117b4576117b4615903565b6020026020010181815250505b6000846060015182606001516117d7919061583e565b603854633b9aca008c87815181106117f1576117f1615903565b6020026020010151611803919061583e565b61180d919061583e565b6118179190615873565b905061182e8b8581518110610d8a57610d8a615903565b82518110611964575081516020830151604080546000906118509084906158a4565b92505081905550604360008c868151811061186d5761186d615903565b60209081029190910181015182528101919091526040016000908120818155600101819055603d548b51633b9aca0091600160401b90046001600160401b0316908d90889081106118c0576118c0615903565b60200260200101516118d2919061583e565b6118dc9190615873565b9050826080015181106118f0576000611900565b80836080015161190091906158a4565b8660400181815161191191906159c3565b905250508a51600080516020615e6b833981519152908c908690811061193957611939615903565b602002602001015184602001516000604051611957939291906159db565b60405180910390a1611a25565b80604360008d878151811061197b5761197b615903565b6020026020010151815260200190815260200160002060000160008282546119a391906158a4565b92505081905550611a238b85815181106119bf576119bf615903565b6020026020010151633b9aca00603d60089054906101000a90046001600160401b03166001600160401b03168d88815181106119fd576119fd615903565b6020026020010151611a0f919061583e565b611a199190615873565b8760800151613bb9565b505b8085602001818151611a3791906159c3565b90525089518a9085908110611a4e57611a4e615903565b602002602001015185600001818151611a6791906159c3565b905250839250611a7a91508290506159f4565b9150506116d1565b50603d54633b9aca0090611aa690600160401b90046001600160401b0316826158a4565b8251611ab2919061583e565b611abc9190615873565b60416000828254611acd91906159c3565b9091555050604081015160428054600090611ae99084906159c3565b909155505060208101518151611b03919087878787613cee565b600180559695505050505050565b603d54600160c81b900460ff1615611b3c576040516313d0ff5960e31b815260040160405180910390fd5b6033546040516333b52a9f60e11b81526001600160a01b039091169063676a553e90611b6c903390600401614eb4565b602060405180830381865afa158015611b89573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611bad9190615887565b611bca5760405163027f480760e01b815260040160405180910390fd5b603c54600090600160c01b90046001600160401b0316821015611c0857603c54611c05908390600160c01b90046001600160401b03166158a4565b90505b603c54600090600160801b90046001600160401b0316841115611c4557603c54611c4290600160801b90046001600160401b0316856158a4565b90505b6000611c566002633b9aca00615af3565b611c6483633b9aca006158a4565b611c7285633b9aca006158a4565b611c7c908961583e565b611c86919061583e565b611c909190615873565b9050611c9c81876158a4565b60416000828254611cad91906159c3565b90915550611cbf905087826000613bb9565b5050505050505050565b607e80546108fd906157da565b611cde614e77565b60408051600080825260208201909252611d00918791879187918791906125b4565b90505b949350505050565b610d8a338383613df8565b60335460405163521d4de960e01b81526001600160a01b039091169063521d4de990611d46903390600401614eb4565b602060405180830381865afa158015611d63573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611d879190615887565b611da457604051632678482f60e21b815260040160405180910390fd5b60398190556040518181527fdd63b3dcdbebad734892f7c7a26d0f647fbc7eec973e0775f5229018ac4ab47a9060200160405180910390a150565b603d54600090600160c81b900460ff1615611e0d576040516313d0ff5960e31b815260040160405180910390fd5b6108ea82613eae565b919050565b3382611e278282613404565b611e445760405163c19f17a960e01b815260040160405180910390fd5b611e5086868686613fdc565b505050505050565b60335460405163521d4de960e01b81526001600160a01b039091169063521d4de990611e88903390600401614eb4565b602060405180830381865afa158015611ea5573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611ec99190615887565b611ee657604051632678482f60e21b815260040160405180910390fd5b603d805460ff60c81b198116600160c81b9182900460ff1615909102179055565b6060611f1282613328565b611f2f5760405163062a39dd60e11b815260040160405180910390fd5b8160005b8115611f595780611f43816159f4565b9150611f529050600a83615873565b9150611f33565b6000816001600160401b03811115611f7357611f73615087565b6040519080825280601f01601f191660200182016040528015611f9d576020820181803683370190505b5090505b841561200857611fb26001836158a4565b9150611fbf600a86615b02565b611fca9060306159c3565b60f81b818381518110611fdf57611fdf615903565b60200101906001600160f81b031916908160001a905350612001600a86615873565b9450611fa1565b600060468054612017906157da565b9050116120335760405180602001604052806000815250612057565b604681604051602001612047929190615b32565b6040516020818303038152906040525b95945050505050565b600054610100900460ff1661207b5760005460ff161561207f565b303b155b6120e25760405162461bcd60e51b815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201526d191e481a5b9a5d1a585b1a5e995960921b60648201526084016115d1565b600054610100900460ff16158015612104576000805461ffff19166101011790555b856001600160a01b0316846001600160a01b03166361d027b36040518163ffffffff1660e01b8152600401602060405180830381865afa15801561214c573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061217091906158e6565b6001600160a01b031614612197576040516302979eb960e31b815260040160405180910390fd5b603380546001600160a01b038089166001600160a01b0319928316179092556034805492881692909116821790556040805163313ce56760e01b8152905163313ce567916004808201926020929091908290030181865afa158015612200573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906122249190615bd0565b61222f90600a615af3565b603881905550856001600160a01b031663e9cbd8226040518163ffffffff1660e01b8152600401602060405180830381865afa158015612273573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061229791906158e6565b603580546001600160a01b03199081166001600160a01b0393841617909155603680549091169186169190911790556040516000906122da908490602001615bed565b60408051601f19818403018152919052805190915061230090607d906020840190614db9565b5061230a81614016565b8260405160200161231b9190615c34565b604051602081830303815290604052607e908051906020019061233f929190614db9565b50676765c793fa10079d601b1b603f5542603e5561236360a0850160808601615c5e565b6001600160401b031661237c6040860160208701615c5e565b6001600160401b031611806123ac5750633b9aca006123a160a0860160808701615c5e565b6001600160401b0316115b806123d257506123c26060850160408601615c5e565b6001600160401b0316633b9aca00115b806123f95750633b9aca006123ed60c0860160a08701615c5e565b6001600160401b031610155b80612406575060e0840135155b1561242457604051631746545d60e11b815260040160405180910390fd5b83356039556124396040850160208601615c5e565b603c80546001600160401b0319166001600160401b03929092169190911790556124696060850160408601615c5e565b603c80546001600160401b0392909216600160401b02600160401b600160801b03199092169190911790556124a46080850160608601615c5e565b603d80546001600160401b0319166001600160401b03929092169190911790556124d460a0850160808601615c5e565b603d80546001600160401b0392909216600160401b02600160401b600160801b031990921691909117905561250f60c0850160a08601615c5e565b603d80546001600160401b0392909216600160801b02600160801b600160c01b031990921691909117905561254a60e0850160c08601615c79565b603d8054911515600160c01b0260ff60c01b19909216919091179055604080516020810190915260e0850135815261258690603b906001614e3d565b5050603d805460ff60c81b1916600160c81b1790558015611e50576000805461ff0019169055505050505050565b6125bc614e77565b603d54600160c81b900460ff16156125e7576040516313d0ff5960e31b815260040160405180910390fd5b6002600154141561260a5760405162461bcd60e51b81526004016115d190615979565b60026001558551875114158061261f57508651155b1561263d576040516346282e8d60e01b815260040160405180910390fd5b600080808080805b8c51811015612ba45760008d828151811061266257612662615903565b602002602001015190506000600781111561267f5761267f615c96565b81600781111561269157612691615c96565b14156126d2576126cc8d83815181106126ac576126ac615903565b60200260200101518060200190518101906126c791906158e6565b613eae565b50612b91565b60028160078111156126e6576126e6615c96565b141561274c578c82815181106126fe576126fe615903565b60200260200101518060200190518101906127199190615cac565b95509250826127285760455492505b61273283866140ec565b848860600181815161274491906159c3565b905250612b91565b600781600781111561276057612760615c96565b14156128395760008060008f858151811061277d5761277d615903565b60200260200101518060200190518101906127989190615cd0565b60345460405163d505accf60e01b81526001600160a01b038089166004830152306024830152604482018890526064820187905260ff8616608483015260a4820185905260c48201849052969f50939d50939b509497509550929350169063d505accf9060e401600060405180830381600087803b15801561281957600080fd5b505af115801561282d573d6000803e3d6000fd5b50505050505050612b91565b8661284957612846613b18565b96505b600481600781111561285d5761285d615c96565b1415612929578c828151811061287557612875615903565b60200260200101518060200190518101906128909190615cac565b945092508261289f5760455492505b6128aa838589613bb9565b603c549094506000906128d190600160c01b90046001600160401b0316633b9aca006158a4565b6128df633b9aca008761583e565b6128e99190615873565b90506128f585826158a4565b6041600082825461290691906159c3565b92505081905550808960200181815161291f91906159c3565b905250612b919050565b856129a857603660009054906101000a90046001600160a01b03166001600160a01b03166357de26a46040518163ffffffff1660e01b8152600401602060405180830381865afa158015612981573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906129a5919061580f565b95505b60018160078111156129bc576129bc615c96565b1415612a38578c82815181106129d4576129d4615903565b60200260200101518060200190518101906129ef919061580f565b9250826129fc5760455492505b612a07838789614158565b80965081955050508488604001818151612a2191906159c3565b9052506020880180518591906127449083906159c3565b6003816007811115612a4c57612a4c615c96565b1415612aac578c8281518110612a6457612a64615903565b6020026020010151806020019051810190612a7f9190615cac565b9550925082612a8e5760455492505b612a9a8386888a614278565b848860400181815161274491906159c3565b6005816007811115612ac057612ac0615c96565b1415612b22578c8281518110612ad857612ad8615903565b6020026020010151806020019051810190612af39190615cac565b9450925082612b025760455492505b612b0e8385888a614352565b9350838860000181815161274491906159c3565b6006816007811115612b3657612b36615c96565b1415612b91576000808e8481518110612b5157612b51615903565b6020026020010151806020019051810190612b6c9190615d23565b98509196509250905084612b805760455494505b612b8e858383898c8e6143ed565b50505b5080612b9c816159f4565b915050612645565b508551602087015110612c9b5785516020870151600091612bc4916158a4565b90508660600151876040015110612bfb57612bf687606001518860400151612bec91906158a4565b828d8d8d8d613cee565b612c95565b8015612c6857603554604051630d43af8160e21b81526001600160a01b039091169063350ebe0490612c359084908f903390600401615d61565b600060405180830381600087803b158015612c4f57600080fd5b505af1158015612c63573d6000803e3d6000fd5b505050505b612c95333089604001518a60600151612c8191906158a4565b6034546001600160a01b0316929190614529565b50612e27565b60208601518651600091612cae916158a4565b6035546040516340c10f1960e01b81529192506001600160a01b0316906340c10f1990612ce1908d908590600401615d80565b600060405180830381600087803b158015612cfb57600080fd5b505af1158015612d0f573d6000803e3d6000fd5b50505050866060015187604001511115612d5357612d4e8a88606001518960400151612d3b91906158a4565b6034546001600160a01b03169190614594565b612e25565b600087604001518860600151612d6991906158a4565b90508015612e2357885115612e0b57896001600160a01b031663a5d4096b603560009054906101000a90046001600160a01b0316603460009054906101000a90046001600160a01b03163385878f6040518763ffffffff1660e01b8152600401612dd896959493929190615d99565b600060405180830381600087803b158015612df257600080fd5b505af1158015612e06573d6000803e3d6000fd5b505050505b603454612e23906001600160a01b0316333084614529565b505b505b505060018055509198975050505050505050565b603a8181548110610cb157600080fd5b6001600160a01b039182166000908152604a6020908152604080832093909416825291909152205460011490565b6033546001600160a01b03163314612ea45760405163b90cdbb160e01b815260040160405180910390fd5b603380546001600160a01b0319166001600160a01b0383811691909117909155603654604051630787a21360e51b815291169063f0f4426090612eeb908490600401614eb4565b600060405180830381600087803b158015612f0557600080fd5b505af1158015610a70573d6000803e3d6000fd5b83421115612f3a5760405163f87d927160e01b815260040160405180910390fd5b6fa2a8918ca85bafe22016d0b997e4df60600160ff1b03811180612f7157508260ff16601b14158015612f7157508260ff16601c14155b15612f8f57604051638baa579f60e01b815260040160405180910390fd5b6000612f99613aac565b608254898989612fa88d6145b3565b6040805160208101969096526001600160a01b03948516908601529290911660608401521515608083015260a082015260c0810187905260e0016040516020818303038152906040528051906020012060405160200161301f92919061190160f01b81526002810192909252602282015260420190565b60405160208183030381529060405280519060200120905061304a886001600160a01b03163b151590565b1561312657604080516020810185905280820184905260f886901b6001600160f81b0319166060820152815160418183030181526061820192839052630b135d3f60e11b9092526001600160a01b038a1691631626ba7e916130b0918591606501615ddb565b602060405180830381865afa1580156130cd573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906130f19190615df4565b6001600160e01b031916631626ba7e60e01b1461312157604051638baa579f60e01b815260040160405180910390fd5b6131ce565b6040805160008082526020820180845284905260ff871692820192909252606081018590526080810184905260019060a0016020604051602081039080840390855afa15801561317a573d6000803e3d6000fd5b505050602060405103519050886001600160a01b0316816001600160a01b03161415806131ae57506001600160a01b038116155b156131cc57604051638baa579f60e01b815260040160405180910390fd5b505b611cbf888888613df8565b6131e1614d8a565b60408051600080825260208201909252611d009187918791879187919061157b565b60335460009081906001600160a01b031633146132335760405163b90cdbb160e01b815260040160405180910390fd5b61323b613b18565b5050604180546042805460009384905592905591508082106132d45761326181836158a4565b6035546033546040516340c10f1960e01b8152929450600093506001600160a01b03918216926340c10f199261329d9216908690600401615d80565b600060405180830381600087803b1580156132b757600080fd5b505af11580156132cb573d6000803e3d6000fd5b505050506132e5565b6132de82826158a4565b9050600091505b60408051838152602081018390527ffeb12225c131aab793a00c5239afb778932d170fa28ce6e9d23703e4bd892121910160405180910390a19091565b3b151590565b6000908152604760205260409020546001600160a01b0316151590565b6000908152604960205260409020546001600160a01b031690565b6000818152604760205260409020546001600160a01b031680611e165760405163062a39dd60e11b815260040160405180910390fd5b600081815260496020526040902080546001600160a01b0319166001600160a01b03841690811790915581906133cb82613360565b6001600160a01b03167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92560405160405180910390a45050565b60008061341083613360565b9050806001600160a01b0316846001600160a01b0316148061344b5750836001600160a01b031661344084613345565b6001600160a01b0316145b80611d0357506001600160a01b038082166000908152604a6020908152604080832093881683529290522054600114949350505050565b826001600160a01b031661349582613360565b6001600160a01b0316146134bc5760405163c19f17a960e01b815260040160405180910390fd5b6001600160a01b0382166134e35760405163d92e233d60e01b815260040160405180910390fd5b603d54600160c01b900460ff16801561351557506001600160a01b038216600090815260446020526040902054600114155b1561353357604051630b094f2760e31b815260040160405180910390fd5b61353e600082613396565b6001600160a01b038084166000818152604860209081526040808320805460001901905593861680835284832080546001019055858352604790915283822080546001600160a01b03191682179055925184939291600080516020615eab83398151915291a4505050565b600080603e54426135ba91906158a4565b603d549091506001600160401b03168115806135d4575080155b156135e357603f549250505090565b60006135f06001846158a4565b905060006002841161360357600061360e565b61360e6002856158a4565b90506000676765c793fa10079d601b1b676765c793fa10079d601a1b613634868061583e565b61363e91906159c3565b6136489190615873565b90506000676765c793fa10079d601b1b676765c793fa10079d601a1b61366e878561583e565b61367891906159c3565b6136829190615873565b90506000600283613693878a61583e565b61369d919061583e565b6136a79190615873565b90506000600683866136b9898c61583e565b6136c3919061583e565b6136cd919061583e565b6136d79190615873565b9050676765c793fa10079d601b1b81836136f18b8b61583e565b61370690676765c793fa10079d601b1b6159c3565b61371091906159c3565b61371a91906159c3565b603f54613727919061583e565b6137319190615873565b9850505050505050505090565b613746614d8a565b60008060006137568887876145f7565b925092509250633b9aca008310613780576040516315fe9b6160e21b815260040160405180910390fd5b6000633b9aca0061379185826158a4565b61379a8a614680565b6137a4919061583e565b6137ae9190615873565b603d54909150600160801b90046001600160401b03168110156137de576137d981633b9aca006158a4565b6137ff565b603d546137ff90600160801b90046001600160401b0316633b9aca006158a4565b603d54909150600160401b90046001600160401b03166000806138276002633b9aca00615af3565b603c5461383d91906001600160401b031661583e565b83613848868a61583e565b613852919061583e565b106139ec57603c546001600160401b03166138726002633b9aca00615af3565b61387c919061583e565b603c54859061389b90600160401b90046001600160401b03168661583e565b6138a5919061583e565b6138af91906158a4565b603c548590633b9aca00906138cd906001600160401b03168961583e565b603c546138eb908b90600160401b90046001600160401b031661583e565b6138f591906158a4565b6138ff919061583e565b613909919061583e565b6139139190615873565b9150633b9aca0061392360b45490565b61392d919061583e565b613937848461583e565b61394191906159c3565b61394f633b9aca008861583e565b116139e757613969676765c793fa10079d601b1b8461583e565b633b9aca008a8e6020015161397e919061583e565b613988919061583e565b6139929190615873565b61399d9060016159c3565b91506139a860b45490565b8611156139e35782633b9aca006139be60b45490565b6139c890896158a4565b6139d2919061583e565b6139dc9190615873565b9050613a5a565b5060015b613a5a565b6038546139fd90633b9aca0061583e565b8c518b90613a0c90879061583e565b613a16919061583e565b613a209190615873565b613a2b9060016159c3565b9150613a3660b55490565b851115613a5657633b9aca0084613a4c60b55490565b6139c890886158a4565b5060015b818852613a67848b61583e565b603854613a78633b9aca008561583e565b613a82919061583e565b613a8c9190615873565b602089015260408801525050606085015250608083015250949350505050565b60808054608154604080517f8b73c3c69bb8fe3d512ecc4cf759cc79239f7b179b0ffacaa9a75d522b39400f602082015290810192909252606082015246918101919091523060a082015260009060c00160405160208183030381529060405280519060200120905090565b6000613b226135a9565b90506000676765c793fa10079d601b1b603f5483613b4091906158a4565b604054613b4d919061583e565b613b579190615873565b90508060416000828254613b6b91906159c3565b9091555050603f82905542603e8190556040805184815260208101929092527fd1fa8ba00a3bf20274346919dce0de62d2a140af2c71fe7e29fa6472eea3bb9d910160405180910390a15090565b600081613bcb57613bc8613b18565b91505b60008481526043602052604081206001015490676765c793fa10079d601b1b613bf4858461583e565b613bfe9190615873565b9050808510613c0f57935080613c32565b83613c25676765c793fa10079d601b1b8761583e565b613c2f9190615873565b90505b613c3c81836158a4565b91508060406000828254613c5091906158a4565b90915550508115801590613c8b5750676765c793fa10079d601b1b613c7460b45490565b613c7e919061583e565b613c88858461583e565b11155b15613ca95760405163228af07f60e21b815260040160405180910390fd5b60008681526043602052604080822060010184905551600080516020615e6b83398151915291613cdc91899185916159db565b60405180910390a15092949350505050565b8515613d0b57603454613d0b906001600160a01b03168488614594565b8415611e5057805115613d8a5760345460355460405163a5d4096b60e01b81526001600160a01b038086169363a5d4096b93613d579391831692169089908b908d908990600401615d99565b600060405180830381600087803b158015613d7157600080fd5b505af1158015613d85573d6000803e3d6000fd5b505050505b603554604051630d43af8160e21b81526001600160a01b039091169063350ebe0490613dbe90889088903390600401615d61565b600060405180830381600087803b158015613dd857600080fd5b505af1158015613dec573d6000803e3d6000fd5b50505050505050505050565b826001600160a01b0316826001600160a01b03161415613e2b576040516320c5195360e21b815260040160405180910390fd5b600081613e39576000613e3c565b60015b6001600160a01b038581166000818152604a602090815260408083209489168084529482529182902060ff959095169485905590518615158152939450919290917f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c31910160405180910390a350505050565b603d54600090600160c01b900460ff168015613efd57506001600160a01b0382166000908152604460205260409020546001141580613efd575033600090815260446020526040902054600114155b15613f1b57604051630b094f2760e31b815260040160405180910390fd5b6001600160a01b038216613f425760405163d92e233d60e01b815260040160405180910390fd5b5060458054600101908190556001600160a01b038216600081815260486020908152604080832080546001019055848352604790915280822080546001600160a01b031916841790555183929190600080516020615eab833981519152908290a4613fbf60008383604051806020016040528060008152506148af565b611e16576040516320149b4360e21b815260040160405180910390fd5b613fe7848484613482565b613ff3848484846148af565b614010576040516320149b4360e21b815260040160405180910390fd5b50505050565b600054610100900460ff166140815760405162461bcd60e51b815260206004820152602b60248201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960448201526a6e697469616c697a696e6760a81b60648201526084016115d1565b7f3f43a9c6bafb5c7aab4e0cfe239dc5d4c15caf0381c6104188191f78a6640bd860825580516020918201206080556040805180820190915260018152603160f81b9101527fc89efdaa54c0f20c7adf612882df0950f5a951637e0307cdcb4c672f298b8bc6608155565b6140f582613328565b6141125760405163062a39dd60e11b815260040160405180910390fd5b600082815260436020526040812080548392906141309084906159c3565b9091555050604051600080516020615e8b8339815191529061123790849084906001906159db565b60008033856141678282613404565b6141845760405163c19f17a960e01b815260040160405180910390fd5b6000878152604360209081526040808320815180830190925280548252600101549181019190915290806141b9838a8a6145f7565b5091509150633b9aca0082116141e257604051631527804d60e31b815260040160405180910390fd5b8260200151604060008282546141f891906158a4565b9091555061420790508a6149ab565b603c5460009061422b90600160c01b90046001600160401b0316633b9aca006158a4565b614239633b9aca008461583e565b6142439190615873565b905061424f82826158a4565b6041600082825461426091906159c3565b90915550509251929a92995091975050505050505050565b33846142848282613404565b6142a15760405163c19f17a960e01b815260040160405180910390fd5b600086815260436020526040812080548792906142bf9084906158a4565b9091555050600086815260436020908152604080832081518083019092528054825260010154918101919091526142f79086866145f7565b50509050633b9aca00811161431f57604051631527804d60e31b815260040160405180910390fd5b600080516020615e8b83398151915287876000604051614341939291906159db565b60405180910390a150505050505050565b600033856143608282613404565b61437d5760405163c19f17a960e01b815260040160405180910390fd5b61438987878787614a2a565b603c54909650600090633b9aca00906143b3908990600160801b90046001600160401b031661583e565b6143bd9190615873565b905080604160008282546143d191906159c3565b909155506143e1905081886158a4565b98975050505050505050565b33866143f98282613404565b6144165760405163c19f17a960e01b815260040160405180910390fd5b60408051898152602081018890526001600160a01b038916818301526060810187905290517fddd3b70af631334f7552aadb582ed091018e62e103fa8b150ca66cc700d4dac69181900360800190a161447188868686614a2a565b94506001600160a01b0387163014156144955761448f868685613bb9565b50611cbf565b603c546040516320d661ad60e21b815260048101889052602481018790526001600160401b03600160801b830481166044830152600160c01b90920490911660648201526001600160a01b0388169063835986b490608401600060405180830381600087803b15801561450757600080fd5b505af115801561451b573d6000803e3d6000fd5b505050505050505050505050565b6040516001600160a01b03808516602483015283166044820152606481018290526140109085906323b872dd60e01b906084015b60408051601f198184030181529190526020810180516001600160e01b03166001600160e01b031990931692909217909152614bbd565b610a378363a9059cbb60e01b848460405160240161455d929190615d80565b6001600160a01b0381166000908152607f60205260409020546145d78160016159c3565b6001600160a01b039092166000908152607f602052604090209190915590565b6000806000676765c793fa10079d601b1b848760200151614618919061583e565b6146229190615873565b9150603854858760000151614637919061583e565b6146419190615873565b905081614652576000199250614677565b603c54829061466a906001600160401b03168361583e565b6146749190615873565b92505b93509350939050565b6037546000906001600160a01b03166146b957603b6000815481106146a7576146a7615903565b90600052602060002001549050919050565b603754604051635dfba04560e11b81526000916001600160a01b03169063bbf7408a906146ea908690600401614eb4565b602060405180830381865afa158015614707573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061472b919061580f565b9050603a60018154811061474157614741615903565b9060005260206000200154811061477957603b60018154811061476657614766615903565b9060005260206000200154915050919050565b603a60008154811061478d5761478d615903565b906000526020600020015481116147b257603b60008154811061476657614766615903565b603a6000815481106147c6576147c6615903565b9060005260206000200154603a6001815481106147e5576147e5615903565b90600052602060002001546147fa91906158a4565b603a60008154811061480e5761480e615903565b90600052602060002001548261482491906158a4565b603b60008154811061483857614838615903565b9060005260206000200154603b60018154811061485757614857615903565b906000526020600020015461486c91906158a4565b614876919061583e565b6148809190615873565b603b60008154811061489457614894615903565b9060005260206000200154610b2291906159c3565b50919050565b60006001600160a01b0384163b156149a357604051630a85bd0160e11b81526001600160a01b0385169063150b7a02906148f3903390899088908890600401615e11565b6020604051808303816000875af192505050801561492e575060408051601f3d908101601f1916820190925261492b91810190615df4565b60015b614989573d80801561495c576040519150601f19603f3d011682016040523d82523d6000602084013e614961565b606091505b508051614981576040516320149b4360e21b815260040160405180910390fd5b805181602001fd5b6001600160e01b031916630a85bd0160e11b149050611d03565b506001611d03565b60006149b682613360565b90506149c3600083613396565b6001600160a01b038116600081815260486020908152604080832080546000190190558583526047825280832080546001600160a01b0319169055604390915280822082815560010182905551849290600080516020615eab833981519152908390a45050565b60008082614a43676765c793fa10079d601b1b8761583e565b614a4d9190615873565b600087815260436020526040902060010154909150614a885760b4548511614a885760405163228af07f60e21b815260040160405180910390fd5b60008681526043602052604081206001018054839290614aa99084906159c3565b925050819055508060406000828254614ac291906159c3565b9091555050603954614ae090676765c793fa10079d601b1b9061583e565b83604054614aee919061583e565b1115614b0d576040516371239a6160e11b815260040160405180910390fd5b60008681526043602090815260408083208151808301909252805482526001015491810191909152614b409086866145f7565b50509050633b9aca008111614b6857604051631527804d60e31b815260040160405180910390fd5b600080516020615e6b83398151915287836001604051614b8a939291906159db565b60405180910390a1676765c793fa10079d601b1b614ba8858461583e565b614bb29190615873565b979650505050505050565b6000614c12826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b0316614c8f9092919063ffffffff16565b805190915015610a375780806020019051810190614c309190615887565b610a375760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b60648201526084016115d1565b6060611d03848460008585843b614ce85760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e747261637400000060448201526064016115d1565b600080866001600160a01b03168587604051614d049190615e4e565b60006040518083038185875af1925050503d8060008114614d41576040519150601f19603f3d011682016040523d82523d6000602084013e614d46565b606091505b5091509150614bb282828660608315614d60575081610b22565b825115614d705782518084602001fd5b8160405162461bcd60e51b81526004016115d19190614f53565b6040518060a0016040528060008152602001600081526020016000815260200160008152602001600081525090565b828054614dc5906157da565b90600052602060002090601f016020900481019282614de75760008555614e2d565b82601f10614e0057805160ff1916838001178555614e2d565b82800160010185558215614e2d579182015b82811115614e2d578251825591602001919060010190614e12565b50614e39929150614e9f565b5090565b828054828255906000526020600020908101928215614e2d5791602002820182811115614e2d578251825591602001919060010190614e12565b6040518060800160405280600081526020016000815260200160008152602001600081525090565b5b80821115614e395760008155600101614ea0565b6001600160a01b0391909116815260200190565b6001600160e01b031981168114610c9e57600080fd5b600060208284031215614ef057600080fd5b8135610b2281614ec8565b60005b83811015614f16578181015183820152602001614efe565b838111156140105750506000910152565b60008151808452614f3f816020860160208601614efb565b601f01601f19169290920160200192915050565b602081526000610b226020830184614f27565b600060208284031215614f7857600080fd5b5035919050565b6001600160a01b0381168114610c9e57600080fd5b60008060408385031215614fa757600080fd5b8235614fb281614f7f565b946020939093013593505050565b600080600060608486031215614fd557600080fd5b8335614fe081614f7f565b92506020840135614ff081614f7f565b929592945050506040919091013590565b6000806040838503121561501457600080fd5b82359150602083013561502681614f7f565b809150509250929050565b60a081016108ea828480518252602081015160208301526040810151604083015260608101516060830152608081015160808301525050565b60006020828403121561507c57600080fd5b8135610b2281614f7f565b634e487b7160e01b600052604160045260246000fd5b604051601f8201601f191681016001600160401b03811182821017156150c5576150c5615087565b604052919050565b600082601f8301126150de57600080fd5b81356001600160401b038111156150f7576150f7615087565b61510a601f8201601f191660200161509d565b81815284602083860101111561511f57600080fd5b816020850160208301376000918101602001919091529392505050565b60006020828403121561514e57600080fd5b81356001600160401b0381111561516457600080fd5b611d03848285016150cd565b6000806040838503121561518357600080fd5b50508035926020909101359150565b80356001600160401b0381168114611e1657600080fd5b600080604083850312156151bc57600080fd5b614fb283615192565b60006001600160401b038211156151de576151de615087565b5060051b60200190565b600082601f8301126151f957600080fd5b8135602061520e615209836151c5565b61509d565b82815260059290921b8401810191818101908684111561522d57600080fd5b8286015b848110156152485780358352918301918301615231565b509695505050505050565b60008060006060848603121561526857600080fd5b833561527381614f7f565b925060208401356001600160401b038082111561528f57600080fd5b61529b878388016151e8565b935060408601359150808211156152b157600080fd5b506152be868287016151e8565b9150509250925092565b60008060008060008060c087890312156152e157600080fd5b86356001600160401b03808211156152f857600080fd5b6153048a838b016151e8565b9750602089013591508082111561531a57600080fd5b6153268a838b016151e8565b96506040890135915061533882614f7f565b90945060608801359061534a82614f7f565b90935060808801359061535c82614f7f565b90925060a0880135908082111561537257600080fd5b5061537f89828a016150cd565b9150509295509295509295565b600080600080608085870312156153a257600080fd5b5050823594602084013594506040840135936060013592509050565b600082601f8301126153cf57600080fd5b813560206153df615209836151c5565b82815260059290921b840181019181810190868411156153fe57600080fd5b8286015b848110156152485780356008811061541a5760008081fd5b8352918301918301615402565b600082601f83011261543857600080fd5b81356020615448615209836151c5565b82815260059290921b8401810191818101908684111561546757600080fd5b8286015b848110156152485780356001600160401b0381111561548a5760008081fd5b6154988986838b01016150cd565b84525091830191830161546b565b600080600080608085870312156154bc57600080fd5b84356001600160401b03808211156154d357600080fd5b6154df888389016153be565b955060208701359150808211156154f557600080fd5b5061550287828801615427565b935050604085013561551381614f7f565b9150606085013561552381614f7f565b939692955090935050565b8015158114610c9e57600080fd5b6000806040838503121561554f57600080fd5b823561555a81614f7f565b915060208301356150268161552e565b6000806000806080858703121561558057600080fd5b843561558b81614f7f565b9350602085013561559b81614f7f565b92506040850135915060608501356001600160401b038111156155bd57600080fd5b6155c9878288016150cd565b91505092959194509250565b60008060008060008587036101808112156155ef57600080fd5b86356155fa81614f7f565b9550602087013561560a81614f7f565b9450604087013561561a81614f7f565b9350610100605f198201121561562f57600080fd5b506060860191506101608601356001600160401b0381111561565057600080fd5b61565c888289016150cd565b9150509295509295909350565b60008060008060008060c0878903121561568257600080fd5b86356001600160401b038082111561569957600080fd5b6156a58a838b016153be565b975060208901359150808211156156bb57600080fd5b6153268a838b01615427565b600080604083850312156156da57600080fd5b82356156e581614f7f565b9150602083013561502681614f7f565b60ff81168114610c9e57600080fd5b600080600080600080600060e0888a03121561571f57600080fd5b873561572a81614f7f565b9650602088013561573a81614f7f565b9550604088013561574a8161552e565b9450606088013593506080880135615761816156f5565b9699959850939692959460a0840135945060c09093013592915050565b6000806000806080858703121561579457600080fd5b84356001600160401b03808211156157ab57600080fd5b6157b7888389016151e8565b955060208701359150808211156157cd57600080fd5b50615502878288016151e8565b600181811c908216806157ee57607f821691505b602082108114156148a957634e487b7160e01b600052602260045260246000fd5b60006020828403121561582157600080fd5b5051919050565b634e487b7160e01b600052601160045260246000fd5b600081600019048311821515161561585857615858615828565b500290565b634e487b7160e01b600052601260045260246000fd5b6000826158825761588261585d565b500490565b60006020828403121561589957600080fd5b8151610b228161552e565b6000828210156158b6576158b6615828565b500390565b60006001600160401b038281168482168083038211156158dd576158dd615828565b01949350505050565b6000602082840312156158f857600080fd5b8151610b2281614f7f565b634e487b7160e01b600052603260045260246000fd5b600081518084526020808501945080840160005b838110156159495781518752958201959082019060010161592d565b509495945050505050565b6040815260006159676040830185615919565b82810360208401526120578185615919565b6020808252601f908201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c00604082015260600190565b602081526000610b226020830184615919565b600082198211156159d6576159d6615828565b500190565b928352602083019190915260ff16604082015260600190565b6000600019821415615a0857615a08615828565b5060010190565b600181815b80851115615a4a578160001904821115615a3057615a30615828565b80851615615a3d57918102915b93841c9390800290615a14565b509250929050565b600082615a61575060016108ea565b81615a6e575060006108ea565b8160018114615a845760028114615a8e57615aaa565b60019150506108ea565b60ff841115615a9f57615a9f615828565b50506001821b6108ea565b5060208310610133831016604e8410600b8410161715615acd575081810a6108ea565b615ad78383615a0f565b8060001904821115615aeb57615aeb615828565b029392505050565b6000610b2260ff841683615a52565b600082615b1157615b1161585d565b500690565b60008151615b28818560208601614efb565b9290920192915050565b600080845481600182811c915080831680615b4e57607f831692505b6020808410821415615b6e57634e487b7160e01b86526022600452602486fd5b818015615b825760018114615b9357615bc0565b60ff19861689528489019650615bc0565b60008b81526020902060005b86811015615bb85781548b820152908501908301615b9f565b505084890196505b5050505050506120578185615b16565b600060208284031215615be257600080fd5b8151610b22816156f5565b6e020b733b63290283937ba37b1b7b61608d1b815260008251615c1781600f850160208701614efb565b650815985d5b1d60d21b600f939091019283015250601501919050565b60008251615c46818460208701614efb565b650b5d985d5b1d60d21b920191825250600601919050565b600060208284031215615c7057600080fd5b610b2282615192565b600060208284031215615c8b57600080fd5b8135610b228161552e565b634e487b7160e01b600052602160045260246000fd5b60008060408385031215615cbf57600080fd5b505080516020909101519092909150565b60008060008060008060c08789031215615ce957600080fd5b8651615cf481614f7f565b6020880151604089015160608a015160808b015160a0909b0151939c929b509099909850965090945092505050565b60008060008060808587031215615d3957600080fd5b845193506020850151615d4b81614f7f565b6040860151606090960151949790965092505050565b9283526001600160a01b03918216602084015216604082015260600190565b6001600160a01b03929092168252602082015260400190565b6001600160a01b038781168252868116602083015285166040820152606081018490526080810183905260c060a082018190526000906143e190830184614f27565b828152604060208201526000611d036040830184614f27565b600060208284031215615e0657600080fd5b8151610b2281614ec8565b6001600160a01b0385811682528416602082015260408101839052608060608201819052600090615e4490830184614f27565b9695505050505050565b60008251615e60818460208701614efb565b919091019291505056fe70cf49afe7355562d5b022e594790f22b71ad8cc7eec902fa5feac7c67f71091722cb71fa87c947148cefc06dd890af5802a6a00207c5ddecf1191bf71ce3cd4ddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3efa26469706673582212201f576770aa8b1ac44c345b6c00f8ce99e7e7f0e9e2214692591abbf1a81e680964736f6c634300080c0033", - "deployedBytecode": "0x608060405234801561001057600080fd5b50600436106103015760003560e01c8063010db1951461030657806301ffc9a71461032f57806306fdde0314610352578063081812fc14610367578063087a60071461037a578063095ea7b3146103915780630e198f22146103a657806313888565146103af57806323b872dd146103b8578063254cf439146103cb578063307439af146103fd57806334ce998a1461041d57806335836f15146104255780633644e5151461043857806339393ac91461044057806339eb4dc6146104535780633ae2325f146104675780633af32abf1461047a5780633c2e941b1461049a57806342842e0e146104a3578063430c2081146104b65780634f7e43df146104c957806355f804b3146104e35780635b84d88a146104f65780635c975abb1461050957806361d027b31461051d5780636352211e1461053057806370a082311461054357806374107543146105565780637aacfffa146105695780637adbf973146105a55780637c0f59f4146105b85780637c3a00fd146105d25780637dc0d1d0146105e55780637e53bd97146105f85780637e56d47c1461060b5780637ecebe001461061e578063835986b41461064757806389050f1d1461065a57806395d89b411461066c5780639a3b6f2f146106745780639f48118f146106ba578063a172923a146106c5578063a22cb465146106ce578063af2c8c2e146106e1578063b1511cc9146106ea578063b4bd6f46146106fd578063b88d4fde14610710578063bbcac55714610723578063c4ae31681461072c578063c66d8b0114610734578063c87b56dd1461074e578063d8dfeb4514610761578063d9b1cb5b14610774578063de1f776514610787578063de8fc69814610799578063df011c41146107ac578063e182b883146107bf578063e1c84ea4146107d2578063e626648a146107db578063e985e9c5146107f5578063e9cbd82214610808578063f0f442601461081b578063f51cc7dd1461082e578063fad9aba314610841578063fc29b02114610868578063fd527cf81461087b575b600080fd5b603754610319906001600160a01b031681565b6040516103269190614eb4565b60405180910390f35b61034261033d366004614ede565b610883565b6040519015158152602001610326565b61035a6108f0565b6040516103269190614f53565b610319610375366004614f66565b61097e565b610383603f5481565b604051908152602001610326565b6103a461039f366004614f94565b6109af565b005b610383603e5481565b61038360415481565b6103a46103c6366004614fc0565b610a3c565b603c546103e590600160401b90046001600160401b031681565b6040516001600160401b039091168152602001610326565b61041061040b366004615001565b610a77565b6040516103269190615031565b610383610b29565b610383610433366004614f66565b610b5b565b610383610b97565b6103a461044e36600461506a565b610ba1565b603d5461034290600160c01b900460ff1681565b610383610475366004614f66565b610ca1565b61038361048836600461506a565b60446020526000908152604090205481565b61038360455481565b6103a46104b1366004614fc0565b610cc2565b6103426104c4366004614f94565b610cdd565b603d546103e590600160801b90046001600160401b031681565b6103a46104f136600461513c565b610ce9565b6103a4610504366004615170565b610d8e565b603d5461034290600160c81b900460ff1681565b603354610319906001600160a01b031681565b61031961053e366004614f66565b610e27565b61038361055136600461506a565b610e32565b6103a46105643660046151a9565b610e77565b610590610577366004614f66565b6043602052600090815260409020805460019091015482565b60408051928352602083019190915201610326565b6103a46105b336600461506a565b611243565b603c546103e590600160c01b90046001600160401b031681565b603d546103e5906001600160401b031681565b603654610319906001600160a01b031681565b6103a4610606366004615253565b61138a565b6104106106193660046152c8565b61157b565b61038361062c36600461506a565b6001600160a01b03166000908152607f602052604090205490565b6103a461065536600461538c565b611b11565b610383676765c793fa10079d601a1b81565b61035a611cc9565b6106876106823660046154a6565b611cd6565b60405161032691908151815260208083015190820152604080830151908201526060918201519181019190915260800190565b610383633b9aca0081565b61038360b45481565b6103a46106dc36600461553c565b611d0b565b61038360405481565b6103a46106f8366004614f66565b611d16565b61038361070b36600461506a565b611ddf565b6103a461071e36600461556a565b611e1b565b61038360425481565b6103a4611e58565b603d546103e590600160401b90046001600160401b031681565b61035a61075c366004614f66565b611f07565b603454610319906001600160a01b031681565b6103a46107823660046155d5565b612060565b610383676765c793fa10079d601b1b81565b6106876107a7366004615669565b6125b4565b603c546103e5906001600160401b031681565b6103836107cd366004614f66565b612e3b565b61038360395481565b603c546103e590600160801b90046001600160401b031681565b6103426108033660046156c7565b612e4b565b603554610319906001600160a01b031681565b6103a461082936600461506a565b612e79565b6103a461083c366004615704565b612f19565b6103837f000000000000000000000000000000000000000000000000000000000000000081565b61041061087636600461577e565b6131d9565b610590613203565b60006001600160e01b03198216635b5e139f60e01b14806108b457506001600160e01b031982166380ac58cd60e01b145b806108cf57506001600160e01b0319821663430c208160e01b145b806108ea57506001600160e01b031982166301ffc9a760e01b145b92915050565b607d80546108fd906157da565b80601f0160208091040260200160405190810160405280929190818152602001828054610929906157da565b80156109765780601f1061094b57610100808354040283529160200191610976565b820191906000526020600020905b81548152906001019060200180831161095957829003601f168201915b505050505081565b600061098982613328565b6109a65760405163062a39dd60e11b815260040160405180910390fd5b6108ea82613345565b60006109ba82613360565b9050806001600160a01b0316836001600160a01b031614156109ef576040516349fa8bc360e11b815260040160405180910390fd5b336001600160a01b03821614801590610a0f5750610a0d8133612e4b565b155b15610a2d5760405163c19f17a960e01b815260040160405180910390fd5b610a378383613396565b505050565b3381610a488282613404565b610a655760405163c19f17a960e01b815260040160405180910390fd5b610a70858585613482565b5050505050565b610a7f614d8a565b60008381526043602090815260409182902082518084018452815481526001909101548183015260365483516315f789a960e21b81529351610b2294929387936001600160a01b03909316926357de26a492600480830193928290030181865afa158015610af1573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610b15919061580f565b610b1d6135a9565b61373e565b9392505050565b6000676765c793fa10079d601b1b610b3f6135a9565b604054610b4c919061583e565b610b569190615873565b905090565b6000676765c793fa10079d601b1b610b716135a9565b600084815260436020526040902060010154610b8d919061583e565b6108ea9190615873565b6000610b56613aac565b603354604051631c86b03760e31b81526001600160a01b039091169063e43581b890610bd1903390600401614eb4565b602060405180830381865afa158015610bee573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610c129190615887565b610c2f57604051633b8d9d7560e21b815260040160405180910390fd5b6001600160a01b03811615610c7e576001600160a01b038116600090815260446020526040902054610c629060016158a4565b6001600160a01b03821660009081526044602052604090205550565b603d805460ff60c01b198116600160c01b9182900460ff16159091021790555b50565b603b8181548110610cb157600080fd5b600091825260209091200154905081565b610a3783838360405180602001604052806000815250611e1b565b6000610b228383613404565b60335460405163521d4de960e01b81526001600160a01b039091169063521d4de990610d19903390600401614eb4565b602060405180830381865afa158015610d36573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610d5a9190615887565b610d7757604051632678482f60e21b815260040160405180910390fd5b8051610d8a906046906020840190614db9565b5050565b603354604051631c86b03760e31b81526001600160a01b039091169063e43581b890610dbe903390600401614eb4565b602060405180830381865afa158015610ddb573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610dff9190615887565b610e1c57604051633b8d9d7560e21b815260040160405180910390fd5b60b49190915560b555565b60006108ea82613360565b60006001600160a01b038216610e5b5760405163d92e233d60e01b815260040160405180910390fd5b506001600160a01b031660009081526048602052604090205490565b60335460405163521d4de960e01b81526001600160a01b039091169063521d4de990610ea7903390600401614eb4565b602060405180830381865afa158015610ec4573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610ee89190615887565b610f0557604051632678482f60e21b815260040160405180910390fd5b806121a360f11b1415610f6957603d546001600160401b03600160401b90910481169083161115610f4957604051637650e96360e11b815260040160405180910390fd5b603c80546001600160401b0319166001600160401b0384161790556111fc565b80622a242360e91b1415610fce57633b9aca00826001600160401b03161015610fa55760405163da6a17b960e01b815260040160405180910390fd5b603c8054600160401b600160801b031916600160401b6001600160401b038516021790556111fc565b8061212360f11b141561103257633b9aca00826001600160401b0316111561100957604051637650e96360e11b815260040160405180910390fd5b603c8054600160801b600160c01b031916600160801b6001600160401b038516021790556111fc565b8061292360f11b14156110af57603d54633b9aca009061106290600160401b90046001600160401b0316846158bb565b6001600160401b0316111561108a57604051637650e96360e11b815260040160405180910390fd5b603c80546001600160c01b0316600160c01b6001600160401b038516021790556111fc565b806124a960f11b14156110e5576110c4613b18565b50603d80546001600160401b0319166001600160401b0384161790556111fc565b80614c5360f01b141561117e57603c546001600160401b03808416911611806111375750603c54633b9aca009061112c90600160c01b90046001600160401b0316846158bb565b6001600160401b0316115b156111555760405163180d062b60e31b815260040160405180910390fd5b603d8054600160401b600160801b031916600160401b6001600160401b038516021790556111fc565b806213531160ea1b14156111e357633b9aca00826001600160401b031611156111ba57604051637650e96360e11b815260040160405180910390fd5b603d8054600160801b600160c01b031916600160801b6001600160401b038516021790556111fc565b60405163e1daa9cf60e01b815260040160405180910390fd5b604080516001600160401b0384168152602081018390527f13b367dac93b85d1ed9b3d8961d8b48e1a677c9800bb1613b4b0416b2d5b61d091015b60405180910390a15050565b603354604051631c86b03760e31b81526001600160a01b039091169063e43581b890611273903390600401614eb4565b602060405180830381865afa158015611290573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906112b49190615887565b6112d157604051633b8d9d7560e21b815260040160405180910390fd5b603354604080516361d027b360e01b815290516001600160a01b03928316928416916361d027b39160048083019260209291908290030181865afa15801561131d573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061134191906158e6565b6001600160a01b031614611368576040516302979eb960e31b815260040160405180910390fd5b603680546001600160a01b0319166001600160a01b0392909216919091179055565b60335460405163521d4de960e01b81526001600160a01b039091169063521d4de9906113ba903390600401614eb4565b602060405180830381865afa1580156113d7573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906113fb9190615887565b61141857604051632678482f60e21b815260040160405180910390fd5b8051825114158061144357508060008151811061143757611437615903565b60200260200101516000145b806114d257506001600160a01b038316158015906114d257508160008151811061146f5761146f615903565b60200260200101518260018151811061148a5761148a615903565b60200260200101511115806114d25750806000815181106114ad576114ad615903565b6020026020010151816001815181106114c8576114c8615903565b6020026020010151105b156114f057604051631746545d60e11b815260040160405180910390fd5b603780546001600160a01b0319166001600160a01b038516179055815161151e90603a906020850190614e3d565b50805161153290603b906020840190614e3d565b50826001600160a01b03167feb74d4d9fea592587c926aeb35eb6a7893fb28db0c1c8eb2eb3c586e7164b76c838360405161156e929190615954565b60405180910390a2505050565b611583614d8a565b603d54600160c81b900460ff16156115ae576040516313d0ff5960e31b815260040160405180910390fd5b600260015414156115da5760405162461bcd60e51b81526004016115d190615979565b60405180910390fd5b6002600155855187511415806115ef57508551155b1561160d576040516346282e8d60e01b815260040160405180910390fd5b603660009054906101000a90046001600160a01b03166001600160a01b03166357de26a46040518163ffffffff1660e01b8152600401602060405180830381865afa158015611660573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611684919061580f565b6060820152611691613b18565b60808201526040517f965a177723c641ee49150b583a0b9ad4730bb20d3474e00ae5a65e777c00d67b906116c69089906159b0565b60405180910390a160005b8751811015611a82576000604360008a84815181106116f2576116f2615903565b60200260200101518152602001908152602001600020604051806040016040529081600082015481526020016001820154815250509050600061173f82338660600151876080015161373e565b9050600081604001511180156117715750806040015189848151811061176757611767615903565b6020026020010151115b806117985750806000015189848151811061178e5761178e615903565b6020026020010151115b156117c15780600001518984815181106117b4576117b4615903565b6020026020010181815250505b6000846060015182606001516117d7919061583e565b603854633b9aca008c87815181106117f1576117f1615903565b6020026020010151611803919061583e565b61180d919061583e565b6118179190615873565b905061182e8b8581518110610d8a57610d8a615903565b82518110611964575081516020830151604080546000906118509084906158a4565b92505081905550604360008c868151811061186d5761186d615903565b60209081029190910181015182528101919091526040016000908120818155600101819055603d548b51633b9aca0091600160401b90046001600160401b0316908d90889081106118c0576118c0615903565b60200260200101516118d2919061583e565b6118dc9190615873565b9050826080015181106118f0576000611900565b80836080015161190091906158a4565b8660400181815161191191906159c3565b905250508a51600080516020615e6b833981519152908c908690811061193957611939615903565b602002602001015184602001516000604051611957939291906159db565b60405180910390a1611a25565b80604360008d878151811061197b5761197b615903565b6020026020010151815260200190815260200160002060000160008282546119a391906158a4565b92505081905550611a238b85815181106119bf576119bf615903565b6020026020010151633b9aca00603d60089054906101000a90046001600160401b03166001600160401b03168d88815181106119fd576119fd615903565b6020026020010151611a0f919061583e565b611a199190615873565b8760800151613bb9565b505b8085602001818151611a3791906159c3565b90525089518a9085908110611a4e57611a4e615903565b602002602001015185600001818151611a6791906159c3565b905250839250611a7a91508290506159f4565b9150506116d1565b50603d54633b9aca0090611aa690600160401b90046001600160401b0316826158a4565b8251611ab2919061583e565b611abc9190615873565b60416000828254611acd91906159c3565b9091555050604081015160428054600090611ae99084906159c3565b909155505060208101518151611b03919087878787613cee565b600180559695505050505050565b603d54600160c81b900460ff1615611b3c576040516313d0ff5960e31b815260040160405180910390fd5b6033546040516333b52a9f60e11b81526001600160a01b039091169063676a553e90611b6c903390600401614eb4565b602060405180830381865afa158015611b89573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611bad9190615887565b611bca5760405163027f480760e01b815260040160405180910390fd5b603c54600090600160c01b90046001600160401b0316821015611c0857603c54611c05908390600160c01b90046001600160401b03166158a4565b90505b603c54600090600160801b90046001600160401b0316841115611c4557603c54611c4290600160801b90046001600160401b0316856158a4565b90505b6000611c566002633b9aca00615af3565b611c6483633b9aca006158a4565b611c7285633b9aca006158a4565b611c7c908961583e565b611c86919061583e565b611c909190615873565b9050611c9c81876158a4565b60416000828254611cad91906159c3565b90915550611cbf905087826000613bb9565b5050505050505050565b607e80546108fd906157da565b611cde614e77565b60408051600080825260208201909252611d00918791879187918791906125b4565b90505b949350505050565b610d8a338383613df8565b60335460405163521d4de960e01b81526001600160a01b039091169063521d4de990611d46903390600401614eb4565b602060405180830381865afa158015611d63573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611d879190615887565b611da457604051632678482f60e21b815260040160405180910390fd5b60398190556040518181527fdd63b3dcdbebad734892f7c7a26d0f647fbc7eec973e0775f5229018ac4ab47a9060200160405180910390a150565b603d54600090600160c81b900460ff1615611e0d576040516313d0ff5960e31b815260040160405180910390fd5b6108ea82613eae565b919050565b3382611e278282613404565b611e445760405163c19f17a960e01b815260040160405180910390fd5b611e5086868686613fdc565b505050505050565b60335460405163521d4de960e01b81526001600160a01b039091169063521d4de990611e88903390600401614eb4565b602060405180830381865afa158015611ea5573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611ec99190615887565b611ee657604051632678482f60e21b815260040160405180910390fd5b603d805460ff60c81b198116600160c81b9182900460ff1615909102179055565b6060611f1282613328565b611f2f5760405163062a39dd60e11b815260040160405180910390fd5b8160005b8115611f595780611f43816159f4565b9150611f529050600a83615873565b9150611f33565b6000816001600160401b03811115611f7357611f73615087565b6040519080825280601f01601f191660200182016040528015611f9d576020820181803683370190505b5090505b841561200857611fb26001836158a4565b9150611fbf600a86615b02565b611fca9060306159c3565b60f81b818381518110611fdf57611fdf615903565b60200101906001600160f81b031916908160001a905350612001600a86615873565b9450611fa1565b600060468054612017906157da565b9050116120335760405180602001604052806000815250612057565b604681604051602001612047929190615b32565b6040516020818303038152906040525b95945050505050565b600054610100900460ff1661207b5760005460ff161561207f565b303b155b6120e25760405162461bcd60e51b815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201526d191e481a5b9a5d1a585b1a5e995960921b60648201526084016115d1565b600054610100900460ff16158015612104576000805461ffff19166101011790555b856001600160a01b0316846001600160a01b03166361d027b36040518163ffffffff1660e01b8152600401602060405180830381865afa15801561214c573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061217091906158e6565b6001600160a01b031614612197576040516302979eb960e31b815260040160405180910390fd5b603380546001600160a01b038089166001600160a01b0319928316179092556034805492881692909116821790556040805163313ce56760e01b8152905163313ce567916004808201926020929091908290030181865afa158015612200573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906122249190615bd0565b61222f90600a615af3565b603881905550856001600160a01b031663e9cbd8226040518163ffffffff1660e01b8152600401602060405180830381865afa158015612273573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061229791906158e6565b603580546001600160a01b03199081166001600160a01b0393841617909155603680549091169186169190911790556040516000906122da908490602001615bed565b60408051601f19818403018152919052805190915061230090607d906020840190614db9565b5061230a81614016565b8260405160200161231b9190615c34565b604051602081830303815290604052607e908051906020019061233f929190614db9565b50676765c793fa10079d601b1b603f5542603e5561236360a0850160808601615c5e565b6001600160401b031661237c6040860160208701615c5e565b6001600160401b031611806123ac5750633b9aca006123a160a0860160808701615c5e565b6001600160401b0316115b806123d257506123c26060850160408601615c5e565b6001600160401b0316633b9aca00115b806123f95750633b9aca006123ed60c0860160a08701615c5e565b6001600160401b031610155b80612406575060e0840135155b1561242457604051631746545d60e11b815260040160405180910390fd5b83356039556124396040850160208601615c5e565b603c80546001600160401b0319166001600160401b03929092169190911790556124696060850160408601615c5e565b603c80546001600160401b0392909216600160401b02600160401b600160801b03199092169190911790556124a46080850160608601615c5e565b603d80546001600160401b0319166001600160401b03929092169190911790556124d460a0850160808601615c5e565b603d80546001600160401b0392909216600160401b02600160401b600160801b031990921691909117905561250f60c0850160a08601615c5e565b603d80546001600160401b0392909216600160801b02600160801b600160c01b031990921691909117905561254a60e0850160c08601615c79565b603d8054911515600160c01b0260ff60c01b19909216919091179055604080516020810190915260e0850135815261258690603b906001614e3d565b5050603d805460ff60c81b1916600160c81b1790558015611e50576000805461ff0019169055505050505050565b6125bc614e77565b603d54600160c81b900460ff16156125e7576040516313d0ff5960e31b815260040160405180910390fd5b6002600154141561260a5760405162461bcd60e51b81526004016115d190615979565b60026001558551875114158061261f57508651155b1561263d576040516346282e8d60e01b815260040160405180910390fd5b600080808080805b8c51811015612ba45760008d828151811061266257612662615903565b602002602001015190506000600781111561267f5761267f615c96565b81600781111561269157612691615c96565b14156126d2576126cc8d83815181106126ac576126ac615903565b60200260200101518060200190518101906126c791906158e6565b613eae565b50612b91565b60028160078111156126e6576126e6615c96565b141561274c578c82815181106126fe576126fe615903565b60200260200101518060200190518101906127199190615cac565b95509250826127285760455492505b61273283866140ec565b848860600181815161274491906159c3565b905250612b91565b600781600781111561276057612760615c96565b14156128395760008060008f858151811061277d5761277d615903565b60200260200101518060200190518101906127989190615cd0565b60345460405163d505accf60e01b81526001600160a01b038089166004830152306024830152604482018890526064820187905260ff8616608483015260a4820185905260c48201849052969f50939d50939b509497509550929350169063d505accf9060e401600060405180830381600087803b15801561281957600080fd5b505af115801561282d573d6000803e3d6000fd5b50505050505050612b91565b8661284957612846613b18565b96505b600481600781111561285d5761285d615c96565b1415612929578c828151811061287557612875615903565b60200260200101518060200190518101906128909190615cac565b945092508261289f5760455492505b6128aa838589613bb9565b603c549094506000906128d190600160c01b90046001600160401b0316633b9aca006158a4565b6128df633b9aca008761583e565b6128e99190615873565b90506128f585826158a4565b6041600082825461290691906159c3565b92505081905550808960200181815161291f91906159c3565b905250612b919050565b856129a857603660009054906101000a90046001600160a01b03166001600160a01b03166357de26a46040518163ffffffff1660e01b8152600401602060405180830381865afa158015612981573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906129a5919061580f565b95505b60018160078111156129bc576129bc615c96565b1415612a38578c82815181106129d4576129d4615903565b60200260200101518060200190518101906129ef919061580f565b9250826129fc5760455492505b612a07838789614158565b80965081955050508488604001818151612a2191906159c3565b9052506020880180518591906127449083906159c3565b6003816007811115612a4c57612a4c615c96565b1415612aac578c8281518110612a6457612a64615903565b6020026020010151806020019051810190612a7f9190615cac565b9550925082612a8e5760455492505b612a9a8386888a614278565b848860400181815161274491906159c3565b6005816007811115612ac057612ac0615c96565b1415612b22578c8281518110612ad857612ad8615903565b6020026020010151806020019051810190612af39190615cac565b9450925082612b025760455492505b612b0e8385888a614352565b9350838860000181815161274491906159c3565b6006816007811115612b3657612b36615c96565b1415612b91576000808e8481518110612b5157612b51615903565b6020026020010151806020019051810190612b6c9190615d23565b98509196509250905084612b805760455494505b612b8e858383898c8e6143ed565b50505b5080612b9c816159f4565b915050612645565b508551602087015110612c9b5785516020870151600091612bc4916158a4565b90508660600151876040015110612bfb57612bf687606001518860400151612bec91906158a4565b828d8d8d8d613cee565b612c95565b8015612c6857603554604051630d43af8160e21b81526001600160a01b039091169063350ebe0490612c359084908f903390600401615d61565b600060405180830381600087803b158015612c4f57600080fd5b505af1158015612c63573d6000803e3d6000fd5b505050505b612c95333089604001518a60600151612c8191906158a4565b6034546001600160a01b0316929190614529565b50612e27565b60208601518651600091612cae916158a4565b6035546040516340c10f1960e01b81529192506001600160a01b0316906340c10f1990612ce1908d908590600401615d80565b600060405180830381600087803b158015612cfb57600080fd5b505af1158015612d0f573d6000803e3d6000fd5b50505050866060015187604001511115612d5357612d4e8a88606001518960400151612d3b91906158a4565b6034546001600160a01b03169190614594565b612e25565b600087604001518860600151612d6991906158a4565b90508015612e2357885115612e0b57896001600160a01b031663a5d4096b603560009054906101000a90046001600160a01b0316603460009054906101000a90046001600160a01b03163385878f6040518763ffffffff1660e01b8152600401612dd896959493929190615d99565b600060405180830381600087803b158015612df257600080fd5b505af1158015612e06573d6000803e3d6000fd5b505050505b603454612e23906001600160a01b0316333084614529565b505b505b505060018055509198975050505050505050565b603a8181548110610cb157600080fd5b6001600160a01b039182166000908152604a6020908152604080832093909416825291909152205460011490565b6033546001600160a01b03163314612ea45760405163b90cdbb160e01b815260040160405180910390fd5b603380546001600160a01b0319166001600160a01b0383811691909117909155603654604051630787a21360e51b815291169063f0f4426090612eeb908490600401614eb4565b600060405180830381600087803b158015612f0557600080fd5b505af1158015610a70573d6000803e3d6000fd5b83421115612f3a5760405163f87d927160e01b815260040160405180910390fd5b6fa2a8918ca85bafe22016d0b997e4df60600160ff1b03811180612f7157508260ff16601b14158015612f7157508260ff16601c14155b15612f8f57604051638baa579f60e01b815260040160405180910390fd5b6000612f99613aac565b608254898989612fa88d6145b3565b6040805160208101969096526001600160a01b03948516908601529290911660608401521515608083015260a082015260c0810187905260e0016040516020818303038152906040528051906020012060405160200161301f92919061190160f01b81526002810192909252602282015260420190565b60405160208183030381529060405280519060200120905061304a886001600160a01b03163b151590565b1561312657604080516020810185905280820184905260f886901b6001600160f81b0319166060820152815160418183030181526061820192839052630b135d3f60e11b9092526001600160a01b038a1691631626ba7e916130b0918591606501615ddb565b602060405180830381865afa1580156130cd573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906130f19190615df4565b6001600160e01b031916631626ba7e60e01b1461312157604051638baa579f60e01b815260040160405180910390fd5b6131ce565b6040805160008082526020820180845284905260ff871692820192909252606081018590526080810184905260019060a0016020604051602081039080840390855afa15801561317a573d6000803e3d6000fd5b505050602060405103519050886001600160a01b0316816001600160a01b03161415806131ae57506001600160a01b038116155b156131cc57604051638baa579f60e01b815260040160405180910390fd5b505b611cbf888888613df8565b6131e1614d8a565b60408051600080825260208201909252611d009187918791879187919061157b565b60335460009081906001600160a01b031633146132335760405163b90cdbb160e01b815260040160405180910390fd5b61323b613b18565b5050604180546042805460009384905592905591508082106132d45761326181836158a4565b6035546033546040516340c10f1960e01b8152929450600093506001600160a01b03918216926340c10f199261329d9216908690600401615d80565b600060405180830381600087803b1580156132b757600080fd5b505af11580156132cb573d6000803e3d6000fd5b505050506132e5565b6132de82826158a4565b9050600091505b60408051838152602081018390527ffeb12225c131aab793a00c5239afb778932d170fa28ce6e9d23703e4bd892121910160405180910390a19091565b3b151590565b6000908152604760205260409020546001600160a01b0316151590565b6000908152604960205260409020546001600160a01b031690565b6000818152604760205260409020546001600160a01b031680611e165760405163062a39dd60e11b815260040160405180910390fd5b600081815260496020526040902080546001600160a01b0319166001600160a01b03841690811790915581906133cb82613360565b6001600160a01b03167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92560405160405180910390a45050565b60008061341083613360565b9050806001600160a01b0316846001600160a01b0316148061344b5750836001600160a01b031661344084613345565b6001600160a01b0316145b80611d0357506001600160a01b038082166000908152604a6020908152604080832093881683529290522054600114949350505050565b826001600160a01b031661349582613360565b6001600160a01b0316146134bc5760405163c19f17a960e01b815260040160405180910390fd5b6001600160a01b0382166134e35760405163d92e233d60e01b815260040160405180910390fd5b603d54600160c01b900460ff16801561351557506001600160a01b038216600090815260446020526040902054600114155b1561353357604051630b094f2760e31b815260040160405180910390fd5b61353e600082613396565b6001600160a01b038084166000818152604860209081526040808320805460001901905593861680835284832080546001019055858352604790915283822080546001600160a01b03191682179055925184939291600080516020615eab83398151915291a4505050565b600080603e54426135ba91906158a4565b603d549091506001600160401b03168115806135d4575080155b156135e357603f549250505090565b60006135f06001846158a4565b905060006002841161360357600061360e565b61360e6002856158a4565b90506000676765c793fa10079d601b1b676765c793fa10079d601a1b613634868061583e565b61363e91906159c3565b6136489190615873565b90506000676765c793fa10079d601b1b676765c793fa10079d601a1b61366e878561583e565b61367891906159c3565b6136829190615873565b90506000600283613693878a61583e565b61369d919061583e565b6136a79190615873565b90506000600683866136b9898c61583e565b6136c3919061583e565b6136cd919061583e565b6136d79190615873565b9050676765c793fa10079d601b1b81836136f18b8b61583e565b61370690676765c793fa10079d601b1b6159c3565b61371091906159c3565b61371a91906159c3565b603f54613727919061583e565b6137319190615873565b9850505050505050505090565b613746614d8a565b60008060006137568887876145f7565b925092509250633b9aca008310613780576040516315fe9b6160e21b815260040160405180910390fd5b6000633b9aca0061379185826158a4565b61379a8a614680565b6137a4919061583e565b6137ae9190615873565b603d54909150600160801b90046001600160401b03168110156137de576137d981633b9aca006158a4565b6137ff565b603d546137ff90600160801b90046001600160401b0316633b9aca006158a4565b603d54909150600160401b90046001600160401b03166000806138276002633b9aca00615af3565b603c5461383d91906001600160401b031661583e565b83613848868a61583e565b613852919061583e565b106139ec57603c546001600160401b03166138726002633b9aca00615af3565b61387c919061583e565b603c54859061389b90600160401b90046001600160401b03168661583e565b6138a5919061583e565b6138af91906158a4565b603c548590633b9aca00906138cd906001600160401b03168961583e565b603c546138eb908b90600160401b90046001600160401b031661583e565b6138f591906158a4565b6138ff919061583e565b613909919061583e565b6139139190615873565b9150633b9aca0061392360b45490565b61392d919061583e565b613937848461583e565b61394191906159c3565b61394f633b9aca008861583e565b116139e757613969676765c793fa10079d601b1b8461583e565b633b9aca008a8e6020015161397e919061583e565b613988919061583e565b6139929190615873565b61399d9060016159c3565b91506139a860b45490565b8611156139e35782633b9aca006139be60b45490565b6139c890896158a4565b6139d2919061583e565b6139dc9190615873565b9050613a5a565b5060015b613a5a565b6038546139fd90633b9aca0061583e565b8c518b90613a0c90879061583e565b613a16919061583e565b613a209190615873565b613a2b9060016159c3565b9150613a3660b55490565b851115613a5657633b9aca0084613a4c60b55490565b6139c890886158a4565b5060015b818852613a67848b61583e565b603854613a78633b9aca008561583e565b613a82919061583e565b613a8c9190615873565b602089015260408801525050606085015250608083015250949350505050565b60808054608154604080517f8b73c3c69bb8fe3d512ecc4cf759cc79239f7b179b0ffacaa9a75d522b39400f602082015290810192909252606082015246918101919091523060a082015260009060c00160405160208183030381529060405280519060200120905090565b6000613b226135a9565b90506000676765c793fa10079d601b1b603f5483613b4091906158a4565b604054613b4d919061583e565b613b579190615873565b90508060416000828254613b6b91906159c3565b9091555050603f82905542603e8190556040805184815260208101929092527fd1fa8ba00a3bf20274346919dce0de62d2a140af2c71fe7e29fa6472eea3bb9d910160405180910390a15090565b600081613bcb57613bc8613b18565b91505b60008481526043602052604081206001015490676765c793fa10079d601b1b613bf4858461583e565b613bfe9190615873565b9050808510613c0f57935080613c32565b83613c25676765c793fa10079d601b1b8761583e565b613c2f9190615873565b90505b613c3c81836158a4565b91508060406000828254613c5091906158a4565b90915550508115801590613c8b5750676765c793fa10079d601b1b613c7460b45490565b613c7e919061583e565b613c88858461583e565b11155b15613ca95760405163228af07f60e21b815260040160405180910390fd5b60008681526043602052604080822060010184905551600080516020615e6b83398151915291613cdc91899185916159db565b60405180910390a15092949350505050565b8515613d0b57603454613d0b906001600160a01b03168488614594565b8415611e5057805115613d8a5760345460355460405163a5d4096b60e01b81526001600160a01b038086169363a5d4096b93613d579391831692169089908b908d908990600401615d99565b600060405180830381600087803b158015613d7157600080fd5b505af1158015613d85573d6000803e3d6000fd5b505050505b603554604051630d43af8160e21b81526001600160a01b039091169063350ebe0490613dbe90889088903390600401615d61565b600060405180830381600087803b158015613dd857600080fd5b505af1158015613dec573d6000803e3d6000fd5b50505050505050505050565b826001600160a01b0316826001600160a01b03161415613e2b576040516320c5195360e21b815260040160405180910390fd5b600081613e39576000613e3c565b60015b6001600160a01b038581166000818152604a602090815260408083209489168084529482529182902060ff959095169485905590518615158152939450919290917f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c31910160405180910390a350505050565b603d54600090600160c01b900460ff168015613efd57506001600160a01b0382166000908152604460205260409020546001141580613efd575033600090815260446020526040902054600114155b15613f1b57604051630b094f2760e31b815260040160405180910390fd5b6001600160a01b038216613f425760405163d92e233d60e01b815260040160405180910390fd5b5060458054600101908190556001600160a01b038216600081815260486020908152604080832080546001019055848352604790915280822080546001600160a01b031916841790555183929190600080516020615eab833981519152908290a4613fbf60008383604051806020016040528060008152506148af565b611e16576040516320149b4360e21b815260040160405180910390fd5b613fe7848484613482565b613ff3848484846148af565b614010576040516320149b4360e21b815260040160405180910390fd5b50505050565b600054610100900460ff166140815760405162461bcd60e51b815260206004820152602b60248201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960448201526a6e697469616c697a696e6760a81b60648201526084016115d1565b7f3f43a9c6bafb5c7aab4e0cfe239dc5d4c15caf0381c6104188191f78a6640bd860825580516020918201206080556040805180820190915260018152603160f81b9101527fc89efdaa54c0f20c7adf612882df0950f5a951637e0307cdcb4c672f298b8bc6608155565b6140f582613328565b6141125760405163062a39dd60e11b815260040160405180910390fd5b600082815260436020526040812080548392906141309084906159c3565b9091555050604051600080516020615e8b8339815191529061123790849084906001906159db565b60008033856141678282613404565b6141845760405163c19f17a960e01b815260040160405180910390fd5b6000878152604360209081526040808320815180830190925280548252600101549181019190915290806141b9838a8a6145f7565b5091509150633b9aca0082116141e257604051631527804d60e31b815260040160405180910390fd5b8260200151604060008282546141f891906158a4565b9091555061420790508a6149ab565b603c5460009061422b90600160c01b90046001600160401b0316633b9aca006158a4565b614239633b9aca008461583e565b6142439190615873565b905061424f82826158a4565b6041600082825461426091906159c3565b90915550509251929a92995091975050505050505050565b33846142848282613404565b6142a15760405163c19f17a960e01b815260040160405180910390fd5b600086815260436020526040812080548792906142bf9084906158a4565b9091555050600086815260436020908152604080832081518083019092528054825260010154918101919091526142f79086866145f7565b50509050633b9aca00811161431f57604051631527804d60e31b815260040160405180910390fd5b600080516020615e8b83398151915287876000604051614341939291906159db565b60405180910390a150505050505050565b600033856143608282613404565b61437d5760405163c19f17a960e01b815260040160405180910390fd5b61438987878787614a2a565b603c54909650600090633b9aca00906143b3908990600160801b90046001600160401b031661583e565b6143bd9190615873565b905080604160008282546143d191906159c3565b909155506143e1905081886158a4565b98975050505050505050565b33866143f98282613404565b6144165760405163c19f17a960e01b815260040160405180910390fd5b60408051898152602081018890526001600160a01b038916818301526060810187905290517fddd3b70af631334f7552aadb582ed091018e62e103fa8b150ca66cc700d4dac69181900360800190a161447188868686614a2a565b94506001600160a01b0387163014156144955761448f868685613bb9565b50611cbf565b603c546040516320d661ad60e21b815260048101889052602481018790526001600160401b03600160801b830481166044830152600160c01b90920490911660648201526001600160a01b0388169063835986b490608401600060405180830381600087803b15801561450757600080fd5b505af115801561451b573d6000803e3d6000fd5b505050505050505050505050565b6040516001600160a01b03808516602483015283166044820152606481018290526140109085906323b872dd60e01b906084015b60408051601f198184030181529190526020810180516001600160e01b03166001600160e01b031990931692909217909152614bbd565b610a378363a9059cbb60e01b848460405160240161455d929190615d80565b6001600160a01b0381166000908152607f60205260409020546145d78160016159c3565b6001600160a01b039092166000908152607f602052604090209190915590565b6000806000676765c793fa10079d601b1b848760200151614618919061583e565b6146229190615873565b9150603854858760000151614637919061583e565b6146419190615873565b905081614652576000199250614677565b603c54829061466a906001600160401b03168361583e565b6146749190615873565b92505b93509350939050565b6037546000906001600160a01b03166146b957603b6000815481106146a7576146a7615903565b90600052602060002001549050919050565b603754604051635dfba04560e11b81526000916001600160a01b03169063bbf7408a906146ea908690600401614eb4565b602060405180830381865afa158015614707573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061472b919061580f565b9050603a60018154811061474157614741615903565b9060005260206000200154811061477957603b60018154811061476657614766615903565b9060005260206000200154915050919050565b603a60008154811061478d5761478d615903565b906000526020600020015481116147b257603b60008154811061476657614766615903565b603a6000815481106147c6576147c6615903565b9060005260206000200154603a6001815481106147e5576147e5615903565b90600052602060002001546147fa91906158a4565b603a60008154811061480e5761480e615903565b90600052602060002001548261482491906158a4565b603b60008154811061483857614838615903565b9060005260206000200154603b60018154811061485757614857615903565b906000526020600020015461486c91906158a4565b614876919061583e565b6148809190615873565b603b60008154811061489457614894615903565b9060005260206000200154610b2291906159c3565b50919050565b60006001600160a01b0384163b156149a357604051630a85bd0160e11b81526001600160a01b0385169063150b7a02906148f3903390899088908890600401615e11565b6020604051808303816000875af192505050801561492e575060408051601f3d908101601f1916820190925261492b91810190615df4565b60015b614989573d80801561495c576040519150601f19603f3d011682016040523d82523d6000602084013e614961565b606091505b508051614981576040516320149b4360e21b815260040160405180910390fd5b805181602001fd5b6001600160e01b031916630a85bd0160e11b149050611d03565b506001611d03565b60006149b682613360565b90506149c3600083613396565b6001600160a01b038116600081815260486020908152604080832080546000190190558583526047825280832080546001600160a01b0319169055604390915280822082815560010182905551849290600080516020615eab833981519152908390a45050565b60008082614a43676765c793fa10079d601b1b8761583e565b614a4d9190615873565b600087815260436020526040902060010154909150614a885760b4548511614a885760405163228af07f60e21b815260040160405180910390fd5b60008681526043602052604081206001018054839290614aa99084906159c3565b925050819055508060406000828254614ac291906159c3565b9091555050603954614ae090676765c793fa10079d601b1b9061583e565b83604054614aee919061583e565b1115614b0d576040516371239a6160e11b815260040160405180910390fd5b60008681526043602090815260408083208151808301909252805482526001015491810191909152614b409086866145f7565b50509050633b9aca008111614b6857604051631527804d60e31b815260040160405180910390fd5b600080516020615e6b83398151915287836001604051614b8a939291906159db565b60405180910390a1676765c793fa10079d601b1b614ba8858461583e565b614bb29190615873565b979650505050505050565b6000614c12826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b0316614c8f9092919063ffffffff16565b805190915015610a375780806020019051810190614c309190615887565b610a375760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b60648201526084016115d1565b6060611d03848460008585843b614ce85760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e747261637400000060448201526064016115d1565b600080866001600160a01b03168587604051614d049190615e4e565b60006040518083038185875af1925050503d8060008114614d41576040519150601f19603f3d011682016040523d82523d6000602084013e614d46565b606091505b5091509150614bb282828660608315614d60575081610b22565b825115614d705782518084602001fd5b8160405162461bcd60e51b81526004016115d19190614f53565b6040518060a0016040528060008152602001600081526020016000815260200160008152602001600081525090565b828054614dc5906157da565b90600052602060002090601f016020900481019282614de75760008555614e2d565b82601f10614e0057805160ff1916838001178555614e2d565b82800160010185558215614e2d579182015b82811115614e2d578251825591602001919060010190614e12565b50614e39929150614e9f565b5090565b828054828255906000526020600020908101928215614e2d5791602002820182811115614e2d578251825591602001919060010190614e12565b6040518060800160405280600081526020016000815260200160008152602001600081525090565b5b80821115614e395760008155600101614ea0565b6001600160a01b0391909116815260200190565b6001600160e01b031981168114610c9e57600080fd5b600060208284031215614ef057600080fd5b8135610b2281614ec8565b60005b83811015614f16578181015183820152602001614efe565b838111156140105750506000910152565b60008151808452614f3f816020860160208601614efb565b601f01601f19169290920160200192915050565b602081526000610b226020830184614f27565b600060208284031215614f7857600080fd5b5035919050565b6001600160a01b0381168114610c9e57600080fd5b60008060408385031215614fa757600080fd5b8235614fb281614f7f565b946020939093013593505050565b600080600060608486031215614fd557600080fd5b8335614fe081614f7f565b92506020840135614ff081614f7f565b929592945050506040919091013590565b6000806040838503121561501457600080fd5b82359150602083013561502681614f7f565b809150509250929050565b60a081016108ea828480518252602081015160208301526040810151604083015260608101516060830152608081015160808301525050565b60006020828403121561507c57600080fd5b8135610b2281614f7f565b634e487b7160e01b600052604160045260246000fd5b604051601f8201601f191681016001600160401b03811182821017156150c5576150c5615087565b604052919050565b600082601f8301126150de57600080fd5b81356001600160401b038111156150f7576150f7615087565b61510a601f8201601f191660200161509d565b81815284602083860101111561511f57600080fd5b816020850160208301376000918101602001919091529392505050565b60006020828403121561514e57600080fd5b81356001600160401b0381111561516457600080fd5b611d03848285016150cd565b6000806040838503121561518357600080fd5b50508035926020909101359150565b80356001600160401b0381168114611e1657600080fd5b600080604083850312156151bc57600080fd5b614fb283615192565b60006001600160401b038211156151de576151de615087565b5060051b60200190565b600082601f8301126151f957600080fd5b8135602061520e615209836151c5565b61509d565b82815260059290921b8401810191818101908684111561522d57600080fd5b8286015b848110156152485780358352918301918301615231565b509695505050505050565b60008060006060848603121561526857600080fd5b833561527381614f7f565b925060208401356001600160401b038082111561528f57600080fd5b61529b878388016151e8565b935060408601359150808211156152b157600080fd5b506152be868287016151e8565b9150509250925092565b60008060008060008060c087890312156152e157600080fd5b86356001600160401b03808211156152f857600080fd5b6153048a838b016151e8565b9750602089013591508082111561531a57600080fd5b6153268a838b016151e8565b96506040890135915061533882614f7f565b90945060608801359061534a82614f7f565b90935060808801359061535c82614f7f565b90925060a0880135908082111561537257600080fd5b5061537f89828a016150cd565b9150509295509295509295565b600080600080608085870312156153a257600080fd5b5050823594602084013594506040840135936060013592509050565b600082601f8301126153cf57600080fd5b813560206153df615209836151c5565b82815260059290921b840181019181810190868411156153fe57600080fd5b8286015b848110156152485780356008811061541a5760008081fd5b8352918301918301615402565b600082601f83011261543857600080fd5b81356020615448615209836151c5565b82815260059290921b8401810191818101908684111561546757600080fd5b8286015b848110156152485780356001600160401b0381111561548a5760008081fd5b6154988986838b01016150cd565b84525091830191830161546b565b600080600080608085870312156154bc57600080fd5b84356001600160401b03808211156154d357600080fd5b6154df888389016153be565b955060208701359150808211156154f557600080fd5b5061550287828801615427565b935050604085013561551381614f7f565b9150606085013561552381614f7f565b939692955090935050565b8015158114610c9e57600080fd5b6000806040838503121561554f57600080fd5b823561555a81614f7f565b915060208301356150268161552e565b6000806000806080858703121561558057600080fd5b843561558b81614f7f565b9350602085013561559b81614f7f565b92506040850135915060608501356001600160401b038111156155bd57600080fd5b6155c9878288016150cd565b91505092959194509250565b60008060008060008587036101808112156155ef57600080fd5b86356155fa81614f7f565b9550602087013561560a81614f7f565b9450604087013561561a81614f7f565b9350610100605f198201121561562f57600080fd5b506060860191506101608601356001600160401b0381111561565057600080fd5b61565c888289016150cd565b9150509295509295909350565b60008060008060008060c0878903121561568257600080fd5b86356001600160401b038082111561569957600080fd5b6156a58a838b016153be565b975060208901359150808211156156bb57600080fd5b6153268a838b01615427565b600080604083850312156156da57600080fd5b82356156e581614f7f565b9150602083013561502681614f7f565b60ff81168114610c9e57600080fd5b600080600080600080600060e0888a03121561571f57600080fd5b873561572a81614f7f565b9650602088013561573a81614f7f565b9550604088013561574a8161552e565b9450606088013593506080880135615761816156f5565b9699959850939692959460a0840135945060c09093013592915050565b6000806000806080858703121561579457600080fd5b84356001600160401b03808211156157ab57600080fd5b6157b7888389016151e8565b955060208701359150808211156157cd57600080fd5b50615502878288016151e8565b600181811c908216806157ee57607f821691505b602082108114156148a957634e487b7160e01b600052602260045260246000fd5b60006020828403121561582157600080fd5b5051919050565b634e487b7160e01b600052601160045260246000fd5b600081600019048311821515161561585857615858615828565b500290565b634e487b7160e01b600052601260045260246000fd5b6000826158825761588261585d565b500490565b60006020828403121561589957600080fd5b8151610b228161552e565b6000828210156158b6576158b6615828565b500390565b60006001600160401b038281168482168083038211156158dd576158dd615828565b01949350505050565b6000602082840312156158f857600080fd5b8151610b2281614f7f565b634e487b7160e01b600052603260045260246000fd5b600081518084526020808501945080840160005b838110156159495781518752958201959082019060010161592d565b509495945050505050565b6040815260006159676040830185615919565b82810360208401526120578185615919565b6020808252601f908201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c00604082015260600190565b602081526000610b226020830184615919565b600082198211156159d6576159d6615828565b500190565b928352602083019190915260ff16604082015260600190565b6000600019821415615a0857615a08615828565b5060010190565b600181815b80851115615a4a578160001904821115615a3057615a30615828565b80851615615a3d57918102915b93841c9390800290615a14565b509250929050565b600082615a61575060016108ea565b81615a6e575060006108ea565b8160018114615a845760028114615a8e57615aaa565b60019150506108ea565b60ff841115615a9f57615a9f615828565b50506001821b6108ea565b5060208310610133831016604e8410600b8410161715615acd575081810a6108ea565b615ad78383615a0f565b8060001904821115615aeb57615aeb615828565b029392505050565b6000610b2260ff841683615a52565b600082615b1157615b1161585d565b500690565b60008151615b28818560208601614efb565b9290920192915050565b600080845481600182811c915080831680615b4e57607f831692505b6020808410821415615b6e57634e487b7160e01b86526022600452602486fd5b818015615b825760018114615b9357615bc0565b60ff19861689528489019650615bc0565b60008b81526020902060005b86811015615bb85781548b820152908501908301615b9f565b505084890196505b5050505050506120578185615b16565b600060208284031215615be257600080fd5b8151610b22816156f5565b6e020b733b63290283937ba37b1b7b61608d1b815260008251615c1781600f850160208701614efb565b650815985d5b1d60d21b600f939091019283015250601501919050565b60008251615c46818460208701614efb565b650b5d985d5b1d60d21b920191825250600601919050565b600060208284031215615c7057600080fd5b610b2282615192565b600060208284031215615c8b57600080fd5b8135610b228161552e565b634e487b7160e01b600052602160045260246000fd5b60008060408385031215615cbf57600080fd5b505080516020909101519092909150565b60008060008060008060c08789031215615ce957600080fd5b8651615cf481614f7f565b6020880151604089015160608a015160808b015160a0909b0151939c929b509099909850965090945092505050565b60008060008060808587031215615d3957600080fd5b845193506020850151615d4b81614f7f565b6040860151606090960151949790965092505050565b9283526001600160a01b03918216602084015216604082015260600190565b6001600160a01b03929092168252602082015260400190565b6001600160a01b038781168252868116602083015285166040820152606081018490526080810183905260c060a082018190526000906143e190830184614f27565b828152604060208201526000611d036040830184614f27565b600060208284031215615e0657600080fd5b8151610b2281614ec8565b6001600160a01b0385811682528416602082015260408101839052608060608201819052600090615e4490830184614f27565b9695505050505050565b60008251615e60818460208701614efb565b919091019291505056fe70cf49afe7355562d5b022e594790f22b71ad8cc7eec902fa5feac7c67f71091722cb71fa87c947148cefc06dd890af5802a6a00207c5ddecf1191bf71ce3cd4ddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3efa26469706673582212201f576770aa8b1ac44c345b6c00f8ce99e7e7f0e9e2214692591abbf1a81e680964736f6c634300080c0033" + "solcInputHash": "dc345d3eed7216da5bac40699a727ed4", + "metadata": "{\"compiler\":{\"version\":\"0.8.12+commit.f00d7308\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[],\"name\":\"ApprovalToCaller\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"ApprovalToOwner\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"DebtCeilingExceeded\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"DustyLeftoverAmount\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"ExpiredDeadline\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"HealthyVault\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"IncompatibleLengths\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"InsolventVault\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"InvalidParameterType\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"InvalidParameterValue\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"InvalidSetOfParameters\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"InvalidSignature\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"InvalidTreasury\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"NonERC721Receiver\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"NonexistentVault\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"NotApproved\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"NotGovernor\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"NotGovernorOrGuardian\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"NotTreasury\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"NotVaultManager\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"NotWhitelisted\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"Paused\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"TooHighParameterValue\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"TooSmallParameterValue\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"ZeroAddress\",\"type\":\"error\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"surplusEndValue\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"badDebtEndValue\",\"type\":\"uint256\"}],\"name\":\"AccruedToTreasury\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"owner\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"approved\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"tokenId\",\"type\":\"uint256\"}],\"name\":\"Approval\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"owner\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"operator\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"bool\",\"name\":\"approved\",\"type\":\"bool\"}],\"name\":\"ApprovalForAll\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"vaultID\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"collateralAmount\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint8\",\"name\":\"isIncrease\",\"type\":\"uint8\"}],\"name\":\"CollateralAmountUpdated\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"debtCeiling\",\"type\":\"uint256\"}],\"name\":\"DebtCeilingUpdated\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"srcVaultID\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"dstVaultID\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"dstVaultManager\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"DebtTransferred\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint64\",\"name\":\"param\",\"type\":\"uint64\"},{\"indexed\":false,\"internalType\":\"bytes32\",\"name\":\"what\",\"type\":\"bytes32\"}],\"name\":\"FiledUint64\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint8\",\"name\":\"version\",\"type\":\"uint8\"}],\"name\":\"Initialized\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"value\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"timestamp\",\"type\":\"uint256\"}],\"name\":\"InterestAccumulatorUpdated\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"vaultID\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"internalAmount\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint8\",\"name\":\"isIncrease\",\"type\":\"uint8\"}],\"name\":\"InternalDebtUpdated\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256[]\",\"name\":\"vaultIDs\",\"type\":\"uint256[]\"}],\"name\":\"LiquidatedVaults\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"_veBoostProxy\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256[]\",\"name\":\"xBoost\",\"type\":\"uint256[]\"},{\"indexed\":false,\"internalType\":\"uint256[]\",\"name\":\"yBoost\",\"type\":\"uint256[]\"}],\"name\":\"LiquidationBoostParametersUpdated\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"from\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"to\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"tokenId\",\"type\":\"uint256\"}],\"name\":\"Transfer\",\"type\":\"event\"},{\"inputs\":[],\"name\":\"BASE_INTEREST\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"BASE_PARAMS\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"DOMAIN_SEPARATOR\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"HALF_BASE_INTEREST\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"accrueInterestToTreasury\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"surplusValue\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"badDebtValue\",\"type\":\"uint256\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"enum ActionType[]\",\"name\":\"actions\",\"type\":\"uint8[]\"},{\"internalType\":\"bytes[]\",\"name\":\"datas\",\"type\":\"bytes[]\"},{\"internalType\":\"address\",\"name\":\"from\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"to\",\"type\":\"address\"}],\"name\":\"angle\",\"outputs\":[{\"components\":[{\"internalType\":\"uint256\",\"name\":\"stablecoinAmountToGive\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"stablecoinAmountToReceive\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"collateralAmountToGive\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"collateralAmountToReceive\",\"type\":\"uint256\"}],\"internalType\":\"struct PaymentData\",\"name\":\"\",\"type\":\"tuple\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"enum ActionType[]\",\"name\":\"actions\",\"type\":\"uint8[]\"},{\"internalType\":\"bytes[]\",\"name\":\"datas\",\"type\":\"bytes[]\"},{\"internalType\":\"address\",\"name\":\"from\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"to\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"who\",\"type\":\"address\"},{\"internalType\":\"bytes\",\"name\":\"repayData\",\"type\":\"bytes\"}],\"name\":\"angle\",\"outputs\":[{\"components\":[{\"internalType\":\"uint256\",\"name\":\"stablecoinAmountToGive\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"stablecoinAmountToReceive\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"collateralAmountToGive\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"collateralAmountToReceive\",\"type\":\"uint256\"}],\"internalType\":\"struct PaymentData\",\"name\":\"paymentData\",\"type\":\"tuple\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"to\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"vaultID\",\"type\":\"uint256\"}],\"name\":\"approve\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"badDebt\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"owner\",\"type\":\"address\"}],\"name\":\"balanceOf\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"borrowFee\",\"outputs\":[{\"internalType\":\"uint64\",\"name\":\"\",\"type\":\"uint64\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"vaultID\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"liquidator\",\"type\":\"address\"}],\"name\":\"checkLiquidation\",\"outputs\":[{\"components\":[{\"internalType\":\"uint256\",\"name\":\"maxStablecoinAmountToRepay\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"maxCollateralAmountGiven\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"thresholdRepayAmount\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"discount\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"currentDebt\",\"type\":\"uint256\"}],\"internalType\":\"struct LiquidationOpportunity\",\"name\":\"liqOpp\",\"type\":\"tuple\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"collateral\",\"outputs\":[{\"internalType\":\"contract IERC20\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"collateralFactor\",\"outputs\":[{\"internalType\":\"uint64\",\"name\":\"\",\"type\":\"uint64\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"toVault\",\"type\":\"address\"}],\"name\":\"createVault\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"debtCeiling\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"dust\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"vaultID\",\"type\":\"uint256\"}],\"name\":\"getApproved\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"vaultID\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"stablecoinAmount\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"senderBorrowFee\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"senderRepayFee\",\"type\":\"uint256\"}],\"name\":\"getDebtOut\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"getTotalDebt\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"vaultID\",\"type\":\"uint256\"}],\"name\":\"getVaultDebt\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"contract ITreasury\",\"name\":\"_treasury\",\"type\":\"address\"},{\"internalType\":\"contract IERC20\",\"name\":\"_collateral\",\"type\":\"address\"},{\"internalType\":\"contract IOracle\",\"name\":\"_oracle\",\"type\":\"address\"},{\"components\":[{\"internalType\":\"uint256\",\"name\":\"debtCeiling\",\"type\":\"uint256\"},{\"internalType\":\"uint64\",\"name\":\"collateralFactor\",\"type\":\"uint64\"},{\"internalType\":\"uint64\",\"name\":\"targetHealthFactor\",\"type\":\"uint64\"},{\"internalType\":\"uint64\",\"name\":\"interestRate\",\"type\":\"uint64\"},{\"internalType\":\"uint64\",\"name\":\"liquidationSurcharge\",\"type\":\"uint64\"},{\"internalType\":\"uint64\",\"name\":\"maxLiquidationDiscount\",\"type\":\"uint64\"},{\"internalType\":\"bool\",\"name\":\"whitelistingActivated\",\"type\":\"bool\"},{\"internalType\":\"uint256\",\"name\":\"baseBoost\",\"type\":\"uint256\"}],\"internalType\":\"struct VaultParameters\",\"name\":\"params\",\"type\":\"tuple\"},{\"internalType\":\"string\",\"name\":\"_symbol\",\"type\":\"string\"}],\"name\":\"initialize\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"interestAccumulator\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"interestRate\",\"outputs\":[{\"internalType\":\"uint64\",\"name\":\"\",\"type\":\"uint64\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"owner\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"operator\",\"type\":\"address\"}],\"name\":\"isApprovedForAll\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"spender\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"vaultID\",\"type\":\"uint256\"}],\"name\":\"isApprovedOrOwner\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"name\":\"isWhitelisted\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"lastInterestAccumulatorUpdated\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256[]\",\"name\":\"vaultIDs\",\"type\":\"uint256[]\"},{\"internalType\":\"uint256[]\",\"name\":\"amounts\",\"type\":\"uint256[]\"},{\"internalType\":\"address\",\"name\":\"from\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"to\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"who\",\"type\":\"address\"},{\"internalType\":\"bytes\",\"name\":\"data\",\"type\":\"bytes\"}],\"name\":\"liquidate\",\"outputs\":[{\"components\":[{\"internalType\":\"uint256\",\"name\":\"stablecoinAmountToReceive\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"collateralAmountToGive\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"badDebtFromLiquidation\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"oracleValue\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"newInterestAccumulator\",\"type\":\"uint256\"}],\"internalType\":\"struct LiquidatorData\",\"name\":\"liqData\",\"type\":\"tuple\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256[]\",\"name\":\"vaultIDs\",\"type\":\"uint256[]\"},{\"internalType\":\"uint256[]\",\"name\":\"amounts\",\"type\":\"uint256[]\"},{\"internalType\":\"address\",\"name\":\"from\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"to\",\"type\":\"address\"}],\"name\":\"liquidate\",\"outputs\":[{\"components\":[{\"internalType\":\"uint256\",\"name\":\"stablecoinAmountToReceive\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"collateralAmountToGive\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"badDebtFromLiquidation\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"oracleValue\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"newInterestAccumulator\",\"type\":\"uint256\"}],\"internalType\":\"struct LiquidatorData\",\"name\":\"\",\"type\":\"tuple\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"liquidationSurcharge\",\"outputs\":[{\"internalType\":\"uint64\",\"name\":\"\",\"type\":\"uint64\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"maxLiquidationDiscount\",\"outputs\":[{\"internalType\":\"uint64\",\"name\":\"\",\"type\":\"uint64\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"name\",\"outputs\":[{\"internalType\":\"string\",\"name\":\"\",\"type\":\"string\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"owner\",\"type\":\"address\"}],\"name\":\"nonces\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"oracle\",\"outputs\":[{\"internalType\":\"contract IOracle\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"vaultID\",\"type\":\"uint256\"}],\"name\":\"ownerOf\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"paused\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"owner\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"spender\",\"type\":\"address\"},{\"internalType\":\"bool\",\"name\":\"approved\",\"type\":\"bool\"},{\"internalType\":\"uint256\",\"name\":\"deadline\",\"type\":\"uint256\"},{\"internalType\":\"uint8\",\"name\":\"v\",\"type\":\"uint8\"},{\"internalType\":\"bytes32\",\"name\":\"r\",\"type\":\"bytes32\"},{\"internalType\":\"bytes32\",\"name\":\"s\",\"type\":\"bytes32\"}],\"name\":\"permit\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"repayFee\",\"outputs\":[{\"internalType\":\"uint64\",\"name\":\"\",\"type\":\"uint64\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"from\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"to\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"vaultID\",\"type\":\"uint256\"}],\"name\":\"safeTransferFrom\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"from\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"to\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"vaultID\",\"type\":\"uint256\"},{\"internalType\":\"bytes\",\"name\":\"_data\",\"type\":\"bytes\"}],\"name\":\"safeTransferFrom\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"operator\",\"type\":\"address\"},{\"internalType\":\"bool\",\"name\":\"approved\",\"type\":\"bool\"}],\"name\":\"setApprovalForAll\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"string\",\"name\":\"baseURI_\",\"type\":\"string\"}],\"name\":\"setBaseURI\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_debtCeiling\",\"type\":\"uint256\"}],\"name\":\"setDebtCeiling\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_dust\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"dustCollateral_\",\"type\":\"uint256\"}],\"name\":\"setDusts\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_veBoostProxy\",\"type\":\"address\"},{\"internalType\":\"uint256[]\",\"name\":\"xBoost\",\"type\":\"uint256[]\"},{\"internalType\":\"uint256[]\",\"name\":\"yBoost\",\"type\":\"uint256[]\"}],\"name\":\"setLiquidationBoostParameters\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_oracle\",\"type\":\"address\"}],\"name\":\"setOracle\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_treasury\",\"type\":\"address\"}],\"name\":\"setTreasury\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint64\",\"name\":\"param\",\"type\":\"uint64\"},{\"internalType\":\"bytes32\",\"name\":\"what\",\"type\":\"bytes32\"}],\"name\":\"setUint64\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"stablecoin\",\"outputs\":[{\"internalType\":\"contract IAgToken\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes4\",\"name\":\"interfaceId\",\"type\":\"bytes4\"}],\"name\":\"supportsInterface\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"pure\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"surplus\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"symbol\",\"outputs\":[{\"internalType\":\"string\",\"name\":\"\",\"type\":\"string\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"targetHealthFactor\",\"outputs\":[{\"internalType\":\"uint64\",\"name\":\"\",\"type\":\"uint64\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"togglePause\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"target\",\"type\":\"address\"}],\"name\":\"toggleWhitelist\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"vaultID\",\"type\":\"uint256\"}],\"name\":\"tokenURI\",\"outputs\":[{\"internalType\":\"string\",\"name\":\"\",\"type\":\"string\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"totalNormalizedDebt\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"from\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"to\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"vaultID\",\"type\":\"uint256\"}],\"name\":\"transferFrom\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"treasury\",\"outputs\":[{\"internalType\":\"contract ITreasury\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"name\":\"vaultData\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"collateralAmount\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"normalizedDebt\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"vaultIDCount\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"veBoostProxy\",\"outputs\":[{\"internalType\":\"contract IVeBoostProxy\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"whitelistingActivated\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"name\":\"xLiquidationBoost\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"name\":\"yLiquidationBoost\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"}],\"devdoc\":{\"author\":\"Angle Labs, Inc.\",\"kind\":\"dev\",\"methods\":{\"accrueInterestToTreasury()\":{\"details\":\"`surplus` and `badDebt` should be reset to 0 once their current value have been given to the `treasury` contract\",\"returns\":{\"badDebtValue\":\"Value of the bad debt communicated to the `Treasury`\",\"surplusValue\":\"Value of the surplus communicated to the `Treasury`\"}},\"angle(uint8[],bytes[],address,address,address,bytes)\":{\"details\":\"This function is optimized to reduce gas cost due to payment from or to the user and that expensive calls or computations (like `oracleValue`) are done only onceWhen specifying `vaultID` in `data`, it is important to know that if you specify `vaultID = 0`, it will simply use the latest `vaultID`. This is the default behavior, and unless you're engaging into some complex protocol actions it is encouraged to use `vaultID = 0` only when the first action of the batch is `createVault`\",\"params\":{\"actions\":\"Set of actions to perform\",\"datas\":\"Data to be decoded for each action: it can include like the `vaultID` or the `stablecoinAmount` to borrow\",\"from\":\"Address from which stablecoins will be taken if one action includes burning stablecoins. This address should either be the `msg.sender` or be approved by the latter\",\"repayData\":\"Data to pass to the repayment contract in case of\",\"to\":\"Address to which stablecoins and/or collateral will be sent in case of\",\"who\":\"Address of the contract to handle in case of repayment of stablecoins from received collateral\"},\"returns\":{\"paymentData\":\"Struct containing the accounting changes from the protocol's perspective (like how much of collateral or how much has been received). Note that the values in the struct are not aggregated and you could have in the output a positive amount of stablecoins to receive as well as a positive amount of stablecoins to give\"}},\"approve(address,uint256)\":{\"details\":\"Gives permission to `to` to transfer `tokenId` token to another account. The approval is cleared when the token is transferred. Only a single account can be approved at a time, so approving the zero address clears previous approvals. Requirements: - The caller must own the token or be an approved operator. - `tokenId` must exist. Emits an {Approval} event.\"},\"balanceOf(address)\":{\"details\":\"Returns the number of tokens in ``owner``'s account.\"},\"checkLiquidation(uint256,address)\":{\"details\":\"This function will revert if it's called on a vault that does not exist\",\"params\":{\"liquidator\":\"Address of the liquidator which will be performing the liquidation\",\"vaultID\":\"ID of the vault to check\"},\"returns\":{\"liqOpp\":\"Description of the opportunity of liquidation\"}},\"createVault(address)\":{\"details\":\"This function just creates the vault without doing any collateral or\",\"params\":{\"toVault\":\"Address for which the va\"},\"returns\":{\"_0\":\"vaultID ID of the vault created\"}},\"getApproved(uint256)\":{\"details\":\"Returns the account approved for `tokenId` token. Requirements: - `tokenId` must exist.\"},\"getDebtOut(uint256,uint256,uint256,uint256)\":{\"details\":\"This function can only be called from a vaultManager registered in the same Treasury\",\"params\":{\"amountStablecoins\":\"Amount of stablecoins to remove from the debt: this amount is to be converted to an internal debt amount\",\"senderBorrowFee\":\"Borrowing fees from the contract which requested this: this is to make sure that people are not arbitraging difference in minting fees\",\"senderRepayFee\":\"Repay fees from the contract which requested this: this is to make sure that people are not arbitraging differences in repay fees\",\"vaultID\":\"ID of the vault to remove debt from\"}},\"getTotalDebt()\":{\"returns\":{\"_0\":\"Total debt across all vaults, taking into account the interest accumulated over time\"}},\"getVaultDebt(uint256)\":{\"params\":{\"vaultID\":\"ID of the vault to check\"},\"returns\":{\"_0\":\"Debt of the vault\"}},\"initialize(address,address,address,(uint256,uint64,uint64,uint64,uint64,uint64,bool,uint256),string)\":{\"details\":\"The parameters and the oracle are the only elements which could be modified once the contract has been initializedFor the contract to be fully initialized, governance needs to set the parameters for the liquidation boost\",\"params\":{\"_collateral\":\"Collateral supported by this contract\",\"_oracle\":\"Oracle contract used\",\"_symbol\":\"Symbol used to define the `VaultManager` name and symbol\",\"_treasury\":\"Treasury address handling the contract\"}},\"isApprovedForAll(address,address)\":{\"details\":\"Returns if the `operator` is allowed to manage all of the assets of `owner`. See {setApprovalForAll}\"},\"isApprovedOrOwner(address,uint256)\":{\"params\":{\"spender\":\"Address for which vault ownership should be checked\",\"vaultID\":\"ID of the vault to check\"},\"returns\":{\"_0\":\"Whether the `spender` address owns or is approved for `vaultID`\"}},\"liquidate(uint256[],uint256[],address,address)\":{\"details\":\"This function is a simplified wrapper of the function below. It is built to remove for liquidators the need to specify a `who` and a `data` parameter\"},\"liquidate(uint256[],uint256[],address,address,address,bytes)\":{\"details\":\"This function will revert if it's called on a vault that cannot be liquidated or that does not exist\",\"params\":{\"amounts\":\"Amount of stablecoin to bring for the liquidation of each vault\",\"data\":\"Data to pass to the repayment contract in case of. If empty, liquidators simply have to bring the exact amount of stablecoins to get the discounted collateral. If not, it is used by the repayment contract to swap a portion or all of the collateral received to stablecoins to be sent to the `from` address. More details in the `_handleRepay` function\",\"from\":\"Address from which the stablecoins for the liquidation should be taken: this address should be the `msg.sender` or have received an approval\",\"to\":\"Address to which discounted collateral should be sent\",\"vaultIDs\":\"List of the vaults to liquidate\",\"who\":\"Address of the contract to handle repayment of stablecoins from received collateral\"},\"returns\":{\"liqData\":\"Data about the liquidation process for the liquidator to track everything that has been going on (like how much stablecoins have been repaid, how much collateral has been received)\"}},\"ownerOf(uint256)\":{\"details\":\"Returns the owner of the `tokenId` token. Requirements: - `tokenId` must exist.\"},\"permit(address,address,bool,uint256,uint8,bytes32,bytes32)\":{\"details\":\"The `v`, `r`, and `s` parameters are used as signature data\",\"params\":{\"approved\":\"Whether to give or revoke the approval\",\"deadline\":\"Deadline parameter for the signature to be valid\",\"owner\":\"Address signing the permit and giving (or revoking) its approval for all the controlled vaults\",\"spender\":\"Address to give approval to\"}},\"safeTransferFrom(address,address,uint256)\":{\"details\":\"Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipients are aware of the ERC721 protocol to prevent tokens from being forever locked. Requirements: - `from` cannot be the zero address. - `to` cannot be the zero address. - `tokenId` token must exist and be owned by `from`. - If the caller is not `from`, it must have been allowed to move this token by either {approve} or {setApprovalForAll}. - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer. Emits a {Transfer} event.\"},\"safeTransferFrom(address,address,uint256,bytes)\":{\"details\":\"Safely transfers `tokenId` token from `from` to `to`. Requirements: - `from` cannot be the zero address. - `to` cannot be the zero address. - `tokenId` token must exist and be owned by `from`. - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}. - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer. Emits a {Transfer} event.\"},\"setApprovalForAll(address,bool)\":{\"details\":\"Approve or remove `operator` as an operator for the caller. Operators can call {transferFrom} or {safeTransferFrom} for any token owned by the caller. Requirements: - The `operator` cannot be the caller. Emits an {ApprovalForAll} event.\"},\"setDebtCeiling(uint256)\":{\"details\":\"`debtCeiling` should not be bigger than `type(uint256).max / 10**27` otherwise there could be overflows\",\"params\":{\"_debtCeiling\":\"New value for `debtCeiling`\"}},\"setDusts(uint256,uint256)\":{\"details\":\"dustCollateral_ is in stable value\",\"params\":{\"_dust\":\"New minimum debt allowed\",\"dustCollateral_\":\"New minimum collateral allowed in a vault after a liquidation\"}},\"setLiquidationBoostParameters(address,uint256[],uint256[])\":{\"details\":\"There are 2 modes: When boost is enabled, `xBoost` and `yBoost` should have a length of 2, but if they have a higher length contract will still work as expected. Contract will also work as expected if their length differ When boost is disabled, `_veBoostProxy` needs to be zero address and `yBoost[0]` is the base boost\",\"params\":{\"_veBoostProxy\":\"Address which queries veANGLE balances and adjusted balances from delegation\",\"xBoost\":\"Threshold values of veANGLE adjusted balances\",\"yBoost\":\"Values of the liquidation boost at the threshold values of x\"}},\"setOracle(address)\":{\"params\":{\"_oracle\":\"Reference to the oracle contract\"}},\"setTreasury(address)\":{\"details\":\"All required checks when setting up a treasury contract are performed in the contract calling this function\",\"params\":{\"_treasury\":\"New treasury contract\"}},\"setUint64(uint64,bytes32)\":{\"details\":\"This function performs the required checks when updating a parameterWhen setting parameters governance or the guardian should make sure that when `HF < CF/((1-surcharge)(1-discount))` and hence when liquidating a vault is going to decrease its health factor, `discount = max discount`. Otherwise, it may be profitable for the liquidator to liquidate in multiple times: as it will decrease the HF and therefore increase the discount between each time\",\"params\":{\"param\":\"Value for the parameter\",\"what\":\"Parameter to change\"}},\"supportsInterface(bytes4)\":{\"details\":\"Returns true if this contract implements the interface defined by `interfaceId`. See the corresponding https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section] to learn more about how these ids are created. This function call must use less than 30 000 gas.\"},\"toggleWhitelist(address)\":{\"details\":\"If the `target` address is the zero address then this function toggles whitelisting for all addresses\",\"params\":{\"target\":\"Address to toggle\"}},\"tokenURI(uint256)\":{\"details\":\"Returns the Uniform Resource Identifier (URI) for `tokenId` token.\"},\"transferFrom(address,address,uint256)\":{\"details\":\"Transfers `tokenId` token from `from` to `to`. WARNING: Usage of this method is discouraged, use {safeTransferFrom} whenever possible. Requirements: - `from` cannot be the zero address. - `to` cannot be the zero address. - `tokenId` token must be owned by `from`. - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}. Emits a {Transfer} event.\"}},\"title\":\"VaultManagerLiquidationBoost\",\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{\"BASE_INTEREST()\":{\"notice\":\"Base used for interest rate computation\"},\"BASE_PARAMS()\":{\"notice\":\"Base used for parameter computation: almost all the parameters of this contract are set in `BASE_PARAMS`\"},\"DOMAIN_SEPARATOR()\":{\"notice\":\"Returns the domain separator for the current chain.\"},\"HALF_BASE_INTEREST()\":{\"notice\":\"Used for interest rate computation\"},\"accrueInterestToTreasury()\":{\"notice\":\"Accrues interest accumulated across all vaults to the surplus and sends the surplus to the treasury\"},\"angle(uint8[],bytes[],address,address)\":{\"notice\":\"This function is a wrapper built on top of the function above. It enables users to interact with the contract without having to provide `who` and `repayData` parameters\"},\"angle(uint8[],bytes[],address,address,address,bytes)\":{\"notice\":\"Allows composability between calls to the different entry points of this module. Any user calling this function can perform any of the allowed actions in the order of their choice\"},\"badDebt()\":{\"notice\":\"Bad debt made from liquidated vaults which ended up having no collateral and a positive amount of stablecoins\"},\"borrowFee()\":{\"notice\":\"Upfront fee taken when borrowing stablecoins: this fee is optional and should in practice not be used\"},\"checkLiquidation(uint256,address)\":{\"notice\":\"Checks whether a given vault is liquidable and if yes gives information regarding its liquidation\"},\"collateral()\":{\"notice\":\"Reference to the collateral handled by this `VaultManager`\"},\"collateralFactor()\":{\"notice\":\"Encodes the maximum ratio stablecoin/collateral a vault can have before being liquidated. It's what determines the minimum collateral ratio of a position\"},\"createVault(address)\":{\"notice\":\"Creates a vault\"},\"debtCeiling()\":{\"notice\":\"Maximum amount of stablecoins that can be issued with this contract (in `BASE_TOKENS`). This parameter should not be bigger than `type(uint256).max / BASE_INTEREST` otherwise there may be some overflows in the `increaseDebt` function\"},\"dust()\":{\"notice\":\"Minimum amount of debt a vault can have, expressed in `BASE_TOKENS` that is to say the base of the agTokens\"},\"getDebtOut(uint256,uint256,uint256,uint256)\":{\"notice\":\"Removes debt from a vault after being requested to do so by another `VaultManager` contract\"},\"getTotalDebt()\":{\"notice\":\"Gets the total debt across all vaults\"},\"getVaultDebt(uint256)\":{\"notice\":\"Gets the current debt of a vault\"},\"initialize(address,address,address,(uint256,uint64,uint64,uint64,uint64,uint64,bool,uint256),string)\":{\"notice\":\"Initializes the `VaultManager` contract\"},\"interestAccumulator()\":{\"notice\":\"The `interestAccumulator` variable keeps track of the interest that should accrue to the protocol. The stored value is not necessarily the true value: this one is recomputed every time an action takes place within the protocol. It is in base `BASE_INTEREST`\"},\"interestRate()\":{\"notice\":\"Per second interest taken to borrowers taking agToken loans. Contrarily to other parameters, it is set in `BASE_INTEREST` that is to say in base 10**27\"},\"isApprovedOrOwner(address,uint256)\":{\"notice\":\"Checks whether a given address is approved for a vault or owns this vault\"},\"isWhitelisted(address)\":{\"notice\":\"Maps an address to 1 if it's whitelisted and can open or own a vault\"},\"lastInterestAccumulatorUpdated()\":{\"notice\":\"Timestamp at which the `interestAccumulator` was updated\"},\"liquidate(uint256[],uint256[],address,address)\":{\"notice\":\"Liquidates an ensemble of vaults specified by their IDs\"},\"liquidate(uint256[],uint256[],address,address,address,bytes)\":{\"notice\":\"Liquidates an ensemble of vaults specified by their IDs\"},\"liquidationSurcharge()\":{\"notice\":\"Fee taken by the protocol during a liquidation. Technically, this value is not the fee per se, it's 1 - fee. For instance for a 2% fee, `liquidationSurcharge` should be 98%\"},\"maxLiquidationDiscount()\":{\"notice\":\"Maximum discount given to liquidators\"},\"nonces(address)\":{\"notice\":\"Returns the current nonce for an `owner` address\"},\"oracle()\":{\"notice\":\"Oracle contract to get access to the price of the collateral with respect to the stablecoin\"},\"paused()\":{\"notice\":\"Whether the contract is paused or not\"},\"permit(address,address,bool,uint256,uint8,bytes32,bytes32)\":{\"notice\":\"Allows an address to give or revoke approval for all its vaults to another address\"},\"repayFee()\":{\"notice\":\"Upfront fee taken when repaying stablecoins: this fee is optional as well. It should be smaller than the liquidation surcharge (cf below) to avoid exploits where people voluntarily get liquidated at a 0 discount to pay smaller repaying fees\"},\"setBaseURI(string)\":{\"notice\":\"Changes the ERC721 metadata URI\"},\"setDebtCeiling(uint256)\":{\"notice\":\"Sets `debtCeiling`\"},\"setDusts(uint256,uint256)\":{\"notice\":\"Sets the dust variables\"},\"setLiquidationBoostParameters(address,uint256[],uint256[])\":{\"notice\":\"Sets the parameters for the liquidation booster which encodes the slope of the discount\"},\"setOracle(address)\":{\"notice\":\"Changes the reference to the oracle contract used to get the price of the oracle\"},\"setTreasury(address)\":{\"notice\":\"Sets the treasury contract\"},\"setUint64(uint64,bytes32)\":{\"notice\":\"Sets parameters encoded as uint64\"},\"stablecoin()\":{\"notice\":\"Stablecoin handled by this contract. Another `VaultManager` contract could have the same rights as this `VaultManager` on the stablecoin contract\"},\"surplus()\":{\"notice\":\"Surplus accumulated by the contract: surplus is always in stablecoins, and is then reset when the value is communicated to the treasury contract\"},\"targetHealthFactor()\":{\"notice\":\"Maximum Health factor at which a vault can end up after a liquidation (unless it's fully liquidated)\"},\"togglePause()\":{\"notice\":\"Pauses external permissionless functions of the contract\"},\"toggleWhitelist(address)\":{\"notice\":\"Changes the whitelisting of an address\"},\"totalNormalizedDebt()\":{\"notice\":\"Total normalized amount of stablecoins borrowed, not taking into account the potential bad debt accumulated This value is expressed in the base of Angle stablecoins (`BASE_TOKENS = 10**18`)\"},\"treasury()\":{\"notice\":\"Reference to the `treasury` contract handling this `VaultManager`\"},\"vaultData(uint256)\":{\"notice\":\"Maps a `vaultID` to its data (namely collateral amount and normalized debt)\"},\"vaultIDCount()\":{\"notice\":\"ID of the last vault created. The `vaultIDCount` variables serves as a counter to generate a unique `vaultID` for each vault: it is like `tokenID` in basic ERC721 contracts\"},\"veBoostProxy()\":{\"notice\":\"Reference to the contract which computes adjusted veANGLE balances for liquidators boosts\"},\"whitelistingActivated()\":{\"notice\":\"Whether whitelisting is required to own a vault or not\"},\"xLiquidationBoost(uint256)\":{\"notice\":\"Threshold veANGLE balance values for the computation of the boost for liquidators: the length of this array should normally be 2. The base of the x-values in this array should be `BASE_TOKENS`\"},\"yLiquidationBoost(uint256)\":{\"notice\":\"Values of the liquidation boost at the threshold values of x\"}},\"notice\":\"Liquidation discount depending also on the liquidator veANGLE balance\",\"version\":1}},\"settings\":{\"compilationTarget\":{\"contracts/vaultManager/VaultManagerLiquidationBoost.sol\":\"VaultManagerLiquidationBoost\"},\"evmVersion\":\"london\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\"},\"optimizer\":{\"enabled\":true,\"runs\":1},\"remappings\":[]},\"sources\":{\"@openzeppelin/contracts-upgradeable/interfaces/IERC721MetadataUpgradeable.sol\":{\"keccak256\":\"0xc0e1ac396ac591a4c38ddcdd220321128eb94424d73e41a573cf58d5c643af38\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://2bd729caa85e0c3740b2d3a28a91fac0fd1ef66e0907145005a37f1927ae7a22\",\"dweb:/ipfs/QmcfVoLnE2PZj3U6KbACk6ykqE5WXuAM3hsXLJxC2sxZGt\"]},\"@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol\":{\"keccak256\":\"0x0203dcadc5737d9ef2c211d6fa15d18ebc3b30dfa51903b64870b01a062b0b4e\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://6eb2fd1e9894dbe778f4b8131adecebe570689e63cf892f4e21257bfe1252497\",\"dweb:/ipfs/QmXgUGNfZvrn6N2miv3nooSs7Jm34A41qz94fu2GtDFcx8\"]},\"@openzeppelin/contracts-upgradeable/security/ReentrancyGuardUpgradeable.sol\":{\"keccak256\":\"0x8cc03c5ac17e8a7396e487cda41fc1f1dfdb91db7d528e6da84bee3b6dd7e167\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://607818f1b44548c2d8268176f73cdb290e1faed971b1061930d92698366e2a11\",\"dweb:/ipfs/QmQibMe3r5no95b6q7isGT5R75V8xSofWEDLXzp95b7LgZ\"]},\"@openzeppelin/contracts-upgradeable/token/ERC20/IERC20Upgradeable.sol\":{\"keccak256\":\"0x4e733d3164f73f461eaf9d8087a7ad1ea180bdc8ba0d3d61b0e1ae16d8e63dff\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://75b47c3aeca7b66ea6752f8be020ec5c1c502de6ec9065272dae23d3a52196e2\",\"dweb:/ipfs/QmUebPMHv16tYKFh5BmBQkMfRFb5b8UZ2RgVwdjxCeufVF\"]},\"@openzeppelin/contracts-upgradeable/token/ERC20/extensions/draft-IERC20PermitUpgradeable.sol\":{\"keccak256\":\"0xcc70d8e2281fb3ff69e8ab242500f10142cd0a7fa8dd9e45882be270d4d09024\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://17a4063bc918df0f7bb9cbf04c6f0bb4977afab3f2fc212bc138a178312a221d\",\"dweb:/ipfs/QmZMdvsHP5mDEAAdrK4bNeNh47TfmSFgN9qEBFTbie7zmm\"]},\"@openzeppelin/contracts-upgradeable/token/ERC721/IERC721ReceiverUpgradeable.sol\":{\"keccak256\":\"0xbb2ed8106d94aeae6858e2551a1e7174df73994b77b13ebd120ccaaef80155f5\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://8bc3c6a456dba727d8dd9fd33420febede490abb49a07469f61d2a3ace66a95a\",\"dweb:/ipfs/QmVAWtEVj7K5AbvgJa9Dz22KiDq9eoptCjnVZqsTMtKXyd\"]},\"@openzeppelin/contracts-upgradeable/token/ERC721/IERC721Upgradeable.sol\":{\"keccak256\":\"0x016298e66a5810253c6c905e61966bb31c8775c3f3517bf946ff56ee31d6c005\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://1723de5ae414f210db039b19e6487c19c2d643483c9be7c445cf481a80c199d2\",\"dweb:/ipfs/QmcBLbmPdZsNngYhA1KDadNUqQZoGACytFWuUH74RC4AXC\"]},\"@openzeppelin/contracts-upgradeable/token/ERC721/extensions/IERC721MetadataUpgradeable.sol\":{\"keccak256\":\"0x95a471796eb5f030fdc438660bebec121ad5d063763e64d92376ffb4b5ce8b70\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://4ffbd627e6958983d288801acdedbf3491ee0ebf1a430338bce47c96481ce9e3\",\"dweb:/ipfs/QmUM1vpmNgBV34sYf946SthDJNGhwwqjoRggmj4TUUQmdB\"]},\"@openzeppelin/contracts-upgradeable/utils/AddressUpgradeable.sol\":{\"keccak256\":\"0x611aa3f23e59cfdd1863c536776407b3e33d695152a266fa7cfb34440a29a8a3\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://9b4b2110b7f2b3eb32951bc08046fa90feccffa594e1176cb91cdfb0e94726b4\",\"dweb:/ipfs/QmSxLwYjicf9zWFuieRc8WQwE4FisA1Um5jp1iSa731TGt\"]},\"@openzeppelin/contracts-upgradeable/utils/introspection/IERC165Upgradeable.sol\":{\"keccak256\":\"0xc6cef87559d0aeffdf0a99803de655938a7779ec0a3cd5d4383483ad85565a09\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://92ad7e572cf44e6b4b37631b44b62f9eb9fb1cf14d9ce51c1504d5dc7ccaf758\",\"dweb:/ipfs/QmcnbqX85tsWnUXPmtuPLE4SczME2sJaTfmqEFkuAJvWhy\"]},\"@openzeppelin/contracts/interfaces/IERC721Metadata.sol\":{\"keccak256\":\"0x1e88abdf82fcbbf98f97be17ea56c924376350637896bc37366ec9f89b7c2628\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://c8eb8afc411b87c9718cfe5c68669d5210d7012a96890c520c0fc321f74f0992\",\"dweb:/ipfs/Qmcr74gEtRpWER5qjFN86AKUep66pGuzp9WDYueaNtt97n\"]},\"@openzeppelin/contracts/token/ERC20/IERC20.sol\":{\"keccak256\":\"0x9750c6b834f7b43000631af5cc30001c5f547b3ceb3635488f140f60e897ea6b\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://5a7d5b1ef5d8d5889ad2ed89d8619c09383b80b72ab226e0fe7bde1636481e34\",\"dweb:/ipfs/QmebXWgtEfumQGBdVeM6c71McLixYXQP5Bk6kKXuoY4Bmr\"]},\"@openzeppelin/contracts/token/ERC20/extensions/IERC20Metadata.sol\":{\"keccak256\":\"0x8de418a5503946cabe331f35fe242d3201a73f67f77aaeb7110acb1f30423aca\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://5a376d3dda2cb70536c0a45c208b29b34ac560c4cb4f513a42079f96ba47d2dd\",\"dweb:/ipfs/QmZQg6gn1sUpM8wHzwNvSnihumUCAhxD119MpXeKp8B9s8\"]},\"@openzeppelin/contracts/token/ERC20/extensions/draft-IERC20Permit.sol\":{\"keccak256\":\"0xf41ca991f30855bf80ffd11e9347856a517b977f0a6c2d52e6421a99b7840329\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://b2717fd2bdac99daa960a6de500754ea1b932093c946388c381da48658234b95\",\"dweb:/ipfs/QmP6QVMn6UeA3ByahyJbYQr5M6coHKBKsf3ySZSfbyA8R7\"]},\"@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol\":{\"keccak256\":\"0x032807210d1d7d218963d7355d62e021a84bf1b3339f4f50be2f63b53cccaf29\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://11756f42121f6541a35a8339ea899ee7514cfaa2e6d740625fcc844419296aa6\",\"dweb:/ipfs/QmekMuk6BY4DAjzeXr4MSbKdgoqqsZnA8JPtuyWc6CwXHf\"]},\"@openzeppelin/contracts/token/ERC721/IERC721.sol\":{\"keccak256\":\"0xed6a749c5373af398105ce6ee3ac4763aa450ea7285d268c85d9eeca809cdb1f\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://20a97f891d06f0fe91560ea1a142aaa26fdd22bed1b51606b7d48f670deeb50f\",\"dweb:/ipfs/QmTbCtZKChpaX5H2iRiTDMcSz29GSLCpTCDgJpcMR4wg8x\"]},\"@openzeppelin/contracts/token/ERC721/extensions/IERC721Metadata.sol\":{\"keccak256\":\"0x75b829ff2f26c14355d1cba20e16fe7b29ca58eb5fef665ede48bc0f9c6c74b9\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://a0a107160525724f9e1bbbab031defc2f298296dd9e331f16a6f7130cec32146\",\"dweb:/ipfs/QmemujxSd7gX8A9M8UwmNbz4Ms3U9FG9QfudUgxwvTmPWf\"]},\"@openzeppelin/contracts/utils/Address.sol\":{\"keccak256\":\"0xd6153ce99bcdcce22b124f755e72553295be6abcd63804cfdffceb188b8bef10\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://35c47bece3c03caaa07fab37dd2bb3413bfbca20db7bd9895024390e0a469487\",\"dweb:/ipfs/QmPGWT2x3QHcKxqe6gRmAkdakhbaRgx3DLzcakHz5M4eXG\"]},\"@openzeppelin/contracts/utils/introspection/IERC165.sol\":{\"keccak256\":\"0x447a5f3ddc18419d41ff92b3773fb86471b1db25773e07f877f548918a185bf1\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://be161e54f24e5c6fae81a12db1a8ae87bc5ae1b0ddc805d82a1440a68455088f\",\"dweb:/ipfs/QmP7C3CHdY9urF4dEMb9wmsp1wMxHF6nhA2yQE5SKiPAdy\"]},\"contracts/interfaces/IAgToken.sol\":{\"keccak256\":\"0x6dd62e6c5de3b2e6e7d08694c7b97bd7bdaa7dd53be12a7c2d8c279398b78d39\",\"license\":\"GPL-3.0\",\"urls\":[\"bzz-raw://6ea7608c4787711ccd11c0fc67c1c4997936d818ee59695624cd53493c2b703e\",\"dweb:/ipfs/QmRrhdCX6PXXMsBbJHE9GQ9kY1JHwZztttDoUHUsFW7tgE\"]},\"contracts/interfaces/ICoreBorrow.sol\":{\"keccak256\":\"0x10249210cbf522775f040baf981d7d037472168ce2746d87473ac7c29a34e62e\",\"license\":\"GPL-3.0\",\"urls\":[\"bzz-raw://5662508bcc221233db54b5b311c4e371bd8616b3c5c3572ae207c04060758b67\",\"dweb:/ipfs/QmZCQVyMFbWkBZJnwwB3vxLZkvSXGxEg3Hu1UFJQfpV9fi\"]},\"contracts/interfaces/IFlashAngle.sol\":{\"keccak256\":\"0x39b0097f695b9e934bccdc72676c91513f1077cc5d0fd151908fd25a7c5cfbe4\",\"license\":\"GPL-3.0\",\"urls\":[\"bzz-raw://5b0f3c3581f390b0242d8252a4a215dd04b4c5b74e1efb7396bbba72c3922a02\",\"dweb:/ipfs/Qmc7BxyifSkpKtneN2gMsKkworGPDwVfBdT2t66iGMDerm\"]},\"contracts/interfaces/IOracle.sol\":{\"keccak256\":\"0x94f9c32fbf4f360175d595122686d494a107e9dcbcb8b0b8850edd976204c387\",\"license\":\"GPL-3.0\",\"urls\":[\"bzz-raw://0a77c7a25e729bbf2d0c61f66680b6c9cdb29481fd876268e92aca52ac698fe4\",\"dweb:/ipfs/QmUcraMPnHBgokvPaXuyuVjsKmDJVEwVMfeqXqrMAEwwYp\"]},\"contracts/interfaces/ISwapper.sol\":{\"keccak256\":\"0x2c18883cbff92d1e558e670480f5e2f517bce8c95c202cc3f6602ac276222609\",\"license\":\"GPL-3.0\",\"urls\":[\"bzz-raw://948ebdaf95b08d6617f490aa0651a90d8cc3ef3d4c0b9edc3a50e4fe6df73013\",\"dweb:/ipfs/QmejFnT3zzN2StAUnVDHS62iFxZ4e5ZQBTQ3kghDPXRR9g\"]},\"contracts/interfaces/ITreasury.sol\":{\"keccak256\":\"0x624733dae1bfb98721ba994573aed10997f7448c893b791ed985300531c361fd\",\"license\":\"GPL-3.0\",\"urls\":[\"bzz-raw://8ef7cfe9121192bc39d0906c1585c288f1302237fdf8c0a1575395233d25b90a\",\"dweb:/ipfs/QmWCUt4VTope9mFQd1opjom4CnGpdV4yiG3AQpNkeAgsRp\"]},\"contracts/interfaces/IVaultManager.sol\":{\"keccak256\":\"0x9d2dca11dba2fa9d646ccf88b3c0929d7601de925f1a6270f9ef2bef9390e6e4\",\"license\":\"GPL-3.0\",\"urls\":[\"bzz-raw://8b4991cb79afa8a717f66e4d9ef0c92a619574706affd2462c2b48937ca3585e\",\"dweb:/ipfs/QmWAxyT7jJkuQeFdvQmLVjZbBpEHhZbtfyhijXaqHEdumW\"]},\"contracts/interfaces/external/IERC1271.sol\":{\"keccak256\":\"0x6887d50d488064e481dfba3a9c54c049430b1ffc0a5536387fa89ff5133e6479\",\"license\":\"GPL-2.0-or-later\",\"urls\":[\"bzz-raw://0b080810d65481a97abbb7306b31ed944cd01dd19cb27a7a8e779f81bd9b6d11\",\"dweb:/ipfs/QmZUoJgs3JxAeki6CkbFD8uxBypipefhMS8uuVkQcxnsug\"]},\"contracts/interfaces/governance/IVeBoostProxy.sol\":{\"keccak256\":\"0xce73b8dcafcfaba4d01216f02f49930c078617e11223290004c6f662fc900d6b\",\"license\":\"GPL-3.0\",\"urls\":[\"bzz-raw://eb1eec1ea1c000dc07fa89e4f5f8e7009c1777a03960d7e02dcf3fa6f1630333\",\"dweb:/ipfs/QmbMqqz6nBHQmY57EqfhQA5Ep8WVnQSjaejW79XWtowHzv\"]},\"contracts/vaultManager/VaultManager.sol\":{\"keccak256\":\"0x18cbfb818323a0e40f52aaefc1b940d4e11068f7dd5ceee9a5dc93f2efd9070b\",\"license\":\"GPL-3.0\",\"urls\":[\"bzz-raw://d9b13e669a257ef484528dcc7b0a55fb8885ceb8d3b5d70daa351ab14e01c9c2\",\"dweb:/ipfs/QmNe92AaSvMpYFp9ZwBYBmQAU3wKXYEXD38Xxex1pyevKK\"]},\"contracts/vaultManager/VaultManagerERC721.sol\":{\"keccak256\":\"0x9bb1a6093dc753bd8341e8257a895e764d2e02fccdb8a8b2da44f5268857611a\",\"license\":\"GPL-3.0\",\"urls\":[\"bzz-raw://cd915bd744a2aec9a5da0deec58b4ecec6033cb21aee3e21608e09b57a8ec54c\",\"dweb:/ipfs/QmNtfQsXo5YAz5igsKqHno3bKuk8vVUejK7gEEL9hx8MtF\"]},\"contracts/vaultManager/VaultManagerLiquidationBoost.sol\":{\"keccak256\":\"0xbe2a172d8bd96149ac6bd0113644d59337a40c99b8e9eff0a6393efc3ae8de81\",\"license\":\"GPL-3.0\",\"urls\":[\"bzz-raw://e114f045f071084f504b96d28796d391867346a95cf9004b3f47e10ce906bee1\",\"dweb:/ipfs/QmXSW6XnDTpCredi8KEjwNgntPL6kRPb1mMX5YF9QgHiXQ\"]},\"contracts/vaultManager/VaultManagerPermit.sol\":{\"keccak256\":\"0x1303785eb96597effcbf7d7969be0c5c40c0c7d5a5c6b5b2f7eb20325f07e61f\",\"license\":\"GPL-3.0\",\"urls\":[\"bzz-raw://e9c853c15dc80a49de107cb02788b55006a0797f4ac6c003ea7db2dc62b80ea5\",\"dweb:/ipfs/QmT1XyC5L8u95fYti9DnGTXsyWCQLBcvqGoEKmDazf8pog\"]},\"contracts/vaultManager/VaultManagerStorage.sol\":{\"keccak256\":\"0x612208b1e1f538968d270671f67d1e0e54183872d8a18ddb0f4d0ab3985e8bf3\",\"license\":\"GPL-3.0\",\"urls\":[\"bzz-raw://e78aaffe7506abe8ea1f1568e0f19091703bdd1a264ae59496415a4f53e76dcb\",\"dweb:/ipfs/QmSgEJaWmsRMwxuwviZuKM4s4BLCBfYAtHN6ak2PuAJLPc\"]}},\"version\":1}", + "bytecode": "0x60806040523480156200001157600080fd5b50600054610100900460ff1615808015620000335750600054600160ff909116105b8062000063575062000050306200013d60201b620033591760201c565b15801562000063575060005460ff166001145b620000cb5760405162461bcd60e51b815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201526d191e481a5b9a5d1a585b1a5e995960921b606482015260840160405180910390fd5b6000805460ff191660011790558015620000ef576000805461ff0019166101001790555b801562000136576000805461ff0019169055604051600181527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989060200160405180910390a15b506200014c565b6001600160a01b03163b151590565b615f2c806200015c6000396000f3fe608060405234801561001057600080fd5b50600436106102f65760003560e01c8063010db195146102fb57806301ffc9a71461032457806306fdde0314610347578063081812fc1461035c578063087a60071461036f578063095ea7b3146103865780630e198f221461039b57806313888565146103a457806323b872dd146103ad578063254cf439146103c0578063307439af146103f257806334ce998a1461041257806335836f151461041a5780633644e5151461042d57806339393ac91461043557806339eb4dc6146104485780633ae2325f1461045c5780633af32abf1461046f5780633c2e941b1461048f57806342842e0e14610498578063430c2081146104ab5780634f7e43df146104be57806355f804b3146104d85780635b84d88a146104eb5780635c975abb146104fe57806361d027b3146105125780636352211e1461052557806370a0823114610538578063741075431461054b5780637aacfffa1461055e5780637adbf9731461059a5780637c0f59f4146105ad5780637c3a00fd146105c75780637dc0d1d0146105da5780637e53bd97146105ed5780637e56d47c146106005780637ecebe0014610613578063835986b41461063c57806389050f1d1461064f57806395d89b41146106615780639a3b6f2f146106695780639f48118f146106af578063a22cb465146106ba578063af2c8c2e146106cd578063b1511cc9146106d6578063b4bd6f46146106e9578063b88d4fde146106fc578063bbcac5571461070f578063c4ae316814610718578063c66d8b0114610720578063c87b56dd1461073a578063d8dfeb451461074d578063d9b1cb5b14610760578063de1f776514610773578063de8fc69814610785578063df011c4114610798578063e182b883146107ab578063e1c84ea4146107be578063e626648a146107c7578063e985e9c5146107e1578063e9cbd822146107f4578063f0f4426014610807578063f51cc7dd1461081a578063fad9aba31461082d578063fc29b02114610836578063fd527cf814610849575b600080fd5b60375461030e906001600160a01b031681565b60405161031b9190614ee0565b60405180910390f35b610337610332366004614f0a565b610851565b604051901515815260200161031b565b61034f6108be565b60405161031b9190614f7f565b61030e61036a366004614f92565b61094c565b610378603f5481565b60405190815260200161031b565b610399610394366004614fc0565b61097d565b005b610378603e5481565b61037860415481565b6103996103bb366004614fec565b610a0a565b603c546103da90600160401b90046001600160401b031681565b6040516001600160401b03909116815260200161031b565b61040561040036600461502d565b610a45565b60405161031b919061505d565b610378610af7565b610378610428366004614f92565b610b29565b610378610b65565b610399610443366004615096565b610b6f565b603d5461033790600160c01b900460ff1681565b61037861046a366004614f92565b610c6f565b61037861047d366004615096565b60446020526000908152604090205481565b61037860455481565b6103996104a6366004614fec565b610c90565b6103376104b9366004614fc0565b610cab565b603d546103da90600160801b90046001600160401b031681565b6103996104e6366004615168565b610cb7565b6103996104f936600461519c565b610d5c565b603d5461033790600160c81b900460ff1681565b60335461030e906001600160a01b031681565b61030e610533366004614f92565b610df5565b610378610546366004615096565b610e00565b6103996105593660046151d5565b610e45565b61058561056c366004614f92565b6043602052600090815260409020805460019091015482565b6040805192835260208301919091520161031b565b6103996105a8366004615096565b611211565b603c546103da90600160c01b90046001600160401b031681565b603d546103da906001600160401b031681565b60365461030e906001600160a01b031681565b6103996105fb36600461527f565b611358565b61040561060e3660046152f4565b611549565b610378610621366004615096565b6001600160a01b03166000908152607f602052604090205490565b61039961064a3660046153b8565b611af6565b610378676765c793fa10079d601a1b81565b61034f611cae565b61067c6106773660046154d2565b611cbb565b60405161031b91908151815260208083015190820152604080830151908201526060918201519181019190915260800190565b610378633b9aca0081565b6103996106c8366004615568565b611cf0565b61037860405481565b6103996106e4366004614f92565b611cfb565b6103786106f7366004615096565b611dc4565b61039961070a366004615596565b611e00565b61037860425481565b610399611e3d565b603d546103da90600160401b90046001600160401b031681565b61034f610748366004614f92565b611eec565b60345461030e906001600160a01b031681565b61039961076e366004615601565b612041565b610378676765c793fa10079d601b1b81565b61067c610793366004615695565b6125ec565b603c546103da906001600160401b031681565b6103786107b9366004614f92565b612e73565b61037860395481565b603c546103da90600160801b90046001600160401b031681565b6103376107ef3660046156f3565b612e83565b60355461030e906001600160a01b031681565b610399610815366004615096565b612eb1565b610399610828366004615730565b612f51565b61037860b45481565b6104056108443660046157aa565b613210565b61058561323a565b60006001600160e01b03198216635b5e139f60e01b148061088257506001600160e01b031982166380ac58cd60e01b145b8061089d57506001600160e01b0319821663430c208160e01b145b806108b857506001600160e01b031982166301ffc9a760e01b145b92915050565b607d80546108cb90615806565b80601f01602080910402602001604051908101604052809291908181526020018280546108f790615806565b80156109445780601f1061091957610100808354040283529160200191610944565b820191906000526020600020905b81548152906001019060200180831161092757829003601f168201915b505050505081565b600061095782613368565b6109745760405163062a39dd60e11b815260040160405180910390fd5b6108b882613385565b6000610988826133a0565b9050806001600160a01b0316836001600160a01b031614156109bd576040516349fa8bc360e11b815260040160405180910390fd5b336001600160a01b038216148015906109dd57506109db8133612e83565b155b156109fb5760405163c19f17a960e01b815260040160405180910390fd5b610a0583836133d6565b505050565b3381610a168282613444565b610a335760405163c19f17a960e01b815260040160405180910390fd5b610a3e8585856134c2565b5050505050565b610a4d614db6565b60008381526043602090815260409182902082518084018452815481526001909101548183015260365483516315f789a960e21b81529351610af094929387936001600160a01b03909316926357de26a492600480830193928290030181865afa158015610abf573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610ae3919061583b565b610aeb6135e9565b61377e565b9392505050565b6000676765c793fa10079d601b1b610b0d6135e9565b604054610b1a919061586a565b610b24919061589f565b905090565b6000676765c793fa10079d601b1b610b3f6135e9565b600084815260436020526040902060010154610b5b919061586a565b6108b8919061589f565b6000610b24613ad0565b603354604051631c86b03760e31b81526001600160a01b039091169063e43581b890610b9f903390600401614ee0565b602060405180830381865afa158015610bbc573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610be091906158b3565b610bfd57604051633b8d9d7560e21b815260040160405180910390fd5b6001600160a01b03811615610c4c576001600160a01b038116600090815260446020526040902054610c309060016158d0565b6001600160a01b03821660009081526044602052604090205550565b603d805460ff60c01b198116600160c01b9182900460ff16159091021790555b50565b603b8181548110610c7f57600080fd5b600091825260209091200154905081565b610a0583838360405180602001604052806000815250611e00565b6000610af08383613444565b60335460405163521d4de960e01b81526001600160a01b039091169063521d4de990610ce7903390600401614ee0565b602060405180830381865afa158015610d04573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610d2891906158b3565b610d4557604051632678482f60e21b815260040160405180910390fd5b8051610d58906046906020840190614de5565b5050565b603354604051631c86b03760e31b81526001600160a01b039091169063e43581b890610d8c903390600401614ee0565b602060405180830381865afa158015610da9573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610dcd91906158b3565b610dea57604051633b8d9d7560e21b815260040160405180910390fd5b60b49190915560b555565b60006108b8826133a0565b60006001600160a01b038216610e295760405163d92e233d60e01b815260040160405180910390fd5b506001600160a01b031660009081526048602052604090205490565b60335460405163521d4de960e01b81526001600160a01b039091169063521d4de990610e75903390600401614ee0565b602060405180830381865afa158015610e92573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610eb691906158b3565b610ed357604051632678482f60e21b815260040160405180910390fd5b806121a360f11b1415610f3757603d546001600160401b03600160401b90910481169083161115610f1757604051637650e96360e11b815260040160405180910390fd5b603c80546001600160401b0319166001600160401b0384161790556111ca565b80622a242360e91b1415610f9c57633b9aca00826001600160401b03161015610f735760405163da6a17b960e01b815260040160405180910390fd5b603c8054600160401b600160801b031916600160401b6001600160401b038516021790556111ca565b8061212360f11b141561100057633b9aca00826001600160401b03161115610fd757604051637650e96360e11b815260040160405180910390fd5b603c8054600160801b600160c01b031916600160801b6001600160401b038516021790556111ca565b8061292360f11b141561107d57603d54633b9aca009061103090600160401b90046001600160401b0316846158e7565b6001600160401b0316111561105857604051637650e96360e11b815260040160405180910390fd5b603c80546001600160c01b0316600160c01b6001600160401b038516021790556111ca565b806124a960f11b14156110b357611092613b3c565b50603d80546001600160401b0319166001600160401b0384161790556111ca565b80614c5360f01b141561114c57603c546001600160401b03808416911611806111055750603c54633b9aca00906110fa90600160c01b90046001600160401b0316846158e7565b6001600160401b0316115b156111235760405163180d062b60e31b815260040160405180910390fd5b603d8054600160401b600160801b031916600160401b6001600160401b038516021790556111ca565b806213531160ea1b14156111b157633b9aca00826001600160401b0316111561118857604051637650e96360e11b815260040160405180910390fd5b603d8054600160801b600160c01b031916600160801b6001600160401b038516021790556111ca565b60405163e1daa9cf60e01b815260040160405180910390fd5b604080516001600160401b0384168152602081018390527f13b367dac93b85d1ed9b3d8961d8b48e1a677c9800bb1613b4b0416b2d5b61d091015b60405180910390a15050565b603354604051631c86b03760e31b81526001600160a01b039091169063e43581b890611241903390600401614ee0565b602060405180830381865afa15801561125e573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061128291906158b3565b61129f57604051633b8d9d7560e21b815260040160405180910390fd5b603354604080516361d027b360e01b815290516001600160a01b03928316928416916361d027b39160048083019260209291908290030181865afa1580156112eb573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061130f9190615912565b6001600160a01b031614611336576040516302979eb960e31b815260040160405180910390fd5b603680546001600160a01b0319166001600160a01b0392909216919091179055565b60335460405163521d4de960e01b81526001600160a01b039091169063521d4de990611388903390600401614ee0565b602060405180830381865afa1580156113a5573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906113c991906158b3565b6113e657604051632678482f60e21b815260040160405180910390fd5b805182511415806114115750806000815181106114055761140561592f565b60200260200101516000145b806114a057506001600160a01b038316158015906114a057508160008151811061143d5761143d61592f565b6020026020010151826001815181106114585761145861592f565b60200260200101511115806114a057508060008151811061147b5761147b61592f565b6020026020010151816001815181106114965761149661592f565b6020026020010151105b156114be57604051631746545d60e11b815260040160405180910390fd5b603780546001600160a01b0319166001600160a01b03851617905581516114ec90603a906020850190614e69565b50805161150090603b906020840190614e69565b50826001600160a01b03167feb74d4d9fea592587c926aeb35eb6a7893fb28db0c1c8eb2eb3c586e7164b76c838360405161153c929190615980565b60405180910390a2505050565b611551614db6565b603d54600160c81b900460ff161561157c576040516313d0ff5960e31b815260040160405180910390fd5b600260015414156115a85760405162461bcd60e51b815260040161159f906159a5565b60405180910390fd5b600260015586518651811415806115bd575080155b156115db576040516346282e8d60e01b815260040160405180910390fd5b603660009054906101000a90046001600160a01b03166001600160a01b03166357de26a46040518163ffffffff1660e01b8152600401602060405180830381865afa15801561162e573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611652919061583b565b606083015261165f613b3c565b60808301526040517f965a177723c641ee49150b583a0b9ad4730bb20d3474e00ae5a65e777c00d67b90611694908a906159dc565b60405180910390a160005b81811015611a66576000604360008b84815181106116bf576116bf61592f565b60200260200101518152602001908152602001600020604051806040016040529081600082015481526020016001820154815250509050600061170c82338760600151886080015161377e565b90508060400151600014158015611740575080604001518a84815181106117355761173561592f565b602002602001015110155b80611767575080600001518a848151811061175d5761175d61592f565b6020026020010151115b156117905780600001518a84815181106117835761178361592f565b6020026020010181815250505b6000856060015182606001516117a6919061586a565b603854633b9aca008d87815181106117c0576117c061592f565b60200260200101516117d2919061586a565b6117dc919061586a565b6117e6919061589f565b90506118148c85815181106117fd576117fd61592f565b60200260200101518285600001511115610c6c5750565b8251811061194a575081516020830151604080546000906118369084906158d0565b92505081905550604360008d86815181106118535761185361592f565b60209081029190910181015182528101919091526040016000908120818155600101819055603d548c51633b9aca0091600160401b90046001600160401b0316908e90889081106118a6576118a661592f565b60200260200101516118b8919061586a565b6118c2919061589f565b9050826080015181106118d65760006118e6565b8083608001516118e691906158d0565b876040018181516118f791906159ef565b905250508b51600080516020615e97833981519152908d908690811061191f5761191f61592f565b60200260200101518460200151600060405161193d93929190615a07565b60405180910390a1611a0b565b80604360008e87815181106119615761196161592f565b60200260200101518152602001908152602001600020600001600082825461198991906158d0565b92505081905550611a098c85815181106119a5576119a561592f565b6020026020010151633b9aca00603d60089054906101000a90046001600160401b03166001600160401b03168e88815181106119e3576119e361592f565b60200260200101516119f5919061586a565b6119ff919061589f565b8860800151613bdd565b505b8086602001818151611a1d91906159ef565b9052508a518b9085908110611a3457611a3461592f565b602002602001015186600001818151611a4d91906159ef565b905250611a5f9250839150615a209050565b905061169f565b50603d54633b9aca0090611a8a90600160401b90046001600160401b0316826158d0565b8351611a96919061586a565b611aa0919061589f565b60416000828254611ab191906159ef565b9091555050604082015160428054600090611acd9084906159ef565b909155505060208201518251611ae7919088888888613d0c565b50600180559695505050505050565b603d54600160c81b900460ff1615611b21576040516313d0ff5960e31b815260040160405180910390fd5b6033546040516333b52a9f60e11b81526001600160a01b039091169063676a553e90611b51903390600401614ee0565b602060405180830381865afa158015611b6e573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611b9291906158b3565b611baf5760405163027f480760e01b815260040160405180910390fd5b603c54600090600160c01b90046001600160401b0316821015611bed57603c54611bea908390600160c01b90046001600160401b03166158d0565b90505b603c54600090600160801b90046001600160401b0316841115611c2a57603c54611c2790600160801b90046001600160401b0316856158d0565b90505b6000611c3b6002633b9aca00615b1f565b611c4983633b9aca006158d0565b611c5785633b9aca006158d0565b611c61908961586a565b611c6b919061586a565b611c75919061589f565b9050611c8181876158d0565b60416000828254611c9291906159ef565b90915550611ca4905087826000613bdd565b5050505050505050565b607e80546108cb90615806565b611cc3614ea3565b60408051600080825260208201909252611ce5918791879187918791906125ec565b90505b949350505050565b610d58338383613e16565b60335460405163521d4de960e01b81526001600160a01b039091169063521d4de990611d2b903390600401614ee0565b602060405180830381865afa158015611d48573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611d6c91906158b3565b611d8957604051632678482f60e21b815260040160405180910390fd5b60398190556040518181527fdd63b3dcdbebad734892f7c7a26d0f647fbc7eec973e0775f5229018ac4ab47a9060200160405180910390a150565b603d54600090600160c81b900460ff1615611df2576040516313d0ff5960e31b815260040160405180910390fd5b6108b882613ecc565b919050565b3382611e0c8282613444565b611e295760405163c19f17a960e01b815260040160405180910390fd5b611e3586868686613ffa565b505050505050565b60335460405163521d4de960e01b81526001600160a01b039091169063521d4de990611e6d903390600401614ee0565b602060405180830381865afa158015611e8a573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611eae91906158b3565b611ecb57604051632678482f60e21b815260040160405180910390fd5b603d805460ff60c81b198116600160c81b9182900460ff1615909102179055565b6060611ef782613368565b611f145760405163062a39dd60e11b815260040160405180910390fd5b8160005b8115611f3b57611f2781615a20565b9050611f34600a8361589f565b9150611f18565b6000816001600160401b03811115611f5557611f556150b3565b6040519080825280601f01601f191660200182016040528015611f7f576020820181803683370190505b5090505b8415611fea57611f946001836158d0565b9150611fa1600a86615b2e565b611fac9060306159ef565b60f81b818381518110611fc157611fc161592f565b60200101906001600160f81b031916908160001a905350611fe3600a8661589f565b9450611f83565b60468054611ff790615806565b151590506120145760405180602001604052806000815250612038565b604681604051602001612028929190615b5e565b6040516020818303038152906040525b95945050505050565b600054610100900460ff16158080156120615750600054600160ff909116105b80612082575061207030613359565b158015612082575060005460ff166001145b6120e55760405162461bcd60e51b815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201526d191e481a5b9a5d1a585b1a5e995960921b606482015260840161159f565b6000805460ff191660011790558015612108576000805461ff0019166101001790555b856001600160a01b0316846001600160a01b03166361d027b36040518163ffffffff1660e01b8152600401602060405180830381865afa158015612150573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906121749190615912565b6001600160a01b03161461219b576040516302979eb960e31b815260040160405180910390fd5b603380546001600160a01b038089166001600160a01b0319928316179092556034805492881692909116821790556040805163313ce56760e01b8152905163313ce567916004808201926020929091908290030181865afa158015612204573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906122289190615bfc565b61223390600a615b1f565b603881905550856001600160a01b031663e9cbd8226040518163ffffffff1660e01b8152600401602060405180830381865afa158015612277573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061229b9190615912565b603580546001600160a01b03199081166001600160a01b0393841617909155603680549091169186169190911790556040516000906122de908490602001615c19565b60408051601f19818403018152919052805190915061230490607d906020840190614de5565b5061230e81614034565b8260405160200161231f9190615c60565b604051602081830303815290604052607e9080519060200190612343929190614de5565b50676765c793fa10079d601b1b603f5542603e5561236760a0850160808601615c8a565b6001600160401b03166123806040860160208701615c8a565b6001600160401b031611806123b05750633b9aca006123a560a0860160808701615c8a565b6001600160401b0316115b806123d657506123c66060850160408601615c8a565b6001600160401b0316633b9aca00115b806123fd5750633b9aca006123f160c0860160a08701615c8a565b6001600160401b031610155b8061240a575060e0840135155b1561242857604051631746545d60e11b815260040160405180910390fd5b833560395561243d6040850160208601615c8a565b603c80546001600160401b0319166001600160401b039290921691909117905561246d6060850160408601615c8a565b603c80546001600160401b0392909216600160401b02600160401b600160801b03199092169190911790556124a86080850160608601615c8a565b603d80546001600160401b0319166001600160401b03929092169190911790556124d860a0850160808601615c8a565b603d80546001600160401b0392909216600160401b02600160401b600160801b031990921691909117905561251360c0850160a08601615c8a565b603d80546001600160401b0392909216600160801b02600160801b600160c01b031990921691909117905561254e60e0850160c08601615ca5565b603d8054911515600160c01b0260ff60c01b19909216919091179055604080516020810190915260e0850135815261258a90603b906001614e69565b5050603d805460ff60c81b1916600160c81b1790558015611e35576000805461ff0019169055604051600181527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989060200160405180910390a1505050505050565b6125f4614ea3565b603d54600160c81b900460ff161561261f576040516313d0ff5960e31b815260040160405180910390fd5b600260015414156126425760405162461bcd60e51b815260040161159f906159a5565b60026001558551875114158061265757508651155b15612675576040516346282e8d60e01b815260040160405180910390fd5b6000806000806000805b8c51811015612bdc5760008d828151811061269c5761269c61592f565b60200260200101519050600060078111156126b9576126b9615cc2565b8160078111156126cb576126cb615cc2565b141561270c576127068d83815181106126e6576126e661592f565b60200260200101518060200190518101906127019190615912565b613ecc565b50612bcb565b600281600781111561272057612720615cc2565b1415612786578c82815181106127385761273861592f565b60200260200101518060200190518101906127539190615cd8565b95509250826127625760455492505b61276c838661410a565b848860600181815161277e91906159ef565b905250612bcb565b600781600781111561279a5761279a615cc2565b14156128735760008060008f85815181106127b7576127b761592f565b60200260200101518060200190518101906127d29190615cfc565b60345460405163d505accf60e01b81526001600160a01b038089166004830152306024830152604482018890526064820187905260ff8616608483015260a4820185905260c48201849052969f50939d50939b509497509550929350169063d505accf9060e401600060405180830381600087803b15801561285357600080fd5b505af1158015612867573d6000803e3d6000fd5b50505050505050612bcb565b8661288357612880613b3c565b96505b600481600781111561289757612897615cc2565b1415612963578c82815181106128af576128af61592f565b60200260200101518060200190518101906128ca9190615cd8565b94509250826128d95760455492505b6128e4838589613bdd565b603c5490945060009061290b90600160c01b90046001600160401b0316633b9aca006158d0565b612919633b9aca008761586a565b612923919061589f565b905061292f85826158d0565b6041600082825461294091906159ef565b92505081905550808960200181815161295991906159ef565b905250612bcb9050565b856129e257603660009054906101000a90046001600160a01b03166001600160a01b03166357de26a46040518163ffffffff1660e01b8152600401602060405180830381865afa1580156129bb573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906129df919061583b565b95505b60018160078111156129f6576129f6615cc2565b1415612a72578c8281518110612a0e57612a0e61592f565b6020026020010151806020019051810190612a29919061583b565b925082612a365760455492505b612a41838789614176565b80965081955050508488604001818151612a5b91906159ef565b90525060208801805185919061277e9083906159ef565b6003816007811115612a8657612a86615cc2565b1415612ae6578c8281518110612a9e57612a9e61592f565b6020026020010151806020019051810190612ab99190615cd8565b9550925082612ac85760455492505b612ad48386888a614296565b848860400181815161277e91906159ef565b6005816007811115612afa57612afa615cc2565b1415612b5c578c8281518110612b1257612b1261592f565b6020026020010151806020019051810190612b2d9190615cd8565b9450925082612b3c5760455492505b612b488385888a614370565b9350838860000181815161277e91906159ef565b6006816007811115612b7057612b70615cc2565b1415612bcb576000808e8481518110612b8b57612b8b61592f565b6020026020010151806020019051810190612ba69190615d4f565b98509196509250905084612bba5760455494505b612bc8858383898c8e61440b565b50505b50612bd581615a20565b905061267f565b508551602087015110612cd35785516020870151600091612bfc916158d0565b90508660600151876040015110612c3357612c2e87606001518860400151612c2491906158d0565b828d8d8d8d613d0c565b612ccd565b8015612ca057603554604051630d43af8160e21b81526001600160a01b039091169063350ebe0490612c6d9084908f903390600401615d8d565b600060405180830381600087803b158015612c8757600080fd5b505af1158015612c9b573d6000803e3d6000fd5b505050505b612ccd333089604001518a60600151612cb991906158d0565b6034546001600160a01b0316929190614547565b50612e5f565b60208601518651600091612ce6916158d0565b6035546040516340c10f1960e01b81529192506001600160a01b0316906340c10f1990612d19908d908590600401615dac565b600060405180830381600087803b158015612d3357600080fd5b505af1158015612d47573d6000803e3d6000fd5b50505050866060015187604001511115612d8b57612d868a88606001518960400151612d7391906158d0565b6034546001600160a01b031691906145b2565b612e5d565b600087604001518860600151612da191906158d0565b90508015612e5b57885115612e4357896001600160a01b031663a5d4096b603560009054906101000a90046001600160a01b0316603460009054906101000a90046001600160a01b03163385878f6040518763ffffffff1660e01b8152600401612e1096959493929190615dc5565b600060405180830381600087803b158015612e2a57600080fd5b505af1158015612e3e573d6000803e3d6000fd5b505050505b603454612e5b906001600160a01b0316333084614547565b505b505b505060018055509198975050505050505050565b603a8181548110610c7f57600080fd5b6001600160a01b039182166000908152604a6020908152604080832093909416825291909152205460011490565b6033546001600160a01b03163314612edc5760405163b90cdbb160e01b815260040160405180910390fd5b603380546001600160a01b0319166001600160a01b0383811691909117909155603654604051630787a21360e51b815291169063f0f4426090612f23908490600401614ee0565b600060405180830381600087803b158015612f3d57600080fd5b505af1158015610a3e573d6000803e3d6000fd5b83421115612f725760405163f87d927160e01b815260040160405180910390fd5b6fa2a8918ca85bafe22016d0b997e4df60600160ff1b03811180612fa957508260ff16601b14158015612fa957508260ff16601c14155b15612fc757604051638baa579f60e01b815260040160405180910390fd5b6000612fd1613ad0565b608254898989612fe08d6145d1565b6040805160208101969096526001600160a01b03948516908601529290911660608401521515608083015260a082015260c0810187905260e0016040516020818303038152906040528051906020012060405160200161305792919061190160f01b81526002810192909252602282015260420190565b604051602081830303815290604052805190602001209050613081886001600160a01b0316613359565b1561315d57604080516020810185905280820184905260f886901b6001600160f81b0319166060820152815160418183030181526061820192839052630b135d3f60e11b9092526001600160a01b038a1691631626ba7e916130e7918591606501615e07565b602060405180830381865afa158015613104573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906131289190615e20565b6001600160e01b031916631626ba7e60e01b1461315857604051638baa579f60e01b815260040160405180910390fd5b613205565b6040805160008082526020820180845284905260ff871692820192909252606081018590526080810184905260019060a0016020604051602081039080840390855afa1580156131b1573d6000803e3d6000fd5b505050602060405103519050886001600160a01b0316816001600160a01b03161415806131e557506001600160a01b038116155b1561320357604051638baa579f60e01b815260040160405180910390fd5b505b611ca4888888613e16565b613218614db6565b60408051600080825260208201909252611ce591879187918791879190611549565b60335460009081906001600160a01b0316331461326a5760405163b90cdbb160e01b815260040160405180910390fd5b613272613b3c565b50506041805460428054600093849055929055915080821061330b5761329881836158d0565b6035546033546040516340c10f1960e01b8152929450600093506001600160a01b03918216926340c10f19926132d49216908690600401615dac565b600060405180830381600087803b1580156132ee57600080fd5b505af1158015613302573d6000803e3d6000fd5b5050505061331c565b61331582826158d0565b9050600091505b60408051838152602081018390527ffeb12225c131aab793a00c5239afb778932d170fa28ce6e9d23703e4bd892121910160405180910390a19091565b6001600160a01b03163b151590565b6000908152604760205260409020546001600160a01b0316151590565b6000908152604960205260409020546001600160a01b031690565b6000818152604760205260409020546001600160a01b031680611dfb5760405163062a39dd60e11b815260040160405180910390fd5b600081815260496020526040902080546001600160a01b0319166001600160a01b038416908117909155819061340b826133a0565b6001600160a01b03167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92560405160405180910390a45050565b600080613450836133a0565b9050806001600160a01b0316846001600160a01b0316148061348b5750836001600160a01b031661348084613385565b6001600160a01b0316145b80611ce857506001600160a01b038082166000908152604a6020908152604080832093881683529290522054600114949350505050565b826001600160a01b03166134d5826133a0565b6001600160a01b0316146134fc5760405163c19f17a960e01b815260040160405180910390fd5b6001600160a01b0382166135235760405163d92e233d60e01b815260040160405180910390fd5b603d54600160c01b900460ff16801561355557506001600160a01b038216600090815260446020526040902054600114155b1561357357604051630b094f2760e31b815260040160405180910390fd5b61357e6000826133d6565b6001600160a01b038084166000818152604860209081526040808320805460001901905593861680835284832080546001019055858352604790915283822080546001600160a01b03191682179055925184939291600080516020615ed783398151915291a4505050565b600080603e54426135fa91906158d0565b603d549091506001600160401b0316811580613614575080155b1561362357603f549250505090565b60006136306001846158d0565b905060006002841161364357600061364e565b61364e6002856158d0565b90506000676765c793fa10079d601b1b676765c793fa10079d601a1b613674868061586a565b61367e91906159ef565b613688919061589f565b90506000676765c793fa10079d601b1b676765c793fa10079d601a1b6136ae878561586a565b6136b891906159ef565b6136c2919061589f565b905060006002836136d3878a61586a565b6136dd919061586a565b6136e7919061589f565b90506000600683866136f9898c61586a565b613703919061586a565b61370d919061586a565b613717919061589f565b9050676765c793fa10079d601b1b81836137318b8b61586a565b61374690676765c793fa10079d601b1b6159ef565b61375091906159ef565b61375a91906159ef565b603f54613767919061586a565b613771919061589f565b9850505050505050505090565b613786614db6565b6000806000613796888787614615565b925092509250633b9aca0083106137c0576040516315fe9b6160e21b815260040160405180910390fd5b6000633b9aca006137d185826158d0565b6137da8a61469e565b6137e4919061586a565b6137ee919061589f565b603d54909150600160801b90046001600160401b031681101561381e5761381981633b9aca006158d0565b61383f565b603d5461383f90600160801b90046001600160401b0316633b9aca006158d0565b603d54909150600160401b90046001600160401b03166000806138676002633b9aca00615b1f565b603c5461387d91906001600160401b031661586a565b83613888868a61586a565b613892919061586a565b10613a1b57603c546001600160401b03166138b26002633b9aca00615b1f565b6138bc919061586a565b603c5485906138db90600160401b90046001600160401b03168661586a565b6138e5919061586a565b6138ef91906158d0565b603c548590633b9aca009061390d906001600160401b03168961586a565b603c5461392b908b90600160401b90046001600160401b031661586a565b61393591906158d0565b61393f919061586a565b613949919061586a565b613953919061589f565b9150633b9aca0060b454613967919061586a565b613971848461586a565b61397b91906159ef565b613989633b9aca008861586a565b11613a16576139a3676765c793fa10079d601b1b8461586a565b633b9aca008a8e602001516139b8919061586a565b6139c2919061586a565b6139cc919061589f565b6139d79060016159ef565b915060b454861115613a125782633b9aca0060b454886139f791906158d0565b613a01919061586a565b613a0b919061589f565b9050613a7e565b5060015b613a7e565b603854613a2c90633b9aca0061586a565b8c518b90613a3b90879061586a565b613a45919061586a565b613a4f919061589f565b613a5a9060016159ef565b915060b554851115613a7a57633b9aca008460b554876139f791906158d0565b5060015b818852613a8b848b61586a565b603854613a9c633b9aca008561586a565b613aa6919061586a565b613ab0919061589f565b602089015260408801525050606085015250608083015250949350505050565b60808054608154604080517f8b73c3c69bb8fe3d512ecc4cf759cc79239f7b179b0ffacaa9a75d522b39400f602082015290810192909252606082015246918101919091523060a082015260009060c00160405160208183030381529060405280519060200120905090565b6000613b466135e9565b90506000676765c793fa10079d601b1b603f5483613b6491906158d0565b604054613b71919061586a565b613b7b919061589f565b90508060416000828254613b8f91906159ef565b9091555050603f82905542603e8190556040805184815260208101929092527fd1fa8ba00a3bf20274346919dce0de62d2a140af2c71fe7e29fa6472eea3bb9d910160405180910390a15090565b600081613bef57613bec613b3c565b91505b60008481526043602052604081206001015490676765c793fa10079d601b1b613c18858461586a565b613c22919061589f565b9050808510613c3357935080613c56565b83613c49676765c793fa10079d601b1b8761586a565b613c53919061589f565b90505b613c6081836158d0565b91508060406000828254613c7491906158d0565b90915550508115801590613ca95750676765c793fa10079d601b1b60b454613c9c919061586a565b613ca6858461586a565b11155b15613cc75760405163228af07f60e21b815260040160405180910390fd5b60008681526043602052604080822060010184905551600080516020615e9783398151915291613cfa9189918591615a07565b60405180910390a15092949350505050565b8515613d2957603454613d29906001600160a01b031684886145b2565b8415611e3557805115613da85760345460355460405163a5d4096b60e01b81526001600160a01b038086169363a5d4096b93613d759391831692169089908b908d908990600401615dc5565b600060405180830381600087803b158015613d8f57600080fd5b505af1158015613da3573d6000803e3d6000fd5b505050505b603554604051630d43af8160e21b81526001600160a01b039091169063350ebe0490613ddc90889088903390600401615d8d565b600060405180830381600087803b158015613df657600080fd5b505af1158015613e0a573d6000803e3d6000fd5b50505050505050505050565b826001600160a01b0316826001600160a01b03161415613e49576040516320c5195360e21b815260040160405180910390fd5b600081613e57576000613e5a565b60015b6001600160a01b038581166000818152604a602090815260408083209489168084529482529182902060ff959095169485905590518615158152939450919290917f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c31910160405180910390a350505050565b603d54600090600160c01b900460ff168015613f1b57506001600160a01b0382166000908152604460205260409020546001141580613f1b575033600090815260446020526040902054600114155b15613f3957604051630b094f2760e31b815260040160405180910390fd5b6001600160a01b038216613f605760405163d92e233d60e01b815260040160405180910390fd5b5060458054600101908190556001600160a01b038216600081815260486020908152604080832080546001019055848352604790915280822080546001600160a01b031916841790555183929190600080516020615ed7833981519152908290a4613fdd60008383604051806020016040528060008152506148cd565b611dfb576040516320149b4360e21b815260040160405180910390fd5b6140058484846134c2565b614011848484846148cd565b61402e576040516320149b4360e21b815260040160405180910390fd5b50505050565b600054610100900460ff1661409f5760405162461bcd60e51b815260206004820152602b60248201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960448201526a6e697469616c697a696e6760a81b606482015260840161159f565b7f3f43a9c6bafb5c7aab4e0cfe239dc5d4c15caf0381c6104188191f78a6640bd860825580516020918201206080556040805180820190915260018152603160f81b9101527fc89efdaa54c0f20c7adf612882df0950f5a951637e0307cdcb4c672f298b8bc6608155565b61411382613368565b6141305760405163062a39dd60e11b815260040160405180910390fd5b6000828152604360205260408120805483929061414e9084906159ef565b9091555050604051600080516020615eb7833981519152906112059084908490600190615a07565b60008033856141858282613444565b6141a25760405163c19f17a960e01b815260040160405180910390fd5b6000878152604360209081526040808320815180830190925280548252600101549181019190915290806141d7838a8a614615565b5091509150633b9aca00821161420057604051631527804d60e31b815260040160405180910390fd5b82602001516040600082825461421691906158d0565b9091555061422590508a6149d0565b603c5460009061424990600160c01b90046001600160401b0316633b9aca006158d0565b614257633b9aca008461586a565b614261919061589f565b905061426d82826158d0565b6041600082825461427e91906159ef565b90915550509251929a92995091975050505050505050565b33846142a28282613444565b6142bf5760405163c19f17a960e01b815260040160405180910390fd5b600086815260436020526040812080548792906142dd9084906158d0565b909155505060008681526043602090815260408083208151808301909252805482526001015491810191909152614315908686614615565b50509050633b9aca00811161433d57604051631527804d60e31b815260040160405180910390fd5b600080516020615eb78339815191528787600060405161435f93929190615a07565b60405180910390a150505050505050565b6000338561437e8282613444565b61439b5760405163c19f17a960e01b815260040160405180910390fd5b6143a787878787614a4f565b603c54909650600090633b9aca00906143d1908990600160801b90046001600160401b031661586a565b6143db919061589f565b905080604160008282546143ef91906159ef565b909155506143ff905081886158d0565b98975050505050505050565b33866144178282613444565b6144345760405163c19f17a960e01b815260040160405180910390fd5b60408051898152602081018890526001600160a01b038916818301526060810187905290517fddd3b70af631334f7552aadb582ed091018e62e103fa8b150ca66cc700d4dac69181900360800190a161448f88868686614a4f565b94506001600160a01b0387163014156144b3576144ad868685613bdd565b50611ca4565b603c546040516320d661ad60e21b815260048101889052602481018790526001600160401b03600160801b830481166044830152600160c01b90920490911660648201526001600160a01b0388169063835986b490608401600060405180830381600087803b15801561452557600080fd5b505af1158015614539573d6000803e3d6000fd5b505050505050505050505050565b6040516001600160a01b038085166024830152831660448201526064810182905261402e9085906323b872dd60e01b906084015b60408051601f198184030181529190526020810180516001600160e01b03166001600160e01b031990931692909217909152614be2565b610a058363a9059cbb60e01b848460405160240161457b929190615dac565b6001600160a01b0381166000908152607f60205260409020546145f58160016159ef565b6001600160a01b039092166000908152607f602052604090209190915590565b6000806000676765c793fa10079d601b1b848760200151614636919061586a565b614640919061589f565b9150603854858760000151614655919061586a565b61465f919061589f565b905081614670576000199250614695565b603c548290614688906001600160401b03168361586a565b614692919061589f565b92505b93509350939050565b6037546000906001600160a01b03166146d757603b6000815481106146c5576146c561592f565b90600052602060002001549050919050565b603754604051635dfba04560e11b81526000916001600160a01b03169063bbf7408a90614708908690600401614ee0565b602060405180830381865afa158015614725573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190614749919061583b565b9050603a60018154811061475f5761475f61592f565b9060005260206000200154811061479757603b6001815481106147845761478461592f565b9060005260206000200154915050919050565b603a6000815481106147ab576147ab61592f565b906000526020600020015481116147d057603b6000815481106147845761478461592f565b603a6000815481106147e4576147e461592f565b9060005260206000200154603a6001815481106148035761480361592f565b906000526020600020015461481891906158d0565b603a60008154811061482c5761482c61592f565b90600052602060002001548261484291906158d0565b603b6000815481106148565761485661592f565b9060005260206000200154603b6001815481106148755761487561592f565b906000526020600020015461488a91906158d0565b614894919061586a565b61489e919061589f565b603b6000815481106148b2576148b261592f565b9060005260206000200154610af091906159ef565b50919050565b60006148e1846001600160a01b0316613359565b156149c857604051630a85bd0160e11b81526001600160a01b0385169063150b7a0290614918903390899088908890600401615e3d565b6020604051808303816000875af1925050508015614953575060408051601f3d908101601f1916820190925261495091810190615e20565b60015b6149ae573d808015614981576040519150601f19603f3d011682016040523d82523d6000602084013e614986565b606091505b5080516149a6576040516320149b4360e21b815260040160405180910390fd5b805181602001fd5b6001600160e01b031916630a85bd0160e11b149050611ce8565b506001611ce8565b60006149db826133a0565b90506149e86000836133d6565b6001600160a01b038116600081815260486020908152604080832080546000190190558583526047825280832080546001600160a01b0319169055604390915280822082815560010182905551849290600080516020615ed7833981519152908390a45050565b60008082614a68676765c793fa10079d601b1b8761586a565b614a72919061589f565b600087815260436020526040902060010154909150614aad5760b4548511614aad5760405163228af07f60e21b815260040160405180910390fd5b60008681526043602052604081206001018054839290614ace9084906159ef565b925050819055508060406000828254614ae791906159ef565b9091555050603954614b0590676765c793fa10079d601b1b9061586a565b83604054614b13919061586a565b1115614b32576040516371239a6160e11b815260040160405180910390fd5b60008681526043602090815260408083208151808301909252805482526001015491810191909152614b65908686614615565b50509050633b9aca008111614b8d57604051631527804d60e31b815260040160405180910390fd5b600080516020615e9783398151915287836001604051614baf93929190615a07565b60405180910390a1676765c793fa10079d601b1b614bcd858461586a565b614bd7919061589f565b979650505050505050565b6000614c37826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b0316614cb49092919063ffffffff16565b805190915015610a055780806020019051810190614c5591906158b3565b610a055760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b606482015260840161159f565b6060611ce8848460008585614cc885613359565b614d145760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e7472616374000000604482015260640161159f565b600080866001600160a01b03168587604051614d309190615e7a565b60006040518083038185875af1925050503d8060008114614d6d576040519150601f19603f3d011682016040523d82523d6000602084013e614d72565b606091505b5091509150614bd782828660608315614d8c575081610af0565b825115614d9c5782518084602001fd5b8160405162461bcd60e51b815260040161159f9190614f7f565b6040518060a0016040528060008152602001600081526020016000815260200160008152602001600081525090565b828054614df190615806565b90600052602060002090601f016020900481019282614e135760008555614e59565b82601f10614e2c57805160ff1916838001178555614e59565b82800160010185558215614e59579182015b82811115614e59578251825591602001919060010190614e3e565b50614e65929150614ecb565b5090565b828054828255906000526020600020908101928215614e595791602002820182811115614e59578251825591602001919060010190614e3e565b6040518060800160405280600081526020016000815260200160008152602001600081525090565b5b80821115614e655760008155600101614ecc565b6001600160a01b0391909116815260200190565b6001600160e01b031981168114610c6c57600080fd5b600060208284031215614f1c57600080fd5b8135610af081614ef4565b60005b83811015614f42578181015183820152602001614f2a565b8381111561402e5750506000910152565b60008151808452614f6b816020860160208601614f27565b601f01601f19169290920160200192915050565b602081526000610af06020830184614f53565b600060208284031215614fa457600080fd5b5035919050565b6001600160a01b0381168114610c6c57600080fd5b60008060408385031215614fd357600080fd5b8235614fde81614fab565b946020939093013593505050565b60008060006060848603121561500157600080fd5b833561500c81614fab565b9250602084013561501c81614fab565b929592945050506040919091013590565b6000806040838503121561504057600080fd5b82359150602083013561505281614fab565b809150509250929050565b60a081016108b8828480518252602081015160208301526040810151604083015260608101516060830152608081015160808301525050565b6000602082840312156150a857600080fd5b8135610af081614fab565b634e487b7160e01b600052604160045260246000fd5b604051601f8201601f191681016001600160401b03811182821017156150f1576150f16150b3565b604052919050565b600082601f83011261510a57600080fd5b81356001600160401b03811115615123576151236150b3565b615136601f8201601f19166020016150c9565b81815284602083860101111561514b57600080fd5b816020850160208301376000918101602001919091529392505050565b60006020828403121561517a57600080fd5b81356001600160401b0381111561519057600080fd5b611ce8848285016150f9565b600080604083850312156151af57600080fd5b50508035926020909101359150565b80356001600160401b0381168114611dfb57600080fd5b600080604083850312156151e857600080fd5b614fde836151be565b60006001600160401b0382111561520a5761520a6150b3565b5060051b60200190565b600082601f83011261522557600080fd5b8135602061523a615235836151f1565b6150c9565b82815260059290921b8401810191818101908684111561525957600080fd5b8286015b84811015615274578035835291830191830161525d565b509695505050505050565b60008060006060848603121561529457600080fd5b833561529f81614fab565b925060208401356001600160401b03808211156152bb57600080fd5b6152c787838801615214565b935060408601359150808211156152dd57600080fd5b506152ea86828701615214565b9150509250925092565b60008060008060008060c0878903121561530d57600080fd5b86356001600160401b038082111561532457600080fd5b6153308a838b01615214565b9750602089013591508082111561534657600080fd5b6153528a838b01615214565b96506040890135915061536482614fab565b90945060608801359061537682614fab565b90935060808801359061538882614fab565b90925060a0880135908082111561539e57600080fd5b506153ab89828a016150f9565b9150509295509295509295565b600080600080608085870312156153ce57600080fd5b5050823594602084013594506040840135936060013592509050565b600082601f8301126153fb57600080fd5b8135602061540b615235836151f1565b82815260059290921b8401810191818101908684111561542a57600080fd5b8286015b84811015615274578035600881106154465760008081fd5b835291830191830161542e565b600082601f83011261546457600080fd5b81356020615474615235836151f1565b82815260059290921b8401810191818101908684111561549357600080fd5b8286015b848110156152745780356001600160401b038111156154b65760008081fd5b6154c48986838b01016150f9565b845250918301918301615497565b600080600080608085870312156154e857600080fd5b84356001600160401b03808211156154ff57600080fd5b61550b888389016153ea565b9550602087013591508082111561552157600080fd5b5061552e87828801615453565b935050604085013561553f81614fab565b9150606085013561554f81614fab565b939692955090935050565b8015158114610c6c57600080fd5b6000806040838503121561557b57600080fd5b823561558681614fab565b915060208301356150528161555a565b600080600080608085870312156155ac57600080fd5b84356155b781614fab565b935060208501356155c781614fab565b92506040850135915060608501356001600160401b038111156155e957600080fd5b6155f5878288016150f9565b91505092959194509250565b600080600080600085870361018081121561561b57600080fd5b863561562681614fab565b9550602087013561563681614fab565b9450604087013561564681614fab565b9350610100605f198201121561565b57600080fd5b506060860191506101608601356001600160401b0381111561567c57600080fd5b615688888289016150f9565b9150509295509295909350565b60008060008060008060c087890312156156ae57600080fd5b86356001600160401b03808211156156c557600080fd5b6156d18a838b016153ea565b975060208901359150808211156156e757600080fd5b6153528a838b01615453565b6000806040838503121561570657600080fd5b823561571181614fab565b9150602083013561505281614fab565b60ff81168114610c6c57600080fd5b600080600080600080600060e0888a03121561574b57600080fd5b873561575681614fab565b9650602088013561576681614fab565b955060408801356157768161555a565b945060608801359350608088013561578d81615721565b9699959850939692959460a0840135945060c09093013592915050565b600080600080608085870312156157c057600080fd5b84356001600160401b03808211156157d757600080fd5b6157e388838901615214565b955060208701359150808211156157f957600080fd5b5061552e87828801615214565b600181811c9082168061581a57607f821691505b602082108114156148c757634e487b7160e01b600052602260045260246000fd5b60006020828403121561584d57600080fd5b5051919050565b634e487b7160e01b600052601160045260246000fd5b600081600019048311821515161561588457615884615854565b500290565b634e487b7160e01b600052601260045260246000fd5b6000826158ae576158ae615889565b500490565b6000602082840312156158c557600080fd5b8151610af08161555a565b6000828210156158e2576158e2615854565b500390565b60006001600160401b0382811684821680830382111561590957615909615854565b01949350505050565b60006020828403121561592457600080fd5b8151610af081614fab565b634e487b7160e01b600052603260045260246000fd5b600081518084526020808501945080840160005b8381101561597557815187529582019590820190600101615959565b509495945050505050565b6040815260006159936040830185615945565b82810360208401526120388185615945565b6020808252601f908201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c00604082015260600190565b602081526000610af06020830184615945565b60008219821115615a0257615a02615854565b500190565b928352602083019190915260ff16604082015260600190565b6000600019821415615a3457615a34615854565b5060010190565b600181815b80851115615a76578160001904821115615a5c57615a5c615854565b80851615615a6957918102915b93841c9390800290615a40565b509250929050565b600082615a8d575060016108b8565b81615a9a575060006108b8565b8160018114615ab05760028114615aba57615ad6565b60019150506108b8565b60ff841115615acb57615acb615854565b50506001821b6108b8565b5060208310610133831016604e8410600b8410161715615af9575081810a6108b8565b615b038383615a3b565b8060001904821115615b1757615b17615854565b029392505050565b6000610af060ff841683615a7e565b600082615b3d57615b3d615889565b500690565b60008151615b54818560208601614f27565b9290920192915050565b600080845481600182811c915080831680615b7a57607f831692505b6020808410821415615b9a57634e487b7160e01b86526022600452602486fd5b818015615bae5760018114615bbf57615bec565b60ff19861689528489019650615bec565b60008b81526020902060005b86811015615be45781548b820152908501908301615bcb565b505084890196505b5050505050506120388185615b42565b600060208284031215615c0e57600080fd5b8151610af081615721565b6e020b733b63290283937ba37b1b7b61608d1b815260008251615c4381600f850160208701614f27565b650815985d5b1d60d21b600f939091019283015250601501919050565b60008251615c72818460208701614f27565b650b5d985d5b1d60d21b920191825250600601919050565b600060208284031215615c9c57600080fd5b610af0826151be565b600060208284031215615cb757600080fd5b8135610af08161555a565b634e487b7160e01b600052602160045260246000fd5b60008060408385031215615ceb57600080fd5b505080516020909101519092909150565b60008060008060008060c08789031215615d1557600080fd5b8651615d2081614fab565b6020880151604089015160608a015160808b015160a0909b0151939c929b509099909850965090945092505050565b60008060008060808587031215615d6557600080fd5b845193506020850151615d7781614fab565b6040860151606090960151949790965092505050565b9283526001600160a01b03918216602084015216604082015260600190565b6001600160a01b03929092168252602082015260400190565b6001600160a01b038781168252868116602083015285166040820152606081018490526080810183905260c060a082018190526000906143ff90830184614f53565b828152604060208201526000611ce86040830184614f53565b600060208284031215615e3257600080fd5b8151610af081614ef4565b6001600160a01b0385811682528416602082015260408101839052608060608201819052600090615e7090830184614f53565b9695505050505050565b60008251615e8c818460208701614f27565b919091019291505056fe70cf49afe7355562d5b022e594790f22b71ad8cc7eec902fa5feac7c67f71091722cb71fa87c947148cefc06dd890af5802a6a00207c5ddecf1191bf71ce3cd4ddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3efa264697066735822122004adf5a8fe3c52a612a81111fd6100f9eeb84fbeb3cfcc411a5bf2e9a14a72cb64736f6c634300080c0033", + "deployedBytecode": "0x608060405234801561001057600080fd5b50600436106102f65760003560e01c8063010db195146102fb57806301ffc9a71461032457806306fdde0314610347578063081812fc1461035c578063087a60071461036f578063095ea7b3146103865780630e198f221461039b57806313888565146103a457806323b872dd146103ad578063254cf439146103c0578063307439af146103f257806334ce998a1461041257806335836f151461041a5780633644e5151461042d57806339393ac91461043557806339eb4dc6146104485780633ae2325f1461045c5780633af32abf1461046f5780633c2e941b1461048f57806342842e0e14610498578063430c2081146104ab5780634f7e43df146104be57806355f804b3146104d85780635b84d88a146104eb5780635c975abb146104fe57806361d027b3146105125780636352211e1461052557806370a0823114610538578063741075431461054b5780637aacfffa1461055e5780637adbf9731461059a5780637c0f59f4146105ad5780637c3a00fd146105c75780637dc0d1d0146105da5780637e53bd97146105ed5780637e56d47c146106005780637ecebe0014610613578063835986b41461063c57806389050f1d1461064f57806395d89b41146106615780639a3b6f2f146106695780639f48118f146106af578063a22cb465146106ba578063af2c8c2e146106cd578063b1511cc9146106d6578063b4bd6f46146106e9578063b88d4fde146106fc578063bbcac5571461070f578063c4ae316814610718578063c66d8b0114610720578063c87b56dd1461073a578063d8dfeb451461074d578063d9b1cb5b14610760578063de1f776514610773578063de8fc69814610785578063df011c4114610798578063e182b883146107ab578063e1c84ea4146107be578063e626648a146107c7578063e985e9c5146107e1578063e9cbd822146107f4578063f0f4426014610807578063f51cc7dd1461081a578063fad9aba31461082d578063fc29b02114610836578063fd527cf814610849575b600080fd5b60375461030e906001600160a01b031681565b60405161031b9190614ee0565b60405180910390f35b610337610332366004614f0a565b610851565b604051901515815260200161031b565b61034f6108be565b60405161031b9190614f7f565b61030e61036a366004614f92565b61094c565b610378603f5481565b60405190815260200161031b565b610399610394366004614fc0565b61097d565b005b610378603e5481565b61037860415481565b6103996103bb366004614fec565b610a0a565b603c546103da90600160401b90046001600160401b031681565b6040516001600160401b03909116815260200161031b565b61040561040036600461502d565b610a45565b60405161031b919061505d565b610378610af7565b610378610428366004614f92565b610b29565b610378610b65565b610399610443366004615096565b610b6f565b603d5461033790600160c01b900460ff1681565b61037861046a366004614f92565b610c6f565b61037861047d366004615096565b60446020526000908152604090205481565b61037860455481565b6103996104a6366004614fec565b610c90565b6103376104b9366004614fc0565b610cab565b603d546103da90600160801b90046001600160401b031681565b6103996104e6366004615168565b610cb7565b6103996104f936600461519c565b610d5c565b603d5461033790600160c81b900460ff1681565b60335461030e906001600160a01b031681565b61030e610533366004614f92565b610df5565b610378610546366004615096565b610e00565b6103996105593660046151d5565b610e45565b61058561056c366004614f92565b6043602052600090815260409020805460019091015482565b6040805192835260208301919091520161031b565b6103996105a8366004615096565b611211565b603c546103da90600160c01b90046001600160401b031681565b603d546103da906001600160401b031681565b60365461030e906001600160a01b031681565b6103996105fb36600461527f565b611358565b61040561060e3660046152f4565b611549565b610378610621366004615096565b6001600160a01b03166000908152607f602052604090205490565b61039961064a3660046153b8565b611af6565b610378676765c793fa10079d601a1b81565b61034f611cae565b61067c6106773660046154d2565b611cbb565b60405161031b91908151815260208083015190820152604080830151908201526060918201519181019190915260800190565b610378633b9aca0081565b6103996106c8366004615568565b611cf0565b61037860405481565b6103996106e4366004614f92565b611cfb565b6103786106f7366004615096565b611dc4565b61039961070a366004615596565b611e00565b61037860425481565b610399611e3d565b603d546103da90600160401b90046001600160401b031681565b61034f610748366004614f92565b611eec565b60345461030e906001600160a01b031681565b61039961076e366004615601565b612041565b610378676765c793fa10079d601b1b81565b61067c610793366004615695565b6125ec565b603c546103da906001600160401b031681565b6103786107b9366004614f92565b612e73565b61037860395481565b603c546103da90600160801b90046001600160401b031681565b6103376107ef3660046156f3565b612e83565b60355461030e906001600160a01b031681565b610399610815366004615096565b612eb1565b610399610828366004615730565b612f51565b61037860b45481565b6104056108443660046157aa565b613210565b61058561323a565b60006001600160e01b03198216635b5e139f60e01b148061088257506001600160e01b031982166380ac58cd60e01b145b8061089d57506001600160e01b0319821663430c208160e01b145b806108b857506001600160e01b031982166301ffc9a760e01b145b92915050565b607d80546108cb90615806565b80601f01602080910402602001604051908101604052809291908181526020018280546108f790615806565b80156109445780601f1061091957610100808354040283529160200191610944565b820191906000526020600020905b81548152906001019060200180831161092757829003601f168201915b505050505081565b600061095782613368565b6109745760405163062a39dd60e11b815260040160405180910390fd5b6108b882613385565b6000610988826133a0565b9050806001600160a01b0316836001600160a01b031614156109bd576040516349fa8bc360e11b815260040160405180910390fd5b336001600160a01b038216148015906109dd57506109db8133612e83565b155b156109fb5760405163c19f17a960e01b815260040160405180910390fd5b610a0583836133d6565b505050565b3381610a168282613444565b610a335760405163c19f17a960e01b815260040160405180910390fd5b610a3e8585856134c2565b5050505050565b610a4d614db6565b60008381526043602090815260409182902082518084018452815481526001909101548183015260365483516315f789a960e21b81529351610af094929387936001600160a01b03909316926357de26a492600480830193928290030181865afa158015610abf573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610ae3919061583b565b610aeb6135e9565b61377e565b9392505050565b6000676765c793fa10079d601b1b610b0d6135e9565b604054610b1a919061586a565b610b24919061589f565b905090565b6000676765c793fa10079d601b1b610b3f6135e9565b600084815260436020526040902060010154610b5b919061586a565b6108b8919061589f565b6000610b24613ad0565b603354604051631c86b03760e31b81526001600160a01b039091169063e43581b890610b9f903390600401614ee0565b602060405180830381865afa158015610bbc573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610be091906158b3565b610bfd57604051633b8d9d7560e21b815260040160405180910390fd5b6001600160a01b03811615610c4c576001600160a01b038116600090815260446020526040902054610c309060016158d0565b6001600160a01b03821660009081526044602052604090205550565b603d805460ff60c01b198116600160c01b9182900460ff16159091021790555b50565b603b8181548110610c7f57600080fd5b600091825260209091200154905081565b610a0583838360405180602001604052806000815250611e00565b6000610af08383613444565b60335460405163521d4de960e01b81526001600160a01b039091169063521d4de990610ce7903390600401614ee0565b602060405180830381865afa158015610d04573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610d2891906158b3565b610d4557604051632678482f60e21b815260040160405180910390fd5b8051610d58906046906020840190614de5565b5050565b603354604051631c86b03760e31b81526001600160a01b039091169063e43581b890610d8c903390600401614ee0565b602060405180830381865afa158015610da9573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610dcd91906158b3565b610dea57604051633b8d9d7560e21b815260040160405180910390fd5b60b49190915560b555565b60006108b8826133a0565b60006001600160a01b038216610e295760405163d92e233d60e01b815260040160405180910390fd5b506001600160a01b031660009081526048602052604090205490565b60335460405163521d4de960e01b81526001600160a01b039091169063521d4de990610e75903390600401614ee0565b602060405180830381865afa158015610e92573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610eb691906158b3565b610ed357604051632678482f60e21b815260040160405180910390fd5b806121a360f11b1415610f3757603d546001600160401b03600160401b90910481169083161115610f1757604051637650e96360e11b815260040160405180910390fd5b603c80546001600160401b0319166001600160401b0384161790556111ca565b80622a242360e91b1415610f9c57633b9aca00826001600160401b03161015610f735760405163da6a17b960e01b815260040160405180910390fd5b603c8054600160401b600160801b031916600160401b6001600160401b038516021790556111ca565b8061212360f11b141561100057633b9aca00826001600160401b03161115610fd757604051637650e96360e11b815260040160405180910390fd5b603c8054600160801b600160c01b031916600160801b6001600160401b038516021790556111ca565b8061292360f11b141561107d57603d54633b9aca009061103090600160401b90046001600160401b0316846158e7565b6001600160401b0316111561105857604051637650e96360e11b815260040160405180910390fd5b603c80546001600160c01b0316600160c01b6001600160401b038516021790556111ca565b806124a960f11b14156110b357611092613b3c565b50603d80546001600160401b0319166001600160401b0384161790556111ca565b80614c5360f01b141561114c57603c546001600160401b03808416911611806111055750603c54633b9aca00906110fa90600160c01b90046001600160401b0316846158e7565b6001600160401b0316115b156111235760405163180d062b60e31b815260040160405180910390fd5b603d8054600160401b600160801b031916600160401b6001600160401b038516021790556111ca565b806213531160ea1b14156111b157633b9aca00826001600160401b0316111561118857604051637650e96360e11b815260040160405180910390fd5b603d8054600160801b600160c01b031916600160801b6001600160401b038516021790556111ca565b60405163e1daa9cf60e01b815260040160405180910390fd5b604080516001600160401b0384168152602081018390527f13b367dac93b85d1ed9b3d8961d8b48e1a677c9800bb1613b4b0416b2d5b61d091015b60405180910390a15050565b603354604051631c86b03760e31b81526001600160a01b039091169063e43581b890611241903390600401614ee0565b602060405180830381865afa15801561125e573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061128291906158b3565b61129f57604051633b8d9d7560e21b815260040160405180910390fd5b603354604080516361d027b360e01b815290516001600160a01b03928316928416916361d027b39160048083019260209291908290030181865afa1580156112eb573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061130f9190615912565b6001600160a01b031614611336576040516302979eb960e31b815260040160405180910390fd5b603680546001600160a01b0319166001600160a01b0392909216919091179055565b60335460405163521d4de960e01b81526001600160a01b039091169063521d4de990611388903390600401614ee0565b602060405180830381865afa1580156113a5573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906113c991906158b3565b6113e657604051632678482f60e21b815260040160405180910390fd5b805182511415806114115750806000815181106114055761140561592f565b60200260200101516000145b806114a057506001600160a01b038316158015906114a057508160008151811061143d5761143d61592f565b6020026020010151826001815181106114585761145861592f565b60200260200101511115806114a057508060008151811061147b5761147b61592f565b6020026020010151816001815181106114965761149661592f565b6020026020010151105b156114be57604051631746545d60e11b815260040160405180910390fd5b603780546001600160a01b0319166001600160a01b03851617905581516114ec90603a906020850190614e69565b50805161150090603b906020840190614e69565b50826001600160a01b03167feb74d4d9fea592587c926aeb35eb6a7893fb28db0c1c8eb2eb3c586e7164b76c838360405161153c929190615980565b60405180910390a2505050565b611551614db6565b603d54600160c81b900460ff161561157c576040516313d0ff5960e31b815260040160405180910390fd5b600260015414156115a85760405162461bcd60e51b815260040161159f906159a5565b60405180910390fd5b600260015586518651811415806115bd575080155b156115db576040516346282e8d60e01b815260040160405180910390fd5b603660009054906101000a90046001600160a01b03166001600160a01b03166357de26a46040518163ffffffff1660e01b8152600401602060405180830381865afa15801561162e573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611652919061583b565b606083015261165f613b3c565b60808301526040517f965a177723c641ee49150b583a0b9ad4730bb20d3474e00ae5a65e777c00d67b90611694908a906159dc565b60405180910390a160005b81811015611a66576000604360008b84815181106116bf576116bf61592f565b60200260200101518152602001908152602001600020604051806040016040529081600082015481526020016001820154815250509050600061170c82338760600151886080015161377e565b90508060400151600014158015611740575080604001518a84815181106117355761173561592f565b602002602001015110155b80611767575080600001518a848151811061175d5761175d61592f565b6020026020010151115b156117905780600001518a84815181106117835761178361592f565b6020026020010181815250505b6000856060015182606001516117a6919061586a565b603854633b9aca008d87815181106117c0576117c061592f565b60200260200101516117d2919061586a565b6117dc919061586a565b6117e6919061589f565b90506118148c85815181106117fd576117fd61592f565b60200260200101518285600001511115610c6c5750565b8251811061194a575081516020830151604080546000906118369084906158d0565b92505081905550604360008d86815181106118535761185361592f565b60209081029190910181015182528101919091526040016000908120818155600101819055603d548c51633b9aca0091600160401b90046001600160401b0316908e90889081106118a6576118a661592f565b60200260200101516118b8919061586a565b6118c2919061589f565b9050826080015181106118d65760006118e6565b8083608001516118e691906158d0565b876040018181516118f791906159ef565b905250508b51600080516020615e97833981519152908d908690811061191f5761191f61592f565b60200260200101518460200151600060405161193d93929190615a07565b60405180910390a1611a0b565b80604360008e87815181106119615761196161592f565b60200260200101518152602001908152602001600020600001600082825461198991906158d0565b92505081905550611a098c85815181106119a5576119a561592f565b6020026020010151633b9aca00603d60089054906101000a90046001600160401b03166001600160401b03168e88815181106119e3576119e361592f565b60200260200101516119f5919061586a565b6119ff919061589f565b8860800151613bdd565b505b8086602001818151611a1d91906159ef565b9052508a518b9085908110611a3457611a3461592f565b602002602001015186600001818151611a4d91906159ef565b905250611a5f9250839150615a209050565b905061169f565b50603d54633b9aca0090611a8a90600160401b90046001600160401b0316826158d0565b8351611a96919061586a565b611aa0919061589f565b60416000828254611ab191906159ef565b9091555050604082015160428054600090611acd9084906159ef565b909155505060208201518251611ae7919088888888613d0c565b50600180559695505050505050565b603d54600160c81b900460ff1615611b21576040516313d0ff5960e31b815260040160405180910390fd5b6033546040516333b52a9f60e11b81526001600160a01b039091169063676a553e90611b51903390600401614ee0565b602060405180830381865afa158015611b6e573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611b9291906158b3565b611baf5760405163027f480760e01b815260040160405180910390fd5b603c54600090600160c01b90046001600160401b0316821015611bed57603c54611bea908390600160c01b90046001600160401b03166158d0565b90505b603c54600090600160801b90046001600160401b0316841115611c2a57603c54611c2790600160801b90046001600160401b0316856158d0565b90505b6000611c3b6002633b9aca00615b1f565b611c4983633b9aca006158d0565b611c5785633b9aca006158d0565b611c61908961586a565b611c6b919061586a565b611c75919061589f565b9050611c8181876158d0565b60416000828254611c9291906159ef565b90915550611ca4905087826000613bdd565b5050505050505050565b607e80546108cb90615806565b611cc3614ea3565b60408051600080825260208201909252611ce5918791879187918791906125ec565b90505b949350505050565b610d58338383613e16565b60335460405163521d4de960e01b81526001600160a01b039091169063521d4de990611d2b903390600401614ee0565b602060405180830381865afa158015611d48573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611d6c91906158b3565b611d8957604051632678482f60e21b815260040160405180910390fd5b60398190556040518181527fdd63b3dcdbebad734892f7c7a26d0f647fbc7eec973e0775f5229018ac4ab47a9060200160405180910390a150565b603d54600090600160c81b900460ff1615611df2576040516313d0ff5960e31b815260040160405180910390fd5b6108b882613ecc565b919050565b3382611e0c8282613444565b611e295760405163c19f17a960e01b815260040160405180910390fd5b611e3586868686613ffa565b505050505050565b60335460405163521d4de960e01b81526001600160a01b039091169063521d4de990611e6d903390600401614ee0565b602060405180830381865afa158015611e8a573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611eae91906158b3565b611ecb57604051632678482f60e21b815260040160405180910390fd5b603d805460ff60c81b198116600160c81b9182900460ff1615909102179055565b6060611ef782613368565b611f145760405163062a39dd60e11b815260040160405180910390fd5b8160005b8115611f3b57611f2781615a20565b9050611f34600a8361589f565b9150611f18565b6000816001600160401b03811115611f5557611f556150b3565b6040519080825280601f01601f191660200182016040528015611f7f576020820181803683370190505b5090505b8415611fea57611f946001836158d0565b9150611fa1600a86615b2e565b611fac9060306159ef565b60f81b818381518110611fc157611fc161592f565b60200101906001600160f81b031916908160001a905350611fe3600a8661589f565b9450611f83565b60468054611ff790615806565b151590506120145760405180602001604052806000815250612038565b604681604051602001612028929190615b5e565b6040516020818303038152906040525b95945050505050565b600054610100900460ff16158080156120615750600054600160ff909116105b80612082575061207030613359565b158015612082575060005460ff166001145b6120e55760405162461bcd60e51b815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201526d191e481a5b9a5d1a585b1a5e995960921b606482015260840161159f565b6000805460ff191660011790558015612108576000805461ff0019166101001790555b856001600160a01b0316846001600160a01b03166361d027b36040518163ffffffff1660e01b8152600401602060405180830381865afa158015612150573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906121749190615912565b6001600160a01b03161461219b576040516302979eb960e31b815260040160405180910390fd5b603380546001600160a01b038089166001600160a01b0319928316179092556034805492881692909116821790556040805163313ce56760e01b8152905163313ce567916004808201926020929091908290030181865afa158015612204573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906122289190615bfc565b61223390600a615b1f565b603881905550856001600160a01b031663e9cbd8226040518163ffffffff1660e01b8152600401602060405180830381865afa158015612277573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061229b9190615912565b603580546001600160a01b03199081166001600160a01b0393841617909155603680549091169186169190911790556040516000906122de908490602001615c19565b60408051601f19818403018152919052805190915061230490607d906020840190614de5565b5061230e81614034565b8260405160200161231f9190615c60565b604051602081830303815290604052607e9080519060200190612343929190614de5565b50676765c793fa10079d601b1b603f5542603e5561236760a0850160808601615c8a565b6001600160401b03166123806040860160208701615c8a565b6001600160401b031611806123b05750633b9aca006123a560a0860160808701615c8a565b6001600160401b0316115b806123d657506123c66060850160408601615c8a565b6001600160401b0316633b9aca00115b806123fd5750633b9aca006123f160c0860160a08701615c8a565b6001600160401b031610155b8061240a575060e0840135155b1561242857604051631746545d60e11b815260040160405180910390fd5b833560395561243d6040850160208601615c8a565b603c80546001600160401b0319166001600160401b039290921691909117905561246d6060850160408601615c8a565b603c80546001600160401b0392909216600160401b02600160401b600160801b03199092169190911790556124a86080850160608601615c8a565b603d80546001600160401b0319166001600160401b03929092169190911790556124d860a0850160808601615c8a565b603d80546001600160401b0392909216600160401b02600160401b600160801b031990921691909117905561251360c0850160a08601615c8a565b603d80546001600160401b0392909216600160801b02600160801b600160c01b031990921691909117905561254e60e0850160c08601615ca5565b603d8054911515600160c01b0260ff60c01b19909216919091179055604080516020810190915260e0850135815261258a90603b906001614e69565b5050603d805460ff60c81b1916600160c81b1790558015611e35576000805461ff0019169055604051600181527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989060200160405180910390a1505050505050565b6125f4614ea3565b603d54600160c81b900460ff161561261f576040516313d0ff5960e31b815260040160405180910390fd5b600260015414156126425760405162461bcd60e51b815260040161159f906159a5565b60026001558551875114158061265757508651155b15612675576040516346282e8d60e01b815260040160405180910390fd5b6000806000806000805b8c51811015612bdc5760008d828151811061269c5761269c61592f565b60200260200101519050600060078111156126b9576126b9615cc2565b8160078111156126cb576126cb615cc2565b141561270c576127068d83815181106126e6576126e661592f565b60200260200101518060200190518101906127019190615912565b613ecc565b50612bcb565b600281600781111561272057612720615cc2565b1415612786578c82815181106127385761273861592f565b60200260200101518060200190518101906127539190615cd8565b95509250826127625760455492505b61276c838661410a565b848860600181815161277e91906159ef565b905250612bcb565b600781600781111561279a5761279a615cc2565b14156128735760008060008f85815181106127b7576127b761592f565b60200260200101518060200190518101906127d29190615cfc565b60345460405163d505accf60e01b81526001600160a01b038089166004830152306024830152604482018890526064820187905260ff8616608483015260a4820185905260c48201849052969f50939d50939b509497509550929350169063d505accf9060e401600060405180830381600087803b15801561285357600080fd5b505af1158015612867573d6000803e3d6000fd5b50505050505050612bcb565b8661288357612880613b3c565b96505b600481600781111561289757612897615cc2565b1415612963578c82815181106128af576128af61592f565b60200260200101518060200190518101906128ca9190615cd8565b94509250826128d95760455492505b6128e4838589613bdd565b603c5490945060009061290b90600160c01b90046001600160401b0316633b9aca006158d0565b612919633b9aca008761586a565b612923919061589f565b905061292f85826158d0565b6041600082825461294091906159ef565b92505081905550808960200181815161295991906159ef565b905250612bcb9050565b856129e257603660009054906101000a90046001600160a01b03166001600160a01b03166357de26a46040518163ffffffff1660e01b8152600401602060405180830381865afa1580156129bb573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906129df919061583b565b95505b60018160078111156129f6576129f6615cc2565b1415612a72578c8281518110612a0e57612a0e61592f565b6020026020010151806020019051810190612a29919061583b565b925082612a365760455492505b612a41838789614176565b80965081955050508488604001818151612a5b91906159ef565b90525060208801805185919061277e9083906159ef565b6003816007811115612a8657612a86615cc2565b1415612ae6578c8281518110612a9e57612a9e61592f565b6020026020010151806020019051810190612ab99190615cd8565b9550925082612ac85760455492505b612ad48386888a614296565b848860400181815161277e91906159ef565b6005816007811115612afa57612afa615cc2565b1415612b5c578c8281518110612b1257612b1261592f565b6020026020010151806020019051810190612b2d9190615cd8565b9450925082612b3c5760455492505b612b488385888a614370565b9350838860000181815161277e91906159ef565b6006816007811115612b7057612b70615cc2565b1415612bcb576000808e8481518110612b8b57612b8b61592f565b6020026020010151806020019051810190612ba69190615d4f565b98509196509250905084612bba5760455494505b612bc8858383898c8e61440b565b50505b50612bd581615a20565b905061267f565b508551602087015110612cd35785516020870151600091612bfc916158d0565b90508660600151876040015110612c3357612c2e87606001518860400151612c2491906158d0565b828d8d8d8d613d0c565b612ccd565b8015612ca057603554604051630d43af8160e21b81526001600160a01b039091169063350ebe0490612c6d9084908f903390600401615d8d565b600060405180830381600087803b158015612c8757600080fd5b505af1158015612c9b573d6000803e3d6000fd5b505050505b612ccd333089604001518a60600151612cb991906158d0565b6034546001600160a01b0316929190614547565b50612e5f565b60208601518651600091612ce6916158d0565b6035546040516340c10f1960e01b81529192506001600160a01b0316906340c10f1990612d19908d908590600401615dac565b600060405180830381600087803b158015612d3357600080fd5b505af1158015612d47573d6000803e3d6000fd5b50505050866060015187604001511115612d8b57612d868a88606001518960400151612d7391906158d0565b6034546001600160a01b031691906145b2565b612e5d565b600087604001518860600151612da191906158d0565b90508015612e5b57885115612e4357896001600160a01b031663a5d4096b603560009054906101000a90046001600160a01b0316603460009054906101000a90046001600160a01b03163385878f6040518763ffffffff1660e01b8152600401612e1096959493929190615dc5565b600060405180830381600087803b158015612e2a57600080fd5b505af1158015612e3e573d6000803e3d6000fd5b505050505b603454612e5b906001600160a01b0316333084614547565b505b505b505060018055509198975050505050505050565b603a8181548110610c7f57600080fd5b6001600160a01b039182166000908152604a6020908152604080832093909416825291909152205460011490565b6033546001600160a01b03163314612edc5760405163b90cdbb160e01b815260040160405180910390fd5b603380546001600160a01b0319166001600160a01b0383811691909117909155603654604051630787a21360e51b815291169063f0f4426090612f23908490600401614ee0565b600060405180830381600087803b158015612f3d57600080fd5b505af1158015610a3e573d6000803e3d6000fd5b83421115612f725760405163f87d927160e01b815260040160405180910390fd5b6fa2a8918ca85bafe22016d0b997e4df60600160ff1b03811180612fa957508260ff16601b14158015612fa957508260ff16601c14155b15612fc757604051638baa579f60e01b815260040160405180910390fd5b6000612fd1613ad0565b608254898989612fe08d6145d1565b6040805160208101969096526001600160a01b03948516908601529290911660608401521515608083015260a082015260c0810187905260e0016040516020818303038152906040528051906020012060405160200161305792919061190160f01b81526002810192909252602282015260420190565b604051602081830303815290604052805190602001209050613081886001600160a01b0316613359565b1561315d57604080516020810185905280820184905260f886901b6001600160f81b0319166060820152815160418183030181526061820192839052630b135d3f60e11b9092526001600160a01b038a1691631626ba7e916130e7918591606501615e07565b602060405180830381865afa158015613104573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906131289190615e20565b6001600160e01b031916631626ba7e60e01b1461315857604051638baa579f60e01b815260040160405180910390fd5b613205565b6040805160008082526020820180845284905260ff871692820192909252606081018590526080810184905260019060a0016020604051602081039080840390855afa1580156131b1573d6000803e3d6000fd5b505050602060405103519050886001600160a01b0316816001600160a01b03161415806131e557506001600160a01b038116155b1561320357604051638baa579f60e01b815260040160405180910390fd5b505b611ca4888888613e16565b613218614db6565b60408051600080825260208201909252611ce591879187918791879190611549565b60335460009081906001600160a01b0316331461326a5760405163b90cdbb160e01b815260040160405180910390fd5b613272613b3c565b50506041805460428054600093849055929055915080821061330b5761329881836158d0565b6035546033546040516340c10f1960e01b8152929450600093506001600160a01b03918216926340c10f19926132d49216908690600401615dac565b600060405180830381600087803b1580156132ee57600080fd5b505af1158015613302573d6000803e3d6000fd5b5050505061331c565b61331582826158d0565b9050600091505b60408051838152602081018390527ffeb12225c131aab793a00c5239afb778932d170fa28ce6e9d23703e4bd892121910160405180910390a19091565b6001600160a01b03163b151590565b6000908152604760205260409020546001600160a01b0316151590565b6000908152604960205260409020546001600160a01b031690565b6000818152604760205260409020546001600160a01b031680611dfb5760405163062a39dd60e11b815260040160405180910390fd5b600081815260496020526040902080546001600160a01b0319166001600160a01b038416908117909155819061340b826133a0565b6001600160a01b03167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92560405160405180910390a45050565b600080613450836133a0565b9050806001600160a01b0316846001600160a01b0316148061348b5750836001600160a01b031661348084613385565b6001600160a01b0316145b80611ce857506001600160a01b038082166000908152604a6020908152604080832093881683529290522054600114949350505050565b826001600160a01b03166134d5826133a0565b6001600160a01b0316146134fc5760405163c19f17a960e01b815260040160405180910390fd5b6001600160a01b0382166135235760405163d92e233d60e01b815260040160405180910390fd5b603d54600160c01b900460ff16801561355557506001600160a01b038216600090815260446020526040902054600114155b1561357357604051630b094f2760e31b815260040160405180910390fd5b61357e6000826133d6565b6001600160a01b038084166000818152604860209081526040808320805460001901905593861680835284832080546001019055858352604790915283822080546001600160a01b03191682179055925184939291600080516020615ed783398151915291a4505050565b600080603e54426135fa91906158d0565b603d549091506001600160401b0316811580613614575080155b1561362357603f549250505090565b60006136306001846158d0565b905060006002841161364357600061364e565b61364e6002856158d0565b90506000676765c793fa10079d601b1b676765c793fa10079d601a1b613674868061586a565b61367e91906159ef565b613688919061589f565b90506000676765c793fa10079d601b1b676765c793fa10079d601a1b6136ae878561586a565b6136b891906159ef565b6136c2919061589f565b905060006002836136d3878a61586a565b6136dd919061586a565b6136e7919061589f565b90506000600683866136f9898c61586a565b613703919061586a565b61370d919061586a565b613717919061589f565b9050676765c793fa10079d601b1b81836137318b8b61586a565b61374690676765c793fa10079d601b1b6159ef565b61375091906159ef565b61375a91906159ef565b603f54613767919061586a565b613771919061589f565b9850505050505050505090565b613786614db6565b6000806000613796888787614615565b925092509250633b9aca0083106137c0576040516315fe9b6160e21b815260040160405180910390fd5b6000633b9aca006137d185826158d0565b6137da8a61469e565b6137e4919061586a565b6137ee919061589f565b603d54909150600160801b90046001600160401b031681101561381e5761381981633b9aca006158d0565b61383f565b603d5461383f90600160801b90046001600160401b0316633b9aca006158d0565b603d54909150600160401b90046001600160401b03166000806138676002633b9aca00615b1f565b603c5461387d91906001600160401b031661586a565b83613888868a61586a565b613892919061586a565b10613a1b57603c546001600160401b03166138b26002633b9aca00615b1f565b6138bc919061586a565b603c5485906138db90600160401b90046001600160401b03168661586a565b6138e5919061586a565b6138ef91906158d0565b603c548590633b9aca009061390d906001600160401b03168961586a565b603c5461392b908b90600160401b90046001600160401b031661586a565b61393591906158d0565b61393f919061586a565b613949919061586a565b613953919061589f565b9150633b9aca0060b454613967919061586a565b613971848461586a565b61397b91906159ef565b613989633b9aca008861586a565b11613a16576139a3676765c793fa10079d601b1b8461586a565b633b9aca008a8e602001516139b8919061586a565b6139c2919061586a565b6139cc919061589f565b6139d79060016159ef565b915060b454861115613a125782633b9aca0060b454886139f791906158d0565b613a01919061586a565b613a0b919061589f565b9050613a7e565b5060015b613a7e565b603854613a2c90633b9aca0061586a565b8c518b90613a3b90879061586a565b613a45919061586a565b613a4f919061589f565b613a5a9060016159ef565b915060b554851115613a7a57633b9aca008460b554876139f791906158d0565b5060015b818852613a8b848b61586a565b603854613a9c633b9aca008561586a565b613aa6919061586a565b613ab0919061589f565b602089015260408801525050606085015250608083015250949350505050565b60808054608154604080517f8b73c3c69bb8fe3d512ecc4cf759cc79239f7b179b0ffacaa9a75d522b39400f602082015290810192909252606082015246918101919091523060a082015260009060c00160405160208183030381529060405280519060200120905090565b6000613b466135e9565b90506000676765c793fa10079d601b1b603f5483613b6491906158d0565b604054613b71919061586a565b613b7b919061589f565b90508060416000828254613b8f91906159ef565b9091555050603f82905542603e8190556040805184815260208101929092527fd1fa8ba00a3bf20274346919dce0de62d2a140af2c71fe7e29fa6472eea3bb9d910160405180910390a15090565b600081613bef57613bec613b3c565b91505b60008481526043602052604081206001015490676765c793fa10079d601b1b613c18858461586a565b613c22919061589f565b9050808510613c3357935080613c56565b83613c49676765c793fa10079d601b1b8761586a565b613c53919061589f565b90505b613c6081836158d0565b91508060406000828254613c7491906158d0565b90915550508115801590613ca95750676765c793fa10079d601b1b60b454613c9c919061586a565b613ca6858461586a565b11155b15613cc75760405163228af07f60e21b815260040160405180910390fd5b60008681526043602052604080822060010184905551600080516020615e9783398151915291613cfa9189918591615a07565b60405180910390a15092949350505050565b8515613d2957603454613d29906001600160a01b031684886145b2565b8415611e3557805115613da85760345460355460405163a5d4096b60e01b81526001600160a01b038086169363a5d4096b93613d759391831692169089908b908d908990600401615dc5565b600060405180830381600087803b158015613d8f57600080fd5b505af1158015613da3573d6000803e3d6000fd5b505050505b603554604051630d43af8160e21b81526001600160a01b039091169063350ebe0490613ddc90889088903390600401615d8d565b600060405180830381600087803b158015613df657600080fd5b505af1158015613e0a573d6000803e3d6000fd5b50505050505050505050565b826001600160a01b0316826001600160a01b03161415613e49576040516320c5195360e21b815260040160405180910390fd5b600081613e57576000613e5a565b60015b6001600160a01b038581166000818152604a602090815260408083209489168084529482529182902060ff959095169485905590518615158152939450919290917f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c31910160405180910390a350505050565b603d54600090600160c01b900460ff168015613f1b57506001600160a01b0382166000908152604460205260409020546001141580613f1b575033600090815260446020526040902054600114155b15613f3957604051630b094f2760e31b815260040160405180910390fd5b6001600160a01b038216613f605760405163d92e233d60e01b815260040160405180910390fd5b5060458054600101908190556001600160a01b038216600081815260486020908152604080832080546001019055848352604790915280822080546001600160a01b031916841790555183929190600080516020615ed7833981519152908290a4613fdd60008383604051806020016040528060008152506148cd565b611dfb576040516320149b4360e21b815260040160405180910390fd5b6140058484846134c2565b614011848484846148cd565b61402e576040516320149b4360e21b815260040160405180910390fd5b50505050565b600054610100900460ff1661409f5760405162461bcd60e51b815260206004820152602b60248201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960448201526a6e697469616c697a696e6760a81b606482015260840161159f565b7f3f43a9c6bafb5c7aab4e0cfe239dc5d4c15caf0381c6104188191f78a6640bd860825580516020918201206080556040805180820190915260018152603160f81b9101527fc89efdaa54c0f20c7adf612882df0950f5a951637e0307cdcb4c672f298b8bc6608155565b61411382613368565b6141305760405163062a39dd60e11b815260040160405180910390fd5b6000828152604360205260408120805483929061414e9084906159ef565b9091555050604051600080516020615eb7833981519152906112059084908490600190615a07565b60008033856141858282613444565b6141a25760405163c19f17a960e01b815260040160405180910390fd5b6000878152604360209081526040808320815180830190925280548252600101549181019190915290806141d7838a8a614615565b5091509150633b9aca00821161420057604051631527804d60e31b815260040160405180910390fd5b82602001516040600082825461421691906158d0565b9091555061422590508a6149d0565b603c5460009061424990600160c01b90046001600160401b0316633b9aca006158d0565b614257633b9aca008461586a565b614261919061589f565b905061426d82826158d0565b6041600082825461427e91906159ef565b90915550509251929a92995091975050505050505050565b33846142a28282613444565b6142bf5760405163c19f17a960e01b815260040160405180910390fd5b600086815260436020526040812080548792906142dd9084906158d0565b909155505060008681526043602090815260408083208151808301909252805482526001015491810191909152614315908686614615565b50509050633b9aca00811161433d57604051631527804d60e31b815260040160405180910390fd5b600080516020615eb78339815191528787600060405161435f93929190615a07565b60405180910390a150505050505050565b6000338561437e8282613444565b61439b5760405163c19f17a960e01b815260040160405180910390fd5b6143a787878787614a4f565b603c54909650600090633b9aca00906143d1908990600160801b90046001600160401b031661586a565b6143db919061589f565b905080604160008282546143ef91906159ef565b909155506143ff905081886158d0565b98975050505050505050565b33866144178282613444565b6144345760405163c19f17a960e01b815260040160405180910390fd5b60408051898152602081018890526001600160a01b038916818301526060810187905290517fddd3b70af631334f7552aadb582ed091018e62e103fa8b150ca66cc700d4dac69181900360800190a161448f88868686614a4f565b94506001600160a01b0387163014156144b3576144ad868685613bdd565b50611ca4565b603c546040516320d661ad60e21b815260048101889052602481018790526001600160401b03600160801b830481166044830152600160c01b90920490911660648201526001600160a01b0388169063835986b490608401600060405180830381600087803b15801561452557600080fd5b505af1158015614539573d6000803e3d6000fd5b505050505050505050505050565b6040516001600160a01b038085166024830152831660448201526064810182905261402e9085906323b872dd60e01b906084015b60408051601f198184030181529190526020810180516001600160e01b03166001600160e01b031990931692909217909152614be2565b610a058363a9059cbb60e01b848460405160240161457b929190615dac565b6001600160a01b0381166000908152607f60205260409020546145f58160016159ef565b6001600160a01b039092166000908152607f602052604090209190915590565b6000806000676765c793fa10079d601b1b848760200151614636919061586a565b614640919061589f565b9150603854858760000151614655919061586a565b61465f919061589f565b905081614670576000199250614695565b603c548290614688906001600160401b03168361586a565b614692919061589f565b92505b93509350939050565b6037546000906001600160a01b03166146d757603b6000815481106146c5576146c561592f565b90600052602060002001549050919050565b603754604051635dfba04560e11b81526000916001600160a01b03169063bbf7408a90614708908690600401614ee0565b602060405180830381865afa158015614725573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190614749919061583b565b9050603a60018154811061475f5761475f61592f565b9060005260206000200154811061479757603b6001815481106147845761478461592f565b9060005260206000200154915050919050565b603a6000815481106147ab576147ab61592f565b906000526020600020015481116147d057603b6000815481106147845761478461592f565b603a6000815481106147e4576147e461592f565b9060005260206000200154603a6001815481106148035761480361592f565b906000526020600020015461481891906158d0565b603a60008154811061482c5761482c61592f565b90600052602060002001548261484291906158d0565b603b6000815481106148565761485661592f565b9060005260206000200154603b6001815481106148755761487561592f565b906000526020600020015461488a91906158d0565b614894919061586a565b61489e919061589f565b603b6000815481106148b2576148b261592f565b9060005260206000200154610af091906159ef565b50919050565b60006148e1846001600160a01b0316613359565b156149c857604051630a85bd0160e11b81526001600160a01b0385169063150b7a0290614918903390899088908890600401615e3d565b6020604051808303816000875af1925050508015614953575060408051601f3d908101601f1916820190925261495091810190615e20565b60015b6149ae573d808015614981576040519150601f19603f3d011682016040523d82523d6000602084013e614986565b606091505b5080516149a6576040516320149b4360e21b815260040160405180910390fd5b805181602001fd5b6001600160e01b031916630a85bd0160e11b149050611ce8565b506001611ce8565b60006149db826133a0565b90506149e86000836133d6565b6001600160a01b038116600081815260486020908152604080832080546000190190558583526047825280832080546001600160a01b0319169055604390915280822082815560010182905551849290600080516020615ed7833981519152908390a45050565b60008082614a68676765c793fa10079d601b1b8761586a565b614a72919061589f565b600087815260436020526040902060010154909150614aad5760b4548511614aad5760405163228af07f60e21b815260040160405180910390fd5b60008681526043602052604081206001018054839290614ace9084906159ef565b925050819055508060406000828254614ae791906159ef565b9091555050603954614b0590676765c793fa10079d601b1b9061586a565b83604054614b13919061586a565b1115614b32576040516371239a6160e11b815260040160405180910390fd5b60008681526043602090815260408083208151808301909252805482526001015491810191909152614b65908686614615565b50509050633b9aca008111614b8d57604051631527804d60e31b815260040160405180910390fd5b600080516020615e9783398151915287836001604051614baf93929190615a07565b60405180910390a1676765c793fa10079d601b1b614bcd858461586a565b614bd7919061589f565b979650505050505050565b6000614c37826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b0316614cb49092919063ffffffff16565b805190915015610a055780806020019051810190614c5591906158b3565b610a055760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b606482015260840161159f565b6060611ce8848460008585614cc885613359565b614d145760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e7472616374000000604482015260640161159f565b600080866001600160a01b03168587604051614d309190615e7a565b60006040518083038185875af1925050503d8060008114614d6d576040519150601f19603f3d011682016040523d82523d6000602084013e614d72565b606091505b5091509150614bd782828660608315614d8c575081610af0565b825115614d9c5782518084602001fd5b8160405162461bcd60e51b815260040161159f9190614f7f565b6040518060a0016040528060008152602001600081526020016000815260200160008152602001600081525090565b828054614df190615806565b90600052602060002090601f016020900481019282614e135760008555614e59565b82601f10614e2c57805160ff1916838001178555614e59565b82800160010185558215614e59579182015b82811115614e59578251825591602001919060010190614e3e565b50614e65929150614ecb565b5090565b828054828255906000526020600020908101928215614e595791602002820182811115614e59578251825591602001919060010190614e3e565b6040518060800160405280600081526020016000815260200160008152602001600081525090565b5b80821115614e655760008155600101614ecc565b6001600160a01b0391909116815260200190565b6001600160e01b031981168114610c6c57600080fd5b600060208284031215614f1c57600080fd5b8135610af081614ef4565b60005b83811015614f42578181015183820152602001614f2a565b8381111561402e5750506000910152565b60008151808452614f6b816020860160208601614f27565b601f01601f19169290920160200192915050565b602081526000610af06020830184614f53565b600060208284031215614fa457600080fd5b5035919050565b6001600160a01b0381168114610c6c57600080fd5b60008060408385031215614fd357600080fd5b8235614fde81614fab565b946020939093013593505050565b60008060006060848603121561500157600080fd5b833561500c81614fab565b9250602084013561501c81614fab565b929592945050506040919091013590565b6000806040838503121561504057600080fd5b82359150602083013561505281614fab565b809150509250929050565b60a081016108b8828480518252602081015160208301526040810151604083015260608101516060830152608081015160808301525050565b6000602082840312156150a857600080fd5b8135610af081614fab565b634e487b7160e01b600052604160045260246000fd5b604051601f8201601f191681016001600160401b03811182821017156150f1576150f16150b3565b604052919050565b600082601f83011261510a57600080fd5b81356001600160401b03811115615123576151236150b3565b615136601f8201601f19166020016150c9565b81815284602083860101111561514b57600080fd5b816020850160208301376000918101602001919091529392505050565b60006020828403121561517a57600080fd5b81356001600160401b0381111561519057600080fd5b611ce8848285016150f9565b600080604083850312156151af57600080fd5b50508035926020909101359150565b80356001600160401b0381168114611dfb57600080fd5b600080604083850312156151e857600080fd5b614fde836151be565b60006001600160401b0382111561520a5761520a6150b3565b5060051b60200190565b600082601f83011261522557600080fd5b8135602061523a615235836151f1565b6150c9565b82815260059290921b8401810191818101908684111561525957600080fd5b8286015b84811015615274578035835291830191830161525d565b509695505050505050565b60008060006060848603121561529457600080fd5b833561529f81614fab565b925060208401356001600160401b03808211156152bb57600080fd5b6152c787838801615214565b935060408601359150808211156152dd57600080fd5b506152ea86828701615214565b9150509250925092565b60008060008060008060c0878903121561530d57600080fd5b86356001600160401b038082111561532457600080fd5b6153308a838b01615214565b9750602089013591508082111561534657600080fd5b6153528a838b01615214565b96506040890135915061536482614fab565b90945060608801359061537682614fab565b90935060808801359061538882614fab565b90925060a0880135908082111561539e57600080fd5b506153ab89828a016150f9565b9150509295509295509295565b600080600080608085870312156153ce57600080fd5b5050823594602084013594506040840135936060013592509050565b600082601f8301126153fb57600080fd5b8135602061540b615235836151f1565b82815260059290921b8401810191818101908684111561542a57600080fd5b8286015b84811015615274578035600881106154465760008081fd5b835291830191830161542e565b600082601f83011261546457600080fd5b81356020615474615235836151f1565b82815260059290921b8401810191818101908684111561549357600080fd5b8286015b848110156152745780356001600160401b038111156154b65760008081fd5b6154c48986838b01016150f9565b845250918301918301615497565b600080600080608085870312156154e857600080fd5b84356001600160401b03808211156154ff57600080fd5b61550b888389016153ea565b9550602087013591508082111561552157600080fd5b5061552e87828801615453565b935050604085013561553f81614fab565b9150606085013561554f81614fab565b939692955090935050565b8015158114610c6c57600080fd5b6000806040838503121561557b57600080fd5b823561558681614fab565b915060208301356150528161555a565b600080600080608085870312156155ac57600080fd5b84356155b781614fab565b935060208501356155c781614fab565b92506040850135915060608501356001600160401b038111156155e957600080fd5b6155f5878288016150f9565b91505092959194509250565b600080600080600085870361018081121561561b57600080fd5b863561562681614fab565b9550602087013561563681614fab565b9450604087013561564681614fab565b9350610100605f198201121561565b57600080fd5b506060860191506101608601356001600160401b0381111561567c57600080fd5b615688888289016150f9565b9150509295509295909350565b60008060008060008060c087890312156156ae57600080fd5b86356001600160401b03808211156156c557600080fd5b6156d18a838b016153ea565b975060208901359150808211156156e757600080fd5b6153528a838b01615453565b6000806040838503121561570657600080fd5b823561571181614fab565b9150602083013561505281614fab565b60ff81168114610c6c57600080fd5b600080600080600080600060e0888a03121561574b57600080fd5b873561575681614fab565b9650602088013561576681614fab565b955060408801356157768161555a565b945060608801359350608088013561578d81615721565b9699959850939692959460a0840135945060c09093013592915050565b600080600080608085870312156157c057600080fd5b84356001600160401b03808211156157d757600080fd5b6157e388838901615214565b955060208701359150808211156157f957600080fd5b5061552e87828801615214565b600181811c9082168061581a57607f821691505b602082108114156148c757634e487b7160e01b600052602260045260246000fd5b60006020828403121561584d57600080fd5b5051919050565b634e487b7160e01b600052601160045260246000fd5b600081600019048311821515161561588457615884615854565b500290565b634e487b7160e01b600052601260045260246000fd5b6000826158ae576158ae615889565b500490565b6000602082840312156158c557600080fd5b8151610af08161555a565b6000828210156158e2576158e2615854565b500390565b60006001600160401b0382811684821680830382111561590957615909615854565b01949350505050565b60006020828403121561592457600080fd5b8151610af081614fab565b634e487b7160e01b600052603260045260246000fd5b600081518084526020808501945080840160005b8381101561597557815187529582019590820190600101615959565b509495945050505050565b6040815260006159936040830185615945565b82810360208401526120388185615945565b6020808252601f908201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c00604082015260600190565b602081526000610af06020830184615945565b60008219821115615a0257615a02615854565b500190565b928352602083019190915260ff16604082015260600190565b6000600019821415615a3457615a34615854565b5060010190565b600181815b80851115615a76578160001904821115615a5c57615a5c615854565b80851615615a6957918102915b93841c9390800290615a40565b509250929050565b600082615a8d575060016108b8565b81615a9a575060006108b8565b8160018114615ab05760028114615aba57615ad6565b60019150506108b8565b60ff841115615acb57615acb615854565b50506001821b6108b8565b5060208310610133831016604e8410600b8410161715615af9575081810a6108b8565b615b038383615a3b565b8060001904821115615b1757615b17615854565b029392505050565b6000610af060ff841683615a7e565b600082615b3d57615b3d615889565b500690565b60008151615b54818560208601614f27565b9290920192915050565b600080845481600182811c915080831680615b7a57607f831692505b6020808410821415615b9a57634e487b7160e01b86526022600452602486fd5b818015615bae5760018114615bbf57615bec565b60ff19861689528489019650615bec565b60008b81526020902060005b86811015615be45781548b820152908501908301615bcb565b505084890196505b5050505050506120388185615b42565b600060208284031215615c0e57600080fd5b8151610af081615721565b6e020b733b63290283937ba37b1b7b61608d1b815260008251615c4381600f850160208701614f27565b650815985d5b1d60d21b600f939091019283015250601501919050565b60008251615c72818460208701614f27565b650b5d985d5b1d60d21b920191825250600601919050565b600060208284031215615c9c57600080fd5b610af0826151be565b600060208284031215615cb757600080fd5b8135610af08161555a565b634e487b7160e01b600052602160045260246000fd5b60008060408385031215615ceb57600080fd5b505080516020909101519092909150565b60008060008060008060c08789031215615d1557600080fd5b8651615d2081614fab565b6020880151604089015160608a015160808b015160a0909b0151939c929b509099909850965090945092505050565b60008060008060808587031215615d6557600080fd5b845193506020850151615d7781614fab565b6040860151606090960151949790965092505050565b9283526001600160a01b03918216602084015216604082015260600190565b6001600160a01b03929092168252602082015260400190565b6001600160a01b038781168252868116602083015285166040820152606081018490526080810183905260c060a082018190526000906143ff90830184614f53565b828152604060208201526000611ce86040830184614f53565b600060208284031215615e3257600080fd5b8151610af081614ef4565b6001600160a01b0385811682528416602082015260408101839052608060608201819052600090615e7090830184614f53565b9695505050505050565b60008251615e8c818460208701614f27565b919091019291505056fe70cf49afe7355562d5b022e594790f22b71ad8cc7eec902fa5feac7c67f71091722cb71fa87c947148cefc06dd890af5802a6a00207c5ddecf1191bf71ce3cd4ddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3efa264697066735822122004adf5a8fe3c52a612a81111fd6100f9eeb84fbeb3cfcc411a5bf2e9a14a72cb64736f6c634300080c0033" } \ No newline at end of file diff --git a/deployments/polygon/VaultManagerNoDust_MAI_Implementation.json b/deployments/polygon/VaultManagerNoDust_MAI_Implementation.json new file mode 100644 index 00000000..381d1a43 --- /dev/null +++ b/deployments/polygon/VaultManagerNoDust_MAI_Implementation.json @@ -0,0 +1,1832 @@ +{ + "address": "0xF929345E5A5Ac2f86c7a5802c1CE4aa46f524b28", + "abi": [ + { + "inputs": [ + { + "internalType": "uint256", + "name": "dust_", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "dustCollateral_", + "type": "uint256" + } + ], + "stateMutability": "nonpayable", + "type": "constructor" + }, + { + "inputs": [], + "name": "ApprovalToCaller", + "type": "error" + }, + { + "inputs": [], + "name": "ApprovalToOwner", + "type": "error" + }, + { + "inputs": [], + "name": "DebtCeilingExceeded", + "type": "error" + }, + { + "inputs": [], + "name": "DustyLeftoverAmount", + "type": "error" + }, + { + "inputs": [], + "name": "ExpiredDeadline", + "type": "error" + }, + { + "inputs": [], + "name": "HealthyVault", + "type": "error" + }, + { + "inputs": [], + "name": "IncompatibleLengths", + "type": "error" + }, + { + "inputs": [], + "name": "InsolventVault", + "type": "error" + }, + { + "inputs": [], + "name": "InvalidParameterType", + "type": "error" + }, + { + "inputs": [], + "name": "InvalidParameterValue", + "type": "error" + }, + { + "inputs": [], + "name": "InvalidSetOfParameters", + "type": "error" + }, + { + "inputs": [], + "name": "InvalidSignature", + "type": "error" + }, + { + "inputs": [], + "name": "InvalidTreasury", + "type": "error" + }, + { + "inputs": [], + "name": "NonERC721Receiver", + "type": "error" + }, + { + "inputs": [], + "name": "NonexistentVault", + "type": "error" + }, + { + "inputs": [], + "name": "NotApproved", + "type": "error" + }, + { + "inputs": [], + "name": "NotGovernor", + "type": "error" + }, + { + "inputs": [], + "name": "NotGovernorOrGuardian", + "type": "error" + }, + { + "inputs": [], + "name": "NotTreasury", + "type": "error" + }, + { + "inputs": [], + "name": "NotVaultManager", + "type": "error" + }, + { + "inputs": [], + "name": "NotWhitelisted", + "type": "error" + }, + { + "inputs": [], + "name": "Paused", + "type": "error" + }, + { + "inputs": [], + "name": "TooHighParameterValue", + "type": "error" + }, + { + "inputs": [], + "name": "TooSmallParameterValue", + "type": "error" + }, + { + "inputs": [], + "name": "ZeroAddress", + "type": "error" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint256", + "name": "surplusEndValue", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "badDebtEndValue", + "type": "uint256" + } + ], + "name": "AccruedToTreasury", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "owner", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "approved", + "type": "address" + }, + { + "indexed": true, + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + } + ], + "name": "Approval", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "owner", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "operator", + "type": "address" + }, + { + "indexed": false, + "internalType": "bool", + "name": "approved", + "type": "bool" + } + ], + "name": "ApprovalForAll", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint256", + "name": "vaultID", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "collateralAmount", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint8", + "name": "isIncrease", + "type": "uint8" + } + ], + "name": "CollateralAmountUpdated", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint256", + "name": "debtCeiling", + "type": "uint256" + } + ], + "name": "DebtCeilingUpdated", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint256", + "name": "srcVaultID", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "dstVaultID", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "address", + "name": "dstVaultManager", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "DebtTransferred", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint64", + "name": "param", + "type": "uint64" + }, + { + "indexed": false, + "internalType": "bytes32", + "name": "what", + "type": "bytes32" + } + ], + "name": "FiledUint64", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint256", + "name": "value", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "timestamp", + "type": "uint256" + } + ], + "name": "InterestAccumulatorUpdated", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint256", + "name": "vaultID", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "internalAmount", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint8", + "name": "isIncrease", + "type": "uint8" + } + ], + "name": "InternalDebtUpdated", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint256[]", + "name": "vaultIDs", + "type": "uint256[]" + } + ], + "name": "LiquidatedVaults", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "_veBoostProxy", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256[]", + "name": "xBoost", + "type": "uint256[]" + }, + { + "indexed": false, + "internalType": "uint256[]", + "name": "yBoost", + "type": "uint256[]" + } + ], + "name": "LiquidationBoostParametersUpdated", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "from", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "to", + "type": "address" + }, + { + "indexed": true, + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + } + ], + "name": "Transfer", + "type": "event" + }, + { + "inputs": [], + "name": "BASE_INTEREST", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "BASE_PARAMS", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "DOMAIN_SEPARATOR", + "outputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "HALF_BASE_INTEREST", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "accrueInterestToTreasury", + "outputs": [ + { + "internalType": "uint256", + "name": "surplusValue", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "badDebtValue", + "type": "uint256" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "enum ActionType[]", + "name": "actions", + "type": "uint8[]" + }, + { + "internalType": "bytes[]", + "name": "datas", + "type": "bytes[]" + }, + { + "internalType": "address", + "name": "from", + "type": "address" + }, + { + "internalType": "address", + "name": "to", + "type": "address" + } + ], + "name": "angle", + "outputs": [ + { + "components": [ + { + "internalType": "uint256", + "name": "stablecoinAmountToGive", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "stablecoinAmountToReceive", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "collateralAmountToGive", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "collateralAmountToReceive", + "type": "uint256" + } + ], + "internalType": "struct PaymentData", + "name": "", + "type": "tuple" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "enum ActionType[]", + "name": "actions", + "type": "uint8[]" + }, + { + "internalType": "bytes[]", + "name": "datas", + "type": "bytes[]" + }, + { + "internalType": "address", + "name": "from", + "type": "address" + }, + { + "internalType": "address", + "name": "to", + "type": "address" + }, + { + "internalType": "address", + "name": "who", + "type": "address" + }, + { + "internalType": "bytes", + "name": "repayData", + "type": "bytes" + } + ], + "name": "angle", + "outputs": [ + { + "components": [ + { + "internalType": "uint256", + "name": "stablecoinAmountToGive", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "stablecoinAmountToReceive", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "collateralAmountToGive", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "collateralAmountToReceive", + "type": "uint256" + } + ], + "internalType": "struct PaymentData", + "name": "paymentData", + "type": "tuple" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "to", + "type": "address" + }, + { + "internalType": "uint256", + "name": "vaultID", + "type": "uint256" + } + ], + "name": "approve", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "badDebt", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "owner", + "type": "address" + } + ], + "name": "balanceOf", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "borrowFee", + "outputs": [ + { + "internalType": "uint64", + "name": "", + "type": "uint64" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "vaultID", + "type": "uint256" + }, + { + "internalType": "address", + "name": "liquidator", + "type": "address" + } + ], + "name": "checkLiquidation", + "outputs": [ + { + "components": [ + { + "internalType": "uint256", + "name": "maxStablecoinAmountToRepay", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "maxCollateralAmountGiven", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "thresholdRepayAmount", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "discount", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "currentDebt", + "type": "uint256" + } + ], + "internalType": "struct LiquidationOpportunity", + "name": "liqOpp", + "type": "tuple" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "collateral", + "outputs": [ + { + "internalType": "contract IERC20", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "collateralFactor", + "outputs": [ + { + "internalType": "uint64", + "name": "", + "type": "uint64" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "toVault", + "type": "address" + } + ], + "name": "createVault", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "debtCeiling", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "dust", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "dustOverride", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "vaultID", + "type": "uint256" + } + ], + "name": "getApproved", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "vaultID", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "stablecoinAmount", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "senderBorrowFee", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "senderRepayFee", + "type": "uint256" + } + ], + "name": "getDebtOut", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "getTotalDebt", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "vaultID", + "type": "uint256" + } + ], + "name": "getVaultDebt", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "contract ITreasury", + "name": "_treasury", + "type": "address" + }, + { + "internalType": "contract IERC20", + "name": "_collateral", + "type": "address" + }, + { + "internalType": "contract IOracle", + "name": "_oracle", + "type": "address" + }, + { + "components": [ + { + "internalType": "uint256", + "name": "debtCeiling", + "type": "uint256" + }, + { + "internalType": "uint64", + "name": "collateralFactor", + "type": "uint64" + }, + { + "internalType": "uint64", + "name": "targetHealthFactor", + "type": "uint64" + }, + { + "internalType": "uint64", + "name": "interestRate", + "type": "uint64" + }, + { + "internalType": "uint64", + "name": "liquidationSurcharge", + "type": "uint64" + }, + { + "internalType": "uint64", + "name": "maxLiquidationDiscount", + "type": "uint64" + }, + { + "internalType": "bool", + "name": "whitelistingActivated", + "type": "bool" + }, + { + "internalType": "uint256", + "name": "baseBoost", + "type": "uint256" + } + ], + "internalType": "struct VaultParameters", + "name": "params", + "type": "tuple" + }, + { + "internalType": "string", + "name": "_symbol", + "type": "string" + } + ], + "name": "initialize", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "interestAccumulator", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "interestRate", + "outputs": [ + { + "internalType": "uint64", + "name": "", + "type": "uint64" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "owner", + "type": "address" + }, + { + "internalType": "address", + "name": "operator", + "type": "address" + } + ], + "name": "isApprovedForAll", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "spender", + "type": "address" + }, + { + "internalType": "uint256", + "name": "vaultID", + "type": "uint256" + } + ], + "name": "isApprovedOrOwner", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "name": "isWhitelisted", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "lastInterestAccumulatorUpdated", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256[]", + "name": "vaultIDs", + "type": "uint256[]" + }, + { + "internalType": "uint256[]", + "name": "amounts", + "type": "uint256[]" + }, + { + "internalType": "address", + "name": "from", + "type": "address" + }, + { + "internalType": "address", + "name": "to", + "type": "address" + }, + { + "internalType": "address", + "name": "who", + "type": "address" + }, + { + "internalType": "bytes", + "name": "data", + "type": "bytes" + } + ], + "name": "liquidate", + "outputs": [ + { + "components": [ + { + "internalType": "uint256", + "name": "stablecoinAmountToReceive", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "collateralAmountToGive", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "badDebtFromLiquidation", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "oracleValue", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "newInterestAccumulator", + "type": "uint256" + } + ], + "internalType": "struct LiquidatorData", + "name": "liqData", + "type": "tuple" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256[]", + "name": "vaultIDs", + "type": "uint256[]" + }, + { + "internalType": "uint256[]", + "name": "amounts", + "type": "uint256[]" + }, + { + "internalType": "address", + "name": "from", + "type": "address" + }, + { + "internalType": "address", + "name": "to", + "type": "address" + } + ], + "name": "liquidate", + "outputs": [ + { + "components": [ + { + "internalType": "uint256", + "name": "stablecoinAmountToReceive", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "collateralAmountToGive", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "badDebtFromLiquidation", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "oracleValue", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "newInterestAccumulator", + "type": "uint256" + } + ], + "internalType": "struct LiquidatorData", + "name": "", + "type": "tuple" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "liquidationSurcharge", + "outputs": [ + { + "internalType": "uint64", + "name": "", + "type": "uint64" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "maxLiquidationDiscount", + "outputs": [ + { + "internalType": "uint64", + "name": "", + "type": "uint64" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "name", + "outputs": [ + { + "internalType": "string", + "name": "", + "type": "string" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "owner", + "type": "address" + } + ], + "name": "nonces", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "oracle", + "outputs": [ + { + "internalType": "contract IOracle", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "vaultID", + "type": "uint256" + } + ], + "name": "ownerOf", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "paused", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "owner", + "type": "address" + }, + { + "internalType": "address", + "name": "spender", + "type": "address" + }, + { + "internalType": "bool", + "name": "approved", + "type": "bool" + }, + { + "internalType": "uint256", + "name": "deadline", + "type": "uint256" + }, + { + "internalType": "uint8", + "name": "v", + "type": "uint8" + }, + { + "internalType": "bytes32", + "name": "r", + "type": "bytes32" + }, + { + "internalType": "bytes32", + "name": "s", + "type": "bytes32" + } + ], + "name": "permit", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "repayFee", + "outputs": [ + { + "internalType": "uint64", + "name": "", + "type": "uint64" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "from", + "type": "address" + }, + { + "internalType": "address", + "name": "to", + "type": "address" + }, + { + "internalType": "uint256", + "name": "vaultID", + "type": "uint256" + } + ], + "name": "safeTransferFrom", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "from", + "type": "address" + }, + { + "internalType": "address", + "name": "to", + "type": "address" + }, + { + "internalType": "uint256", + "name": "vaultID", + "type": "uint256" + }, + { + "internalType": "bytes", + "name": "_data", + "type": "bytes" + } + ], + "name": "safeTransferFrom", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "operator", + "type": "address" + }, + { + "internalType": "bool", + "name": "approved", + "type": "bool" + } + ], + "name": "setApprovalForAll", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "string", + "name": "baseURI_", + "type": "string" + } + ], + "name": "setBaseURI", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "_debtCeiling", + "type": "uint256" + } + ], + "name": "setDebtCeiling", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "newDust", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "newDustCollateral", + "type": "uint256" + } + ], + "name": "setDusts", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_veBoostProxy", + "type": "address" + }, + { + "internalType": "uint256[]", + "name": "xBoost", + "type": "uint256[]" + }, + { + "internalType": "uint256[]", + "name": "yBoost", + "type": "uint256[]" + } + ], + "name": "setLiquidationBoostParameters", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_oracle", + "type": "address" + } + ], + "name": "setOracle", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_treasury", + "type": "address" + } + ], + "name": "setTreasury", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint64", + "name": "param", + "type": "uint64" + }, + { + "internalType": "bytes32", + "name": "what", + "type": "bytes32" + } + ], + "name": "setUint64", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "stablecoin", + "outputs": [ + { + "internalType": "contract IAgToken", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes4", + "name": "interfaceId", + "type": "bytes4" + } + ], + "name": "supportsInterface", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "pure", + "type": "function" + }, + { + "inputs": [], + "name": "surplus", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "symbol", + "outputs": [ + { + "internalType": "string", + "name": "", + "type": "string" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "targetHealthFactor", + "outputs": [ + { + "internalType": "uint64", + "name": "", + "type": "uint64" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "togglePause", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "target", + "type": "address" + } + ], + "name": "toggleWhitelist", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "vaultID", + "type": "uint256" + } + ], + "name": "tokenURI", + "outputs": [ + { + "internalType": "string", + "name": "", + "type": "string" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "totalNormalizedDebt", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "from", + "type": "address" + }, + { + "internalType": "address", + "name": "to", + "type": "address" + }, + { + "internalType": "uint256", + "name": "vaultID", + "type": "uint256" + } + ], + "name": "transferFrom", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "treasury", + "outputs": [ + { + "internalType": "contract ITreasury", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "name": "vaultData", + "outputs": [ + { + "internalType": "uint256", + "name": "collateralAmount", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "normalizedDebt", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "vaultIDCount", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "veBoostProxy", + "outputs": [ + { + "internalType": "contract IVeBoostProxy", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "whitelistingActivated", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "name": "xLiquidationBoost", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "name": "yLiquidationBoost", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + } + ], + "transactionHash": "0xd9c8be3f319b09b384b83704bb7a17c98e8dc911fb4aaceb526bb15a365cb301", + "receipt": { + "to": null, + "from": "0xfdA462548Ce04282f4B6D6619823a7C64Fdc0185", + "contractAddress": "0xF929345E5A5Ac2f86c7a5802c1CE4aa46f524b28", + "transactionIndex": 4, + "gasUsed": "5334111", + "logsBloom": "0x00000000000000000000000000000000000000000000000000000000040000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000000000000800000000000000000000100000000000000000000000000000000000000000000000000000000000080000000000000000000000000000000000000000000000000000002000000000000000000000000200000000000000000000000000000000000000000000000000000200000005000000000000000000001000000000000000800000000000000100000000000000000000000000000000000000000000002000000000000000000000000100000", + "blockHash": "0x145944e49cda91b0e6bbacbdfec1eceadc937c9cb1eef86e9991bbcd0b75e3a9", + "transactionHash": "0xd9c8be3f319b09b384b83704bb7a17c98e8dc911fb4aaceb526bb15a365cb301", + "logs": [ + { + "transactionIndex": 4, + "blockNumber": 35594816, + "transactionHash": "0xd9c8be3f319b09b384b83704bb7a17c98e8dc911fb4aaceb526bb15a365cb301", + "address": "0x0000000000000000000000000000000000001010", + "topics": [ + "0x4dfe1bbbcf077ddc3e01291eea2d5c70c2b422b415d95645b9adcfd678cb1d63", + "0x0000000000000000000000000000000000000000000000000000000000001010", + "0x000000000000000000000000fda462548ce04282f4b6d6619823a7c64fdc0185", + "0x000000000000000000000000ef46d5fe753c988606e6f703260d816af53b03eb" + ], + "data": "0x0000000000000000000000000000000000000000000000000e813915adbc8715000000000000000000000000000000000000000000000005200c39a5c4d29ba6000000000000000000000000000000000000000000003bdea59eaa0eeeeec2da000000000000000000000000000000000000000000000005118b009017161491000000000000000000000000000000000000000000003bdeb41fe3249cab49ef", + "logIndex": 14, + "blockHash": "0x145944e49cda91b0e6bbacbdfec1eceadc937c9cb1eef86e9991bbcd0b75e3a9" + } + ], + "blockNumber": 35594816, + "cumulativeGasUsed": "5720899", + "status": 1, + "byzantium": true + }, + "args": [ + 0, + 0 + ], + "numDeployments": 1, + "solcInputHash": "97428e5cc1402a581bde2d79fd2b13fe", + "metadata": "{\"compiler\":{\"version\":\"0.8.12+commit.f00d7308\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"dust_\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"dustCollateral_\",\"type\":\"uint256\"}],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"inputs\":[],\"name\":\"ApprovalToCaller\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"ApprovalToOwner\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"DebtCeilingExceeded\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"DustyLeftoverAmount\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"ExpiredDeadline\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"HealthyVault\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"IncompatibleLengths\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"InsolventVault\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"InvalidParameterType\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"InvalidParameterValue\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"InvalidSetOfParameters\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"InvalidSignature\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"InvalidTreasury\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"NonERC721Receiver\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"NonexistentVault\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"NotApproved\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"NotGovernor\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"NotGovernorOrGuardian\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"NotTreasury\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"NotVaultManager\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"NotWhitelisted\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"Paused\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"TooHighParameterValue\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"TooSmallParameterValue\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"ZeroAddress\",\"type\":\"error\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"surplusEndValue\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"badDebtEndValue\",\"type\":\"uint256\"}],\"name\":\"AccruedToTreasury\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"owner\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"approved\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"tokenId\",\"type\":\"uint256\"}],\"name\":\"Approval\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"owner\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"operator\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"bool\",\"name\":\"approved\",\"type\":\"bool\"}],\"name\":\"ApprovalForAll\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"vaultID\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"collateralAmount\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint8\",\"name\":\"isIncrease\",\"type\":\"uint8\"}],\"name\":\"CollateralAmountUpdated\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"debtCeiling\",\"type\":\"uint256\"}],\"name\":\"DebtCeilingUpdated\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"srcVaultID\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"dstVaultID\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"dstVaultManager\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"DebtTransferred\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint64\",\"name\":\"param\",\"type\":\"uint64\"},{\"indexed\":false,\"internalType\":\"bytes32\",\"name\":\"what\",\"type\":\"bytes32\"}],\"name\":\"FiledUint64\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"value\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"timestamp\",\"type\":\"uint256\"}],\"name\":\"InterestAccumulatorUpdated\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"vaultID\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"internalAmount\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint8\",\"name\":\"isIncrease\",\"type\":\"uint8\"}],\"name\":\"InternalDebtUpdated\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256[]\",\"name\":\"vaultIDs\",\"type\":\"uint256[]\"}],\"name\":\"LiquidatedVaults\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"_veBoostProxy\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256[]\",\"name\":\"xBoost\",\"type\":\"uint256[]\"},{\"indexed\":false,\"internalType\":\"uint256[]\",\"name\":\"yBoost\",\"type\":\"uint256[]\"}],\"name\":\"LiquidationBoostParametersUpdated\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"from\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"to\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"tokenId\",\"type\":\"uint256\"}],\"name\":\"Transfer\",\"type\":\"event\"},{\"inputs\":[],\"name\":\"BASE_INTEREST\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"BASE_PARAMS\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"DOMAIN_SEPARATOR\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"HALF_BASE_INTEREST\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"accrueInterestToTreasury\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"surplusValue\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"badDebtValue\",\"type\":\"uint256\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"enum ActionType[]\",\"name\":\"actions\",\"type\":\"uint8[]\"},{\"internalType\":\"bytes[]\",\"name\":\"datas\",\"type\":\"bytes[]\"},{\"internalType\":\"address\",\"name\":\"from\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"to\",\"type\":\"address\"}],\"name\":\"angle\",\"outputs\":[{\"components\":[{\"internalType\":\"uint256\",\"name\":\"stablecoinAmountToGive\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"stablecoinAmountToReceive\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"collateralAmountToGive\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"collateralAmountToReceive\",\"type\":\"uint256\"}],\"internalType\":\"struct PaymentData\",\"name\":\"\",\"type\":\"tuple\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"enum ActionType[]\",\"name\":\"actions\",\"type\":\"uint8[]\"},{\"internalType\":\"bytes[]\",\"name\":\"datas\",\"type\":\"bytes[]\"},{\"internalType\":\"address\",\"name\":\"from\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"to\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"who\",\"type\":\"address\"},{\"internalType\":\"bytes\",\"name\":\"repayData\",\"type\":\"bytes\"}],\"name\":\"angle\",\"outputs\":[{\"components\":[{\"internalType\":\"uint256\",\"name\":\"stablecoinAmountToGive\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"stablecoinAmountToReceive\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"collateralAmountToGive\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"collateralAmountToReceive\",\"type\":\"uint256\"}],\"internalType\":\"struct PaymentData\",\"name\":\"paymentData\",\"type\":\"tuple\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"to\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"vaultID\",\"type\":\"uint256\"}],\"name\":\"approve\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"badDebt\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"owner\",\"type\":\"address\"}],\"name\":\"balanceOf\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"borrowFee\",\"outputs\":[{\"internalType\":\"uint64\",\"name\":\"\",\"type\":\"uint64\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"vaultID\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"liquidator\",\"type\":\"address\"}],\"name\":\"checkLiquidation\",\"outputs\":[{\"components\":[{\"internalType\":\"uint256\",\"name\":\"maxStablecoinAmountToRepay\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"maxCollateralAmountGiven\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"thresholdRepayAmount\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"discount\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"currentDebt\",\"type\":\"uint256\"}],\"internalType\":\"struct LiquidationOpportunity\",\"name\":\"liqOpp\",\"type\":\"tuple\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"collateral\",\"outputs\":[{\"internalType\":\"contract IERC20\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"collateralFactor\",\"outputs\":[{\"internalType\":\"uint64\",\"name\":\"\",\"type\":\"uint64\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"toVault\",\"type\":\"address\"}],\"name\":\"createVault\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"debtCeiling\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"dust\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"dustOverride\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"vaultID\",\"type\":\"uint256\"}],\"name\":\"getApproved\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"vaultID\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"stablecoinAmount\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"senderBorrowFee\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"senderRepayFee\",\"type\":\"uint256\"}],\"name\":\"getDebtOut\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"getTotalDebt\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"vaultID\",\"type\":\"uint256\"}],\"name\":\"getVaultDebt\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"contract ITreasury\",\"name\":\"_treasury\",\"type\":\"address\"},{\"internalType\":\"contract IERC20\",\"name\":\"_collateral\",\"type\":\"address\"},{\"internalType\":\"contract IOracle\",\"name\":\"_oracle\",\"type\":\"address\"},{\"components\":[{\"internalType\":\"uint256\",\"name\":\"debtCeiling\",\"type\":\"uint256\"},{\"internalType\":\"uint64\",\"name\":\"collateralFactor\",\"type\":\"uint64\"},{\"internalType\":\"uint64\",\"name\":\"targetHealthFactor\",\"type\":\"uint64\"},{\"internalType\":\"uint64\",\"name\":\"interestRate\",\"type\":\"uint64\"},{\"internalType\":\"uint64\",\"name\":\"liquidationSurcharge\",\"type\":\"uint64\"},{\"internalType\":\"uint64\",\"name\":\"maxLiquidationDiscount\",\"type\":\"uint64\"},{\"internalType\":\"bool\",\"name\":\"whitelistingActivated\",\"type\":\"bool\"},{\"internalType\":\"uint256\",\"name\":\"baseBoost\",\"type\":\"uint256\"}],\"internalType\":\"struct VaultParameters\",\"name\":\"params\",\"type\":\"tuple\"},{\"internalType\":\"string\",\"name\":\"_symbol\",\"type\":\"string\"}],\"name\":\"initialize\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"interestAccumulator\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"interestRate\",\"outputs\":[{\"internalType\":\"uint64\",\"name\":\"\",\"type\":\"uint64\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"owner\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"operator\",\"type\":\"address\"}],\"name\":\"isApprovedForAll\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"spender\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"vaultID\",\"type\":\"uint256\"}],\"name\":\"isApprovedOrOwner\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"name\":\"isWhitelisted\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"lastInterestAccumulatorUpdated\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256[]\",\"name\":\"vaultIDs\",\"type\":\"uint256[]\"},{\"internalType\":\"uint256[]\",\"name\":\"amounts\",\"type\":\"uint256[]\"},{\"internalType\":\"address\",\"name\":\"from\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"to\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"who\",\"type\":\"address\"},{\"internalType\":\"bytes\",\"name\":\"data\",\"type\":\"bytes\"}],\"name\":\"liquidate\",\"outputs\":[{\"components\":[{\"internalType\":\"uint256\",\"name\":\"stablecoinAmountToReceive\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"collateralAmountToGive\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"badDebtFromLiquidation\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"oracleValue\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"newInterestAccumulator\",\"type\":\"uint256\"}],\"internalType\":\"struct LiquidatorData\",\"name\":\"liqData\",\"type\":\"tuple\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256[]\",\"name\":\"vaultIDs\",\"type\":\"uint256[]\"},{\"internalType\":\"uint256[]\",\"name\":\"amounts\",\"type\":\"uint256[]\"},{\"internalType\":\"address\",\"name\":\"from\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"to\",\"type\":\"address\"}],\"name\":\"liquidate\",\"outputs\":[{\"components\":[{\"internalType\":\"uint256\",\"name\":\"stablecoinAmountToReceive\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"collateralAmountToGive\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"badDebtFromLiquidation\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"oracleValue\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"newInterestAccumulator\",\"type\":\"uint256\"}],\"internalType\":\"struct LiquidatorData\",\"name\":\"\",\"type\":\"tuple\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"liquidationSurcharge\",\"outputs\":[{\"internalType\":\"uint64\",\"name\":\"\",\"type\":\"uint64\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"maxLiquidationDiscount\",\"outputs\":[{\"internalType\":\"uint64\",\"name\":\"\",\"type\":\"uint64\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"name\",\"outputs\":[{\"internalType\":\"string\",\"name\":\"\",\"type\":\"string\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"owner\",\"type\":\"address\"}],\"name\":\"nonces\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"oracle\",\"outputs\":[{\"internalType\":\"contract IOracle\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"vaultID\",\"type\":\"uint256\"}],\"name\":\"ownerOf\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"paused\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"owner\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"spender\",\"type\":\"address\"},{\"internalType\":\"bool\",\"name\":\"approved\",\"type\":\"bool\"},{\"internalType\":\"uint256\",\"name\":\"deadline\",\"type\":\"uint256\"},{\"internalType\":\"uint8\",\"name\":\"v\",\"type\":\"uint8\"},{\"internalType\":\"bytes32\",\"name\":\"r\",\"type\":\"bytes32\"},{\"internalType\":\"bytes32\",\"name\":\"s\",\"type\":\"bytes32\"}],\"name\":\"permit\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"repayFee\",\"outputs\":[{\"internalType\":\"uint64\",\"name\":\"\",\"type\":\"uint64\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"from\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"to\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"vaultID\",\"type\":\"uint256\"}],\"name\":\"safeTransferFrom\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"from\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"to\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"vaultID\",\"type\":\"uint256\"},{\"internalType\":\"bytes\",\"name\":\"_data\",\"type\":\"bytes\"}],\"name\":\"safeTransferFrom\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"operator\",\"type\":\"address\"},{\"internalType\":\"bool\",\"name\":\"approved\",\"type\":\"bool\"}],\"name\":\"setApprovalForAll\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"string\",\"name\":\"baseURI_\",\"type\":\"string\"}],\"name\":\"setBaseURI\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_debtCeiling\",\"type\":\"uint256\"}],\"name\":\"setDebtCeiling\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"newDust\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"newDustCollateral\",\"type\":\"uint256\"}],\"name\":\"setDusts\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_veBoostProxy\",\"type\":\"address\"},{\"internalType\":\"uint256[]\",\"name\":\"xBoost\",\"type\":\"uint256[]\"},{\"internalType\":\"uint256[]\",\"name\":\"yBoost\",\"type\":\"uint256[]\"}],\"name\":\"setLiquidationBoostParameters\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_oracle\",\"type\":\"address\"}],\"name\":\"setOracle\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_treasury\",\"type\":\"address\"}],\"name\":\"setTreasury\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint64\",\"name\":\"param\",\"type\":\"uint64\"},{\"internalType\":\"bytes32\",\"name\":\"what\",\"type\":\"bytes32\"}],\"name\":\"setUint64\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"stablecoin\",\"outputs\":[{\"internalType\":\"contract IAgToken\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes4\",\"name\":\"interfaceId\",\"type\":\"bytes4\"}],\"name\":\"supportsInterface\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"pure\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"surplus\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"symbol\",\"outputs\":[{\"internalType\":\"string\",\"name\":\"\",\"type\":\"string\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"targetHealthFactor\",\"outputs\":[{\"internalType\":\"uint64\",\"name\":\"\",\"type\":\"uint64\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"togglePause\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"target\",\"type\":\"address\"}],\"name\":\"toggleWhitelist\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"vaultID\",\"type\":\"uint256\"}],\"name\":\"tokenURI\",\"outputs\":[{\"internalType\":\"string\",\"name\":\"\",\"type\":\"string\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"totalNormalizedDebt\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"from\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"to\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"vaultID\",\"type\":\"uint256\"}],\"name\":\"transferFrom\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"treasury\",\"outputs\":[{\"internalType\":\"contract ITreasury\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"name\":\"vaultData\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"collateralAmount\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"normalizedDebt\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"vaultIDCount\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"veBoostProxy\",\"outputs\":[{\"internalType\":\"contract IVeBoostProxy\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"whitelistingActivated\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"name\":\"xLiquidationBoost\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"name\":\"yLiquidationBoost\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"}],\"devdoc\":{\"author\":\"Angle Core Team\",\"kind\":\"dev\",\"methods\":{\"accrueInterestToTreasury()\":{\"details\":\"`surplus` and `badDebt` should be reset to 0 once their current value have been given to the `treasury` contract\",\"returns\":{\"badDebtValue\":\"Value of the bad debt communicated to the `Treasury`\",\"surplusValue\":\"Value of the surplus communicated to the `Treasury`\"}},\"angle(uint8[],bytes[],address,address,address,bytes)\":{\"details\":\"This function is optimized to reduce gas cost due to payment from or to the user and that expensive calls or computations (like `oracleValue`) are done only onceWhen specifying `vaultID` in `data`, it is important to know that if you specify `vaultID = 0`, it will simply use the latest `vaultID`. This is the default behavior, and unless you're engaging into some complex protocol actions it is encouraged to use `vaultID = 0` only when the first action of the batch is `createVault`\",\"params\":{\"actions\":\"Set of actions to perform\",\"datas\":\"Data to be decoded for each action: it can include like the `vaultID` or the `stablecoinAmount` to borrow\",\"from\":\"Address from which stablecoins will be taken if one action includes burning stablecoins. This address should either be the `msg.sender` or be approved by the latter\",\"repayData\":\"Data to pass to the repayment contract in case of\",\"to\":\"Address to which stablecoins and/or collateral will be sent in case of\",\"who\":\"Address of the contract to handle in case of repayment of stablecoins from received collateral\"},\"returns\":{\"paymentData\":\"Struct containing the accounting changes from the protocol's perspective (like how much of collateral or how much has been received). Note that the values in the struct are not aggregated and you could have in the output a positive amount of stablecoins to receive as well as a positive amount of stablecoins to give\"}},\"approve(address,uint256)\":{\"details\":\"Gives permission to `to` to transfer `tokenId` token to another account. The approval is cleared when the token is transferred. Only a single account can be approved at a time, so approving the zero address clears previous approvals. Requirements: - The caller must own the token or be an approved operator. - `tokenId` must exist. Emits an {Approval} event.\"},\"balanceOf(address)\":{\"details\":\"Returns the number of tokens in ``owner``'s account.\"},\"checkLiquidation(uint256,address)\":{\"details\":\"This function will revert if it's called on a vault that does not exist\",\"params\":{\"liquidator\":\"Address of the liquidator which will be performing the liquidation\",\"vaultID\":\"ID of the vault to check\"},\"returns\":{\"liqOpp\":\"Description of the opportunity of liquidation\"}},\"constructor\":{\"custom:oz-upgrades-unsafe-allow\":\"constructor\"},\"createVault(address)\":{\"details\":\"This function just creates the vault without doing any collateral or\",\"params\":{\"toVault\":\"Address for which the va\"},\"returns\":{\"_0\":\"vaultID ID of the vault created\"}},\"getApproved(uint256)\":{\"details\":\"Returns the account approved for `tokenId` token. Requirements: - `tokenId` must exist.\"},\"getDebtOut(uint256,uint256,uint256,uint256)\":{\"details\":\"This function can only be called from a vaultManager registered in the same Treasury\",\"params\":{\"amountStablecoins\":\"Amount of stablecoins to remove from the debt: this amount is to be converted to an internal debt amount\",\"senderBorrowFee\":\"Borrowing fees from the contract which requested this: this is to make sure that people are not arbitraging difference in minting fees\",\"senderRepayFee\":\"Repay fees from the contract which requested this: this is to make sure that people are not arbitraging differences in repay fees\",\"vaultID\":\"ID of the vault to remove debt from\"}},\"getTotalDebt()\":{\"returns\":{\"_0\":\"Total debt across all vaults, taking into account the interest accumulated over time\"}},\"getVaultDebt(uint256)\":{\"params\":{\"vaultID\":\"ID of the vault to check\"},\"returns\":{\"_0\":\"Debt of the vault\"}},\"initialize(address,address,address,(uint256,uint64,uint64,uint64,uint64,uint64,bool,uint256),string)\":{\"details\":\"The parameters and the oracle are the only elements which could be modified once the contract has been initializedFor the contract to be fully initialized, governance needs to set the parameters for the liquidation boost\",\"params\":{\"_collateral\":\"Collateral supported by this contract\",\"_oracle\":\"Oracle contract used\",\"_symbol\":\"Symbol used to define the `VaultManager` name and symbol\",\"_treasury\":\"Treasury address handling the contract\"}},\"isApprovedForAll(address,address)\":{\"details\":\"Returns if the `operator` is allowed to manage all of the assets of `owner`. See {setApprovalForAll}\"},\"isApprovedOrOwner(address,uint256)\":{\"params\":{\"spender\":\"Address for which vault ownership should be checked\",\"vaultID\":\"ID of the vault to check\"},\"returns\":{\"_0\":\"Whether the `spender` address owns or is approved for `vaultID`\"}},\"liquidate(uint256[],uint256[],address,address)\":{\"details\":\"This function is a simplified wrapper of the function below. It is built to remove for liquidators the need to specify a `who` and a `data` parameter\"},\"liquidate(uint256[],uint256[],address,address,address,bytes)\":{\"details\":\"This function will revert if it's called on a vault that cannot be liquidated or that does not exist\",\"params\":{\"amounts\":\"Amount of stablecoin to bring for the liquidation of each vault\",\"data\":\"Data to pass to the repayment contract in case of. If empty, liquidators simply have to bring the exact amount of stablecoins to get the discounted collateral. If not, it is used by the repayment contract to swap a portion or all of the collateral received to stablecoins to be sent to the `from` address. More details in the `_handleRepay` function\",\"from\":\"Address from which the stablecoins for the liquidation should be taken: this address should be the `msg.sender` or have received an approval\",\"to\":\"Address to which discounted collateral should be sent\",\"vaultIDs\":\"List of the vaults to liquidate\",\"who\":\"Address of the contract to handle repayment of stablecoins from received collateral\"},\"returns\":{\"liqData\":\"Data about the liquidation process for the liquidator to track everything that has been going on (like how much stablecoins have been repaid, how much collateral has been received)\"}},\"ownerOf(uint256)\":{\"details\":\"Returns the owner of the `tokenId` token. Requirements: - `tokenId` must exist.\"},\"permit(address,address,bool,uint256,uint8,bytes32,bytes32)\":{\"details\":\"The `v`, `r`, and `s` parameters are used as signature data\",\"params\":{\"approved\":\"Whether to give or revoke the approval\",\"deadline\":\"Deadline parameter for the signature to be valid\",\"owner\":\"Address signing the permit and giving (or revoking) its approval for all the controlled vaults\",\"spender\":\"Address to give approval to\"}},\"safeTransferFrom(address,address,uint256)\":{\"details\":\"Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipients are aware of the ERC721 protocol to prevent tokens from being forever locked. Requirements: - `from` cannot be the zero address. - `to` cannot be the zero address. - `tokenId` token must exist and be owned by `from`. - If the caller is not `from`, it must be have been allowed to move this token by either {approve} or {setApprovalForAll}. - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer. Emits a {Transfer} event.\"},\"safeTransferFrom(address,address,uint256,bytes)\":{\"details\":\"Safely transfers `tokenId` token from `from` to `to`. Requirements: - `from` cannot be the zero address. - `to` cannot be the zero address. - `tokenId` token must exist and be owned by `from`. - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}. - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer. Emits a {Transfer} event.\"},\"setApprovalForAll(address,bool)\":{\"details\":\"Approve or remove `operator` as an operator for the caller. Operators can call {transferFrom} or {safeTransferFrom} for any token owned by the caller. Requirements: - The `operator` cannot be the caller. Emits an {ApprovalForAll} event.\"},\"setDebtCeiling(uint256)\":{\"details\":\"`debtCeiling` should not be bigger than `type(uint256).max / 10**27` otherwise there could be overflows\",\"params\":{\"_debtCeiling\":\"New value for `debtCeiling`\"}},\"setDusts(uint256,uint256)\":{\"details\":\"These variables are not taken into account in all circumstances as the actual dust variables\"},\"setLiquidationBoostParameters(address,uint256[],uint256[])\":{\"details\":\"There are 2 modes: When boost is enabled, `xBoost` and `yBoost` should have a length of 2, but if they have a higher length contract will still work as expected. Contract will also work as expected if their length differ When boost is disabled, `_veBoostProxy` needs to be zero address and `yBoost[0]` is the base boost\",\"params\":{\"_veBoostProxy\":\"Address which queries veANGLE balances and adjusted balances from delegation\",\"xBoost\":\"Threshold values of veANGLE adjusted balances\",\"yBoost\":\"Values of the liquidation boost at the threshold values of x\"}},\"setOracle(address)\":{\"params\":{\"_oracle\":\"Reference to the oracle contract\"}},\"setTreasury(address)\":{\"details\":\"All required checks when setting up a treasury contract are performed in the contract calling this function\",\"params\":{\"_treasury\":\"New treasury contract\"}},\"setUint64(uint64,bytes32)\":{\"details\":\"This function performs the required checks when updating a parameterWhen setting parameters governance or the guardian should make sure that when `HF < CF/((1-surcharge)(1-discount))` and hence when liquidating a vault is going to decrease its health factor, `discount = max discount`. Otherwise, it may be profitable for the liquidator to liquidate in multiple times: as it will decrease the HF and therefore increase the discount between each time\",\"params\":{\"param\":\"Value for the parameter\",\"what\":\"Parameter to change\"}},\"supportsInterface(bytes4)\":{\"details\":\"Returns true if this contract implements the interface defined by `interfaceId`. See the corresponding https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section] to learn more about how these ids are created. This function call must use less than 30 000 gas.\"},\"toggleWhitelist(address)\":{\"details\":\"If the `target` address is the zero address then this function toggles whitelisting for all addresses\",\"params\":{\"target\":\"Address to toggle\"}},\"tokenURI(uint256)\":{\"details\":\"Returns the Uniform Resource Identifier (URI) for `tokenId` token.\"},\"transferFrom(address,address,uint256)\":{\"details\":\"Transfers `tokenId` token from `from` to `to`. WARNING: Usage of this method is discouraged, use {safeTransferFrom} whenever possible. Requirements: - `from` cannot be the zero address. - `to` cannot be the zero address. - `tokenId` token must be owned by `from`. - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}. Emits a {Transfer} event.\"}},\"title\":\"VaultManagerLiquidationBoost\",\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{\"BASE_INTEREST()\":{\"notice\":\"Base used for interest rate computation\"},\"BASE_PARAMS()\":{\"notice\":\"Base used for parameter computation: almost all the parameters of this contract are set in `BASE_PARAMS`\"},\"DOMAIN_SEPARATOR()\":{\"notice\":\"Returns the domain separator for the current chain.\"},\"HALF_BASE_INTEREST()\":{\"notice\":\"Used for interest rate computation\"},\"accrueInterestToTreasury()\":{\"notice\":\"Accrues interest accumulated across all vaults to the surplus and sends the surplus to the treasury\"},\"angle(uint8[],bytes[],address,address)\":{\"notice\":\"This function is a wrapper built on top of the function above. It enables users to interact with the contract without having to provide `who` and `repayData` parameters\"},\"angle(uint8[],bytes[],address,address,address,bytes)\":{\"notice\":\"Allows composability between calls to the different entry points of this module. Any user calling this function can perform any of the allowed actions in the order of their choice\"},\"badDebt()\":{\"notice\":\"Bad debt made from liquidated vaults which ended up having no collateral and a positive amount of stablecoins\"},\"borrowFee()\":{\"notice\":\"Upfront fee taken when borrowing stablecoins: this fee is optional and should in practice not be used\"},\"checkLiquidation(uint256,address)\":{\"notice\":\"Checks whether a given vault is liquidable and if yes gives information regarding its liquidation\"},\"collateral()\":{\"notice\":\"Reference to the collateral handled by this `VaultManager`\"},\"collateralFactor()\":{\"notice\":\"Encodes the maximum ratio stablecoin/collateral a vault can have before being liquidated. It's what determines the minimum collateral ratio of a position\"},\"createVault(address)\":{\"notice\":\"Creates a vault\"},\"debtCeiling()\":{\"notice\":\"Maximum amount of stablecoins that can be issued with this contract (in `BASE_TOKENS`). This parameter should not be bigger than `type(uint256).max / BASE_INTEREST` otherwise there may be some overflows in the `increaseDebt` function\"},\"dust()\":{\"notice\":\"Minimum amount of debt a vault can have, expressed in `BASE_TOKENS` that is to say the base of the agTokens\"},\"dustOverride()\":{\"notice\":\"Variable to potentially override the immutable `dust`\"},\"getDebtOut(uint256,uint256,uint256,uint256)\":{\"notice\":\"Removes debt from a vault after being requested to do so by another `VaultManager` contract\"},\"getTotalDebt()\":{\"notice\":\"Gets the total debt across all vaults\"},\"getVaultDebt(uint256)\":{\"notice\":\"Gets the current debt of a vault\"},\"initialize(address,address,address,(uint256,uint64,uint64,uint64,uint64,uint64,bool,uint256),string)\":{\"notice\":\"Initializes the `VaultManager` contract\"},\"interestAccumulator()\":{\"notice\":\"The `interestAccumulator` variable keeps track of the interest that should accrue to the protocol. The stored value is not necessarily the true value: this one is recomputed every time an action takes place within the protocol. It is in base `BASE_INTEREST`\"},\"interestRate()\":{\"notice\":\"Per second interest taken to borrowers taking agToken loans. Contrarily to other parameters, it is set in `BASE_INTEREST` that is to say in base 10**27\"},\"isApprovedOrOwner(address,uint256)\":{\"notice\":\"Checks whether a given address is approved for a vault or owns this vault\"},\"isWhitelisted(address)\":{\"notice\":\"Maps an address to 1 if it's whitelisted and can open or own a vault\"},\"lastInterestAccumulatorUpdated()\":{\"notice\":\"Timestamp at which the `interestAccumulator` was updated\"},\"liquidate(uint256[],uint256[],address,address)\":{\"notice\":\"Liquidates an ensemble of vaults specified by their IDs\"},\"liquidate(uint256[],uint256[],address,address,address,bytes)\":{\"notice\":\"Liquidates an ensemble of vaults specified by their IDs\"},\"liquidationSurcharge()\":{\"notice\":\"Fee taken by the protocol during a liquidation. Technically, this value is not the fee per se, it's 1 - fee. For instance for a 2% fee, `liquidationSurcharge` should be 98%\"},\"maxLiquidationDiscount()\":{\"notice\":\"Maximum discount given to liquidators\"},\"nonces(address)\":{\"notice\":\"Returns the current nonce for an `owner` address\"},\"oracle()\":{\"notice\":\"Oracle contract to get access to the price of the collateral with respect to the stablecoin\"},\"paused()\":{\"notice\":\"Whether the contract is paused or not\"},\"permit(address,address,bool,uint256,uint8,bytes32,bytes32)\":{\"notice\":\"Allows an address to give or revoke approval for all its vaults to another address\"},\"repayFee()\":{\"notice\":\"Upfront fee taken when repaying stablecoins: this fee is optional as well. It should be smaller than the liquidation surcharge (cf below) to avoid exploits where people voluntarily get liquidated at a 0 discount to pay smaller repaying fees\"},\"setBaseURI(string)\":{\"notice\":\"Changes the ERC721 metadata URI\"},\"setDebtCeiling(uint256)\":{\"notice\":\"Sets `debtCeiling`\"},\"setDusts(uint256,uint256)\":{\"notice\":\"Sets the dust variables\"},\"setLiquidationBoostParameters(address,uint256[],uint256[])\":{\"notice\":\"Sets the parameters for the liquidation booster which encodes the slope of the discount\"},\"setOracle(address)\":{\"notice\":\"Changes the reference to the oracle contract used to get the price of the oracle\"},\"setTreasury(address)\":{\"notice\":\"Sets the treasury contract\"},\"setUint64(uint64,bytes32)\":{\"notice\":\"Sets parameters encoded as uint64\"},\"stablecoin()\":{\"notice\":\"Stablecoin handled by this contract. Another `VaultManager` contract could have the same rights as this `VaultManager` on the stablecoin contract\"},\"surplus()\":{\"notice\":\"Surplus accumulated by the contract: surplus is always in stablecoins, and is then reset when the value is communicated to the treasury contract\"},\"targetHealthFactor()\":{\"notice\":\"Maximum Health factor at which a vault can end up after a liquidation (unless it's fully liquidated)\"},\"togglePause()\":{\"notice\":\"Pauses external permissionless functions of the contract\"},\"toggleWhitelist(address)\":{\"notice\":\"Changes the whitelisting of an address\"},\"totalNormalizedDebt()\":{\"notice\":\"Total normalized amount of stablecoins borrowed, not taking into account the potential bad debt accumulated This value is expressed in the base of Angle stablecoins (`BASE_TOKENS = 10**18`)\"},\"treasury()\":{\"notice\":\"Reference to the `treasury` contract handling this `VaultManager`\"},\"vaultData(uint256)\":{\"notice\":\"Maps a `vaultID` to its data (namely collateral amount and normalized debt)\"},\"vaultIDCount()\":{\"notice\":\"ID of the last vault created. The `vaultIDCount` variables serves as a counter to generate a unique `vaultID` for each vault: it is like `tokenID` in basic ERC721 contracts\"},\"veBoostProxy()\":{\"notice\":\"Reference to the contract which computes adjusted veANGLE balances for liquidators boosts\"},\"whitelistingActivated()\":{\"notice\":\"Whether whitelisting is required to own a vault or not\"},\"xLiquidationBoost(uint256)\":{\"notice\":\"Threshold veANGLE balance values for the computation of the boost for liquidators: the length of this array should normally be 2. The base of the x-values in this array should be `BASE_TOKENS`\"},\"yLiquidationBoost(uint256)\":{\"notice\":\"Values of the liquidation boost at the threshold values of x\"}},\"notice\":\"Liquidation discount depending also on the liquidator veANGLE balance\",\"version\":1}},\"settings\":{\"compilationTarget\":{\"contracts/vaultManager/VaultManagerLiquidationBoost.sol\":\"VaultManagerLiquidationBoost\"},\"evmVersion\":\"london\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\"},\"optimizer\":{\"enabled\":true,\"runs\":1},\"remappings\":[]},\"sources\":{\"@openzeppelin/contracts-upgradeable/interfaces/IERC721MetadataUpgradeable.sol\":{\"keccak256\":\"0xc0e1ac396ac591a4c38ddcdd220321128eb94424d73e41a573cf58d5c643af38\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://2bd729caa85e0c3740b2d3a28a91fac0fd1ef66e0907145005a37f1927ae7a22\",\"dweb:/ipfs/QmcfVoLnE2PZj3U6KbACk6ykqE5WXuAM3hsXLJxC2sxZGt\"]},\"@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol\":{\"keccak256\":\"0x68861bcc80cacbd498efde75aab6c74a486cc48262660d326c8d7530d9752097\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://5beb2713aca05976562500789329e8c41320d00bd68ea9247856ec73894c3e3f\",\"dweb:/ipfs/QmQKwkpofsZYAzMZs7uNL7Qq58zVBuhoZCGpD6bJdUwyqy\"]},\"@openzeppelin/contracts-upgradeable/security/ReentrancyGuardUpgradeable.sol\":{\"keccak256\":\"0xf3a9b766b0d0456f79d9402db4b49bb16c414f3f9d65244475c0704b6c66dcf1\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://2be836e0695ca8a93f81a4bb6a7f74469ba97fb6e33948739c7f65a5f4110e4f\",\"dweb:/ipfs/QmTcsEpD8XJHtA5vjJ2mbrgYyDYQoMF3zuAEMTu6KFSXjX\"]},\"@openzeppelin/contracts-upgradeable/token/ERC20/IERC20Upgradeable.sol\":{\"keccak256\":\"0x5ca0eb1120133a6d0799752532d4638048391823a2b623c4fe9ff46e262266fb\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://439a76e6c35f75a7253f1ff68c99f399094233b0ddecac6bd19093f0d18980c4\",\"dweb:/ipfs/QmYGY3jR6A4k8KWzHjGG249EWR6KtoENzdPGv6MZRFhdEW\"]},\"@openzeppelin/contracts-upgradeable/token/ERC20/extensions/draft-IERC20PermitUpgradeable.sol\":{\"keccak256\":\"0xcc70d8e2281fb3ff69e8ab242500f10142cd0a7fa8dd9e45882be270d4d09024\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://17a4063bc918df0f7bb9cbf04c6f0bb4977afab3f2fc212bc138a178312a221d\",\"dweb:/ipfs/QmZMdvsHP5mDEAAdrK4bNeNh47TfmSFgN9qEBFTbie7zmm\"]},\"@openzeppelin/contracts-upgradeable/token/ERC721/IERC721ReceiverUpgradeable.sol\":{\"keccak256\":\"0x2f359f9d5c56394e60d74401487ab55d8ef0012907b07c9abbb8f998bf5ddfec\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://47d1408f0b62a24a9c2abd7678665178916fc147b8f23153d61e21353f0205e4\",\"dweb:/ipfs/QmWis4pCq81JzNTqdCoiMqjEtcwp3NGRnCz4nYPYp2jEKd\"]},\"@openzeppelin/contracts-upgradeable/token/ERC721/IERC721Upgradeable.sol\":{\"keccak256\":\"0x714a33fd66816f608f6eda908da24eb6009eee50adf4062c86639d4fe508a7b6\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://1222806a46ee6d877cff1f609cdb548271a0ae85228716c8d1427462a16bd59b\",\"dweb:/ipfs/QmZVjwuTFqhoFBuug3fvHFVC5Y9ompwdHMwUy5upevMfJ5\"]},\"@openzeppelin/contracts-upgradeable/token/ERC721/extensions/IERC721MetadataUpgradeable.sol\":{\"keccak256\":\"0x95a471796eb5f030fdc438660bebec121ad5d063763e64d92376ffb4b5ce8b70\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://4ffbd627e6958983d288801acdedbf3491ee0ebf1a430338bce47c96481ce9e3\",\"dweb:/ipfs/QmUM1vpmNgBV34sYf946SthDJNGhwwqjoRggmj4TUUQmdB\"]},\"@openzeppelin/contracts-upgradeable/utils/AddressUpgradeable.sol\":{\"keccak256\":\"0x3f0f878c796dfc7feba6d3c4e3e526c14c7deae8b7bfc71088e3f38fab0d77b3\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://69bf7d357ce97852f4fb71045919b1bb2c0ad0c820e3f06b9dd4451b2dc5a343\",\"dweb:/ipfs/QmWt96ZviufDu2qqS7Ln6UCJjfLyoFKbo6YKn54ao3o94z\"]},\"@openzeppelin/contracts-upgradeable/utils/introspection/IERC165Upgradeable.sol\":{\"keccak256\":\"0xc6cef87559d0aeffdf0a99803de655938a7779ec0a3cd5d4383483ad85565a09\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://92ad7e572cf44e6b4b37631b44b62f9eb9fb1cf14d9ce51c1504d5dc7ccaf758\",\"dweb:/ipfs/QmcnbqX85tsWnUXPmtuPLE4SczME2sJaTfmqEFkuAJvWhy\"]},\"@openzeppelin/contracts/interfaces/IERC721Metadata.sol\":{\"keccak256\":\"0x1e88abdf82fcbbf98f97be17ea56c924376350637896bc37366ec9f89b7c2628\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://c8eb8afc411b87c9718cfe5c68669d5210d7012a96890c520c0fc321f74f0992\",\"dweb:/ipfs/Qmcr74gEtRpWER5qjFN86AKUep66pGuzp9WDYueaNtt97n\"]},\"@openzeppelin/contracts/token/ERC20/IERC20.sol\":{\"keccak256\":\"0x61437cb513a887a1bbad006e7b1c8b414478427d33de47c5600af3c748f108da\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://2c3d0973630ed74f2b5ce3944677a885dc70ec32fc83b35f55045a10224da32b\",\"dweb:/ipfs/QmbefZ5RoEZKNHXCALfh683PnaNYzKPcKMFjyY1DVAgq8A\"]},\"@openzeppelin/contracts/token/ERC20/extensions/IERC20Metadata.sol\":{\"keccak256\":\"0x8de418a5503946cabe331f35fe242d3201a73f67f77aaeb7110acb1f30423aca\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://5a376d3dda2cb70536c0a45c208b29b34ac560c4cb4f513a42079f96ba47d2dd\",\"dweb:/ipfs/QmZQg6gn1sUpM8wHzwNvSnihumUCAhxD119MpXeKp8B9s8\"]},\"@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol\":{\"keccak256\":\"0xc3d946432c0ddbb1f846a0d3985be71299df331b91d06732152117f62f0be2b5\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://4632c341a06ba5c079b51ca5a915efab4e6ab57735b37839b3e8365ff806a43e\",\"dweb:/ipfs/QmTHT3xHYed2wajEoA5qu7ii2BxLpPhQZHwAhtLK5Z7ANK\"]},\"@openzeppelin/contracts/token/ERC721/IERC721.sol\":{\"keccak256\":\"0x516a22876c1fab47f49b1bc22b4614491cd05338af8bd2e7b382da090a079990\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://a439187f7126d31add4557f82d8aed6be0162007cd7182c48fd934dbab8f3849\",\"dweb:/ipfs/QmRPLguRFvrRJS7r6F1bcLvsx6q1VrgjEpZafyeL8D7xZh\"]},\"@openzeppelin/contracts/token/ERC721/extensions/IERC721Metadata.sol\":{\"keccak256\":\"0x75b829ff2f26c14355d1cba20e16fe7b29ca58eb5fef665ede48bc0f9c6c74b9\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://a0a107160525724f9e1bbbab031defc2f298296dd9e331f16a6f7130cec32146\",\"dweb:/ipfs/QmemujxSd7gX8A9M8UwmNbz4Ms3U9FG9QfudUgxwvTmPWf\"]},\"@openzeppelin/contracts/utils/Address.sol\":{\"keccak256\":\"0x51b758a8815ecc9596c66c37d56b1d33883a444631a3f916b9fe65cb863ef7c4\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://997ca03557985b3c6f9143a18b6c3a710b3bc1c7f189ee956d305a966ecfb922\",\"dweb:/ipfs/QmQaD3Wb62F88SHqmpLttvF6wKuPDQep2LLUcKPekeRzvz\"]},\"@openzeppelin/contracts/utils/introspection/IERC165.sol\":{\"keccak256\":\"0x447a5f3ddc18419d41ff92b3773fb86471b1db25773e07f877f548918a185bf1\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://be161e54f24e5c6fae81a12db1a8ae87bc5ae1b0ddc805d82a1440a68455088f\",\"dweb:/ipfs/QmP7C3CHdY9urF4dEMb9wmsp1wMxHF6nhA2yQE5SKiPAdy\"]},\"contracts/interfaces/IAgToken.sol\":{\"keccak256\":\"0xcd50d86128e457543483981ea6127cb8dac03584b919614352aa89d7e991405c\",\"license\":\"GPL-3.0\",\"urls\":[\"bzz-raw://bb6868cb86cd44401b1bf1b65b3f44092ef39e68a44af66f2424e744bef8a1fa\",\"dweb:/ipfs/QmR9aMfNCQiWWTYQFA88Vv4XeqZReYgYohPeoZ2AHYU7eU\"]},\"contracts/interfaces/ICoreBorrow.sol\":{\"keccak256\":\"0x25b65b3f506ca91745a444502a36f0556585d82d9d60f4bd32fbcaabc12840d4\",\"license\":\"GPL-3.0\",\"urls\":[\"bzz-raw://a32f4726c09eaa4f8fd6f40c9bdb25e154852d62d76c0cdc0c42bd12454dca5c\",\"dweb:/ipfs/QmaCfibrHC9HULzYqXw12DdNk9RTPZqerN4Ld1dyGCoUFa\"]},\"contracts/interfaces/IFlashAngle.sol\":{\"keccak256\":\"0xc17654e512897efe41e3f1173c07dd4676e8c699a72b859d14b473d1e8300e45\",\"license\":\"GPL-3.0\",\"urls\":[\"bzz-raw://2155889f592887eaf45a7f8df4d0328312918dfbf03508500c20927496d54ea8\",\"dweb:/ipfs/QmWRW2r8oUCbNprXY5G8ZDYxR9ssDCP7T2FMPS2h56Fq6N\"]},\"contracts/interfaces/IOracle.sol\":{\"keccak256\":\"0x90fc39ba314b05884005b9deb1d949ca20f7fc5158fa0a7e41f1c798fb0c0a43\",\"license\":\"GPL-3.0\",\"urls\":[\"bzz-raw://aad639fa57c2553dc4bbbdb4007bddf9f3ace49eb83f99595fe5408a6329588b\",\"dweb:/ipfs/QmPiLrpwuQ7bUVB1fxnPKV8xGZR69X4yXttYspx89UoSYk\"]},\"contracts/interfaces/ISwapper.sol\":{\"keccak256\":\"0x8f9abab47966d41ca36eb9e8bb8b39bd5ba262d66ed141d001084f64f186c525\",\"license\":\"GPL-3.0\",\"urls\":[\"bzz-raw://71a48cc8df422d5860af1985596990fc71d30e1a0b7373676e4cfd9492bf7e4a\",\"dweb:/ipfs/QmcMfpqJEbcYEbGbTv2Fm9BP8mqTBDnruGUihDVuz1HdJW\"]},\"contracts/interfaces/ITreasury.sol\":{\"keccak256\":\"0x795cdb939e8958ba29fcd76c0f6c8101a5d367e72c07438b2c5860b9c4a27013\",\"license\":\"GPL-3.0\",\"urls\":[\"bzz-raw://b47ac25cb1c1285b70d3c68097e05c0015688bafbbdc8ed2e48a0c69b6865966\",\"dweb:/ipfs/QmeKdwUmqwU2pf9fcNAtTcHu7DzbPmp8RQ5C4tMWgiKT89\"]},\"contracts/interfaces/IVaultManager.sol\":{\"keccak256\":\"0xa5ef23f07897288bff816c0df37182e55e90ea8ce4db092a23700c0ebcfdeffe\",\"license\":\"GPL-3.0\",\"urls\":[\"bzz-raw://c1d8ac1164bf861c72b145ad7a692c450506b07a9a4d0523a295e46fb02ea53f\",\"dweb:/ipfs/QmNTSPYJjT6eTP9KQvt4uhps444P3CB6yAEyPL7NxGAovh\"]},\"contracts/interfaces/external/IERC1271.sol\":{\"keccak256\":\"0xdb92e9d322d403b39f53be53cefbb560253def674128144786e7244a306ccfa5\",\"license\":\"GPL-2.0-or-later\",\"urls\":[\"bzz-raw://83fe1ef24f594848a27daf09959cb3157876938c9e5193194224a4f5e2233dc3\",\"dweb:/ipfs/QmPA7KxdoSCsedPYZdZw9pNGvyYGLCED8Baj3W4NpX7r1A\"]},\"contracts/interfaces/governance/IVeBoostProxy.sol\":{\"keccak256\":\"0x3225addd919f109d6178d0bbc9b53b25589a015283815dfed34d3d2b3029aff7\",\"license\":\"GPL-3.0\",\"urls\":[\"bzz-raw://0282f869b843734adbf954103768a111925267653ed8b1772bb703e0989d1846\",\"dweb:/ipfs/QmTAddu4gxA9abj5wp7jXqyGCd5YCYZCn9NGuYLf2vEVpd\"]},\"contracts/vaultManager/VaultManager.sol\":{\"keccak256\":\"0xf98e8e77657204564b4eb000271453f7557f182f8b8af36456feb728414cc895\",\"license\":\"GPL-3.0\",\"urls\":[\"bzz-raw://7ad79a928b8b5cc83952fbcd71a942ad6dda824d435383b5e8a5b1de6a1b3b54\",\"dweb:/ipfs/QmSYeBMUhzFwt1vT9fsYrmbe2FpJn1M9n8HzNNEp4sGJa7\"]},\"contracts/vaultManager/VaultManagerERC721.sol\":{\"keccak256\":\"0xeef355be781d26a3ea0055ba01e6342922221ff440d75bb2afe0ca4b2eef3c08\",\"license\":\"GPL-3.0\",\"urls\":[\"bzz-raw://bc7d3af8e343087c5fd2ce26309e636885f89d66d4a56ee96fddb7589139bf7a\",\"dweb:/ipfs/QmTUjsw6LRhQmzFAzUrqv3qQdFwrYKsEwbTR3SQXn4yNyN\"]},\"contracts/vaultManager/VaultManagerLiquidationBoost.sol\":{\"keccak256\":\"0x7e235e5e325430d78f8af56527eb8b8baa1f8c0becff974f24373771057134ab\",\"license\":\"GPL-3.0\",\"urls\":[\"bzz-raw://bef0253529aff1bf1b3f097a00e8a8a6fc4b0f98e9e25e0cee553e6b2966a950\",\"dweb:/ipfs/QmNPci9YYWfrzvXt2wcZYhzLPpzrfHmnW1KWxzbbAPZpkE\"]},\"contracts/vaultManager/VaultManagerPermit.sol\":{\"keccak256\":\"0x4f97de1875f9a341b3e1eb1745a72e78edd1a2fffb3e3d9e1fe8dd1e00835d28\",\"license\":\"GPL-3.0\",\"urls\":[\"bzz-raw://4e9dd5c023c1f21885aa2f41af11e149bde93ec0684a1bbe8e56bf94f621d0f2\",\"dweb:/ipfs/QmXJ9f7eMjScrgNDaNTLLqF3YmTaxBThGp8YKqgmDXfcKA\"]},\"contracts/vaultManager/VaultManagerStorage.sol\":{\"keccak256\":\"0x6e9345444632eeef0416b14057e929eb5f7aeb31499f2c29abd51c54c4bfad7b\",\"license\":\"GPL-3.0\",\"urls\":[\"bzz-raw://f5913b2189835ab0ba3527e5ca7f6138733b122fb12e3ad1e736decb116422b0\",\"dweb:/ipfs/QmanKBCLb6VQVMnvH85n3FdxPfHEffK4dqjqw4bcUS75jB\"]}},\"version\":1}", + "bytecode": "0x60c06040523480156200001157600080fd5b50604051620060853803806200608583398101604081905262000034916200013d565b81818181600060019054906101000a900460ff166200005a5760005460ff161562000064565b6200006462000119565b620000cc5760405162461bcd60e51b815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201526d191e481a5b9a5d1a585b1a5e995960921b606482015260840160405180910390fd5b600054610100900460ff16158015620000ef576000805461ffff19166101011790555b608083905260a082905280156200010c576000805461ff00191690555b5050505050505062000162565b600062000131306200013760201b620033221760201c565b15905090565b3b151590565b600080604083850312156200015157600080fd5b505080516020909101519092909150565b60805160a051615f00620001856000396000505060006108460152615f006000f3fe608060405234801561001057600080fd5b50600436106103015760003560e01c8063010db1951461030657806301ffc9a71461032f57806306fdde0314610352578063081812fc14610367578063087a60071461037a578063095ea7b3146103915780630e198f22146103a657806313888565146103af57806323b872dd146103b8578063254cf439146103cb578063307439af146103fd57806334ce998a1461041d57806335836f15146104255780633644e5151461043857806339393ac91461044057806339eb4dc6146104535780633ae2325f146104675780633af32abf1461047a5780633c2e941b1461049a57806342842e0e146104a3578063430c2081146104b65780634f7e43df146104c957806355f804b3146104e35780635b84d88a146104f65780635c975abb1461050957806361d027b31461051d5780636352211e1461053057806370a082311461054357806374107543146105565780637aacfffa146105695780637adbf973146105a55780637c0f59f4146105b85780637c3a00fd146105d25780637dc0d1d0146105e55780637e53bd97146105f85780637e56d47c1461060b5780637ecebe001461061e578063835986b41461064757806389050f1d1461065a57806395d89b411461066c5780639a3b6f2f146106745780639f48118f146106ba578063a172923a146106c5578063a22cb465146106ce578063af2c8c2e146106e1578063b1511cc9146106ea578063b4bd6f46146106fd578063b88d4fde14610710578063bbcac55714610723578063c4ae31681461072c578063c66d8b0114610734578063c87b56dd1461074e578063d8dfeb4514610761578063d9b1cb5b14610774578063de1f776514610787578063de8fc69814610799578063df011c41146107ac578063e182b883146107bf578063e1c84ea4146107d2578063e626648a146107db578063e985e9c5146107f5578063e9cbd82214610808578063f0f442601461081b578063f51cc7dd1461082e578063fad9aba314610841578063fc29b02114610868578063fd527cf81461087b575b600080fd5b603754610319906001600160a01b031681565b6040516103269190614eb4565b60405180910390f35b61034261033d366004614ede565b610883565b6040519015158152602001610326565b61035a6108f0565b6040516103269190614f53565b610319610375366004614f66565b61097e565b610383603f5481565b604051908152602001610326565b6103a461039f366004614f94565b6109af565b005b610383603e5481565b61038360415481565b6103a46103c6366004614fc0565b610a3c565b603c546103e590600160401b90046001600160401b031681565b6040516001600160401b039091168152602001610326565b61041061040b366004615001565b610a77565b6040516103269190615031565b610383610b29565b610383610433366004614f66565b610b5b565b610383610b97565b6103a461044e36600461506a565b610ba1565b603d5461034290600160c01b900460ff1681565b610383610475366004614f66565b610ca1565b61038361048836600461506a565b60446020526000908152604090205481565b61038360455481565b6103a46104b1366004614fc0565b610cc2565b6103426104c4366004614f94565b610cdd565b603d546103e590600160801b90046001600160401b031681565b6103a46104f136600461513c565b610ce9565b6103a4610504366004615170565b610d8e565b603d5461034290600160c81b900460ff1681565b603354610319906001600160a01b031681565b61031961053e366004614f66565b610e27565b61038361055136600461506a565b610e32565b6103a46105643660046151a9565b610e77565b610590610577366004614f66565b6043602052600090815260409020805460019091015482565b60408051928352602083019190915201610326565b6103a46105b336600461506a565b611243565b603c546103e590600160c01b90046001600160401b031681565b603d546103e5906001600160401b031681565b603654610319906001600160a01b031681565b6103a4610606366004615253565b61138a565b6104106106193660046152c8565b61157b565b61038361062c36600461506a565b6001600160a01b03166000908152607f602052604090205490565b6103a461065536600461538c565b611b11565b610383676765c793fa10079d601a1b81565b61035a611cc9565b6106876106823660046154a6565b611cd6565b60405161032691908151815260208083015190820152604080830151908201526060918201519181019190915260800190565b610383633b9aca0081565b61038360b45481565b6103a46106dc36600461553c565b611d0b565b61038360405481565b6103a46106f8366004614f66565b611d16565b61038361070b36600461506a565b611ddf565b6103a461071e36600461556a565b611e1b565b61038360425481565b6103a4611e58565b603d546103e590600160401b90046001600160401b031681565b61035a61075c366004614f66565b611f07565b603454610319906001600160a01b031681565b6103a46107823660046155d5565b612060565b610383676765c793fa10079d601b1b81565b6106876107a7366004615669565b6125b4565b603c546103e5906001600160401b031681565b6103836107cd366004614f66565b612e3b565b61038360395481565b603c546103e590600160801b90046001600160401b031681565b6103426108033660046156c7565b612e4b565b603554610319906001600160a01b031681565b6103a461082936600461506a565b612e79565b6103a461083c366004615704565b612f19565b6103837f000000000000000000000000000000000000000000000000000000000000000081565b61041061087636600461577e565b6131d9565b610590613203565b60006001600160e01b03198216635b5e139f60e01b14806108b457506001600160e01b031982166380ac58cd60e01b145b806108cf57506001600160e01b0319821663430c208160e01b145b806108ea57506001600160e01b031982166301ffc9a760e01b145b92915050565b607d80546108fd906157da565b80601f0160208091040260200160405190810160405280929190818152602001828054610929906157da565b80156109765780601f1061094b57610100808354040283529160200191610976565b820191906000526020600020905b81548152906001019060200180831161095957829003601f168201915b505050505081565b600061098982613328565b6109a65760405163062a39dd60e11b815260040160405180910390fd5b6108ea82613345565b60006109ba82613360565b9050806001600160a01b0316836001600160a01b031614156109ef576040516349fa8bc360e11b815260040160405180910390fd5b336001600160a01b03821614801590610a0f5750610a0d8133612e4b565b155b15610a2d5760405163c19f17a960e01b815260040160405180910390fd5b610a378383613396565b505050565b3381610a488282613404565b610a655760405163c19f17a960e01b815260040160405180910390fd5b610a70858585613482565b5050505050565b610a7f614d8a565b60008381526043602090815260409182902082518084018452815481526001909101548183015260365483516315f789a960e21b81529351610b2294929387936001600160a01b03909316926357de26a492600480830193928290030181865afa158015610af1573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610b15919061580f565b610b1d6135a9565b61373e565b9392505050565b6000676765c793fa10079d601b1b610b3f6135a9565b604054610b4c919061583e565b610b569190615873565b905090565b6000676765c793fa10079d601b1b610b716135a9565b600084815260436020526040902060010154610b8d919061583e565b6108ea9190615873565b6000610b56613aac565b603354604051631c86b03760e31b81526001600160a01b039091169063e43581b890610bd1903390600401614eb4565b602060405180830381865afa158015610bee573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610c129190615887565b610c2f57604051633b8d9d7560e21b815260040160405180910390fd5b6001600160a01b03811615610c7e576001600160a01b038116600090815260446020526040902054610c629060016158a4565b6001600160a01b03821660009081526044602052604090205550565b603d805460ff60c01b198116600160c01b9182900460ff16159091021790555b50565b603b8181548110610cb157600080fd5b600091825260209091200154905081565b610a3783838360405180602001604052806000815250611e1b565b6000610b228383613404565b60335460405163521d4de960e01b81526001600160a01b039091169063521d4de990610d19903390600401614eb4565b602060405180830381865afa158015610d36573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610d5a9190615887565b610d7757604051632678482f60e21b815260040160405180910390fd5b8051610d8a906046906020840190614db9565b5050565b603354604051631c86b03760e31b81526001600160a01b039091169063e43581b890610dbe903390600401614eb4565b602060405180830381865afa158015610ddb573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610dff9190615887565b610e1c57604051633b8d9d7560e21b815260040160405180910390fd5b60b49190915560b555565b60006108ea82613360565b60006001600160a01b038216610e5b5760405163d92e233d60e01b815260040160405180910390fd5b506001600160a01b031660009081526048602052604090205490565b60335460405163521d4de960e01b81526001600160a01b039091169063521d4de990610ea7903390600401614eb4565b602060405180830381865afa158015610ec4573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610ee89190615887565b610f0557604051632678482f60e21b815260040160405180910390fd5b806121a360f11b1415610f6957603d546001600160401b03600160401b90910481169083161115610f4957604051637650e96360e11b815260040160405180910390fd5b603c80546001600160401b0319166001600160401b0384161790556111fc565b80622a242360e91b1415610fce57633b9aca00826001600160401b03161015610fa55760405163da6a17b960e01b815260040160405180910390fd5b603c8054600160401b600160801b031916600160401b6001600160401b038516021790556111fc565b8061212360f11b141561103257633b9aca00826001600160401b0316111561100957604051637650e96360e11b815260040160405180910390fd5b603c8054600160801b600160c01b031916600160801b6001600160401b038516021790556111fc565b8061292360f11b14156110af57603d54633b9aca009061106290600160401b90046001600160401b0316846158bb565b6001600160401b0316111561108a57604051637650e96360e11b815260040160405180910390fd5b603c80546001600160c01b0316600160c01b6001600160401b038516021790556111fc565b806124a960f11b14156110e5576110c4613b18565b50603d80546001600160401b0319166001600160401b0384161790556111fc565b80614c5360f01b141561117e57603c546001600160401b03808416911611806111375750603c54633b9aca009061112c90600160c01b90046001600160401b0316846158bb565b6001600160401b0316115b156111555760405163180d062b60e31b815260040160405180910390fd5b603d8054600160401b600160801b031916600160401b6001600160401b038516021790556111fc565b806213531160ea1b14156111e357633b9aca00826001600160401b031611156111ba57604051637650e96360e11b815260040160405180910390fd5b603d8054600160801b600160c01b031916600160801b6001600160401b038516021790556111fc565b60405163e1daa9cf60e01b815260040160405180910390fd5b604080516001600160401b0384168152602081018390527f13b367dac93b85d1ed9b3d8961d8b48e1a677c9800bb1613b4b0416b2d5b61d091015b60405180910390a15050565b603354604051631c86b03760e31b81526001600160a01b039091169063e43581b890611273903390600401614eb4565b602060405180830381865afa158015611290573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906112b49190615887565b6112d157604051633b8d9d7560e21b815260040160405180910390fd5b603354604080516361d027b360e01b815290516001600160a01b03928316928416916361d027b39160048083019260209291908290030181865afa15801561131d573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061134191906158e6565b6001600160a01b031614611368576040516302979eb960e31b815260040160405180910390fd5b603680546001600160a01b0319166001600160a01b0392909216919091179055565b60335460405163521d4de960e01b81526001600160a01b039091169063521d4de9906113ba903390600401614eb4565b602060405180830381865afa1580156113d7573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906113fb9190615887565b61141857604051632678482f60e21b815260040160405180910390fd5b8051825114158061144357508060008151811061143757611437615903565b60200260200101516000145b806114d257506001600160a01b038316158015906114d257508160008151811061146f5761146f615903565b60200260200101518260018151811061148a5761148a615903565b60200260200101511115806114d25750806000815181106114ad576114ad615903565b6020026020010151816001815181106114c8576114c8615903565b6020026020010151105b156114f057604051631746545d60e11b815260040160405180910390fd5b603780546001600160a01b0319166001600160a01b038516179055815161151e90603a906020850190614e3d565b50805161153290603b906020840190614e3d565b50826001600160a01b03167feb74d4d9fea592587c926aeb35eb6a7893fb28db0c1c8eb2eb3c586e7164b76c838360405161156e929190615954565b60405180910390a2505050565b611583614d8a565b603d54600160c81b900460ff16156115ae576040516313d0ff5960e31b815260040160405180910390fd5b600260015414156115da5760405162461bcd60e51b81526004016115d190615979565b60405180910390fd5b6002600155855187511415806115ef57508551155b1561160d576040516346282e8d60e01b815260040160405180910390fd5b603660009054906101000a90046001600160a01b03166001600160a01b03166357de26a46040518163ffffffff1660e01b8152600401602060405180830381865afa158015611660573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611684919061580f565b6060820152611691613b18565b60808201526040517f965a177723c641ee49150b583a0b9ad4730bb20d3474e00ae5a65e777c00d67b906116c69089906159b0565b60405180910390a160005b8751811015611a82576000604360008a84815181106116f2576116f2615903565b60200260200101518152602001908152602001600020604051806040016040529081600082015481526020016001820154815250509050600061173f82338660600151876080015161373e565b9050600081604001511180156117715750806040015189848151811061176757611767615903565b6020026020010151115b806117985750806000015189848151811061178e5761178e615903565b6020026020010151115b156117c15780600001518984815181106117b4576117b4615903565b6020026020010181815250505b6000846060015182606001516117d7919061583e565b603854633b9aca008c87815181106117f1576117f1615903565b6020026020010151611803919061583e565b61180d919061583e565b6118179190615873565b905061182e8b8581518110610d8a57610d8a615903565b82518110611964575081516020830151604080546000906118509084906158a4565b92505081905550604360008c868151811061186d5761186d615903565b60209081029190910181015182528101919091526040016000908120818155600101819055603d548b51633b9aca0091600160401b90046001600160401b0316908d90889081106118c0576118c0615903565b60200260200101516118d2919061583e565b6118dc9190615873565b9050826080015181106118f0576000611900565b80836080015161190091906158a4565b8660400181815161191191906159c3565b905250508a51600080516020615e6b833981519152908c908690811061193957611939615903565b602002602001015184602001516000604051611957939291906159db565b60405180910390a1611a25565b80604360008d878151811061197b5761197b615903565b6020026020010151815260200190815260200160002060000160008282546119a391906158a4565b92505081905550611a238b85815181106119bf576119bf615903565b6020026020010151633b9aca00603d60089054906101000a90046001600160401b03166001600160401b03168d88815181106119fd576119fd615903565b6020026020010151611a0f919061583e565b611a199190615873565b8760800151613bb9565b505b8085602001818151611a3791906159c3565b90525089518a9085908110611a4e57611a4e615903565b602002602001015185600001818151611a6791906159c3565b905250839250611a7a91508290506159f4565b9150506116d1565b50603d54633b9aca0090611aa690600160401b90046001600160401b0316826158a4565b8251611ab2919061583e565b611abc9190615873565b60416000828254611acd91906159c3565b9091555050604081015160428054600090611ae99084906159c3565b909155505060208101518151611b03919087878787613cee565b600180559695505050505050565b603d54600160c81b900460ff1615611b3c576040516313d0ff5960e31b815260040160405180910390fd5b6033546040516333b52a9f60e11b81526001600160a01b039091169063676a553e90611b6c903390600401614eb4565b602060405180830381865afa158015611b89573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611bad9190615887565b611bca5760405163027f480760e01b815260040160405180910390fd5b603c54600090600160c01b90046001600160401b0316821015611c0857603c54611c05908390600160c01b90046001600160401b03166158a4565b90505b603c54600090600160801b90046001600160401b0316841115611c4557603c54611c4290600160801b90046001600160401b0316856158a4565b90505b6000611c566002633b9aca00615af3565b611c6483633b9aca006158a4565b611c7285633b9aca006158a4565b611c7c908961583e565b611c86919061583e565b611c909190615873565b9050611c9c81876158a4565b60416000828254611cad91906159c3565b90915550611cbf905087826000613bb9565b5050505050505050565b607e80546108fd906157da565b611cde614e77565b60408051600080825260208201909252611d00918791879187918791906125b4565b90505b949350505050565b610d8a338383613df8565b60335460405163521d4de960e01b81526001600160a01b039091169063521d4de990611d46903390600401614eb4565b602060405180830381865afa158015611d63573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611d879190615887565b611da457604051632678482f60e21b815260040160405180910390fd5b60398190556040518181527fdd63b3dcdbebad734892f7c7a26d0f647fbc7eec973e0775f5229018ac4ab47a9060200160405180910390a150565b603d54600090600160c81b900460ff1615611e0d576040516313d0ff5960e31b815260040160405180910390fd5b6108ea82613eae565b919050565b3382611e278282613404565b611e445760405163c19f17a960e01b815260040160405180910390fd5b611e5086868686613fdc565b505050505050565b60335460405163521d4de960e01b81526001600160a01b039091169063521d4de990611e88903390600401614eb4565b602060405180830381865afa158015611ea5573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611ec99190615887565b611ee657604051632678482f60e21b815260040160405180910390fd5b603d805460ff60c81b198116600160c81b9182900460ff1615909102179055565b6060611f1282613328565b611f2f5760405163062a39dd60e11b815260040160405180910390fd5b8160005b8115611f595780611f43816159f4565b9150611f529050600a83615873565b9150611f33565b6000816001600160401b03811115611f7357611f73615087565b6040519080825280601f01601f191660200182016040528015611f9d576020820181803683370190505b5090505b841561200857611fb26001836158a4565b9150611fbf600a86615b02565b611fca9060306159c3565b60f81b818381518110611fdf57611fdf615903565b60200101906001600160f81b031916908160001a905350612001600a86615873565b9450611fa1565b600060468054612017906157da565b9050116120335760405180602001604052806000815250612057565b604681604051602001612047929190615b32565b6040516020818303038152906040525b95945050505050565b600054610100900460ff1661207b5760005460ff161561207f565b303b155b6120e25760405162461bcd60e51b815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201526d191e481a5b9a5d1a585b1a5e995960921b60648201526084016115d1565b600054610100900460ff16158015612104576000805461ffff19166101011790555b856001600160a01b0316846001600160a01b03166361d027b36040518163ffffffff1660e01b8152600401602060405180830381865afa15801561214c573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061217091906158e6565b6001600160a01b031614612197576040516302979eb960e31b815260040160405180910390fd5b603380546001600160a01b038089166001600160a01b0319928316179092556034805492881692909116821790556040805163313ce56760e01b8152905163313ce567916004808201926020929091908290030181865afa158015612200573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906122249190615bd0565b61222f90600a615af3565b603881905550856001600160a01b031663e9cbd8226040518163ffffffff1660e01b8152600401602060405180830381865afa158015612273573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061229791906158e6565b603580546001600160a01b03199081166001600160a01b0393841617909155603680549091169186169190911790556040516000906122da908490602001615bed565b60408051601f19818403018152919052805190915061230090607d906020840190614db9565b5061230a81614016565b8260405160200161231b9190615c34565b604051602081830303815290604052607e908051906020019061233f929190614db9565b50676765c793fa10079d601b1b603f5542603e5561236360a0850160808601615c5e565b6001600160401b031661237c6040860160208701615c5e565b6001600160401b031611806123ac5750633b9aca006123a160a0860160808701615c5e565b6001600160401b0316115b806123d257506123c26060850160408601615c5e565b6001600160401b0316633b9aca00115b806123f95750633b9aca006123ed60c0860160a08701615c5e565b6001600160401b031610155b80612406575060e0840135155b1561242457604051631746545d60e11b815260040160405180910390fd5b83356039556124396040850160208601615c5e565b603c80546001600160401b0319166001600160401b03929092169190911790556124696060850160408601615c5e565b603c80546001600160401b0392909216600160401b02600160401b600160801b03199092169190911790556124a46080850160608601615c5e565b603d80546001600160401b0319166001600160401b03929092169190911790556124d460a0850160808601615c5e565b603d80546001600160401b0392909216600160401b02600160401b600160801b031990921691909117905561250f60c0850160a08601615c5e565b603d80546001600160401b0392909216600160801b02600160801b600160c01b031990921691909117905561254a60e0850160c08601615c79565b603d8054911515600160c01b0260ff60c01b19909216919091179055604080516020810190915260e0850135815261258690603b906001614e3d565b5050603d805460ff60c81b1916600160c81b1790558015611e50576000805461ff0019169055505050505050565b6125bc614e77565b603d54600160c81b900460ff16156125e7576040516313d0ff5960e31b815260040160405180910390fd5b6002600154141561260a5760405162461bcd60e51b81526004016115d190615979565b60026001558551875114158061261f57508651155b1561263d576040516346282e8d60e01b815260040160405180910390fd5b600080808080805b8c51811015612ba45760008d828151811061266257612662615903565b602002602001015190506000600781111561267f5761267f615c96565b81600781111561269157612691615c96565b14156126d2576126cc8d83815181106126ac576126ac615903565b60200260200101518060200190518101906126c791906158e6565b613eae565b50612b91565b60028160078111156126e6576126e6615c96565b141561274c578c82815181106126fe576126fe615903565b60200260200101518060200190518101906127199190615cac565b95509250826127285760455492505b61273283866140ec565b848860600181815161274491906159c3565b905250612b91565b600781600781111561276057612760615c96565b14156128395760008060008f858151811061277d5761277d615903565b60200260200101518060200190518101906127989190615cd0565b60345460405163d505accf60e01b81526001600160a01b038089166004830152306024830152604482018890526064820187905260ff8616608483015260a4820185905260c48201849052969f50939d50939b509497509550929350169063d505accf9060e401600060405180830381600087803b15801561281957600080fd5b505af115801561282d573d6000803e3d6000fd5b50505050505050612b91565b8661284957612846613b18565b96505b600481600781111561285d5761285d615c96565b1415612929578c828151811061287557612875615903565b60200260200101518060200190518101906128909190615cac565b945092508261289f5760455492505b6128aa838589613bb9565b603c549094506000906128d190600160c01b90046001600160401b0316633b9aca006158a4565b6128df633b9aca008761583e565b6128e99190615873565b90506128f585826158a4565b6041600082825461290691906159c3565b92505081905550808960200181815161291f91906159c3565b905250612b919050565b856129a857603660009054906101000a90046001600160a01b03166001600160a01b03166357de26a46040518163ffffffff1660e01b8152600401602060405180830381865afa158015612981573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906129a5919061580f565b95505b60018160078111156129bc576129bc615c96565b1415612a38578c82815181106129d4576129d4615903565b60200260200101518060200190518101906129ef919061580f565b9250826129fc5760455492505b612a07838789614158565b80965081955050508488604001818151612a2191906159c3565b9052506020880180518591906127449083906159c3565b6003816007811115612a4c57612a4c615c96565b1415612aac578c8281518110612a6457612a64615903565b6020026020010151806020019051810190612a7f9190615cac565b9550925082612a8e5760455492505b612a9a8386888a614278565b848860400181815161274491906159c3565b6005816007811115612ac057612ac0615c96565b1415612b22578c8281518110612ad857612ad8615903565b6020026020010151806020019051810190612af39190615cac565b9450925082612b025760455492505b612b0e8385888a614352565b9350838860000181815161274491906159c3565b6006816007811115612b3657612b36615c96565b1415612b91576000808e8481518110612b5157612b51615903565b6020026020010151806020019051810190612b6c9190615d23565b98509196509250905084612b805760455494505b612b8e858383898c8e6143ed565b50505b5080612b9c816159f4565b915050612645565b508551602087015110612c9b5785516020870151600091612bc4916158a4565b90508660600151876040015110612bfb57612bf687606001518860400151612bec91906158a4565b828d8d8d8d613cee565b612c95565b8015612c6857603554604051630d43af8160e21b81526001600160a01b039091169063350ebe0490612c359084908f903390600401615d61565b600060405180830381600087803b158015612c4f57600080fd5b505af1158015612c63573d6000803e3d6000fd5b505050505b612c95333089604001518a60600151612c8191906158a4565b6034546001600160a01b0316929190614529565b50612e27565b60208601518651600091612cae916158a4565b6035546040516340c10f1960e01b81529192506001600160a01b0316906340c10f1990612ce1908d908590600401615d80565b600060405180830381600087803b158015612cfb57600080fd5b505af1158015612d0f573d6000803e3d6000fd5b50505050866060015187604001511115612d5357612d4e8a88606001518960400151612d3b91906158a4565b6034546001600160a01b03169190614594565b612e25565b600087604001518860600151612d6991906158a4565b90508015612e2357885115612e0b57896001600160a01b031663a5d4096b603560009054906101000a90046001600160a01b0316603460009054906101000a90046001600160a01b03163385878f6040518763ffffffff1660e01b8152600401612dd896959493929190615d99565b600060405180830381600087803b158015612df257600080fd5b505af1158015612e06573d6000803e3d6000fd5b505050505b603454612e23906001600160a01b0316333084614529565b505b505b505060018055509198975050505050505050565b603a8181548110610cb157600080fd5b6001600160a01b039182166000908152604a6020908152604080832093909416825291909152205460011490565b6033546001600160a01b03163314612ea45760405163b90cdbb160e01b815260040160405180910390fd5b603380546001600160a01b0319166001600160a01b0383811691909117909155603654604051630787a21360e51b815291169063f0f4426090612eeb908490600401614eb4565b600060405180830381600087803b158015612f0557600080fd5b505af1158015610a70573d6000803e3d6000fd5b83421115612f3a5760405163f87d927160e01b815260040160405180910390fd5b6fa2a8918ca85bafe22016d0b997e4df60600160ff1b03811180612f7157508260ff16601b14158015612f7157508260ff16601c14155b15612f8f57604051638baa579f60e01b815260040160405180910390fd5b6000612f99613aac565b608254898989612fa88d6145b3565b6040805160208101969096526001600160a01b03948516908601529290911660608401521515608083015260a082015260c0810187905260e0016040516020818303038152906040528051906020012060405160200161301f92919061190160f01b81526002810192909252602282015260420190565b60405160208183030381529060405280519060200120905061304a886001600160a01b03163b151590565b1561312657604080516020810185905280820184905260f886901b6001600160f81b0319166060820152815160418183030181526061820192839052630b135d3f60e11b9092526001600160a01b038a1691631626ba7e916130b0918591606501615ddb565b602060405180830381865afa1580156130cd573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906130f19190615df4565b6001600160e01b031916631626ba7e60e01b1461312157604051638baa579f60e01b815260040160405180910390fd5b6131ce565b6040805160008082526020820180845284905260ff871692820192909252606081018590526080810184905260019060a0016020604051602081039080840390855afa15801561317a573d6000803e3d6000fd5b505050602060405103519050886001600160a01b0316816001600160a01b03161415806131ae57506001600160a01b038116155b156131cc57604051638baa579f60e01b815260040160405180910390fd5b505b611cbf888888613df8565b6131e1614d8a565b60408051600080825260208201909252611d009187918791879187919061157b565b60335460009081906001600160a01b031633146132335760405163b90cdbb160e01b815260040160405180910390fd5b61323b613b18565b5050604180546042805460009384905592905591508082106132d45761326181836158a4565b6035546033546040516340c10f1960e01b8152929450600093506001600160a01b03918216926340c10f199261329d9216908690600401615d80565b600060405180830381600087803b1580156132b757600080fd5b505af11580156132cb573d6000803e3d6000fd5b505050506132e5565b6132de82826158a4565b9050600091505b60408051838152602081018390527ffeb12225c131aab793a00c5239afb778932d170fa28ce6e9d23703e4bd892121910160405180910390a19091565b3b151590565b6000908152604760205260409020546001600160a01b0316151590565b6000908152604960205260409020546001600160a01b031690565b6000818152604760205260409020546001600160a01b031680611e165760405163062a39dd60e11b815260040160405180910390fd5b600081815260496020526040902080546001600160a01b0319166001600160a01b03841690811790915581906133cb82613360565b6001600160a01b03167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92560405160405180910390a45050565b60008061341083613360565b9050806001600160a01b0316846001600160a01b0316148061344b5750836001600160a01b031661344084613345565b6001600160a01b0316145b80611d0357506001600160a01b038082166000908152604a6020908152604080832093881683529290522054600114949350505050565b826001600160a01b031661349582613360565b6001600160a01b0316146134bc5760405163c19f17a960e01b815260040160405180910390fd5b6001600160a01b0382166134e35760405163d92e233d60e01b815260040160405180910390fd5b603d54600160c01b900460ff16801561351557506001600160a01b038216600090815260446020526040902054600114155b1561353357604051630b094f2760e31b815260040160405180910390fd5b61353e600082613396565b6001600160a01b038084166000818152604860209081526040808320805460001901905593861680835284832080546001019055858352604790915283822080546001600160a01b03191682179055925184939291600080516020615eab83398151915291a4505050565b600080603e54426135ba91906158a4565b603d549091506001600160401b03168115806135d4575080155b156135e357603f549250505090565b60006135f06001846158a4565b905060006002841161360357600061360e565b61360e6002856158a4565b90506000676765c793fa10079d601b1b676765c793fa10079d601a1b613634868061583e565b61363e91906159c3565b6136489190615873565b90506000676765c793fa10079d601b1b676765c793fa10079d601a1b61366e878561583e565b61367891906159c3565b6136829190615873565b90506000600283613693878a61583e565b61369d919061583e565b6136a79190615873565b90506000600683866136b9898c61583e565b6136c3919061583e565b6136cd919061583e565b6136d79190615873565b9050676765c793fa10079d601b1b81836136f18b8b61583e565b61370690676765c793fa10079d601b1b6159c3565b61371091906159c3565b61371a91906159c3565b603f54613727919061583e565b6137319190615873565b9850505050505050505090565b613746614d8a565b60008060006137568887876145f7565b925092509250633b9aca008310613780576040516315fe9b6160e21b815260040160405180910390fd5b6000633b9aca0061379185826158a4565b61379a8a614680565b6137a4919061583e565b6137ae9190615873565b603d54909150600160801b90046001600160401b03168110156137de576137d981633b9aca006158a4565b6137ff565b603d546137ff90600160801b90046001600160401b0316633b9aca006158a4565b603d54909150600160401b90046001600160401b03166000806138276002633b9aca00615af3565b603c5461383d91906001600160401b031661583e565b83613848868a61583e565b613852919061583e565b106139ec57603c546001600160401b03166138726002633b9aca00615af3565b61387c919061583e565b603c54859061389b90600160401b90046001600160401b03168661583e565b6138a5919061583e565b6138af91906158a4565b603c548590633b9aca00906138cd906001600160401b03168961583e565b603c546138eb908b90600160401b90046001600160401b031661583e565b6138f591906158a4565b6138ff919061583e565b613909919061583e565b6139139190615873565b9150633b9aca0061392360b45490565b61392d919061583e565b613937848461583e565b61394191906159c3565b61394f633b9aca008861583e565b116139e757613969676765c793fa10079d601b1b8461583e565b633b9aca008a8e6020015161397e919061583e565b613988919061583e565b6139929190615873565b61399d9060016159c3565b91506139a860b45490565b8611156139e35782633b9aca006139be60b45490565b6139c890896158a4565b6139d2919061583e565b6139dc9190615873565b9050613a5a565b5060015b613a5a565b6038546139fd90633b9aca0061583e565b8c518b90613a0c90879061583e565b613a16919061583e565b613a209190615873565b613a2b9060016159c3565b9150613a3660b55490565b851115613a5657633b9aca0084613a4c60b55490565b6139c890886158a4565b5060015b818852613a67848b61583e565b603854613a78633b9aca008561583e565b613a82919061583e565b613a8c9190615873565b602089015260408801525050606085015250608083015250949350505050565b60808054608154604080517f8b73c3c69bb8fe3d512ecc4cf759cc79239f7b179b0ffacaa9a75d522b39400f602082015290810192909252606082015246918101919091523060a082015260009060c00160405160208183030381529060405280519060200120905090565b6000613b226135a9565b90506000676765c793fa10079d601b1b603f5483613b4091906158a4565b604054613b4d919061583e565b613b579190615873565b90508060416000828254613b6b91906159c3565b9091555050603f82905542603e8190556040805184815260208101929092527fd1fa8ba00a3bf20274346919dce0de62d2a140af2c71fe7e29fa6472eea3bb9d910160405180910390a15090565b600081613bcb57613bc8613b18565b91505b60008481526043602052604081206001015490676765c793fa10079d601b1b613bf4858461583e565b613bfe9190615873565b9050808510613c0f57935080613c32565b83613c25676765c793fa10079d601b1b8761583e565b613c2f9190615873565b90505b613c3c81836158a4565b91508060406000828254613c5091906158a4565b90915550508115801590613c8b5750676765c793fa10079d601b1b613c7460b45490565b613c7e919061583e565b613c88858461583e565b11155b15613ca95760405163228af07f60e21b815260040160405180910390fd5b60008681526043602052604080822060010184905551600080516020615e6b83398151915291613cdc91899185916159db565b60405180910390a15092949350505050565b8515613d0b57603454613d0b906001600160a01b03168488614594565b8415611e5057805115613d8a5760345460355460405163a5d4096b60e01b81526001600160a01b038086169363a5d4096b93613d579391831692169089908b908d908990600401615d99565b600060405180830381600087803b158015613d7157600080fd5b505af1158015613d85573d6000803e3d6000fd5b505050505b603554604051630d43af8160e21b81526001600160a01b039091169063350ebe0490613dbe90889088903390600401615d61565b600060405180830381600087803b158015613dd857600080fd5b505af1158015613dec573d6000803e3d6000fd5b50505050505050505050565b826001600160a01b0316826001600160a01b03161415613e2b576040516320c5195360e21b815260040160405180910390fd5b600081613e39576000613e3c565b60015b6001600160a01b038581166000818152604a602090815260408083209489168084529482529182902060ff959095169485905590518615158152939450919290917f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c31910160405180910390a350505050565b603d54600090600160c01b900460ff168015613efd57506001600160a01b0382166000908152604460205260409020546001141580613efd575033600090815260446020526040902054600114155b15613f1b57604051630b094f2760e31b815260040160405180910390fd5b6001600160a01b038216613f425760405163d92e233d60e01b815260040160405180910390fd5b5060458054600101908190556001600160a01b038216600081815260486020908152604080832080546001019055848352604790915280822080546001600160a01b031916841790555183929190600080516020615eab833981519152908290a4613fbf60008383604051806020016040528060008152506148af565b611e16576040516320149b4360e21b815260040160405180910390fd5b613fe7848484613482565b613ff3848484846148af565b614010576040516320149b4360e21b815260040160405180910390fd5b50505050565b600054610100900460ff166140815760405162461bcd60e51b815260206004820152602b60248201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960448201526a6e697469616c697a696e6760a81b60648201526084016115d1565b7f3f43a9c6bafb5c7aab4e0cfe239dc5d4c15caf0381c6104188191f78a6640bd860825580516020918201206080556040805180820190915260018152603160f81b9101527fc89efdaa54c0f20c7adf612882df0950f5a951637e0307cdcb4c672f298b8bc6608155565b6140f582613328565b6141125760405163062a39dd60e11b815260040160405180910390fd5b600082815260436020526040812080548392906141309084906159c3565b9091555050604051600080516020615e8b8339815191529061123790849084906001906159db565b60008033856141678282613404565b6141845760405163c19f17a960e01b815260040160405180910390fd5b6000878152604360209081526040808320815180830190925280548252600101549181019190915290806141b9838a8a6145f7565b5091509150633b9aca0082116141e257604051631527804d60e31b815260040160405180910390fd5b8260200151604060008282546141f891906158a4565b9091555061420790508a6149ab565b603c5460009061422b90600160c01b90046001600160401b0316633b9aca006158a4565b614239633b9aca008461583e565b6142439190615873565b905061424f82826158a4565b6041600082825461426091906159c3565b90915550509251929a92995091975050505050505050565b33846142848282613404565b6142a15760405163c19f17a960e01b815260040160405180910390fd5b600086815260436020526040812080548792906142bf9084906158a4565b9091555050600086815260436020908152604080832081518083019092528054825260010154918101919091526142f79086866145f7565b50509050633b9aca00811161431f57604051631527804d60e31b815260040160405180910390fd5b600080516020615e8b83398151915287876000604051614341939291906159db565b60405180910390a150505050505050565b600033856143608282613404565b61437d5760405163c19f17a960e01b815260040160405180910390fd5b61438987878787614a2a565b603c54909650600090633b9aca00906143b3908990600160801b90046001600160401b031661583e565b6143bd9190615873565b905080604160008282546143d191906159c3565b909155506143e1905081886158a4565b98975050505050505050565b33866143f98282613404565b6144165760405163c19f17a960e01b815260040160405180910390fd5b60408051898152602081018890526001600160a01b038916818301526060810187905290517fddd3b70af631334f7552aadb582ed091018e62e103fa8b150ca66cc700d4dac69181900360800190a161447188868686614a2a565b94506001600160a01b0387163014156144955761448f868685613bb9565b50611cbf565b603c546040516320d661ad60e21b815260048101889052602481018790526001600160401b03600160801b830481166044830152600160c01b90920490911660648201526001600160a01b0388169063835986b490608401600060405180830381600087803b15801561450757600080fd5b505af115801561451b573d6000803e3d6000fd5b505050505050505050505050565b6040516001600160a01b03808516602483015283166044820152606481018290526140109085906323b872dd60e01b906084015b60408051601f198184030181529190526020810180516001600160e01b03166001600160e01b031990931692909217909152614bbd565b610a378363a9059cbb60e01b848460405160240161455d929190615d80565b6001600160a01b0381166000908152607f60205260409020546145d78160016159c3565b6001600160a01b039092166000908152607f602052604090209190915590565b6000806000676765c793fa10079d601b1b848760200151614618919061583e565b6146229190615873565b9150603854858760000151614637919061583e565b6146419190615873565b905081614652576000199250614677565b603c54829061466a906001600160401b03168361583e565b6146749190615873565b92505b93509350939050565b6037546000906001600160a01b03166146b957603b6000815481106146a7576146a7615903565b90600052602060002001549050919050565b603754604051635dfba04560e11b81526000916001600160a01b03169063bbf7408a906146ea908690600401614eb4565b602060405180830381865afa158015614707573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061472b919061580f565b9050603a60018154811061474157614741615903565b9060005260206000200154811061477957603b60018154811061476657614766615903565b9060005260206000200154915050919050565b603a60008154811061478d5761478d615903565b906000526020600020015481116147b257603b60008154811061476657614766615903565b603a6000815481106147c6576147c6615903565b9060005260206000200154603a6001815481106147e5576147e5615903565b90600052602060002001546147fa91906158a4565b603a60008154811061480e5761480e615903565b90600052602060002001548261482491906158a4565b603b60008154811061483857614838615903565b9060005260206000200154603b60018154811061485757614857615903565b906000526020600020015461486c91906158a4565b614876919061583e565b6148809190615873565b603b60008154811061489457614894615903565b9060005260206000200154610b2291906159c3565b50919050565b60006001600160a01b0384163b156149a357604051630a85bd0160e11b81526001600160a01b0385169063150b7a02906148f3903390899088908890600401615e11565b6020604051808303816000875af192505050801561492e575060408051601f3d908101601f1916820190925261492b91810190615df4565b60015b614989573d80801561495c576040519150601f19603f3d011682016040523d82523d6000602084013e614961565b606091505b508051614981576040516320149b4360e21b815260040160405180910390fd5b805181602001fd5b6001600160e01b031916630a85bd0160e11b149050611d03565b506001611d03565b60006149b682613360565b90506149c3600083613396565b6001600160a01b038116600081815260486020908152604080832080546000190190558583526047825280832080546001600160a01b0319169055604390915280822082815560010182905551849290600080516020615eab833981519152908390a45050565b60008082614a43676765c793fa10079d601b1b8761583e565b614a4d9190615873565b600087815260436020526040902060010154909150614a885760b4548511614a885760405163228af07f60e21b815260040160405180910390fd5b60008681526043602052604081206001018054839290614aa99084906159c3565b925050819055508060406000828254614ac291906159c3565b9091555050603954614ae090676765c793fa10079d601b1b9061583e565b83604054614aee919061583e565b1115614b0d576040516371239a6160e11b815260040160405180910390fd5b60008681526043602090815260408083208151808301909252805482526001015491810191909152614b409086866145f7565b50509050633b9aca008111614b6857604051631527804d60e31b815260040160405180910390fd5b600080516020615e6b83398151915287836001604051614b8a939291906159db565b60405180910390a1676765c793fa10079d601b1b614ba8858461583e565b614bb29190615873565b979650505050505050565b6000614c12826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b0316614c8f9092919063ffffffff16565b805190915015610a375780806020019051810190614c309190615887565b610a375760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b60648201526084016115d1565b6060611d03848460008585843b614ce85760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e747261637400000060448201526064016115d1565b600080866001600160a01b03168587604051614d049190615e4e565b60006040518083038185875af1925050503d8060008114614d41576040519150601f19603f3d011682016040523d82523d6000602084013e614d46565b606091505b5091509150614bb282828660608315614d60575081610b22565b825115614d705782518084602001fd5b8160405162461bcd60e51b81526004016115d19190614f53565b6040518060a0016040528060008152602001600081526020016000815260200160008152602001600081525090565b828054614dc5906157da565b90600052602060002090601f016020900481019282614de75760008555614e2d565b82601f10614e0057805160ff1916838001178555614e2d565b82800160010185558215614e2d579182015b82811115614e2d578251825591602001919060010190614e12565b50614e39929150614e9f565b5090565b828054828255906000526020600020908101928215614e2d5791602002820182811115614e2d578251825591602001919060010190614e12565b6040518060800160405280600081526020016000815260200160008152602001600081525090565b5b80821115614e395760008155600101614ea0565b6001600160a01b0391909116815260200190565b6001600160e01b031981168114610c9e57600080fd5b600060208284031215614ef057600080fd5b8135610b2281614ec8565b60005b83811015614f16578181015183820152602001614efe565b838111156140105750506000910152565b60008151808452614f3f816020860160208601614efb565b601f01601f19169290920160200192915050565b602081526000610b226020830184614f27565b600060208284031215614f7857600080fd5b5035919050565b6001600160a01b0381168114610c9e57600080fd5b60008060408385031215614fa757600080fd5b8235614fb281614f7f565b946020939093013593505050565b600080600060608486031215614fd557600080fd5b8335614fe081614f7f565b92506020840135614ff081614f7f565b929592945050506040919091013590565b6000806040838503121561501457600080fd5b82359150602083013561502681614f7f565b809150509250929050565b60a081016108ea828480518252602081015160208301526040810151604083015260608101516060830152608081015160808301525050565b60006020828403121561507c57600080fd5b8135610b2281614f7f565b634e487b7160e01b600052604160045260246000fd5b604051601f8201601f191681016001600160401b03811182821017156150c5576150c5615087565b604052919050565b600082601f8301126150de57600080fd5b81356001600160401b038111156150f7576150f7615087565b61510a601f8201601f191660200161509d565b81815284602083860101111561511f57600080fd5b816020850160208301376000918101602001919091529392505050565b60006020828403121561514e57600080fd5b81356001600160401b0381111561516457600080fd5b611d03848285016150cd565b6000806040838503121561518357600080fd5b50508035926020909101359150565b80356001600160401b0381168114611e1657600080fd5b600080604083850312156151bc57600080fd5b614fb283615192565b60006001600160401b038211156151de576151de615087565b5060051b60200190565b600082601f8301126151f957600080fd5b8135602061520e615209836151c5565b61509d565b82815260059290921b8401810191818101908684111561522d57600080fd5b8286015b848110156152485780358352918301918301615231565b509695505050505050565b60008060006060848603121561526857600080fd5b833561527381614f7f565b925060208401356001600160401b038082111561528f57600080fd5b61529b878388016151e8565b935060408601359150808211156152b157600080fd5b506152be868287016151e8565b9150509250925092565b60008060008060008060c087890312156152e157600080fd5b86356001600160401b03808211156152f857600080fd5b6153048a838b016151e8565b9750602089013591508082111561531a57600080fd5b6153268a838b016151e8565b96506040890135915061533882614f7f565b90945060608801359061534a82614f7f565b90935060808801359061535c82614f7f565b90925060a0880135908082111561537257600080fd5b5061537f89828a016150cd565b9150509295509295509295565b600080600080608085870312156153a257600080fd5b5050823594602084013594506040840135936060013592509050565b600082601f8301126153cf57600080fd5b813560206153df615209836151c5565b82815260059290921b840181019181810190868411156153fe57600080fd5b8286015b848110156152485780356008811061541a5760008081fd5b8352918301918301615402565b600082601f83011261543857600080fd5b81356020615448615209836151c5565b82815260059290921b8401810191818101908684111561546757600080fd5b8286015b848110156152485780356001600160401b0381111561548a5760008081fd5b6154988986838b01016150cd565b84525091830191830161546b565b600080600080608085870312156154bc57600080fd5b84356001600160401b03808211156154d357600080fd5b6154df888389016153be565b955060208701359150808211156154f557600080fd5b5061550287828801615427565b935050604085013561551381614f7f565b9150606085013561552381614f7f565b939692955090935050565b8015158114610c9e57600080fd5b6000806040838503121561554f57600080fd5b823561555a81614f7f565b915060208301356150268161552e565b6000806000806080858703121561558057600080fd5b843561558b81614f7f565b9350602085013561559b81614f7f565b92506040850135915060608501356001600160401b038111156155bd57600080fd5b6155c9878288016150cd565b91505092959194509250565b60008060008060008587036101808112156155ef57600080fd5b86356155fa81614f7f565b9550602087013561560a81614f7f565b9450604087013561561a81614f7f565b9350610100605f198201121561562f57600080fd5b506060860191506101608601356001600160401b0381111561565057600080fd5b61565c888289016150cd565b9150509295509295909350565b60008060008060008060c0878903121561568257600080fd5b86356001600160401b038082111561569957600080fd5b6156a58a838b016153be565b975060208901359150808211156156bb57600080fd5b6153268a838b01615427565b600080604083850312156156da57600080fd5b82356156e581614f7f565b9150602083013561502681614f7f565b60ff81168114610c9e57600080fd5b600080600080600080600060e0888a03121561571f57600080fd5b873561572a81614f7f565b9650602088013561573a81614f7f565b9550604088013561574a8161552e565b9450606088013593506080880135615761816156f5565b9699959850939692959460a0840135945060c09093013592915050565b6000806000806080858703121561579457600080fd5b84356001600160401b03808211156157ab57600080fd5b6157b7888389016151e8565b955060208701359150808211156157cd57600080fd5b50615502878288016151e8565b600181811c908216806157ee57607f821691505b602082108114156148a957634e487b7160e01b600052602260045260246000fd5b60006020828403121561582157600080fd5b5051919050565b634e487b7160e01b600052601160045260246000fd5b600081600019048311821515161561585857615858615828565b500290565b634e487b7160e01b600052601260045260246000fd5b6000826158825761588261585d565b500490565b60006020828403121561589957600080fd5b8151610b228161552e565b6000828210156158b6576158b6615828565b500390565b60006001600160401b038281168482168083038211156158dd576158dd615828565b01949350505050565b6000602082840312156158f857600080fd5b8151610b2281614f7f565b634e487b7160e01b600052603260045260246000fd5b600081518084526020808501945080840160005b838110156159495781518752958201959082019060010161592d565b509495945050505050565b6040815260006159676040830185615919565b82810360208401526120578185615919565b6020808252601f908201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c00604082015260600190565b602081526000610b226020830184615919565b600082198211156159d6576159d6615828565b500190565b928352602083019190915260ff16604082015260600190565b6000600019821415615a0857615a08615828565b5060010190565b600181815b80851115615a4a578160001904821115615a3057615a30615828565b80851615615a3d57918102915b93841c9390800290615a14565b509250929050565b600082615a61575060016108ea565b81615a6e575060006108ea565b8160018114615a845760028114615a8e57615aaa565b60019150506108ea565b60ff841115615a9f57615a9f615828565b50506001821b6108ea565b5060208310610133831016604e8410600b8410161715615acd575081810a6108ea565b615ad78383615a0f565b8060001904821115615aeb57615aeb615828565b029392505050565b6000610b2260ff841683615a52565b600082615b1157615b1161585d565b500690565b60008151615b28818560208601614efb565b9290920192915050565b600080845481600182811c915080831680615b4e57607f831692505b6020808410821415615b6e57634e487b7160e01b86526022600452602486fd5b818015615b825760018114615b9357615bc0565b60ff19861689528489019650615bc0565b60008b81526020902060005b86811015615bb85781548b820152908501908301615b9f565b505084890196505b5050505050506120578185615b16565b600060208284031215615be257600080fd5b8151610b22816156f5565b6e020b733b63290283937ba37b1b7b61608d1b815260008251615c1781600f850160208701614efb565b650815985d5b1d60d21b600f939091019283015250601501919050565b60008251615c46818460208701614efb565b650b5d985d5b1d60d21b920191825250600601919050565b600060208284031215615c7057600080fd5b610b2282615192565b600060208284031215615c8b57600080fd5b8135610b228161552e565b634e487b7160e01b600052602160045260246000fd5b60008060408385031215615cbf57600080fd5b505080516020909101519092909150565b60008060008060008060c08789031215615ce957600080fd5b8651615cf481614f7f565b6020880151604089015160608a015160808b015160a0909b0151939c929b509099909850965090945092505050565b60008060008060808587031215615d3957600080fd5b845193506020850151615d4b81614f7f565b6040860151606090960151949790965092505050565b9283526001600160a01b03918216602084015216604082015260600190565b6001600160a01b03929092168252602082015260400190565b6001600160a01b038781168252868116602083015285166040820152606081018490526080810183905260c060a082018190526000906143e190830184614f27565b828152604060208201526000611d036040830184614f27565b600060208284031215615e0657600080fd5b8151610b2281614ec8565b6001600160a01b0385811682528416602082015260408101839052608060608201819052600090615e4490830184614f27565b9695505050505050565b60008251615e60818460208701614efb565b919091019291505056fe70cf49afe7355562d5b022e594790f22b71ad8cc7eec902fa5feac7c67f71091722cb71fa87c947148cefc06dd890af5802a6a00207c5ddecf1191bf71ce3cd4ddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3efa26469706673582212201f576770aa8b1ac44c345b6c00f8ce99e7e7f0e9e2214692591abbf1a81e680964736f6c634300080c0033", + "deployedBytecode": "0x608060405234801561001057600080fd5b50600436106103015760003560e01c8063010db1951461030657806301ffc9a71461032f57806306fdde0314610352578063081812fc14610367578063087a60071461037a578063095ea7b3146103915780630e198f22146103a657806313888565146103af57806323b872dd146103b8578063254cf439146103cb578063307439af146103fd57806334ce998a1461041d57806335836f15146104255780633644e5151461043857806339393ac91461044057806339eb4dc6146104535780633ae2325f146104675780633af32abf1461047a5780633c2e941b1461049a57806342842e0e146104a3578063430c2081146104b65780634f7e43df146104c957806355f804b3146104e35780635b84d88a146104f65780635c975abb1461050957806361d027b31461051d5780636352211e1461053057806370a082311461054357806374107543146105565780637aacfffa146105695780637adbf973146105a55780637c0f59f4146105b85780637c3a00fd146105d25780637dc0d1d0146105e55780637e53bd97146105f85780637e56d47c1461060b5780637ecebe001461061e578063835986b41461064757806389050f1d1461065a57806395d89b411461066c5780639a3b6f2f146106745780639f48118f146106ba578063a172923a146106c5578063a22cb465146106ce578063af2c8c2e146106e1578063b1511cc9146106ea578063b4bd6f46146106fd578063b88d4fde14610710578063bbcac55714610723578063c4ae31681461072c578063c66d8b0114610734578063c87b56dd1461074e578063d8dfeb4514610761578063d9b1cb5b14610774578063de1f776514610787578063de8fc69814610799578063df011c41146107ac578063e182b883146107bf578063e1c84ea4146107d2578063e626648a146107db578063e985e9c5146107f5578063e9cbd82214610808578063f0f442601461081b578063f51cc7dd1461082e578063fad9aba314610841578063fc29b02114610868578063fd527cf81461087b575b600080fd5b603754610319906001600160a01b031681565b6040516103269190614eb4565b60405180910390f35b61034261033d366004614ede565b610883565b6040519015158152602001610326565b61035a6108f0565b6040516103269190614f53565b610319610375366004614f66565b61097e565b610383603f5481565b604051908152602001610326565b6103a461039f366004614f94565b6109af565b005b610383603e5481565b61038360415481565b6103a46103c6366004614fc0565b610a3c565b603c546103e590600160401b90046001600160401b031681565b6040516001600160401b039091168152602001610326565b61041061040b366004615001565b610a77565b6040516103269190615031565b610383610b29565b610383610433366004614f66565b610b5b565b610383610b97565b6103a461044e36600461506a565b610ba1565b603d5461034290600160c01b900460ff1681565b610383610475366004614f66565b610ca1565b61038361048836600461506a565b60446020526000908152604090205481565b61038360455481565b6103a46104b1366004614fc0565b610cc2565b6103426104c4366004614f94565b610cdd565b603d546103e590600160801b90046001600160401b031681565b6103a46104f136600461513c565b610ce9565b6103a4610504366004615170565b610d8e565b603d5461034290600160c81b900460ff1681565b603354610319906001600160a01b031681565b61031961053e366004614f66565b610e27565b61038361055136600461506a565b610e32565b6103a46105643660046151a9565b610e77565b610590610577366004614f66565b6043602052600090815260409020805460019091015482565b60408051928352602083019190915201610326565b6103a46105b336600461506a565b611243565b603c546103e590600160c01b90046001600160401b031681565b603d546103e5906001600160401b031681565b603654610319906001600160a01b031681565b6103a4610606366004615253565b61138a565b6104106106193660046152c8565b61157b565b61038361062c36600461506a565b6001600160a01b03166000908152607f602052604090205490565b6103a461065536600461538c565b611b11565b610383676765c793fa10079d601a1b81565b61035a611cc9565b6106876106823660046154a6565b611cd6565b60405161032691908151815260208083015190820152604080830151908201526060918201519181019190915260800190565b610383633b9aca0081565b61038360b45481565b6103a46106dc36600461553c565b611d0b565b61038360405481565b6103a46106f8366004614f66565b611d16565b61038361070b36600461506a565b611ddf565b6103a461071e36600461556a565b611e1b565b61038360425481565b6103a4611e58565b603d546103e590600160401b90046001600160401b031681565b61035a61075c366004614f66565b611f07565b603454610319906001600160a01b031681565b6103a46107823660046155d5565b612060565b610383676765c793fa10079d601b1b81565b6106876107a7366004615669565b6125b4565b603c546103e5906001600160401b031681565b6103836107cd366004614f66565b612e3b565b61038360395481565b603c546103e590600160801b90046001600160401b031681565b6103426108033660046156c7565b612e4b565b603554610319906001600160a01b031681565b6103a461082936600461506a565b612e79565b6103a461083c366004615704565b612f19565b6103837f000000000000000000000000000000000000000000000000000000000000000081565b61041061087636600461577e565b6131d9565b610590613203565b60006001600160e01b03198216635b5e139f60e01b14806108b457506001600160e01b031982166380ac58cd60e01b145b806108cf57506001600160e01b0319821663430c208160e01b145b806108ea57506001600160e01b031982166301ffc9a760e01b145b92915050565b607d80546108fd906157da565b80601f0160208091040260200160405190810160405280929190818152602001828054610929906157da565b80156109765780601f1061094b57610100808354040283529160200191610976565b820191906000526020600020905b81548152906001019060200180831161095957829003601f168201915b505050505081565b600061098982613328565b6109a65760405163062a39dd60e11b815260040160405180910390fd5b6108ea82613345565b60006109ba82613360565b9050806001600160a01b0316836001600160a01b031614156109ef576040516349fa8bc360e11b815260040160405180910390fd5b336001600160a01b03821614801590610a0f5750610a0d8133612e4b565b155b15610a2d5760405163c19f17a960e01b815260040160405180910390fd5b610a378383613396565b505050565b3381610a488282613404565b610a655760405163c19f17a960e01b815260040160405180910390fd5b610a70858585613482565b5050505050565b610a7f614d8a565b60008381526043602090815260409182902082518084018452815481526001909101548183015260365483516315f789a960e21b81529351610b2294929387936001600160a01b03909316926357de26a492600480830193928290030181865afa158015610af1573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610b15919061580f565b610b1d6135a9565b61373e565b9392505050565b6000676765c793fa10079d601b1b610b3f6135a9565b604054610b4c919061583e565b610b569190615873565b905090565b6000676765c793fa10079d601b1b610b716135a9565b600084815260436020526040902060010154610b8d919061583e565b6108ea9190615873565b6000610b56613aac565b603354604051631c86b03760e31b81526001600160a01b039091169063e43581b890610bd1903390600401614eb4565b602060405180830381865afa158015610bee573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610c129190615887565b610c2f57604051633b8d9d7560e21b815260040160405180910390fd5b6001600160a01b03811615610c7e576001600160a01b038116600090815260446020526040902054610c629060016158a4565b6001600160a01b03821660009081526044602052604090205550565b603d805460ff60c01b198116600160c01b9182900460ff16159091021790555b50565b603b8181548110610cb157600080fd5b600091825260209091200154905081565b610a3783838360405180602001604052806000815250611e1b565b6000610b228383613404565b60335460405163521d4de960e01b81526001600160a01b039091169063521d4de990610d19903390600401614eb4565b602060405180830381865afa158015610d36573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610d5a9190615887565b610d7757604051632678482f60e21b815260040160405180910390fd5b8051610d8a906046906020840190614db9565b5050565b603354604051631c86b03760e31b81526001600160a01b039091169063e43581b890610dbe903390600401614eb4565b602060405180830381865afa158015610ddb573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610dff9190615887565b610e1c57604051633b8d9d7560e21b815260040160405180910390fd5b60b49190915560b555565b60006108ea82613360565b60006001600160a01b038216610e5b5760405163d92e233d60e01b815260040160405180910390fd5b506001600160a01b031660009081526048602052604090205490565b60335460405163521d4de960e01b81526001600160a01b039091169063521d4de990610ea7903390600401614eb4565b602060405180830381865afa158015610ec4573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610ee89190615887565b610f0557604051632678482f60e21b815260040160405180910390fd5b806121a360f11b1415610f6957603d546001600160401b03600160401b90910481169083161115610f4957604051637650e96360e11b815260040160405180910390fd5b603c80546001600160401b0319166001600160401b0384161790556111fc565b80622a242360e91b1415610fce57633b9aca00826001600160401b03161015610fa55760405163da6a17b960e01b815260040160405180910390fd5b603c8054600160401b600160801b031916600160401b6001600160401b038516021790556111fc565b8061212360f11b141561103257633b9aca00826001600160401b0316111561100957604051637650e96360e11b815260040160405180910390fd5b603c8054600160801b600160c01b031916600160801b6001600160401b038516021790556111fc565b8061292360f11b14156110af57603d54633b9aca009061106290600160401b90046001600160401b0316846158bb565b6001600160401b0316111561108a57604051637650e96360e11b815260040160405180910390fd5b603c80546001600160c01b0316600160c01b6001600160401b038516021790556111fc565b806124a960f11b14156110e5576110c4613b18565b50603d80546001600160401b0319166001600160401b0384161790556111fc565b80614c5360f01b141561117e57603c546001600160401b03808416911611806111375750603c54633b9aca009061112c90600160c01b90046001600160401b0316846158bb565b6001600160401b0316115b156111555760405163180d062b60e31b815260040160405180910390fd5b603d8054600160401b600160801b031916600160401b6001600160401b038516021790556111fc565b806213531160ea1b14156111e357633b9aca00826001600160401b031611156111ba57604051637650e96360e11b815260040160405180910390fd5b603d8054600160801b600160c01b031916600160801b6001600160401b038516021790556111fc565b60405163e1daa9cf60e01b815260040160405180910390fd5b604080516001600160401b0384168152602081018390527f13b367dac93b85d1ed9b3d8961d8b48e1a677c9800bb1613b4b0416b2d5b61d091015b60405180910390a15050565b603354604051631c86b03760e31b81526001600160a01b039091169063e43581b890611273903390600401614eb4565b602060405180830381865afa158015611290573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906112b49190615887565b6112d157604051633b8d9d7560e21b815260040160405180910390fd5b603354604080516361d027b360e01b815290516001600160a01b03928316928416916361d027b39160048083019260209291908290030181865afa15801561131d573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061134191906158e6565b6001600160a01b031614611368576040516302979eb960e31b815260040160405180910390fd5b603680546001600160a01b0319166001600160a01b0392909216919091179055565b60335460405163521d4de960e01b81526001600160a01b039091169063521d4de9906113ba903390600401614eb4565b602060405180830381865afa1580156113d7573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906113fb9190615887565b61141857604051632678482f60e21b815260040160405180910390fd5b8051825114158061144357508060008151811061143757611437615903565b60200260200101516000145b806114d257506001600160a01b038316158015906114d257508160008151811061146f5761146f615903565b60200260200101518260018151811061148a5761148a615903565b60200260200101511115806114d25750806000815181106114ad576114ad615903565b6020026020010151816001815181106114c8576114c8615903565b6020026020010151105b156114f057604051631746545d60e11b815260040160405180910390fd5b603780546001600160a01b0319166001600160a01b038516179055815161151e90603a906020850190614e3d565b50805161153290603b906020840190614e3d565b50826001600160a01b03167feb74d4d9fea592587c926aeb35eb6a7893fb28db0c1c8eb2eb3c586e7164b76c838360405161156e929190615954565b60405180910390a2505050565b611583614d8a565b603d54600160c81b900460ff16156115ae576040516313d0ff5960e31b815260040160405180910390fd5b600260015414156115da5760405162461bcd60e51b81526004016115d190615979565b60405180910390fd5b6002600155855187511415806115ef57508551155b1561160d576040516346282e8d60e01b815260040160405180910390fd5b603660009054906101000a90046001600160a01b03166001600160a01b03166357de26a46040518163ffffffff1660e01b8152600401602060405180830381865afa158015611660573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611684919061580f565b6060820152611691613b18565b60808201526040517f965a177723c641ee49150b583a0b9ad4730bb20d3474e00ae5a65e777c00d67b906116c69089906159b0565b60405180910390a160005b8751811015611a82576000604360008a84815181106116f2576116f2615903565b60200260200101518152602001908152602001600020604051806040016040529081600082015481526020016001820154815250509050600061173f82338660600151876080015161373e565b9050600081604001511180156117715750806040015189848151811061176757611767615903565b6020026020010151115b806117985750806000015189848151811061178e5761178e615903565b6020026020010151115b156117c15780600001518984815181106117b4576117b4615903565b6020026020010181815250505b6000846060015182606001516117d7919061583e565b603854633b9aca008c87815181106117f1576117f1615903565b6020026020010151611803919061583e565b61180d919061583e565b6118179190615873565b905061182e8b8581518110610d8a57610d8a615903565b82518110611964575081516020830151604080546000906118509084906158a4565b92505081905550604360008c868151811061186d5761186d615903565b60209081029190910181015182528101919091526040016000908120818155600101819055603d548b51633b9aca0091600160401b90046001600160401b0316908d90889081106118c0576118c0615903565b60200260200101516118d2919061583e565b6118dc9190615873565b9050826080015181106118f0576000611900565b80836080015161190091906158a4565b8660400181815161191191906159c3565b905250508a51600080516020615e6b833981519152908c908690811061193957611939615903565b602002602001015184602001516000604051611957939291906159db565b60405180910390a1611a25565b80604360008d878151811061197b5761197b615903565b6020026020010151815260200190815260200160002060000160008282546119a391906158a4565b92505081905550611a238b85815181106119bf576119bf615903565b6020026020010151633b9aca00603d60089054906101000a90046001600160401b03166001600160401b03168d88815181106119fd576119fd615903565b6020026020010151611a0f919061583e565b611a199190615873565b8760800151613bb9565b505b8085602001818151611a3791906159c3565b90525089518a9085908110611a4e57611a4e615903565b602002602001015185600001818151611a6791906159c3565b905250839250611a7a91508290506159f4565b9150506116d1565b50603d54633b9aca0090611aa690600160401b90046001600160401b0316826158a4565b8251611ab2919061583e565b611abc9190615873565b60416000828254611acd91906159c3565b9091555050604081015160428054600090611ae99084906159c3565b909155505060208101518151611b03919087878787613cee565b600180559695505050505050565b603d54600160c81b900460ff1615611b3c576040516313d0ff5960e31b815260040160405180910390fd5b6033546040516333b52a9f60e11b81526001600160a01b039091169063676a553e90611b6c903390600401614eb4565b602060405180830381865afa158015611b89573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611bad9190615887565b611bca5760405163027f480760e01b815260040160405180910390fd5b603c54600090600160c01b90046001600160401b0316821015611c0857603c54611c05908390600160c01b90046001600160401b03166158a4565b90505b603c54600090600160801b90046001600160401b0316841115611c4557603c54611c4290600160801b90046001600160401b0316856158a4565b90505b6000611c566002633b9aca00615af3565b611c6483633b9aca006158a4565b611c7285633b9aca006158a4565b611c7c908961583e565b611c86919061583e565b611c909190615873565b9050611c9c81876158a4565b60416000828254611cad91906159c3565b90915550611cbf905087826000613bb9565b5050505050505050565b607e80546108fd906157da565b611cde614e77565b60408051600080825260208201909252611d00918791879187918791906125b4565b90505b949350505050565b610d8a338383613df8565b60335460405163521d4de960e01b81526001600160a01b039091169063521d4de990611d46903390600401614eb4565b602060405180830381865afa158015611d63573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611d879190615887565b611da457604051632678482f60e21b815260040160405180910390fd5b60398190556040518181527fdd63b3dcdbebad734892f7c7a26d0f647fbc7eec973e0775f5229018ac4ab47a9060200160405180910390a150565b603d54600090600160c81b900460ff1615611e0d576040516313d0ff5960e31b815260040160405180910390fd5b6108ea82613eae565b919050565b3382611e278282613404565b611e445760405163c19f17a960e01b815260040160405180910390fd5b611e5086868686613fdc565b505050505050565b60335460405163521d4de960e01b81526001600160a01b039091169063521d4de990611e88903390600401614eb4565b602060405180830381865afa158015611ea5573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611ec99190615887565b611ee657604051632678482f60e21b815260040160405180910390fd5b603d805460ff60c81b198116600160c81b9182900460ff1615909102179055565b6060611f1282613328565b611f2f5760405163062a39dd60e11b815260040160405180910390fd5b8160005b8115611f595780611f43816159f4565b9150611f529050600a83615873565b9150611f33565b6000816001600160401b03811115611f7357611f73615087565b6040519080825280601f01601f191660200182016040528015611f9d576020820181803683370190505b5090505b841561200857611fb26001836158a4565b9150611fbf600a86615b02565b611fca9060306159c3565b60f81b818381518110611fdf57611fdf615903565b60200101906001600160f81b031916908160001a905350612001600a86615873565b9450611fa1565b600060468054612017906157da565b9050116120335760405180602001604052806000815250612057565b604681604051602001612047929190615b32565b6040516020818303038152906040525b95945050505050565b600054610100900460ff1661207b5760005460ff161561207f565b303b155b6120e25760405162461bcd60e51b815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201526d191e481a5b9a5d1a585b1a5e995960921b60648201526084016115d1565b600054610100900460ff16158015612104576000805461ffff19166101011790555b856001600160a01b0316846001600160a01b03166361d027b36040518163ffffffff1660e01b8152600401602060405180830381865afa15801561214c573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061217091906158e6565b6001600160a01b031614612197576040516302979eb960e31b815260040160405180910390fd5b603380546001600160a01b038089166001600160a01b0319928316179092556034805492881692909116821790556040805163313ce56760e01b8152905163313ce567916004808201926020929091908290030181865afa158015612200573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906122249190615bd0565b61222f90600a615af3565b603881905550856001600160a01b031663e9cbd8226040518163ffffffff1660e01b8152600401602060405180830381865afa158015612273573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061229791906158e6565b603580546001600160a01b03199081166001600160a01b0393841617909155603680549091169186169190911790556040516000906122da908490602001615bed565b60408051601f19818403018152919052805190915061230090607d906020840190614db9565b5061230a81614016565b8260405160200161231b9190615c34565b604051602081830303815290604052607e908051906020019061233f929190614db9565b50676765c793fa10079d601b1b603f5542603e5561236360a0850160808601615c5e565b6001600160401b031661237c6040860160208701615c5e565b6001600160401b031611806123ac5750633b9aca006123a160a0860160808701615c5e565b6001600160401b0316115b806123d257506123c26060850160408601615c5e565b6001600160401b0316633b9aca00115b806123f95750633b9aca006123ed60c0860160a08701615c5e565b6001600160401b031610155b80612406575060e0840135155b1561242457604051631746545d60e11b815260040160405180910390fd5b83356039556124396040850160208601615c5e565b603c80546001600160401b0319166001600160401b03929092169190911790556124696060850160408601615c5e565b603c80546001600160401b0392909216600160401b02600160401b600160801b03199092169190911790556124a46080850160608601615c5e565b603d80546001600160401b0319166001600160401b03929092169190911790556124d460a0850160808601615c5e565b603d80546001600160401b0392909216600160401b02600160401b600160801b031990921691909117905561250f60c0850160a08601615c5e565b603d80546001600160401b0392909216600160801b02600160801b600160c01b031990921691909117905561254a60e0850160c08601615c79565b603d8054911515600160c01b0260ff60c01b19909216919091179055604080516020810190915260e0850135815261258690603b906001614e3d565b5050603d805460ff60c81b1916600160c81b1790558015611e50576000805461ff0019169055505050505050565b6125bc614e77565b603d54600160c81b900460ff16156125e7576040516313d0ff5960e31b815260040160405180910390fd5b6002600154141561260a5760405162461bcd60e51b81526004016115d190615979565b60026001558551875114158061261f57508651155b1561263d576040516346282e8d60e01b815260040160405180910390fd5b600080808080805b8c51811015612ba45760008d828151811061266257612662615903565b602002602001015190506000600781111561267f5761267f615c96565b81600781111561269157612691615c96565b14156126d2576126cc8d83815181106126ac576126ac615903565b60200260200101518060200190518101906126c791906158e6565b613eae565b50612b91565b60028160078111156126e6576126e6615c96565b141561274c578c82815181106126fe576126fe615903565b60200260200101518060200190518101906127199190615cac565b95509250826127285760455492505b61273283866140ec565b848860600181815161274491906159c3565b905250612b91565b600781600781111561276057612760615c96565b14156128395760008060008f858151811061277d5761277d615903565b60200260200101518060200190518101906127989190615cd0565b60345460405163d505accf60e01b81526001600160a01b038089166004830152306024830152604482018890526064820187905260ff8616608483015260a4820185905260c48201849052969f50939d50939b509497509550929350169063d505accf9060e401600060405180830381600087803b15801561281957600080fd5b505af115801561282d573d6000803e3d6000fd5b50505050505050612b91565b8661284957612846613b18565b96505b600481600781111561285d5761285d615c96565b1415612929578c828151811061287557612875615903565b60200260200101518060200190518101906128909190615cac565b945092508261289f5760455492505b6128aa838589613bb9565b603c549094506000906128d190600160c01b90046001600160401b0316633b9aca006158a4565b6128df633b9aca008761583e565b6128e99190615873565b90506128f585826158a4565b6041600082825461290691906159c3565b92505081905550808960200181815161291f91906159c3565b905250612b919050565b856129a857603660009054906101000a90046001600160a01b03166001600160a01b03166357de26a46040518163ffffffff1660e01b8152600401602060405180830381865afa158015612981573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906129a5919061580f565b95505b60018160078111156129bc576129bc615c96565b1415612a38578c82815181106129d4576129d4615903565b60200260200101518060200190518101906129ef919061580f565b9250826129fc5760455492505b612a07838789614158565b80965081955050508488604001818151612a2191906159c3565b9052506020880180518591906127449083906159c3565b6003816007811115612a4c57612a4c615c96565b1415612aac578c8281518110612a6457612a64615903565b6020026020010151806020019051810190612a7f9190615cac565b9550925082612a8e5760455492505b612a9a8386888a614278565b848860400181815161274491906159c3565b6005816007811115612ac057612ac0615c96565b1415612b22578c8281518110612ad857612ad8615903565b6020026020010151806020019051810190612af39190615cac565b9450925082612b025760455492505b612b0e8385888a614352565b9350838860000181815161274491906159c3565b6006816007811115612b3657612b36615c96565b1415612b91576000808e8481518110612b5157612b51615903565b6020026020010151806020019051810190612b6c9190615d23565b98509196509250905084612b805760455494505b612b8e858383898c8e6143ed565b50505b5080612b9c816159f4565b915050612645565b508551602087015110612c9b5785516020870151600091612bc4916158a4565b90508660600151876040015110612bfb57612bf687606001518860400151612bec91906158a4565b828d8d8d8d613cee565b612c95565b8015612c6857603554604051630d43af8160e21b81526001600160a01b039091169063350ebe0490612c359084908f903390600401615d61565b600060405180830381600087803b158015612c4f57600080fd5b505af1158015612c63573d6000803e3d6000fd5b505050505b612c95333089604001518a60600151612c8191906158a4565b6034546001600160a01b0316929190614529565b50612e27565b60208601518651600091612cae916158a4565b6035546040516340c10f1960e01b81529192506001600160a01b0316906340c10f1990612ce1908d908590600401615d80565b600060405180830381600087803b158015612cfb57600080fd5b505af1158015612d0f573d6000803e3d6000fd5b50505050866060015187604001511115612d5357612d4e8a88606001518960400151612d3b91906158a4565b6034546001600160a01b03169190614594565b612e25565b600087604001518860600151612d6991906158a4565b90508015612e2357885115612e0b57896001600160a01b031663a5d4096b603560009054906101000a90046001600160a01b0316603460009054906101000a90046001600160a01b03163385878f6040518763ffffffff1660e01b8152600401612dd896959493929190615d99565b600060405180830381600087803b158015612df257600080fd5b505af1158015612e06573d6000803e3d6000fd5b505050505b603454612e23906001600160a01b0316333084614529565b505b505b505060018055509198975050505050505050565b603a8181548110610cb157600080fd5b6001600160a01b039182166000908152604a6020908152604080832093909416825291909152205460011490565b6033546001600160a01b03163314612ea45760405163b90cdbb160e01b815260040160405180910390fd5b603380546001600160a01b0319166001600160a01b0383811691909117909155603654604051630787a21360e51b815291169063f0f4426090612eeb908490600401614eb4565b600060405180830381600087803b158015612f0557600080fd5b505af1158015610a70573d6000803e3d6000fd5b83421115612f3a5760405163f87d927160e01b815260040160405180910390fd5b6fa2a8918ca85bafe22016d0b997e4df60600160ff1b03811180612f7157508260ff16601b14158015612f7157508260ff16601c14155b15612f8f57604051638baa579f60e01b815260040160405180910390fd5b6000612f99613aac565b608254898989612fa88d6145b3565b6040805160208101969096526001600160a01b03948516908601529290911660608401521515608083015260a082015260c0810187905260e0016040516020818303038152906040528051906020012060405160200161301f92919061190160f01b81526002810192909252602282015260420190565b60405160208183030381529060405280519060200120905061304a886001600160a01b03163b151590565b1561312657604080516020810185905280820184905260f886901b6001600160f81b0319166060820152815160418183030181526061820192839052630b135d3f60e11b9092526001600160a01b038a1691631626ba7e916130b0918591606501615ddb565b602060405180830381865afa1580156130cd573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906130f19190615df4565b6001600160e01b031916631626ba7e60e01b1461312157604051638baa579f60e01b815260040160405180910390fd5b6131ce565b6040805160008082526020820180845284905260ff871692820192909252606081018590526080810184905260019060a0016020604051602081039080840390855afa15801561317a573d6000803e3d6000fd5b505050602060405103519050886001600160a01b0316816001600160a01b03161415806131ae57506001600160a01b038116155b156131cc57604051638baa579f60e01b815260040160405180910390fd5b505b611cbf888888613df8565b6131e1614d8a565b60408051600080825260208201909252611d009187918791879187919061157b565b60335460009081906001600160a01b031633146132335760405163b90cdbb160e01b815260040160405180910390fd5b61323b613b18565b5050604180546042805460009384905592905591508082106132d45761326181836158a4565b6035546033546040516340c10f1960e01b8152929450600093506001600160a01b03918216926340c10f199261329d9216908690600401615d80565b600060405180830381600087803b1580156132b757600080fd5b505af11580156132cb573d6000803e3d6000fd5b505050506132e5565b6132de82826158a4565b9050600091505b60408051838152602081018390527ffeb12225c131aab793a00c5239afb778932d170fa28ce6e9d23703e4bd892121910160405180910390a19091565b3b151590565b6000908152604760205260409020546001600160a01b0316151590565b6000908152604960205260409020546001600160a01b031690565b6000818152604760205260409020546001600160a01b031680611e165760405163062a39dd60e11b815260040160405180910390fd5b600081815260496020526040902080546001600160a01b0319166001600160a01b03841690811790915581906133cb82613360565b6001600160a01b03167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92560405160405180910390a45050565b60008061341083613360565b9050806001600160a01b0316846001600160a01b0316148061344b5750836001600160a01b031661344084613345565b6001600160a01b0316145b80611d0357506001600160a01b038082166000908152604a6020908152604080832093881683529290522054600114949350505050565b826001600160a01b031661349582613360565b6001600160a01b0316146134bc5760405163c19f17a960e01b815260040160405180910390fd5b6001600160a01b0382166134e35760405163d92e233d60e01b815260040160405180910390fd5b603d54600160c01b900460ff16801561351557506001600160a01b038216600090815260446020526040902054600114155b1561353357604051630b094f2760e31b815260040160405180910390fd5b61353e600082613396565b6001600160a01b038084166000818152604860209081526040808320805460001901905593861680835284832080546001019055858352604790915283822080546001600160a01b03191682179055925184939291600080516020615eab83398151915291a4505050565b600080603e54426135ba91906158a4565b603d549091506001600160401b03168115806135d4575080155b156135e357603f549250505090565b60006135f06001846158a4565b905060006002841161360357600061360e565b61360e6002856158a4565b90506000676765c793fa10079d601b1b676765c793fa10079d601a1b613634868061583e565b61363e91906159c3565b6136489190615873565b90506000676765c793fa10079d601b1b676765c793fa10079d601a1b61366e878561583e565b61367891906159c3565b6136829190615873565b90506000600283613693878a61583e565b61369d919061583e565b6136a79190615873565b90506000600683866136b9898c61583e565b6136c3919061583e565b6136cd919061583e565b6136d79190615873565b9050676765c793fa10079d601b1b81836136f18b8b61583e565b61370690676765c793fa10079d601b1b6159c3565b61371091906159c3565b61371a91906159c3565b603f54613727919061583e565b6137319190615873565b9850505050505050505090565b613746614d8a565b60008060006137568887876145f7565b925092509250633b9aca008310613780576040516315fe9b6160e21b815260040160405180910390fd5b6000633b9aca0061379185826158a4565b61379a8a614680565b6137a4919061583e565b6137ae9190615873565b603d54909150600160801b90046001600160401b03168110156137de576137d981633b9aca006158a4565b6137ff565b603d546137ff90600160801b90046001600160401b0316633b9aca006158a4565b603d54909150600160401b90046001600160401b03166000806138276002633b9aca00615af3565b603c5461383d91906001600160401b031661583e565b83613848868a61583e565b613852919061583e565b106139ec57603c546001600160401b03166138726002633b9aca00615af3565b61387c919061583e565b603c54859061389b90600160401b90046001600160401b03168661583e565b6138a5919061583e565b6138af91906158a4565b603c548590633b9aca00906138cd906001600160401b03168961583e565b603c546138eb908b90600160401b90046001600160401b031661583e565b6138f591906158a4565b6138ff919061583e565b613909919061583e565b6139139190615873565b9150633b9aca0061392360b45490565b61392d919061583e565b613937848461583e565b61394191906159c3565b61394f633b9aca008861583e565b116139e757613969676765c793fa10079d601b1b8461583e565b633b9aca008a8e6020015161397e919061583e565b613988919061583e565b6139929190615873565b61399d9060016159c3565b91506139a860b45490565b8611156139e35782633b9aca006139be60b45490565b6139c890896158a4565b6139d2919061583e565b6139dc9190615873565b9050613a5a565b5060015b613a5a565b6038546139fd90633b9aca0061583e565b8c518b90613a0c90879061583e565b613a16919061583e565b613a209190615873565b613a2b9060016159c3565b9150613a3660b55490565b851115613a5657633b9aca0084613a4c60b55490565b6139c890886158a4565b5060015b818852613a67848b61583e565b603854613a78633b9aca008561583e565b613a82919061583e565b613a8c9190615873565b602089015260408801525050606085015250608083015250949350505050565b60808054608154604080517f8b73c3c69bb8fe3d512ecc4cf759cc79239f7b179b0ffacaa9a75d522b39400f602082015290810192909252606082015246918101919091523060a082015260009060c00160405160208183030381529060405280519060200120905090565b6000613b226135a9565b90506000676765c793fa10079d601b1b603f5483613b4091906158a4565b604054613b4d919061583e565b613b579190615873565b90508060416000828254613b6b91906159c3565b9091555050603f82905542603e8190556040805184815260208101929092527fd1fa8ba00a3bf20274346919dce0de62d2a140af2c71fe7e29fa6472eea3bb9d910160405180910390a15090565b600081613bcb57613bc8613b18565b91505b60008481526043602052604081206001015490676765c793fa10079d601b1b613bf4858461583e565b613bfe9190615873565b9050808510613c0f57935080613c32565b83613c25676765c793fa10079d601b1b8761583e565b613c2f9190615873565b90505b613c3c81836158a4565b91508060406000828254613c5091906158a4565b90915550508115801590613c8b5750676765c793fa10079d601b1b613c7460b45490565b613c7e919061583e565b613c88858461583e565b11155b15613ca95760405163228af07f60e21b815260040160405180910390fd5b60008681526043602052604080822060010184905551600080516020615e6b83398151915291613cdc91899185916159db565b60405180910390a15092949350505050565b8515613d0b57603454613d0b906001600160a01b03168488614594565b8415611e5057805115613d8a5760345460355460405163a5d4096b60e01b81526001600160a01b038086169363a5d4096b93613d579391831692169089908b908d908990600401615d99565b600060405180830381600087803b158015613d7157600080fd5b505af1158015613d85573d6000803e3d6000fd5b505050505b603554604051630d43af8160e21b81526001600160a01b039091169063350ebe0490613dbe90889088903390600401615d61565b600060405180830381600087803b158015613dd857600080fd5b505af1158015613dec573d6000803e3d6000fd5b50505050505050505050565b826001600160a01b0316826001600160a01b03161415613e2b576040516320c5195360e21b815260040160405180910390fd5b600081613e39576000613e3c565b60015b6001600160a01b038581166000818152604a602090815260408083209489168084529482529182902060ff959095169485905590518615158152939450919290917f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c31910160405180910390a350505050565b603d54600090600160c01b900460ff168015613efd57506001600160a01b0382166000908152604460205260409020546001141580613efd575033600090815260446020526040902054600114155b15613f1b57604051630b094f2760e31b815260040160405180910390fd5b6001600160a01b038216613f425760405163d92e233d60e01b815260040160405180910390fd5b5060458054600101908190556001600160a01b038216600081815260486020908152604080832080546001019055848352604790915280822080546001600160a01b031916841790555183929190600080516020615eab833981519152908290a4613fbf60008383604051806020016040528060008152506148af565b611e16576040516320149b4360e21b815260040160405180910390fd5b613fe7848484613482565b613ff3848484846148af565b614010576040516320149b4360e21b815260040160405180910390fd5b50505050565b600054610100900460ff166140815760405162461bcd60e51b815260206004820152602b60248201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960448201526a6e697469616c697a696e6760a81b60648201526084016115d1565b7f3f43a9c6bafb5c7aab4e0cfe239dc5d4c15caf0381c6104188191f78a6640bd860825580516020918201206080556040805180820190915260018152603160f81b9101527fc89efdaa54c0f20c7adf612882df0950f5a951637e0307cdcb4c672f298b8bc6608155565b6140f582613328565b6141125760405163062a39dd60e11b815260040160405180910390fd5b600082815260436020526040812080548392906141309084906159c3565b9091555050604051600080516020615e8b8339815191529061123790849084906001906159db565b60008033856141678282613404565b6141845760405163c19f17a960e01b815260040160405180910390fd5b6000878152604360209081526040808320815180830190925280548252600101549181019190915290806141b9838a8a6145f7565b5091509150633b9aca0082116141e257604051631527804d60e31b815260040160405180910390fd5b8260200151604060008282546141f891906158a4565b9091555061420790508a6149ab565b603c5460009061422b90600160c01b90046001600160401b0316633b9aca006158a4565b614239633b9aca008461583e565b6142439190615873565b905061424f82826158a4565b6041600082825461426091906159c3565b90915550509251929a92995091975050505050505050565b33846142848282613404565b6142a15760405163c19f17a960e01b815260040160405180910390fd5b600086815260436020526040812080548792906142bf9084906158a4565b9091555050600086815260436020908152604080832081518083019092528054825260010154918101919091526142f79086866145f7565b50509050633b9aca00811161431f57604051631527804d60e31b815260040160405180910390fd5b600080516020615e8b83398151915287876000604051614341939291906159db565b60405180910390a150505050505050565b600033856143608282613404565b61437d5760405163c19f17a960e01b815260040160405180910390fd5b61438987878787614a2a565b603c54909650600090633b9aca00906143b3908990600160801b90046001600160401b031661583e565b6143bd9190615873565b905080604160008282546143d191906159c3565b909155506143e1905081886158a4565b98975050505050505050565b33866143f98282613404565b6144165760405163c19f17a960e01b815260040160405180910390fd5b60408051898152602081018890526001600160a01b038916818301526060810187905290517fddd3b70af631334f7552aadb582ed091018e62e103fa8b150ca66cc700d4dac69181900360800190a161447188868686614a2a565b94506001600160a01b0387163014156144955761448f868685613bb9565b50611cbf565b603c546040516320d661ad60e21b815260048101889052602481018790526001600160401b03600160801b830481166044830152600160c01b90920490911660648201526001600160a01b0388169063835986b490608401600060405180830381600087803b15801561450757600080fd5b505af115801561451b573d6000803e3d6000fd5b505050505050505050505050565b6040516001600160a01b03808516602483015283166044820152606481018290526140109085906323b872dd60e01b906084015b60408051601f198184030181529190526020810180516001600160e01b03166001600160e01b031990931692909217909152614bbd565b610a378363a9059cbb60e01b848460405160240161455d929190615d80565b6001600160a01b0381166000908152607f60205260409020546145d78160016159c3565b6001600160a01b039092166000908152607f602052604090209190915590565b6000806000676765c793fa10079d601b1b848760200151614618919061583e565b6146229190615873565b9150603854858760000151614637919061583e565b6146419190615873565b905081614652576000199250614677565b603c54829061466a906001600160401b03168361583e565b6146749190615873565b92505b93509350939050565b6037546000906001600160a01b03166146b957603b6000815481106146a7576146a7615903565b90600052602060002001549050919050565b603754604051635dfba04560e11b81526000916001600160a01b03169063bbf7408a906146ea908690600401614eb4565b602060405180830381865afa158015614707573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061472b919061580f565b9050603a60018154811061474157614741615903565b9060005260206000200154811061477957603b60018154811061476657614766615903565b9060005260206000200154915050919050565b603a60008154811061478d5761478d615903565b906000526020600020015481116147b257603b60008154811061476657614766615903565b603a6000815481106147c6576147c6615903565b9060005260206000200154603a6001815481106147e5576147e5615903565b90600052602060002001546147fa91906158a4565b603a60008154811061480e5761480e615903565b90600052602060002001548261482491906158a4565b603b60008154811061483857614838615903565b9060005260206000200154603b60018154811061485757614857615903565b906000526020600020015461486c91906158a4565b614876919061583e565b6148809190615873565b603b60008154811061489457614894615903565b9060005260206000200154610b2291906159c3565b50919050565b60006001600160a01b0384163b156149a357604051630a85bd0160e11b81526001600160a01b0385169063150b7a02906148f3903390899088908890600401615e11565b6020604051808303816000875af192505050801561492e575060408051601f3d908101601f1916820190925261492b91810190615df4565b60015b614989573d80801561495c576040519150601f19603f3d011682016040523d82523d6000602084013e614961565b606091505b508051614981576040516320149b4360e21b815260040160405180910390fd5b805181602001fd5b6001600160e01b031916630a85bd0160e11b149050611d03565b506001611d03565b60006149b682613360565b90506149c3600083613396565b6001600160a01b038116600081815260486020908152604080832080546000190190558583526047825280832080546001600160a01b0319169055604390915280822082815560010182905551849290600080516020615eab833981519152908390a45050565b60008082614a43676765c793fa10079d601b1b8761583e565b614a4d9190615873565b600087815260436020526040902060010154909150614a885760b4548511614a885760405163228af07f60e21b815260040160405180910390fd5b60008681526043602052604081206001018054839290614aa99084906159c3565b925050819055508060406000828254614ac291906159c3565b9091555050603954614ae090676765c793fa10079d601b1b9061583e565b83604054614aee919061583e565b1115614b0d576040516371239a6160e11b815260040160405180910390fd5b60008681526043602090815260408083208151808301909252805482526001015491810191909152614b409086866145f7565b50509050633b9aca008111614b6857604051631527804d60e31b815260040160405180910390fd5b600080516020615e6b83398151915287836001604051614b8a939291906159db565b60405180910390a1676765c793fa10079d601b1b614ba8858461583e565b614bb29190615873565b979650505050505050565b6000614c12826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b0316614c8f9092919063ffffffff16565b805190915015610a375780806020019051810190614c309190615887565b610a375760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b60648201526084016115d1565b6060611d03848460008585843b614ce85760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e747261637400000060448201526064016115d1565b600080866001600160a01b03168587604051614d049190615e4e565b60006040518083038185875af1925050503d8060008114614d41576040519150601f19603f3d011682016040523d82523d6000602084013e614d46565b606091505b5091509150614bb282828660608315614d60575081610b22565b825115614d705782518084602001fd5b8160405162461bcd60e51b81526004016115d19190614f53565b6040518060a0016040528060008152602001600081526020016000815260200160008152602001600081525090565b828054614dc5906157da565b90600052602060002090601f016020900481019282614de75760008555614e2d565b82601f10614e0057805160ff1916838001178555614e2d565b82800160010185558215614e2d579182015b82811115614e2d578251825591602001919060010190614e12565b50614e39929150614e9f565b5090565b828054828255906000526020600020908101928215614e2d5791602002820182811115614e2d578251825591602001919060010190614e12565b6040518060800160405280600081526020016000815260200160008152602001600081525090565b5b80821115614e395760008155600101614ea0565b6001600160a01b0391909116815260200190565b6001600160e01b031981168114610c9e57600080fd5b600060208284031215614ef057600080fd5b8135610b2281614ec8565b60005b83811015614f16578181015183820152602001614efe565b838111156140105750506000910152565b60008151808452614f3f816020860160208601614efb565b601f01601f19169290920160200192915050565b602081526000610b226020830184614f27565b600060208284031215614f7857600080fd5b5035919050565b6001600160a01b0381168114610c9e57600080fd5b60008060408385031215614fa757600080fd5b8235614fb281614f7f565b946020939093013593505050565b600080600060608486031215614fd557600080fd5b8335614fe081614f7f565b92506020840135614ff081614f7f565b929592945050506040919091013590565b6000806040838503121561501457600080fd5b82359150602083013561502681614f7f565b809150509250929050565b60a081016108ea828480518252602081015160208301526040810151604083015260608101516060830152608081015160808301525050565b60006020828403121561507c57600080fd5b8135610b2281614f7f565b634e487b7160e01b600052604160045260246000fd5b604051601f8201601f191681016001600160401b03811182821017156150c5576150c5615087565b604052919050565b600082601f8301126150de57600080fd5b81356001600160401b038111156150f7576150f7615087565b61510a601f8201601f191660200161509d565b81815284602083860101111561511f57600080fd5b816020850160208301376000918101602001919091529392505050565b60006020828403121561514e57600080fd5b81356001600160401b0381111561516457600080fd5b611d03848285016150cd565b6000806040838503121561518357600080fd5b50508035926020909101359150565b80356001600160401b0381168114611e1657600080fd5b600080604083850312156151bc57600080fd5b614fb283615192565b60006001600160401b038211156151de576151de615087565b5060051b60200190565b600082601f8301126151f957600080fd5b8135602061520e615209836151c5565b61509d565b82815260059290921b8401810191818101908684111561522d57600080fd5b8286015b848110156152485780358352918301918301615231565b509695505050505050565b60008060006060848603121561526857600080fd5b833561527381614f7f565b925060208401356001600160401b038082111561528f57600080fd5b61529b878388016151e8565b935060408601359150808211156152b157600080fd5b506152be868287016151e8565b9150509250925092565b60008060008060008060c087890312156152e157600080fd5b86356001600160401b03808211156152f857600080fd5b6153048a838b016151e8565b9750602089013591508082111561531a57600080fd5b6153268a838b016151e8565b96506040890135915061533882614f7f565b90945060608801359061534a82614f7f565b90935060808801359061535c82614f7f565b90925060a0880135908082111561537257600080fd5b5061537f89828a016150cd565b9150509295509295509295565b600080600080608085870312156153a257600080fd5b5050823594602084013594506040840135936060013592509050565b600082601f8301126153cf57600080fd5b813560206153df615209836151c5565b82815260059290921b840181019181810190868411156153fe57600080fd5b8286015b848110156152485780356008811061541a5760008081fd5b8352918301918301615402565b600082601f83011261543857600080fd5b81356020615448615209836151c5565b82815260059290921b8401810191818101908684111561546757600080fd5b8286015b848110156152485780356001600160401b0381111561548a5760008081fd5b6154988986838b01016150cd565b84525091830191830161546b565b600080600080608085870312156154bc57600080fd5b84356001600160401b03808211156154d357600080fd5b6154df888389016153be565b955060208701359150808211156154f557600080fd5b5061550287828801615427565b935050604085013561551381614f7f565b9150606085013561552381614f7f565b939692955090935050565b8015158114610c9e57600080fd5b6000806040838503121561554f57600080fd5b823561555a81614f7f565b915060208301356150268161552e565b6000806000806080858703121561558057600080fd5b843561558b81614f7f565b9350602085013561559b81614f7f565b92506040850135915060608501356001600160401b038111156155bd57600080fd5b6155c9878288016150cd565b91505092959194509250565b60008060008060008587036101808112156155ef57600080fd5b86356155fa81614f7f565b9550602087013561560a81614f7f565b9450604087013561561a81614f7f565b9350610100605f198201121561562f57600080fd5b506060860191506101608601356001600160401b0381111561565057600080fd5b61565c888289016150cd565b9150509295509295909350565b60008060008060008060c0878903121561568257600080fd5b86356001600160401b038082111561569957600080fd5b6156a58a838b016153be565b975060208901359150808211156156bb57600080fd5b6153268a838b01615427565b600080604083850312156156da57600080fd5b82356156e581614f7f565b9150602083013561502681614f7f565b60ff81168114610c9e57600080fd5b600080600080600080600060e0888a03121561571f57600080fd5b873561572a81614f7f565b9650602088013561573a81614f7f565b9550604088013561574a8161552e565b9450606088013593506080880135615761816156f5565b9699959850939692959460a0840135945060c09093013592915050565b6000806000806080858703121561579457600080fd5b84356001600160401b03808211156157ab57600080fd5b6157b7888389016151e8565b955060208701359150808211156157cd57600080fd5b50615502878288016151e8565b600181811c908216806157ee57607f821691505b602082108114156148a957634e487b7160e01b600052602260045260246000fd5b60006020828403121561582157600080fd5b5051919050565b634e487b7160e01b600052601160045260246000fd5b600081600019048311821515161561585857615858615828565b500290565b634e487b7160e01b600052601260045260246000fd5b6000826158825761588261585d565b500490565b60006020828403121561589957600080fd5b8151610b228161552e565b6000828210156158b6576158b6615828565b500390565b60006001600160401b038281168482168083038211156158dd576158dd615828565b01949350505050565b6000602082840312156158f857600080fd5b8151610b2281614f7f565b634e487b7160e01b600052603260045260246000fd5b600081518084526020808501945080840160005b838110156159495781518752958201959082019060010161592d565b509495945050505050565b6040815260006159676040830185615919565b82810360208401526120578185615919565b6020808252601f908201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c00604082015260600190565b602081526000610b226020830184615919565b600082198211156159d6576159d6615828565b500190565b928352602083019190915260ff16604082015260600190565b6000600019821415615a0857615a08615828565b5060010190565b600181815b80851115615a4a578160001904821115615a3057615a30615828565b80851615615a3d57918102915b93841c9390800290615a14565b509250929050565b600082615a61575060016108ea565b81615a6e575060006108ea565b8160018114615a845760028114615a8e57615aaa565b60019150506108ea565b60ff841115615a9f57615a9f615828565b50506001821b6108ea565b5060208310610133831016604e8410600b8410161715615acd575081810a6108ea565b615ad78383615a0f565b8060001904821115615aeb57615aeb615828565b029392505050565b6000610b2260ff841683615a52565b600082615b1157615b1161585d565b500690565b60008151615b28818560208601614efb565b9290920192915050565b600080845481600182811c915080831680615b4e57607f831692505b6020808410821415615b6e57634e487b7160e01b86526022600452602486fd5b818015615b825760018114615b9357615bc0565b60ff19861689528489019650615bc0565b60008b81526020902060005b86811015615bb85781548b820152908501908301615b9f565b505084890196505b5050505050506120578185615b16565b600060208284031215615be257600080fd5b8151610b22816156f5565b6e020b733b63290283937ba37b1b7b61608d1b815260008251615c1781600f850160208701614efb565b650815985d5b1d60d21b600f939091019283015250601501919050565b60008251615c46818460208701614efb565b650b5d985d5b1d60d21b920191825250600601919050565b600060208284031215615c7057600080fd5b610b2282615192565b600060208284031215615c8b57600080fd5b8135610b228161552e565b634e487b7160e01b600052602160045260246000fd5b60008060408385031215615cbf57600080fd5b505080516020909101519092909150565b60008060008060008060c08789031215615ce957600080fd5b8651615cf481614f7f565b6020880151604089015160608a015160808b015160a0909b0151939c929b509099909850965090945092505050565b60008060008060808587031215615d3957600080fd5b845193506020850151615d4b81614f7f565b6040860151606090960151949790965092505050565b9283526001600160a01b03918216602084015216604082015260600190565b6001600160a01b03929092168252602082015260400190565b6001600160a01b038781168252868116602083015285166040820152606081018490526080810183905260c060a082018190526000906143e190830184614f27565b828152604060208201526000611d036040830184614f27565b600060208284031215615e0657600080fd5b8151610b2281614ec8565b6001600160a01b0385811682528416602082015260408101839052608060608201819052600090615e4490830184614f27565b9695505050505050565b60008251615e60818460208701614efb565b919091019291505056fe70cf49afe7355562d5b022e594790f22b71ad8cc7eec902fa5feac7c67f71091722cb71fa87c947148cefc06dd890af5802a6a00207c5ddecf1191bf71ce3cd4ddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3efa26469706673582212201f576770aa8b1ac44c345b6c00f8ce99e7e7f0e9e2214692591abbf1a81e680964736f6c634300080c0033" +} \ No newline at end of file diff --git a/deployments/polygon/solcInputs/dc345d3eed7216da5bac40699a727ed4.json b/deployments/polygon/solcInputs/dc345d3eed7216da5bac40699a727ed4.json new file mode 100644 index 00000000..07ab4718 --- /dev/null +++ b/deployments/polygon/solcInputs/dc345d3eed7216da5bac40699a727ed4.json @@ -0,0 +1,124 @@ +{ + "language": "Solidity", + "sources": { + "contracts/vaultManager/VaultManagerLiquidationBoost.sol": { + "content": "// SPDX-License-Identifier: GPL-3.0\n\npragma solidity ^0.8.12;\n\nimport \"./VaultManager.sol\";\n\n/// @title VaultManagerLiquidationBoost\n/// @author Angle Labs, Inc.\n/// @notice Liquidation discount depending also on the liquidator veANGLE balance\ncontract VaultManagerLiquidationBoost is VaultManager {\n using SafeERC20 for IERC20;\n using Address for address;\n\n // =================================== SETTER ==================================\n\n /// @inheritdoc VaultManager\n /// @param _veBoostProxy Address which queries veANGLE balances and adjusted balances from delegation\n /// @param xBoost Threshold values of veANGLE adjusted balances\n /// @param yBoost Values of the liquidation boost at the threshold values of x\n /// @dev There are 2 modes:\n /// When boost is enabled, `xBoost` and `yBoost` should have a length of 2, but if they have a\n /// higher length contract will still work as expected. Contract will also work as expected if their\n /// length differ\n /// When boost is disabled, `_veBoostProxy` needs to be zero address and `yBoost[0]` is the base boost\n function setLiquidationBoostParameters(\n address _veBoostProxy,\n uint256[] memory xBoost,\n uint256[] memory yBoost\n ) external override onlyGovernorOrGuardian {\n if (\n (xBoost.length != yBoost.length) ||\n (yBoost[0] == 0) ||\n ((_veBoostProxy != address(0)) && (xBoost[1] <= xBoost[0] || yBoost[1] < yBoost[0]))\n ) revert InvalidSetOfParameters();\n veBoostProxy = IVeBoostProxy(_veBoostProxy);\n xLiquidationBoost = xBoost;\n yLiquidationBoost = yBoost;\n emit LiquidationBoostParametersUpdated(_veBoostProxy, xBoost, yBoost);\n }\n\n // ======================== OVERRIDEN VIRTUAL FUNCTIONS ========================\n\n /// @inheritdoc VaultManager\n function _computeLiquidationBoost(address liquidator) internal view override returns (uint256) {\n if (address(veBoostProxy) == address(0)) {\n return yLiquidationBoost[0];\n } else {\n uint256 adjustedBalance = veBoostProxy.adjusted_balance_of(liquidator);\n if (adjustedBalance >= xLiquidationBoost[1]) return yLiquidationBoost[1];\n else if (adjustedBalance <= xLiquidationBoost[0]) return yLiquidationBoost[0];\n else\n return\n yLiquidationBoost[0] +\n ((yLiquidationBoost[1] - yLiquidationBoost[0]) * (adjustedBalance - xLiquidationBoost[0])) /\n (xLiquidationBoost[1] - xLiquidationBoost[0]);\n }\n }\n}\n" + }, + "contracts/vaultManager/VaultManager.sol": { + "content": "// SPDX-License-Identifier: GPL-3.0\n\npragma solidity ^0.8.12;\n\nimport \"./VaultManagerPermit.sol\";\n\n/// @title VaultManager\n/// @author Angle Labs, Inc.\n/// @notice This contract allows people to deposit collateral and open up loans of a given AgToken. It handles all the loan\n/// logic (fees and interest rate) as well as the liquidation logic\n/// @dev This implementation only supports non-rebasing ERC20 tokens as collateral\n/// @dev This contract is encoded as a NFT contract\ncontract VaultManager is VaultManagerPermit, IVaultManagerFunctions {\n using SafeERC20 for IERC20;\n using Address for address;\n\n /// @inheritdoc IVaultManagerFunctions\n uint256 public dust;\n\n /// @notice Minimum amount of collateral (in stablecoin value, e.g in `BASE_TOKENS = 10**18`) that can be left\n /// in a vault during a liquidation where the health factor function is decreasing\n uint256 internal _dustCollateral;\n\n uint256[48] private __gapVaultManager;\n\n /// @inheritdoc IVaultManagerFunctions\n function initialize(\n ITreasury _treasury,\n IERC20 _collateral,\n IOracle _oracle,\n VaultParameters calldata params,\n string memory _symbol\n ) external initializer {\n if (_oracle.treasury() != _treasury) revert InvalidTreasury();\n treasury = _treasury;\n collateral = _collateral;\n _collatBase = 10**(IERC20Metadata(address(collateral)).decimals());\n stablecoin = IAgToken(_treasury.stablecoin());\n oracle = _oracle;\n string memory _name = string.concat(\"Angle Protocol \", _symbol, \" Vault\");\n name = _name;\n __ERC721Permit_init(_name);\n symbol = string.concat(_symbol, \"-vault\");\n\n interestAccumulator = BASE_INTEREST;\n lastInterestAccumulatorUpdated = block.timestamp;\n\n // Checking if the parameters have been correctly initialized\n if (\n params.collateralFactor > params.liquidationSurcharge ||\n params.liquidationSurcharge > BASE_PARAMS ||\n BASE_PARAMS > params.targetHealthFactor ||\n params.maxLiquidationDiscount >= BASE_PARAMS ||\n params.baseBoost == 0\n ) revert InvalidSetOfParameters();\n\n debtCeiling = params.debtCeiling;\n collateralFactor = params.collateralFactor;\n targetHealthFactor = params.targetHealthFactor;\n interestRate = params.interestRate;\n liquidationSurcharge = params.liquidationSurcharge;\n maxLiquidationDiscount = params.maxLiquidationDiscount;\n whitelistingActivated = params.whitelistingActivated;\n yLiquidationBoost = [params.baseBoost];\n paused = true;\n }\n\n // ================================= MODIFIERS =================================\n\n /// @notice Checks whether the `msg.sender` has the governor role or not\n modifier onlyGovernor() {\n if (!treasury.isGovernor(msg.sender)) revert NotGovernor();\n _;\n }\n\n /// @notice Checks whether the `msg.sender` has the governor role or the guardian role\n modifier onlyGovernorOrGuardian() {\n if (!treasury.isGovernorOrGuardian(msg.sender)) revert NotGovernorOrGuardian();\n _;\n }\n\n /// @notice Checks whether the `msg.sender` is the treasury contract\n modifier onlyTreasury() {\n if (msg.sender != address(treasury)) revert NotTreasury();\n _;\n }\n\n /// @notice Checks whether the contract is paused\n modifier whenNotPaused() {\n if (paused) revert Paused();\n _;\n }\n\n // ============================== VAULT FUNCTIONS ==============================\n\n /// @inheritdoc IVaultManagerFunctions\n function createVault(address toVault) external whenNotPaused returns (uint256) {\n return _mint(toVault);\n }\n\n /// @inheritdoc IVaultManagerFunctions\n function angle(\n ActionType[] memory actions,\n bytes[] memory datas,\n address from,\n address to\n ) external returns (PaymentData memory) {\n return angle(actions, datas, from, to, address(0), new bytes(0));\n }\n\n /// @inheritdoc IVaultManagerFunctions\n function angle(\n ActionType[] memory actions,\n bytes[] memory datas,\n address from,\n address to,\n address who,\n bytes memory repayData\n ) public whenNotPaused nonReentrant returns (PaymentData memory paymentData) {\n if (actions.length != datas.length || actions.length == 0) revert IncompatibleLengths();\n // `newInterestAccumulator` and `oracleValue` are expensive to compute. Therefore, they are computed\n // only once inside the first action where they are necessary, then they are passed forward to further actions\n uint256 newInterestAccumulator;\n uint256 oracleValue;\n uint256 collateralAmount;\n uint256 stablecoinAmount;\n uint256 vaultID;\n for (uint256 i; i < actions.length; ++i) {\n ActionType action = actions[i];\n // Processing actions which do not need the value of the oracle or of the `interestAccumulator`\n if (action == ActionType.createVault) {\n _mint(abi.decode(datas[i], (address)));\n } else if (action == ActionType.addCollateral) {\n (vaultID, collateralAmount) = abi.decode(datas[i], (uint256, uint256));\n if (vaultID == 0) vaultID = vaultIDCount;\n _addCollateral(vaultID, collateralAmount);\n paymentData.collateralAmountToReceive += collateralAmount;\n } else if (action == ActionType.permit) {\n address owner;\n bytes32 r;\n bytes32 s;\n // Watch out naming conventions for permit are not respected to save some space and reduce the stack size\n // `vaultID` is used in place of the `deadline` parameter\n // Same for `collateralAmount` used in place of `value`\n // `stablecoinAmount` is used in place of the `v`\n (owner, collateralAmount, vaultID, stablecoinAmount, r, s) = abi.decode(\n datas[i],\n (address, uint256, uint256, uint256, bytes32, bytes32)\n );\n IERC20PermitUpgradeable(address(collateral)).permit(\n owner,\n address(this),\n collateralAmount,\n vaultID,\n uint8(stablecoinAmount),\n r,\n s\n );\n } else {\n // Processing actions which rely on the `interestAccumulator`: first accruing it to make\n // sure surplus is correctly taken into account between debt changes\n if (newInterestAccumulator == 0) newInterestAccumulator = _accrue();\n if (action == ActionType.repayDebt) {\n (vaultID, stablecoinAmount) = abi.decode(datas[i], (uint256, uint256));\n if (vaultID == 0) vaultID = vaultIDCount;\n stablecoinAmount = _repayDebt(vaultID, stablecoinAmount, newInterestAccumulator);\n uint256 stablecoinAmountPlusRepayFee = (stablecoinAmount * BASE_PARAMS) / (BASE_PARAMS - repayFee);\n surplus += stablecoinAmountPlusRepayFee - stablecoinAmount;\n paymentData.stablecoinAmountToReceive += stablecoinAmountPlusRepayFee;\n } else {\n // Processing actions which need the oracle value\n if (oracleValue == 0) oracleValue = oracle.read();\n if (action == ActionType.closeVault) {\n vaultID = abi.decode(datas[i], (uint256));\n if (vaultID == 0) vaultID = vaultIDCount;\n (stablecoinAmount, collateralAmount) = _closeVault(\n vaultID,\n oracleValue,\n newInterestAccumulator\n );\n paymentData.collateralAmountToGive += collateralAmount;\n paymentData.stablecoinAmountToReceive += stablecoinAmount;\n } else if (action == ActionType.removeCollateral) {\n (vaultID, collateralAmount) = abi.decode(datas[i], (uint256, uint256));\n if (vaultID == 0) vaultID = vaultIDCount;\n _removeCollateral(vaultID, collateralAmount, oracleValue, newInterestAccumulator);\n paymentData.collateralAmountToGive += collateralAmount;\n } else if (action == ActionType.borrow) {\n (vaultID, stablecoinAmount) = abi.decode(datas[i], (uint256, uint256));\n if (vaultID == 0) vaultID = vaultIDCount;\n stablecoinAmount = _borrow(vaultID, stablecoinAmount, oracleValue, newInterestAccumulator);\n paymentData.stablecoinAmountToGive += stablecoinAmount;\n } else if (action == ActionType.getDebtIn) {\n address vaultManager;\n uint256 dstVaultID;\n (vaultID, vaultManager, dstVaultID, stablecoinAmount) = abi.decode(\n datas[i],\n (uint256, address, uint256, uint256)\n );\n if (vaultID == 0) vaultID = vaultIDCount;\n _getDebtIn(\n vaultID,\n IVaultManager(vaultManager),\n dstVaultID,\n stablecoinAmount,\n oracleValue,\n newInterestAccumulator\n );\n }\n }\n }\n }\n\n // Processing the different cases for the repayment, there are 4 of them:\n // - (1) Stablecoins to receive + collateral to send\n // - (2) Stablecoins to receive + collateral to receive\n // - (3) Stablecoins to send + collateral to send\n // - (4) Stablecoins to send + collateral to receive\n if (paymentData.stablecoinAmountToReceive >= paymentData.stablecoinAmountToGive) {\n uint256 stablecoinPayment = paymentData.stablecoinAmountToReceive - paymentData.stablecoinAmountToGive;\n if (paymentData.collateralAmountToGive >= paymentData.collateralAmountToReceive) {\n // In the case where all amounts are null, the function will enter here and nothing will be done\n // for the repayment\n _handleRepay(\n // Collateral payment is the difference between what to give and what to receive\n paymentData.collateralAmountToGive - paymentData.collateralAmountToReceive,\n stablecoinPayment,\n from,\n to,\n who,\n repayData\n );\n } else {\n if (stablecoinPayment != 0) stablecoin.burnFrom(stablecoinPayment, from, msg.sender);\n // In this case the collateral amount is necessarily non null\n collateral.safeTransferFrom(\n msg.sender,\n address(this),\n paymentData.collateralAmountToReceive - paymentData.collateralAmountToGive\n );\n }\n } else {\n uint256 stablecoinPayment = paymentData.stablecoinAmountToGive - paymentData.stablecoinAmountToReceive;\n // `stablecoinPayment` is strictly positive in this case\n stablecoin.mint(to, stablecoinPayment);\n if (paymentData.collateralAmountToGive > paymentData.collateralAmountToReceive) {\n collateral.safeTransfer(to, paymentData.collateralAmountToGive - paymentData.collateralAmountToReceive);\n } else {\n uint256 collateralPayment = paymentData.collateralAmountToReceive - paymentData.collateralAmountToGive;\n if (collateralPayment != 0) {\n if (repayData.length != 0) {\n ISwapper(who).swap(\n IERC20(address(stablecoin)),\n collateral,\n msg.sender,\n // As per the `ISwapper` interface, we must first give the amount of token owed by the address before\n // the amount of token it (or another related address) obtained\n collateralPayment,\n stablecoinPayment,\n repayData\n );\n }\n collateral.safeTransferFrom(msg.sender, address(this), collateralPayment);\n }\n }\n }\n }\n\n /// @inheritdoc IVaultManagerFunctions\n function getDebtOut(\n uint256 vaultID,\n uint256 stablecoinAmount,\n uint256 senderBorrowFee,\n uint256 senderRepayFee\n ) external whenNotPaused {\n if (!treasury.isVaultManager(msg.sender)) revert NotVaultManager();\n // Getting debt out of a vault is equivalent to repaying a portion of your debt, and this could leave exploits:\n // someone could borrow from a vault and transfer its debt to a `VaultManager` contract where debt repayment will\n // be cheaper: in which case we're making people pay the delta\n uint256 _repayFee;\n if (repayFee > senderRepayFee) {\n _repayFee = repayFee - senderRepayFee;\n }\n // Checking the delta of borrow fees to eliminate the risk of exploits here: a similar thing could happen: people\n // could mint from where it is cheap to mint and then transfer their debt to places where it is more expensive\n // to mint\n uint256 _borrowFee;\n if (senderBorrowFee > borrowFee) {\n _borrowFee = senderBorrowFee - borrowFee;\n }\n\n uint256 stablecoinAmountLessFeePaid = (stablecoinAmount *\n (BASE_PARAMS - _repayFee) *\n (BASE_PARAMS - _borrowFee)) / (BASE_PARAMS**2);\n surplus += stablecoinAmount - stablecoinAmountLessFeePaid;\n _repayDebt(vaultID, stablecoinAmountLessFeePaid, 0);\n }\n\n // =============================== VIEW FUNCTIONS ==============================\n\n /// @inheritdoc IVaultManagerFunctions\n function getVaultDebt(uint256 vaultID) external view returns (uint256) {\n return (vaultData[vaultID].normalizedDebt * _calculateCurrentInterestAccumulator()) / BASE_INTEREST;\n }\n\n /// @inheritdoc IVaultManagerFunctions\n function getTotalDebt() external view returns (uint256) {\n return (totalNormalizedDebt * _calculateCurrentInterestAccumulator()) / BASE_INTEREST;\n }\n\n /// @notice Checks whether a given vault is liquidable and if yes gives information regarding its liquidation\n /// @param vaultID ID of the vault to check\n /// @param liquidator Address of the liquidator which will be performing the liquidation\n /// @return liqOpp Description of the opportunity of liquidation\n /// @dev This function will revert if it's called on a vault that does not exist\n function checkLiquidation(uint256 vaultID, address liquidator)\n external\n view\n returns (LiquidationOpportunity memory liqOpp)\n {\n liqOpp = _checkLiquidation(\n vaultData[vaultID],\n liquidator,\n oracle.read(),\n _calculateCurrentInterestAccumulator()\n );\n }\n\n // ====================== INTERNAL UTILITY VIEW FUNCTIONS ======================\n\n /// @notice Computes the health factor of a given vault. This can later be used to check whether a given vault is solvent\n /// (i.e. should be liquidated or not)\n /// @param vault Data of the vault to check\n /// @param oracleValue Oracle value at the time of the call (it is in the base of the stablecoin, that is for agTokens 10**18)\n /// @param newInterestAccumulator Value of the `interestAccumulator` at the time of the call\n /// @return healthFactor Health factor of the vault: if it's inferior to 1 (`BASE_PARAMS` in fact) this means that the vault can be liquidated\n /// @return currentDebt Current value of the debt of the vault (taking into account interest)\n /// @return collateralAmountInStable Collateral in the vault expressed in stablecoin value\n function _isSolvent(\n Vault memory vault,\n uint256 oracleValue,\n uint256 newInterestAccumulator\n )\n internal\n view\n returns (\n uint256 healthFactor,\n uint256 currentDebt,\n uint256 collateralAmountInStable\n )\n {\n currentDebt = (vault.normalizedDebt * newInterestAccumulator) / BASE_INTEREST;\n collateralAmountInStable = (vault.collateralAmount * oracleValue) / _collatBase;\n if (currentDebt == 0) healthFactor = type(uint256).max;\n else healthFactor = (collateralAmountInStable * collateralFactor) / currentDebt;\n }\n\n /// @notice Calculates the current value of the `interestAccumulator` without updating the value\n /// in storage\n /// @dev This function avoids expensive exponentiation and the calculation is performed using a binomial approximation\n /// (1+x)^n = 1+n*x+[n/2*(n-1)]*x^2+[n/6*(n-1)*(n-2)*x^3...\n /// @dev The approximation slightly undercharges borrowers with the advantage of a great gas cost reduction\n /// @dev This function was mostly inspired from Aave implementation\n function _calculateCurrentInterestAccumulator() internal view returns (uint256) {\n uint256 exp = block.timestamp - lastInterestAccumulatorUpdated;\n uint256 ratePerSecond = interestRate;\n if (exp == 0 || ratePerSecond == 0) return interestAccumulator;\n uint256 expMinusOne = exp - 1;\n uint256 expMinusTwo = exp > 2 ? exp - 2 : 0;\n uint256 basePowerTwo = (ratePerSecond * ratePerSecond + HALF_BASE_INTEREST) / BASE_INTEREST;\n uint256 basePowerThree = (basePowerTwo * ratePerSecond + HALF_BASE_INTEREST) / BASE_INTEREST;\n uint256 secondTerm = (exp * expMinusOne * basePowerTwo) / 2;\n uint256 thirdTerm = (exp * expMinusOne * expMinusTwo * basePowerThree) / 6;\n return (interestAccumulator * (BASE_INTEREST + ratePerSecond * exp + secondTerm + thirdTerm)) / BASE_INTEREST;\n }\n\n // ================= INTERNAL UTILITY STATE-MODIFYING FUNCTIONS ================\n\n /// @notice Closes a vault without handling the repayment of the concerned address\n /// @param vaultID ID of the vault to close\n /// @param oracleValue Oracle value at the start of the call\n /// @param newInterestAccumulator Interest rate accumulator value at the start of the call\n /// @return Current debt of the vault to be repaid\n /// @return Value of the collateral in the vault to reimburse\n /// @dev The returned values are here to facilitate composability between calls\n function _closeVault(\n uint256 vaultID,\n uint256 oracleValue,\n uint256 newInterestAccumulator\n ) internal onlyApprovedOrOwner(msg.sender, vaultID) returns (uint256, uint256) {\n Vault memory vault = vaultData[vaultID];\n (uint256 healthFactor, uint256 currentDebt, ) = _isSolvent(vault, oracleValue, newInterestAccumulator);\n if (healthFactor <= BASE_PARAMS) revert InsolventVault();\n totalNormalizedDebt -= vault.normalizedDebt;\n _burn(vaultID);\n uint256 currentDebtPlusRepayFee = (currentDebt * BASE_PARAMS) / (BASE_PARAMS - repayFee);\n surplus += currentDebtPlusRepayFee - currentDebt;\n return (currentDebtPlusRepayFee, vault.collateralAmount);\n }\n\n /// @notice Increases the collateral balance of a vault\n /// @param vaultID ID of the vault to increase the collateral balance of\n /// @param collateralAmount Amount by which increasing the collateral balance of\n function _addCollateral(uint256 vaultID, uint256 collateralAmount) internal {\n if (!_exists(vaultID)) revert NonexistentVault();\n _checkpointCollateral(vaultID, collateralAmount, true);\n vaultData[vaultID].collateralAmount += collateralAmount;\n emit CollateralAmountUpdated(vaultID, collateralAmount, 1);\n }\n\n /// @notice Decreases the collateral balance from a vault (without proceeding to collateral transfers)\n /// @param vaultID ID of the vault to decrease the collateral balance of\n /// @param collateralAmount Amount of collateral to reduce the balance of\n /// @param oracleValue Oracle value at the start of the call (given here to avoid double computations)\n /// @param interestAccumulator_ Value of the interest rate accumulator (potentially zero if it has not been\n /// computed yet)\n function _removeCollateral(\n uint256 vaultID,\n uint256 collateralAmount,\n uint256 oracleValue,\n uint256 interestAccumulator_\n ) internal onlyApprovedOrOwner(msg.sender, vaultID) {\n _checkpointCollateral(vaultID, collateralAmount, false);\n vaultData[vaultID].collateralAmount -= collateralAmount;\n (uint256 healthFactor, , ) = _isSolvent(vaultData[vaultID], oracleValue, interestAccumulator_);\n if (healthFactor <= BASE_PARAMS) revert InsolventVault();\n emit CollateralAmountUpdated(vaultID, collateralAmount, 0);\n }\n\n /// @notice Increases the debt balance of a vault and takes into account borrowing fees\n /// @param vaultID ID of the vault to increase borrow balance of\n /// @param stablecoinAmount Amount of stablecoins to borrow\n /// @param oracleValue Oracle value at the start of the call\n /// @param newInterestAccumulator Value of the interest rate accumulator\n /// @return toMint Amount of stablecoins to mint\n function _borrow(\n uint256 vaultID,\n uint256 stablecoinAmount,\n uint256 oracleValue,\n uint256 newInterestAccumulator\n ) internal onlyApprovedOrOwner(msg.sender, vaultID) returns (uint256 toMint) {\n stablecoinAmount = _increaseDebt(vaultID, stablecoinAmount, oracleValue, newInterestAccumulator);\n uint256 borrowFeePaid = (borrowFee * stablecoinAmount) / BASE_PARAMS;\n surplus += borrowFeePaid;\n toMint = stablecoinAmount - borrowFeePaid;\n }\n\n /// @notice Gets debt in a vault from another vault potentially in another `VaultManager` contract\n /// @param srcVaultID ID of the vault from this contract for which growing debt\n /// @param vaultManager Address of the `VaultManager` where the targeted vault is\n /// @param dstVaultID ID of the vault in the target contract\n /// @param stablecoinAmount Amount of stablecoins to grow the debt of. This amount will be converted\n /// to a normalized value in both `VaultManager` contracts\n /// @param oracleValue Oracle value at the start of the call (potentially zero if it has not been computed yet)\n /// @param newInterestAccumulator Value of the interest rate accumulator (potentially zero if it has not been\n /// computed yet)\n /// @dev A solvency check is performed after the debt increase in the source `vaultID`\n /// @dev Only approved addresses by the source vault owner can perform this action, however any vault\n /// from any vaultManager contract can see its debt reduced by this means\n function _getDebtIn(\n uint256 srcVaultID,\n IVaultManager vaultManager,\n uint256 dstVaultID,\n uint256 stablecoinAmount,\n uint256 oracleValue,\n uint256 newInterestAccumulator\n ) internal onlyApprovedOrOwner(msg.sender, srcVaultID) {\n emit DebtTransferred(srcVaultID, dstVaultID, address(vaultManager), stablecoinAmount);\n // The `stablecoinAmount` needs to be rounded down in the `_increaseDebt` function to reduce the room for exploits\n stablecoinAmount = _increaseDebt(srcVaultID, stablecoinAmount, oracleValue, newInterestAccumulator);\n if (address(vaultManager) == address(this)) {\n // No repayFees taken in this case, otherwise the same stablecoin may end up paying fees twice\n _repayDebt(dstVaultID, stablecoinAmount, newInterestAccumulator);\n } else {\n // No need to check the integrity of `VaultManager` here because `_getDebtIn` can be entered only through the\n // `angle` function which is non reentrant. Also, `getDebtOut` failing would be at the attacker loss, as they\n // would get their debt increasing in the current vault without decreasing it in the remote vault.\n vaultManager.getDebtOut(dstVaultID, stablecoinAmount, borrowFee, repayFee);\n }\n }\n\n /// @notice Increases the debt of a given vault and verifies that this vault is still solvent\n /// @param vaultID ID of the vault to increase the debt of\n /// @param stablecoinAmount Amount of stablecoin to increase the debt of: this amount is converted in\n /// normalized debt using the pre-computed (or not) `newInterestAccumulator` value\n /// @param oracleValue Oracle value at the start of the call (given here to avoid double computations)\n /// @param newInterestAccumulator Value of the interest rate accumulator (potentially zero if it has not been\n /// computed yet)\n /// @return Amount of stablecoins to issue from this debt increase\n /// @dev The `stablecoinAmount` outputted need to be rounded down with respect to the change amount so that\n /// amount of stablecoins minted is smaller than the debt increase\n function _increaseDebt(\n uint256 vaultID,\n uint256 stablecoinAmount,\n uint256 oracleValue,\n uint256 newInterestAccumulator\n ) internal returns (uint256) {\n // We normalize the amount by dividing it by `newInterestAccumulator`. This makes accounting easier, since\n // it allows us to process all (past and future) debts like debts created at the inception of the contract.\n uint256 changeAmount = (stablecoinAmount * BASE_INTEREST) / newInterestAccumulator;\n // if there was no previous debt, we have to check that the debt creation will be higher than `dust`\n if (vaultData[vaultID].normalizedDebt == 0)\n if (stablecoinAmount <= dust) revert DustyLeftoverAmount();\n vaultData[vaultID].normalizedDebt += changeAmount;\n totalNormalizedDebt += changeAmount;\n if (totalNormalizedDebt * newInterestAccumulator > debtCeiling * BASE_INTEREST) revert DebtCeilingExceeded();\n (uint256 healthFactor, , ) = _isSolvent(vaultData[vaultID], oracleValue, newInterestAccumulator);\n if (healthFactor <= BASE_PARAMS) revert InsolventVault();\n emit InternalDebtUpdated(vaultID, changeAmount, 1);\n return (changeAmount * newInterestAccumulator) / BASE_INTEREST;\n }\n\n /// @notice Decreases the debt of a given vault and verifies that this vault still has an amount of debt superior\n /// to a dusty amount or no debt at all\n /// @param vaultID ID of the vault to decrease the debt of\n /// @param stablecoinAmount Amount of stablecoin to decrease the debt of: this amount is converted in\n /// normalized debt using the pre-computed (or not) `newInterestAccumulator` value\n /// To repay the whole debt, one can pass `type(uint256).max`\n /// @param newInterestAccumulator Value of the interest rate accumulator (potentially zero if it has not been\n /// computed yet, like in `getDebtOut`)\n /// @return Amount of stablecoins to be burnt to correctly repay the debt\n /// @dev If `stablecoinAmount` is `type(uint256).max`, this function will repay all the debt of the vault\n function _repayDebt(\n uint256 vaultID,\n uint256 stablecoinAmount,\n uint256 newInterestAccumulator\n ) internal returns (uint256) {\n if (newInterestAccumulator == 0) newInterestAccumulator = _accrue();\n uint256 newVaultNormalizedDebt = vaultData[vaultID].normalizedDebt;\n // To save one variable declaration, `changeAmount` is first expressed in stablecoin amount before being converted\n // to a normalized amount. Here we first store the maximum amount that can be repaid given the current debt\n uint256 changeAmount = (newVaultNormalizedDebt * newInterestAccumulator) / BASE_INTEREST;\n // In some situations (e.g. liquidations), the `stablecoinAmount` is rounded above and we want to make\n // sure to avoid underflows in all situations\n if (stablecoinAmount >= changeAmount) {\n stablecoinAmount = changeAmount;\n changeAmount = newVaultNormalizedDebt;\n } else {\n changeAmount = (stablecoinAmount * BASE_INTEREST) / newInterestAccumulator;\n }\n newVaultNormalizedDebt -= changeAmount;\n totalNormalizedDebt -= changeAmount;\n if (newVaultNormalizedDebt != 0 && newVaultNormalizedDebt * newInterestAccumulator <= dust * BASE_INTEREST)\n revert DustyLeftoverAmount();\n vaultData[vaultID].normalizedDebt = newVaultNormalizedDebt;\n emit InternalDebtUpdated(vaultID, changeAmount, 0);\n return stablecoinAmount;\n }\n\n /// @notice Handles the simultaneous repayment of stablecoins with a transfer of collateral\n /// @param collateralAmountToGive Amount of collateral the contract should give\n /// @param stableAmountToRepay Amount of stablecoins the contract should burn from the call\n /// @param from Address from which stablecoins should be burnt: it should be the `msg.sender` or at least\n /// approved by it\n /// @param to Address to which collateral should be sent\n /// @param who Address which should be notified if needed of the transfer\n /// @param data Data to pass to the `who` contract for it to successfully give the correct amount of stablecoins\n /// to the `from` address\n /// @dev This function allows for capital-efficient liquidations and repayments of loans\n function _handleRepay(\n uint256 collateralAmountToGive,\n uint256 stableAmountToRepay,\n address from,\n address to,\n address who,\n bytes memory data\n ) internal {\n if (collateralAmountToGive != 0) collateral.safeTransfer(to, collateralAmountToGive);\n if (stableAmountToRepay != 0) {\n if (data.length != 0) {\n ISwapper(who).swap(\n collateral,\n IERC20(address(stablecoin)),\n from,\n stableAmountToRepay,\n collateralAmountToGive,\n data\n );\n }\n stablecoin.burnFrom(stableAmountToRepay, from, msg.sender);\n }\n }\n\n // ====================== TREASURY RELATIONSHIP FUNCTIONS ======================\n\n /// @inheritdoc IVaultManagerFunctions\n function accrueInterestToTreasury() external onlyTreasury returns (uint256 surplusValue, uint256 badDebtValue) {\n _accrue();\n surplusValue = surplus;\n badDebtValue = badDebt;\n surplus = 0;\n badDebt = 0;\n if (surplusValue >= badDebtValue) {\n surplusValue -= badDebtValue;\n badDebtValue = 0;\n stablecoin.mint(address(treasury), surplusValue);\n } else {\n badDebtValue -= surplusValue;\n surplusValue = 0;\n }\n emit AccruedToTreasury(surplusValue, badDebtValue);\n }\n\n /// @notice Accrues interest accumulated across all vaults to the surplus and updates the `interestAccumulator`\n /// @return newInterestAccumulator Computed value of the interest accumulator\n /// @dev It should also be called when updating the value of the per second interest rate or when the `totalNormalizedDebt`\n /// value is about to change\n function _accrue() internal returns (uint256 newInterestAccumulator) {\n newInterestAccumulator = _calculateCurrentInterestAccumulator();\n uint256 interestAccrued = (totalNormalizedDebt * (newInterestAccumulator - interestAccumulator)) /\n BASE_INTEREST;\n surplus += interestAccrued;\n interestAccumulator = newInterestAccumulator;\n lastInterestAccumulatorUpdated = block.timestamp;\n emit InterestAccumulatorUpdated(newInterestAccumulator, block.timestamp);\n return newInterestAccumulator;\n }\n\n // ================================ LIQUIDATIONS ===============================\n\n /// @notice Liquidates an ensemble of vaults specified by their IDs\n /// @dev This function is a simplified wrapper of the function below. It is built to remove for liquidators the need to specify\n /// a `who` and a `data` parameter\n function liquidate(\n uint256[] memory vaultIDs,\n uint256[] memory amounts,\n address from,\n address to\n ) external returns (LiquidatorData memory) {\n return liquidate(vaultIDs, amounts, from, to, address(0), new bytes(0));\n }\n\n /// @notice Liquidates an ensemble of vaults specified by their IDs\n /// @param vaultIDs List of the vaults to liquidate\n /// @param amounts Amount of stablecoin to bring for the liquidation of each vault\n /// @param from Address from which the stablecoins for the liquidation should be taken: this address should be the `msg.sender`\n /// or have received an approval\n /// @param to Address to which discounted collateral should be sent\n /// @param who Address of the contract to handle repayment of stablecoins from received collateral\n /// @param data Data to pass to the repayment contract in case of. If empty, liquidators simply have to bring the exact amount of\n /// stablecoins to get the discounted collateral. If not, it is used by the repayment contract to swap a portion or all\n /// of the collateral received to stablecoins to be sent to the `from` address. More details in the `_handleRepay` function\n /// @return liqData Data about the liquidation process for the liquidator to track everything that has been going on (like how much\n /// stablecoins have been repaid, how much collateral has been received)\n /// @dev This function will revert if it's called on a vault that cannot be liquidated or that does not exist\n function liquidate(\n uint256[] memory vaultIDs,\n uint256[] memory amounts,\n address from,\n address to,\n address who,\n bytes memory data\n ) public whenNotPaused nonReentrant returns (LiquidatorData memory liqData) {\n uint256 vaultIDsLength = vaultIDs.length;\n if (vaultIDsLength != amounts.length || vaultIDsLength == 0) revert IncompatibleLengths();\n // Stores all the data about an ongoing liquidation of multiple vaults\n liqData.oracleValue = oracle.read();\n liqData.newInterestAccumulator = _accrue();\n emit LiquidatedVaults(vaultIDs);\n for (uint256 i; i < vaultIDsLength; ++i) {\n Vault memory vault = vaultData[vaultIDs[i]];\n // Computing if liquidation can take place for a vault\n LiquidationOpportunity memory liqOpp = _checkLiquidation(\n vault,\n msg.sender,\n liqData.oracleValue,\n liqData.newInterestAccumulator\n );\n\n // Makes sure not to leave a dusty amount in the vault by either not liquidating too much\n // or everything\n if (\n (liqOpp.thresholdRepayAmount != 0 && amounts[i] >= liqOpp.thresholdRepayAmount) ||\n amounts[i] > liqOpp.maxStablecoinAmountToRepay\n ) amounts[i] = liqOpp.maxStablecoinAmountToRepay;\n\n // liqOpp.discount stores in fact `1-discount`\n uint256 collateralReleased = (amounts[i] * BASE_PARAMS * _collatBase) /\n (liqOpp.discount * liqData.oracleValue);\n\n _checkpointCollateral(\n vaultIDs[i],\n vault.collateralAmount <= collateralReleased ? vault.collateralAmount : collateralReleased,\n false\n );\n // Because we're rounding up in some divisions, `collateralReleased` can be greater than the `collateralAmount` of the vault\n // In this case, `stablecoinAmountToReceive` is still rounded up\n if (vault.collateralAmount <= collateralReleased) {\n collateralReleased = vault.collateralAmount;\n // Remove all the vault's debt (debt repayed + bad debt) from VaultManager totalDebt\n totalNormalizedDebt -= vault.normalizedDebt;\n // Reinitializing the `vaultID`: we're not burning the vault in this case for integration purposes\n delete vaultData[vaultIDs[i]];\n {\n uint256 debtReimbursed = (amounts[i] * liquidationSurcharge) / BASE_PARAMS;\n liqData.badDebtFromLiquidation += debtReimbursed < liqOpp.currentDebt\n ? liqOpp.currentDebt - debtReimbursed\n : 0;\n }\n // There may be an edge case in which: `amounts[i] = (currentDebt * BASE_PARAMS) / surcharge + 1`\n // In this case, as long as `surcharge < BASE_PARAMS`, there cannot be any underflow in the operation\n // above\n emit InternalDebtUpdated(vaultIDs[i], vault.normalizedDebt, 0);\n } else {\n vaultData[vaultIDs[i]].collateralAmount -= collateralReleased;\n _repayDebt(\n vaultIDs[i],\n (amounts[i] * liquidationSurcharge) / BASE_PARAMS,\n liqData.newInterestAccumulator\n );\n }\n liqData.collateralAmountToGive += collateralReleased;\n liqData.stablecoinAmountToReceive += amounts[i];\n }\n // Normalization of good and bad debt is already handled in the `accrueInterestToTreasury` function\n surplus += (liqData.stablecoinAmountToReceive * (BASE_PARAMS - liquidationSurcharge)) / BASE_PARAMS;\n badDebt += liqData.badDebtFromLiquidation;\n _handleRepay(liqData.collateralAmountToGive, liqData.stablecoinAmountToReceive, from, to, who, data);\n }\n\n /// @notice Internal version of the `checkLiquidation` function\n /// @dev This function takes two additional parameters as when entering this function `oracleValue`\n /// and `newInterestAccumulator` should have always been computed\n function _checkLiquidation(\n Vault memory vault,\n address liquidator,\n uint256 oracleValue,\n uint256 newInterestAccumulator\n ) internal view returns (LiquidationOpportunity memory liqOpp) {\n // Checking if the vault can be liquidated\n (uint256 healthFactor, uint256 currentDebt, uint256 collateralAmountInStable) = _isSolvent(\n vault,\n oracleValue,\n newInterestAccumulator\n );\n // Health factor of a vault that does not exist is `type(uint256).max`\n if (healthFactor >= BASE_PARAMS) revert HealthyVault();\n\n uint256 liquidationDiscount = (_computeLiquidationBoost(liquidator) * (BASE_PARAMS - healthFactor)) /\n BASE_PARAMS;\n // In fact `liquidationDiscount` is stored here as 1 minus discount to save some computation costs\n // This value is necessarily != 0 as `maxLiquidationDiscount < BASE_PARAMS`\n liquidationDiscount = liquidationDiscount >= maxLiquidationDiscount\n ? BASE_PARAMS - maxLiquidationDiscount\n : BASE_PARAMS - liquidationDiscount;\n // Same for the surcharge here: it's in fact 1 - the fee taken by the protocol\n uint256 surcharge = liquidationSurcharge;\n // Checking if we're in a situation where the health factor is an increasing or a decreasing function of the\n // amount repaid\n uint256 maxAmountToRepay;\n uint256 thresholdRepayAmount;\n // In the first case, the health factor is an increasing function of the stablecoin amount to repay,\n // this means that the liquidator can bring the vault to the target health ratio\n if (healthFactor * liquidationDiscount * surcharge >= collateralFactor * BASE_PARAMS**2) {\n // This is the max amount to repay that will bring the person to the target health factor\n // Denom is always positive when a vault gets liquidated in this case and when the health factor\n // is an increasing function of the amount of stablecoins repaid\n // And given that most parameters are in base 9, the numerator can very hardly overflow here\n maxAmountToRepay =\n ((targetHealthFactor * currentDebt - collateralAmountInStable * collateralFactor) *\n BASE_PARAMS *\n liquidationDiscount) /\n (surcharge * targetHealthFactor * liquidationDiscount - (BASE_PARAMS**2) * collateralFactor);\n // The quantity below tends to be rounded in the above direction, which means that governance or guardians should\n // set the `targetHealthFactor` accordingly\n // Need to check for the dust: liquidating should not leave a dusty amount in the vault\n if (currentDebt * BASE_PARAMS <= maxAmountToRepay * surcharge + dust * BASE_PARAMS) {\n // If liquidating to the target threshold would leave a dusty amount: the liquidator can repay all\n // We're rounding up the max amount to repay to make sure all the debt ends up being paid\n // and we're computing again the real value of the debt to avoid propagation of rounding errors\n maxAmountToRepay =\n (vault.normalizedDebt * newInterestAccumulator * BASE_PARAMS) /\n (surcharge * BASE_INTEREST) +\n 1;\n // In this case the threshold amount is such that it leaves just enough dust: amount is rounded\n // down such that if a liquidator repays this amount then there would be more than `dust` left in\n // the liquidated vault\n if (currentDebt > dust)\n thresholdRepayAmount = ((currentDebt - dust) * BASE_PARAMS) / surcharge;\n // If there is from the beginning a dusty debt (because of an implementation upgrade), then\n // liquidator should repay everything that's left\n else thresholdRepayAmount = 1;\n }\n } else {\n // In all cases the liquidator can repay stablecoins such that they'll end up getting exactly the collateral\n // in the liquidated vault\n // Rounding up to make sure all gets liquidated in this case: the liquidator will never get more than the collateral\n // amount in the vault however: we're performing the computation of the `collateralAmountInStable` again to avoid\n // propagation of rounding errors\n maxAmountToRepay =\n (vault.collateralAmount * liquidationDiscount * oracleValue) /\n (BASE_PARAMS * _collatBase) +\n 1;\n // It should however make sure not to leave a dusty amount of collateral (in stablecoin value) in the vault\n if (collateralAmountInStable > _dustCollateral)\n // There's no issue with this amount being rounded down\n thresholdRepayAmount =\n ((collateralAmountInStable - _dustCollateral) * liquidationDiscount) /\n BASE_PARAMS;\n // If there is from the beginning a dusty amount of collateral, liquidator should repay everything that's left\n else thresholdRepayAmount = 1;\n }\n liqOpp.maxStablecoinAmountToRepay = maxAmountToRepay;\n liqOpp.maxCollateralAmountGiven =\n (maxAmountToRepay * BASE_PARAMS * _collatBase) /\n (oracleValue * liquidationDiscount);\n liqOpp.thresholdRepayAmount = thresholdRepayAmount;\n liqOpp.discount = liquidationDiscount;\n liqOpp.currentDebt = currentDebt;\n }\n\n // ================================== SETTERS ==================================\n\n /// @notice Sets parameters encoded as uint64\n /// @param param Value for the parameter\n /// @param what Parameter to change\n /// @dev This function performs the required checks when updating a parameter\n /// @dev When setting parameters governance or the guardian should make sure that when `HF < CF/((1-surcharge)(1-discount))`\n /// and hence when liquidating a vault is going to decrease its health factor, `discount = max discount`.\n /// Otherwise, it may be profitable for the liquidator to liquidate in multiple times: as it will decrease\n /// the HF and therefore increase the discount between each time\n function setUint64(uint64 param, bytes32 what) external onlyGovernorOrGuardian {\n if (what == \"CF\") {\n if (param > liquidationSurcharge) revert TooHighParameterValue();\n collateralFactor = param;\n } else if (what == \"THF\") {\n if (param < BASE_PARAMS) revert TooSmallParameterValue();\n targetHealthFactor = param;\n } else if (what == \"BF\") {\n if (param > BASE_PARAMS) revert TooHighParameterValue();\n borrowFee = param;\n } else if (what == \"RF\") {\n // As liquidation surcharge is stored as `1-fee` and as we need `repayFee` to be smaller\n // then the liquidation surcharge, then we need to have:\n // `liquidationSurcharge <= BASE_PARAMS - repayFee` and as such `liquidationSurcharge + repayFee <= BASE_PARAMS`\n if (param + liquidationSurcharge > BASE_PARAMS) revert TooHighParameterValue();\n repayFee = param;\n } else if (what == \"IR\") {\n _accrue();\n interestRate = param;\n } else if (what == \"LS\") {\n if (collateralFactor > param || param + repayFee > BASE_PARAMS) revert InvalidParameterValue();\n liquidationSurcharge = param;\n } else if (what == \"MLD\") {\n if (param > BASE_PARAMS) revert TooHighParameterValue();\n maxLiquidationDiscount = param;\n } else {\n revert InvalidParameterType();\n }\n emit FiledUint64(param, what);\n }\n\n /// @notice Sets `debtCeiling`\n /// @param _debtCeiling New value for `debtCeiling`\n /// @dev `debtCeiling` should not be bigger than `type(uint256).max / 10**27` otherwise there could be overflows\n function setDebtCeiling(uint256 _debtCeiling) external onlyGovernorOrGuardian {\n debtCeiling = _debtCeiling;\n emit DebtCeilingUpdated(_debtCeiling);\n }\n\n /// @notice Sets the parameters for the liquidation booster which encodes the slope of the discount\n function setLiquidationBoostParameters(\n address _veBoostProxy,\n uint256[] memory xBoost,\n uint256[] memory yBoost\n ) external virtual onlyGovernorOrGuardian {\n if (yBoost[0] == 0) revert InvalidSetOfParameters();\n yLiquidationBoost = yBoost;\n emit LiquidationBoostParametersUpdated(_veBoostProxy, xBoost, yBoost);\n }\n\n /// @notice Pauses external permissionless functions of the contract\n function togglePause() external onlyGovernorOrGuardian {\n paused = !paused;\n }\n\n /// @notice Changes the ERC721 metadata URI\n function setBaseURI(string memory baseURI_) external onlyGovernorOrGuardian {\n _baseURI = baseURI_;\n }\n\n /// @notice Changes the whitelisting of an address\n /// @param target Address to toggle\n /// @dev If the `target` address is the zero address then this function toggles whitelisting\n /// for all addresses\n function toggleWhitelist(address target) external onlyGovernor {\n if (target != address(0)) {\n isWhitelisted[target] = 1 - isWhitelisted[target];\n } else {\n whitelistingActivated = !whitelistingActivated;\n }\n }\n\n /// @notice Changes the reference to the oracle contract used to get the price of the oracle\n /// @param _oracle Reference to the oracle contract\n function setOracle(address _oracle) external onlyGovernor {\n if (IOracle(_oracle).treasury() != treasury) revert InvalidTreasury();\n oracle = IOracle(_oracle);\n }\n\n /// @notice Sets the dust variables\n /// @param _dust New minimum debt allowed\n /// @param dustCollateral_ New minimum collateral allowed in a vault after a liquidation\n /// @dev dustCollateral_ is in stable value\n function setDusts(uint256 _dust, uint256 dustCollateral_) external onlyGovernor {\n dust = _dust;\n _dustCollateral = dustCollateral_;\n }\n\n /// @inheritdoc IVaultManagerFunctions\n function setTreasury(address _treasury) external onlyTreasury {\n treasury = ITreasury(_treasury);\n // This function makes sure to propagate the change to the associated contract\n // even though a single oracle contract could be used in different places\n oracle.setTreasury(_treasury);\n }\n\n // ============================= VIRTUAL FUNCTIONS =============================\n\n /// @notice Computes the liquidation boost of a given address, that is the slope of the discount function\n /// @return The slope of the discount function\n function _computeLiquidationBoost(address) internal view virtual returns (uint256) {\n return yLiquidationBoost[0];\n }\n\n /// @notice Hook called before any collateral internal changes\n /// @param vaultID Vault which sees its collateral amount changed\n /// @param amount Collateral amount balance of the owner of vaultID increase/decrease\n /// @param add Whether the balance should be increased/decreased\n /// @param vaultID Vault which sees its collateral amount changed\n function _checkpointCollateral(\n uint256 vaultID,\n uint256 amount,\n bool add\n ) internal virtual {}\n}\n" + }, + "contracts/vaultManager/VaultManagerPermit.sol": { + "content": "// SPDX-License-Identifier: GPL-3.0\n\npragma solidity ^0.8.12;\n\nimport \"./VaultManagerERC721.sol\";\nimport \"../interfaces/external/IERC1271.sol\";\n\n/// @title VaultManagerPermit\n/// @author Angle Labs, Inc.\n/// @dev Base Implementation of permit functions for the `VaultManager` contract\nabstract contract VaultManagerPermit is Initializable, VaultManagerERC721 {\n using Address for address;\n\n mapping(address => uint256) private _nonces;\n /* solhint-disable var-name-mixedcase */\n bytes32 private _HASHED_NAME;\n bytes32 private _HASHED_VERSION;\n bytes32 private _PERMIT_TYPEHASH;\n /* solhint-enable var-name-mixedcase */\n\n error ExpiredDeadline();\n error InvalidSignature();\n\n //solhint-disable-next-line\n function __ERC721Permit_init(string memory _name) internal onlyInitializing {\n _PERMIT_TYPEHASH = keccak256(\n \"Permit(address owner,address spender,bool approved,uint256 nonce,uint256 deadline)\"\n );\n _HASHED_NAME = keccak256(bytes(_name));\n _HASHED_VERSION = keccak256(bytes(\"1\"));\n }\n\n /// @notice Allows an address to give or revoke approval for all its vaults to another address\n /// @param owner Address signing the permit and giving (or revoking) its approval for all the controlled vaults\n /// @param spender Address to give approval to\n /// @param approved Whether to give or revoke the approval\n /// @param deadline Deadline parameter for the signature to be valid\n /// @dev The `v`, `r`, and `s` parameters are used as signature data\n function permit(\n address owner,\n address spender,\n bool approved,\n uint256 deadline,\n uint8 v,\n bytes32 r,\n bytes32 s\n ) external {\n if (block.timestamp > deadline) revert ExpiredDeadline();\n // Additional signature checks performed in the `ECDSAUpgradeable.recover` function\n if (uint256(s) > 0x7FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF5D576E7357A4501DDFE92F46681B20A0 || (v != 27 && v != 28))\n revert InvalidSignature();\n\n bytes32 digest = keccak256(\n abi.encodePacked(\n \"\\x19\\x01\",\n _domainSeparatorV4(),\n keccak256(\n abi.encode(\n _PERMIT_TYPEHASH,\n // 0x3f43a9c6bafb5c7aab4e0cfe239dc5d4c15caf0381c6104188191f78a6640bd8,\n owner,\n spender,\n approved,\n _useNonce(owner),\n deadline\n )\n )\n )\n );\n if (owner.isContract()) {\n if (IERC1271(owner).isValidSignature(digest, abi.encodePacked(r, s, v)) != 0x1626ba7e)\n revert InvalidSignature();\n } else {\n address signer = ecrecover(digest, v, r, s);\n if (signer != owner || signer == address(0)) revert InvalidSignature();\n }\n\n _setApprovalForAll(owner, spender, approved);\n }\n\n /// @notice Returns the current nonce for an `owner` address\n function nonces(address owner) public view returns (uint256) {\n return _nonces[owner];\n }\n\n /// @notice Returns the domain separator for the current chain.\n // solhint-disable-next-line func-name-mixedcase\n function DOMAIN_SEPARATOR() external view returns (bytes32) {\n return _domainSeparatorV4();\n }\n\n /// @notice Internal version of the `DOMAIN_SEPARATOR` function\n function _domainSeparatorV4() internal view returns (bytes32) {\n return\n keccak256(\n abi.encode(\n // keccak256('EIP712Domain(string name,string version,uint256 chainId,address verifyingContract)')\n 0x8b73c3c69bb8fe3d512ecc4cf759cc79239f7b179b0ffacaa9a75d522b39400f,\n _HASHED_NAME,\n _HASHED_VERSION,\n block.chainid,\n address(this)\n )\n );\n }\n\n /// @notice Consumes a nonce for an address: returns the current value and increments it\n function _useNonce(address owner) internal returns (uint256 current) {\n current = _nonces[owner];\n _nonces[owner] = current + 1;\n }\n\n uint256[49] private __gap;\n}\n" + }, + "contracts/vaultManager/VaultManagerERC721.sol": { + "content": "// SPDX-License-Identifier: GPL-3.0\n\npragma solidity ^0.8.12;\n\nimport \"./VaultManagerStorage.sol\";\n\n/// @title VaultManagerERC721\n/// @author Angle Labs, Inc.\n/// @dev Base ERC721 Implementation of VaultManager\nabstract contract VaultManagerERC721 is IERC721MetadataUpgradeable, VaultManagerStorage {\n using SafeERC20 for IERC20;\n using Address for address;\n\n /// @inheritdoc IERC721MetadataUpgradeable\n string public name;\n /// @inheritdoc IERC721MetadataUpgradeable\n string public symbol;\n\n // ================================= MODIFIERS =================================\n\n /// @notice Checks if the person interacting with the vault with `vaultID` is approved\n /// @param caller Address of the person seeking to interact with the vault\n /// @param vaultID ID of the concerned vault\n modifier onlyApprovedOrOwner(address caller, uint256 vaultID) {\n if (!_isApprovedOrOwner(caller, vaultID)) revert NotApproved();\n _;\n }\n\n // ================================ ERC721 LOGIC ===============================\n\n /// @notice Checks whether a given address is approved for a vault or owns this vault\n /// @param spender Address for which vault ownership should be checked\n /// @param vaultID ID of the vault to check\n /// @return Whether the `spender` address owns or is approved for `vaultID`\n function isApprovedOrOwner(address spender, uint256 vaultID) external view returns (bool) {\n return _isApprovedOrOwner(spender, vaultID);\n }\n\n /// @inheritdoc IERC721MetadataUpgradeable\n function tokenURI(uint256 vaultID) external view returns (string memory) {\n if (!_exists(vaultID)) revert NonexistentVault();\n // There is no vault with `vaultID` equal to 0, so the following variable is\n // always greater than zero\n uint256 temp = vaultID;\n uint256 digits;\n while (temp != 0) {\n ++digits;\n temp /= 10;\n }\n bytes memory buffer = new bytes(digits);\n while (vaultID != 0) {\n digits -= 1;\n buffer[digits] = bytes1(uint8(48 + uint256(vaultID % 10)));\n vaultID /= 10;\n }\n return bytes(_baseURI).length != 0 ? string(abi.encodePacked(_baseURI, string(buffer))) : \"\";\n }\n\n /// @inheritdoc IERC721Upgradeable\n function balanceOf(address owner) external view returns (uint256) {\n if (owner == address(0)) revert ZeroAddress();\n return _balances[owner];\n }\n\n /// @inheritdoc IERC721Upgradeable\n function ownerOf(uint256 vaultID) external view returns (address) {\n return _ownerOf(vaultID);\n }\n\n /// @inheritdoc IERC721Upgradeable\n function approve(address to, uint256 vaultID) external {\n address owner = _ownerOf(vaultID);\n if (to == owner) revert ApprovalToOwner();\n if (msg.sender != owner && !isApprovedForAll(owner, msg.sender)) revert NotApproved();\n\n _approve(to, vaultID);\n }\n\n /// @inheritdoc IERC721Upgradeable\n function getApproved(uint256 vaultID) external view returns (address) {\n if (!_exists(vaultID)) revert NonexistentVault();\n return _getApproved(vaultID);\n }\n\n /// @inheritdoc IERC721Upgradeable\n function setApprovalForAll(address operator, bool approved) external {\n _setApprovalForAll(msg.sender, operator, approved);\n }\n\n /// @inheritdoc IERC721Upgradeable\n function isApprovedForAll(address owner, address operator) public view returns (bool) {\n return _operatorApprovals[owner][operator] == 1;\n }\n\n /// @inheritdoc IERC721Upgradeable\n function transferFrom(\n address from,\n address to,\n uint256 vaultID\n ) external onlyApprovedOrOwner(msg.sender, vaultID) {\n _transfer(from, to, vaultID);\n }\n\n /// @inheritdoc IERC721Upgradeable\n function safeTransferFrom(\n address from,\n address to,\n uint256 vaultID\n ) external {\n safeTransferFrom(from, to, vaultID, \"\");\n }\n\n /// @inheritdoc IERC721Upgradeable\n function safeTransferFrom(\n address from,\n address to,\n uint256 vaultID,\n bytes memory _data\n ) public onlyApprovedOrOwner(msg.sender, vaultID) {\n _safeTransfer(from, to, vaultID, _data);\n }\n\n // ================================ ERC165 LOGIC ===============================\n\n /// @inheritdoc IERC165Upgradeable\n function supportsInterface(bytes4 interfaceId) external pure returns (bool) {\n return\n interfaceId == type(IERC721MetadataUpgradeable).interfaceId ||\n interfaceId == type(IERC721Upgradeable).interfaceId ||\n interfaceId == type(IVaultManager).interfaceId ||\n interfaceId == type(IERC165Upgradeable).interfaceId;\n }\n\n // ================== INTERNAL FUNCTIONS FOR THE ERC721 LOGIC ==================\n\n /// @notice Internal version of the `ownerOf` function\n function _ownerOf(uint256 vaultID) internal view returns (address owner) {\n owner = _owners[vaultID];\n if (owner == address(0)) revert NonexistentVault();\n }\n\n /// @notice Internal version of the `getApproved` function\n function _getApproved(uint256 vaultID) internal view returns (address) {\n return _vaultApprovals[vaultID];\n }\n\n /// @notice Internal version of the `safeTransferFrom` function (with the data parameter)\n function _safeTransfer(\n address from,\n address to,\n uint256 vaultID,\n bytes memory _data\n ) internal {\n _transfer(from, to, vaultID);\n if (!_checkOnERC721Received(from, to, vaultID, _data)) revert NonERC721Receiver();\n }\n\n /// @notice Checks whether a vault exists\n /// @param vaultID ID of the vault to check\n /// @return Whether `vaultID` has been created\n function _exists(uint256 vaultID) internal view returns (bool) {\n return _owners[vaultID] != address(0);\n }\n\n /// @notice Internal version of the `isApprovedOrOwner` function\n function _isApprovedOrOwner(address spender, uint256 vaultID) internal view returns (bool) {\n // The following checks if the vault exists\n address owner = _ownerOf(vaultID);\n return (spender == owner || _getApproved(vaultID) == spender || _operatorApprovals[owner][spender] == 1);\n }\n\n /// @notice Internal version of the `createVault` function\n /// Mints `vaultID` and transfers it to `to`\n /// @dev This method is equivalent to the `_safeMint` method used in OpenZeppelin ERC721 contract\n /// @dev Emits a {Transfer} event\n function _mint(address to) internal returns (uint256 vaultID) {\n if (whitelistingActivated && (isWhitelisted[to] != 1 || isWhitelisted[msg.sender] != 1))\n revert NotWhitelisted();\n if (to == address(0)) revert ZeroAddress();\n\n unchecked {\n vaultIDCount += 1;\n }\n\n vaultID = vaultIDCount;\n _beforeTokenTransfer(address(0), to, vaultID);\n\n unchecked {\n _balances[to] += 1;\n }\n\n _owners[vaultID] = to;\n emit Transfer(address(0), to, vaultID);\n if (!_checkOnERC721Received(address(0), to, vaultID, \"\")) revert NonERC721Receiver();\n }\n\n /// @notice Destroys `vaultID`\n /// @dev `vaultID` must exist\n /// @dev Emits a {Transfer} event\n function _burn(uint256 vaultID) internal {\n address owner = _ownerOf(vaultID);\n\n _beforeTokenTransfer(owner, address(0), vaultID);\n // Clear approvals\n _approve(address(0), vaultID);\n // The following line cannot underflow as the owner's balance is necessarily\n // greater than 1\n unchecked {\n _balances[owner] -= 1;\n }\n delete _owners[vaultID];\n delete vaultData[vaultID];\n\n emit Transfer(owner, address(0), vaultID);\n }\n\n /// @notice Transfers `vaultID` from `from` to `to` as opposed to {transferFrom},\n /// this imposes no restrictions on msg.sender\n /// @dev `to` cannot be the zero address and `perpetualID` must be owned by `from`\n /// @dev Emits a {Transfer} event\n /// @dev A whitelist check is performed if necessary on the `to` address\n function _transfer(\n address from,\n address to,\n uint256 vaultID\n ) internal {\n if (_ownerOf(vaultID) != from) revert NotApproved();\n if (to == address(0)) revert ZeroAddress();\n if (whitelistingActivated && isWhitelisted[to] != 1) revert NotWhitelisted();\n\n _beforeTokenTransfer(from, to, vaultID);\n\n // Clear approvals from the previous owner\n _approve(address(0), vaultID);\n unchecked {\n _balances[from] -= 1;\n _balances[to] += 1;\n }\n _owners[vaultID] = to;\n\n emit Transfer(from, to, vaultID);\n }\n\n /// @notice Approves `to` to operate on `vaultID`\n function _approve(address to, uint256 vaultID) internal {\n _vaultApprovals[vaultID] = to;\n emit Approval(_ownerOf(vaultID), to, vaultID);\n }\n\n /// @notice Internal version of the `setApprovalForAll` function\n /// @dev It contains an `approver` field to be used in case someone signs a permit for a particular\n /// address, and this signature is given to the contract by another address (like a router)\n function _setApprovalForAll(\n address approver,\n address operator,\n bool approved\n ) internal {\n if (operator == approver) revert ApprovalToCaller();\n uint256 approval = approved ? 1 : 0;\n _operatorApprovals[approver][operator] = approval;\n emit ApprovalForAll(approver, operator, approved);\n }\n\n /// @notice Internal function to invoke {IERC721Receiver-onERC721Received} on a target address\n /// The call is not executed if the target address is not a contract\n /// @param from Address representing the previous owner of the given token ID\n /// @param to Target address that will receive the tokens\n /// @param vaultID ID of the token to be transferred\n /// @param _data Bytes optional data to send along with the call\n /// @return Bool whether the call correctly returned the expected value\n function _checkOnERC721Received(\n address from,\n address to,\n uint256 vaultID,\n bytes memory _data\n ) private returns (bool) {\n if (to.isContract()) {\n try IERC721ReceiverUpgradeable(to).onERC721Received(msg.sender, from, vaultID, _data) returns (\n bytes4 retval\n ) {\n return retval == IERC721ReceiverUpgradeable.onERC721Received.selector;\n } catch (bytes memory reason) {\n if (reason.length == 0) {\n revert NonERC721Receiver();\n } else {\n // solhint-disable-next-line no-inline-assembly\n assembly {\n revert(add(32, reason), mload(reason))\n }\n }\n }\n } else {\n return true;\n }\n }\n\n /// @notice Hook that is called before any token transfer. This includes minting and burning.\n /// Calling conditions:\n ///\n /// - When `from` and `to` are both non-zero, `from`'s `vaultID` will be\n /// transferred to `to`.\n /// - When `from` is zero, `vaultID` will be minted for `to`.\n /// - When `to` is zero, `from`'s `vaultID` will be burned.\n /// - `from` and `to` are never both zero.\n function _beforeTokenTransfer(\n address from,\n address to,\n uint256 vaultID\n ) internal virtual {}\n}\n" + }, + "contracts/interfaces/external/IERC1271.sol": { + "content": "// SPDX-License-Identifier: GPL-2.0-or-later\npragma solidity ^0.8.12;\n\n/// @title Interface for verifying contract-based account signatures\n/// @notice Interface that verifies provided signature for the data\n/// @dev Interface defined by EIP-1271\ninterface IERC1271 {\n /// @notice Returns whether the provided signature is valid for the provided data\n /// @dev MUST return the bytes4 magic value 0x1626ba7e when function passes.\n /// MUST NOT modify state (using STATICCALL for solc < 0.5, view modifier for solc > 0.5).\n /// MUST allow external calls.\n /// @param hash Hash of the data to be signed\n /// @param signature Signature byte array associated with _data\n /// @return magicValue The bytes4 magic value 0x1626ba7e\n function isValidSignature(bytes32 hash, bytes memory signature) external view returns (bytes4 magicValue);\n}\n" + }, + "contracts/vaultManager/VaultManagerStorage.sol": { + "content": "// SPDX-License-Identifier: GPL-3.0\n\npragma solidity ^0.8.12;\n\nimport \"@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol\";\nimport \"@openzeppelin/contracts-upgradeable/token/ERC20/extensions/draft-IERC20PermitUpgradeable.sol\";\nimport \"@openzeppelin/contracts-upgradeable/token/ERC721/IERC721ReceiverUpgradeable.sol\";\nimport \"@openzeppelin/contracts-upgradeable/interfaces/IERC721MetadataUpgradeable.sol\";\nimport \"@openzeppelin/contracts-upgradeable/utils/introspection/IERC165Upgradeable.sol\";\nimport \"@openzeppelin/contracts-upgradeable/utils/AddressUpgradeable.sol\";\nimport \"@openzeppelin/contracts-upgradeable/security/ReentrancyGuardUpgradeable.sol\";\nimport \"@openzeppelin/contracts/token/ERC20/extensions/IERC20Metadata.sol\";\nimport \"@openzeppelin/contracts/token/ERC20/IERC20.sol\";\nimport \"@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol\";\n\nimport \"../interfaces/IAgToken.sol\";\nimport \"../interfaces/IOracle.sol\";\nimport \"../interfaces/ISwapper.sol\";\nimport \"../interfaces/ITreasury.sol\";\nimport \"../interfaces/IVaultManager.sol\";\nimport \"../interfaces/governance/IVeBoostProxy.sol\";\n\n/// @title VaultManagerStorage\n/// @author Angle Labs, Inc.\n/// @dev Variables, references, parameters and events needed in the `VaultManager` contract\n// solhint-disable-next-line max-states-count\ncontract VaultManagerStorage is IVaultManagerStorage, Initializable, ReentrancyGuardUpgradeable {\n /// @notice Base used for parameter computation: almost all the parameters of this contract are set in `BASE_PARAMS`\n uint256 public constant BASE_PARAMS = 10**9;\n /// @notice Base used for interest rate computation\n uint256 public constant BASE_INTEREST = 10**27;\n /// @notice Used for interest rate computation\n uint256 public constant HALF_BASE_INTEREST = 10**27 / 2;\n\n // ================================= REFERENCES ================================\n\n /// @inheritdoc IVaultManagerStorage\n ITreasury public treasury;\n /// @inheritdoc IVaultManagerStorage\n IERC20 public collateral;\n /// @inheritdoc IVaultManagerStorage\n IAgToken public stablecoin;\n /// @inheritdoc IVaultManagerStorage\n IOracle public oracle;\n /// @notice Reference to the contract which computes adjusted veANGLE balances for liquidators boosts\n IVeBoostProxy public veBoostProxy;\n /// @notice Base of the collateral\n uint256 internal _collatBase;\n\n // ================================= PARAMETERS ================================\n // Unless specified otherwise, parameters of this contract are expressed in `BASE_PARAMS`\n\n /// @notice Maximum amount of stablecoins that can be issued with this contract (in `BASE_TOKENS`). This parameter should\n /// not be bigger than `type(uint256).max / BASE_INTEREST` otherwise there may be some overflows in the `increaseDebt` function\n uint256 public debtCeiling;\n /// @notice Threshold veANGLE balance values for the computation of the boost for liquidators: the length of this array\n /// should normally be 2. The base of the x-values in this array should be `BASE_TOKENS`\n uint256[] public xLiquidationBoost;\n /// @notice Values of the liquidation boost at the threshold values of x\n uint256[] public yLiquidationBoost;\n /// @inheritdoc IVaultManagerStorage\n uint64 public collateralFactor;\n /// @notice Maximum Health factor at which a vault can end up after a liquidation (unless it's fully liquidated)\n uint64 public targetHealthFactor;\n /// @notice Upfront fee taken when borrowing stablecoins: this fee is optional and should in practice not be used\n uint64 public borrowFee;\n /// @notice Upfront fee taken when repaying stablecoins: this fee is optional as well. It should be smaller\n /// than the liquidation surcharge (cf below) to avoid exploits where people voluntarily get liquidated at a 0\n /// discount to pay smaller repaying fees\n uint64 public repayFee;\n /// @notice Per second interest taken to borrowers taking agToken loans. Contrarily to other parameters, it is set in `BASE_INTEREST`\n /// that is to say in base 10**27\n uint64 public interestRate;\n /// @notice Fee taken by the protocol during a liquidation. Technically, this value is not the fee per se, it's 1 - fee.\n /// For instance for a 2% fee, `liquidationSurcharge` should be 98%\n uint64 public liquidationSurcharge;\n /// @notice Maximum discount given to liquidators\n uint64 public maxLiquidationDiscount;\n /// @notice Whether whitelisting is required to own a vault or not\n bool public whitelistingActivated;\n /// @notice Whether the contract is paused or not\n bool public paused;\n\n // ================================= VARIABLES =================================\n\n /// @notice Timestamp at which the `interestAccumulator` was updated\n uint256 public lastInterestAccumulatorUpdated;\n /// @inheritdoc IVaultManagerStorage\n uint256 public interestAccumulator;\n /// @inheritdoc IVaultManagerStorage\n uint256 public totalNormalizedDebt;\n /// @notice Surplus accumulated by the contract: surplus is always in stablecoins, and is then reset\n /// when the value is communicated to the treasury contract\n uint256 public surplus;\n /// @notice Bad debt made from liquidated vaults which ended up having no collateral and a positive amount\n /// of stablecoins\n uint256 public badDebt;\n\n // ================================== MAPPINGS =================================\n\n /// @inheritdoc IVaultManagerStorage\n mapping(uint256 => Vault) public vaultData;\n /// @notice Maps an address to 1 if it's whitelisted and can open or own a vault\n mapping(address => uint256) public isWhitelisted;\n\n // ================================ ERC721 DATA ================================\n\n /// @inheritdoc IVaultManagerStorage\n uint256 public vaultIDCount;\n\n /// @notice URI\n string internal _baseURI;\n\n // Mapping from `vaultID` to owner address\n mapping(uint256 => address) internal _owners;\n\n // Mapping from owner address to vault owned count\n mapping(address => uint256) internal _balances;\n\n // Mapping from `vaultID` to approved address\n mapping(uint256 => address) internal _vaultApprovals;\n\n // Mapping from owner to operator approvals\n mapping(address => mapping(address => uint256)) internal _operatorApprovals;\n\n uint256[50] private __gap;\n\n // =================================== EVENTS ==================================\n\n event AccruedToTreasury(uint256 surplusEndValue, uint256 badDebtEndValue);\n event CollateralAmountUpdated(uint256 vaultID, uint256 collateralAmount, uint8 isIncrease);\n event InterestAccumulatorUpdated(uint256 value, uint256 timestamp);\n event InternalDebtUpdated(uint256 vaultID, uint256 internalAmount, uint8 isIncrease);\n event FiledUint64(uint64 param, bytes32 what);\n event DebtCeilingUpdated(uint256 debtCeiling);\n event LiquidationBoostParametersUpdated(address indexed _veBoostProxy, uint256[] xBoost, uint256[] yBoost);\n event LiquidatedVaults(uint256[] vaultIDs);\n event DebtTransferred(uint256 srcVaultID, uint256 dstVaultID, address dstVaultManager, uint256 amount);\n\n // =================================== ERRORS ==================================\n\n error ApprovalToOwner();\n error ApprovalToCaller();\n error DustyLeftoverAmount();\n error DebtCeilingExceeded();\n error HealthyVault();\n error IncompatibleLengths();\n error InsolventVault();\n error InvalidParameterValue();\n error InvalidParameterType();\n error InvalidSetOfParameters();\n error InvalidTreasury();\n error NonERC721Receiver();\n error NonexistentVault();\n error NotApproved();\n error NotGovernor();\n error NotGovernorOrGuardian();\n error NotTreasury();\n error NotWhitelisted();\n error NotVaultManager();\n error Paused();\n error TooHighParameterValue();\n error TooSmallParameterValue();\n error ZeroAddress();\n\n /// @custom:oz-upgrades-unsafe-allow constructor\n constructor() initializer {}\n}\n" + }, + "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.7.0) (proxy/utils/Initializable.sol)\n\npragma solidity ^0.8.2;\n\nimport \"../../utils/AddressUpgradeable.sol\";\n\n/**\n * @dev This is a base contract to aid in writing upgradeable contracts, or any kind of contract that will be deployed\n * behind a proxy. Since proxied contracts do not make use of a constructor, it's common to move constructor logic to an\n * external initializer function, usually called `initialize`. It then becomes necessary to protect this initializer\n * function so it can only be called once. The {initializer} modifier provided by this contract will have this effect.\n *\n * The initialization functions use a version number. Once a version number is used, it is consumed and cannot be\n * reused. This mechanism prevents re-execution of each \"step\" but allows the creation of new initialization steps in\n * case an upgrade adds a module that needs to be initialized.\n *\n * For example:\n *\n * [.hljs-theme-light.nopadding]\n * ```\n * contract MyToken is ERC20Upgradeable {\n * function initialize() initializer public {\n * __ERC20_init(\"MyToken\", \"MTK\");\n * }\n * }\n * contract MyTokenV2 is MyToken, ERC20PermitUpgradeable {\n * function initializeV2() reinitializer(2) public {\n * __ERC20Permit_init(\"MyToken\");\n * }\n * }\n * ```\n *\n * TIP: To avoid leaving the proxy in an uninitialized state, the initializer function should be called as early as\n * possible by providing the encoded function call as the `_data` argument to {ERC1967Proxy-constructor}.\n *\n * CAUTION: When used with inheritance, manual care must be taken to not invoke a parent initializer twice, or to ensure\n * that all initializers are idempotent. This is not verified automatically as constructors are by Solidity.\n *\n * [CAUTION]\n * ====\n * Avoid leaving a contract uninitialized.\n *\n * An uninitialized contract can be taken over by an attacker. This applies to both a proxy and its implementation\n * contract, which may impact the proxy. To prevent the implementation contract from being used, you should invoke\n * the {_disableInitializers} function in the constructor to automatically lock it when it is deployed:\n *\n * [.hljs-theme-light.nopadding]\n * ```\n * /// @custom:oz-upgrades-unsafe-allow constructor\n * constructor() {\n * _disableInitializers();\n * }\n * ```\n * ====\n */\nabstract contract Initializable {\n /**\n * @dev Indicates that the contract has been initialized.\n * @custom:oz-retyped-from bool\n */\n uint8 private _initialized;\n\n /**\n * @dev Indicates that the contract is in the process of being initialized.\n */\n bool private _initializing;\n\n /**\n * @dev Triggered when the contract has been initialized or reinitialized.\n */\n event Initialized(uint8 version);\n\n /**\n * @dev A modifier that defines a protected initializer function that can be invoked at most once. In its scope,\n * `onlyInitializing` functions can be used to initialize parent contracts. Equivalent to `reinitializer(1)`.\n */\n modifier initializer() {\n bool isTopLevelCall = !_initializing;\n require(\n (isTopLevelCall && _initialized < 1) || (!AddressUpgradeable.isContract(address(this)) && _initialized == 1),\n \"Initializable: contract is already initialized\"\n );\n _initialized = 1;\n if (isTopLevelCall) {\n _initializing = true;\n }\n _;\n if (isTopLevelCall) {\n _initializing = false;\n emit Initialized(1);\n }\n }\n\n /**\n * @dev A modifier that defines a protected reinitializer function that can be invoked at most once, and only if the\n * contract hasn't been initialized to a greater version before. In its scope, `onlyInitializing` functions can be\n * used to initialize parent contracts.\n *\n * `initializer` is equivalent to `reinitializer(1)`, so a reinitializer may be used after the original\n * initialization step. This is essential to configure modules that are added through upgrades and that require\n * initialization.\n *\n * Note that versions can jump in increments greater than 1; this implies that if multiple reinitializers coexist in\n * a contract, executing them in the right order is up to the developer or operator.\n */\n modifier reinitializer(uint8 version) {\n require(!_initializing && _initialized < version, \"Initializable: contract is already initialized\");\n _initialized = version;\n _initializing = true;\n _;\n _initializing = false;\n emit Initialized(version);\n }\n\n /**\n * @dev Modifier to protect an initialization function so that it can only be invoked by functions with the\n * {initializer} and {reinitializer} modifiers, directly or indirectly.\n */\n modifier onlyInitializing() {\n require(_initializing, \"Initializable: contract is not initializing\");\n _;\n }\n\n /**\n * @dev Locks the contract, preventing any future reinitialization. This cannot be part of an initializer call.\n * Calling this in the constructor of a contract will prevent that contract from being initialized or reinitialized\n * to any version. It is recommended to use this to lock implementation contracts that are designed to be called\n * through proxies.\n */\n function _disableInitializers() internal virtual {\n require(!_initializing, \"Initializable: contract is initializing\");\n if (_initialized < type(uint8).max) {\n _initialized = type(uint8).max;\n emit Initialized(type(uint8).max);\n }\n }\n}\n" + }, + "@openzeppelin/contracts-upgradeable/token/ERC20/extensions/draft-IERC20PermitUpgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (token/ERC20/extensions/draft-IERC20Permit.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Interface of the ERC20 Permit extension allowing approvals to be made via signatures, as defined in\n * https://eips.ethereum.org/EIPS/eip-2612[EIP-2612].\n *\n * Adds the {permit} method, which can be used to change an account's ERC20 allowance (see {IERC20-allowance}) by\n * presenting a message signed by the account. By not relying on {IERC20-approve}, the token holder account doesn't\n * need to send a transaction, and thus is not required to hold Ether at all.\n */\ninterface IERC20PermitUpgradeable {\n /**\n * @dev Sets `value` as the allowance of `spender` over ``owner``'s tokens,\n * given ``owner``'s signed approval.\n *\n * IMPORTANT: The same issues {IERC20-approve} has related to transaction\n * ordering also apply here.\n *\n * Emits an {Approval} event.\n *\n * Requirements:\n *\n * - `spender` cannot be the zero address.\n * - `deadline` must be a timestamp in the future.\n * - `v`, `r` and `s` must be a valid `secp256k1` signature from `owner`\n * over the EIP712-formatted function arguments.\n * - the signature must use ``owner``'s current nonce (see {nonces}).\n *\n * For more information on the signature format, see the\n * https://eips.ethereum.org/EIPS/eip-2612#specification[relevant EIP\n * section].\n */\n function permit(\n address owner,\n address spender,\n uint256 value,\n uint256 deadline,\n uint8 v,\n bytes32 r,\n bytes32 s\n ) external;\n\n /**\n * @dev Returns the current nonce for `owner`. This value must be\n * included whenever a signature is generated for {permit}.\n *\n * Every successful call to {permit} increases ``owner``'s nonce by one. This\n * prevents a signature from being used multiple times.\n */\n function nonces(address owner) external view returns (uint256);\n\n /**\n * @dev Returns the domain separator used in the encoding of the signature for {permit}, as defined by {EIP712}.\n */\n // solhint-disable-next-line func-name-mixedcase\n function DOMAIN_SEPARATOR() external view returns (bytes32);\n}\n" + }, + "@openzeppelin/contracts-upgradeable/token/ERC721/IERC721ReceiverUpgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.6.0) (token/ERC721/IERC721Receiver.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @title ERC721 token receiver interface\n * @dev Interface for any contract that wants to support safeTransfers\n * from ERC721 asset contracts.\n */\ninterface IERC721ReceiverUpgradeable {\n /**\n * @dev Whenever an {IERC721} `tokenId` token is transferred to this contract via {IERC721-safeTransferFrom}\n * by `operator` from `from`, this function is called.\n *\n * It must return its Solidity selector to confirm the token transfer.\n * If any other value is returned or the interface is not implemented by the recipient, the transfer will be reverted.\n *\n * The selector can be obtained in Solidity with `IERC721Receiver.onERC721Received.selector`.\n */\n function onERC721Received(\n address operator,\n address from,\n uint256 tokenId,\n bytes calldata data\n ) external returns (bytes4);\n}\n" + }, + "@openzeppelin/contracts-upgradeable/interfaces/IERC721MetadataUpgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (interfaces/IERC721Metadata.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../token/ERC721/extensions/IERC721MetadataUpgradeable.sol\";\n" + }, + "@openzeppelin/contracts-upgradeable/utils/introspection/IERC165Upgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (utils/introspection/IERC165.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Interface of the ERC165 standard, as defined in the\n * https://eips.ethereum.org/EIPS/eip-165[EIP].\n *\n * Implementers can declare support of contract interfaces, which can then be\n * queried by others ({ERC165Checker}).\n *\n * For an implementation, see {ERC165}.\n */\ninterface IERC165Upgradeable {\n /**\n * @dev Returns true if this contract implements the interface defined by\n * `interfaceId`. See the corresponding\n * https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section]\n * to learn more about how these ids are created.\n *\n * This function call must use less than 30 000 gas.\n */\n function supportsInterface(bytes4 interfaceId) external view returns (bool);\n}\n" + }, + "@openzeppelin/contracts-upgradeable/utils/AddressUpgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.7.0) (utils/Address.sol)\n\npragma solidity ^0.8.1;\n\n/**\n * @dev Collection of functions related to the address type\n */\nlibrary AddressUpgradeable {\n /**\n * @dev Returns true if `account` is a contract.\n *\n * [IMPORTANT]\n * ====\n * It is unsafe to assume that an address for which this function returns\n * false is an externally-owned account (EOA) and not a contract.\n *\n * Among others, `isContract` will return false for the following\n * types of addresses:\n *\n * - an externally-owned account\n * - a contract in construction\n * - an address where a contract will be created\n * - an address where a contract lived, but was destroyed\n * ====\n *\n * [IMPORTANT]\n * ====\n * You shouldn't rely on `isContract` to protect against flash loan attacks!\n *\n * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets\n * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract\n * constructor.\n * ====\n */\n function isContract(address account) internal view returns (bool) {\n // This method relies on extcodesize/address.code.length, which returns 0\n // for contracts in construction, since the code is only stored at the end\n // of the constructor execution.\n\n return account.code.length > 0;\n }\n\n /**\n * @dev Replacement for Solidity's `transfer`: sends `amount` wei to\n * `recipient`, forwarding all available gas and reverting on errors.\n *\n * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost\n * of certain opcodes, possibly making contracts go over the 2300 gas limit\n * imposed by `transfer`, making them unable to receive funds via\n * `transfer`. {sendValue} removes this limitation.\n *\n * https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more].\n *\n * IMPORTANT: because control is transferred to `recipient`, care must be\n * taken to not create reentrancy vulnerabilities. Consider using\n * {ReentrancyGuard} or the\n * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].\n */\n function sendValue(address payable recipient, uint256 amount) internal {\n require(address(this).balance >= amount, \"Address: insufficient balance\");\n\n (bool success, ) = recipient.call{value: amount}(\"\");\n require(success, \"Address: unable to send value, recipient may have reverted\");\n }\n\n /**\n * @dev Performs a Solidity function call using a low level `call`. A\n * plain `call` is an unsafe replacement for a function call: use this\n * function instead.\n *\n * If `target` reverts with a revert reason, it is bubbled up by this\n * function (like regular Solidity function calls).\n *\n * Returns the raw returned data. To convert to the expected return value,\n * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].\n *\n * Requirements:\n *\n * - `target` must be a contract.\n * - calling `target` with `data` must not revert.\n *\n * _Available since v3.1._\n */\n function functionCall(address target, bytes memory data) internal returns (bytes memory) {\n return functionCall(target, data, \"Address: low-level call failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with\n * `errorMessage` as a fallback revert reason when `target` reverts.\n *\n * _Available since v3.1._\n */\n function functionCall(\n address target,\n bytes memory data,\n string memory errorMessage\n ) internal returns (bytes memory) {\n return functionCallWithValue(target, data, 0, errorMessage);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but also transferring `value` wei to `target`.\n *\n * Requirements:\n *\n * - the calling contract must have an ETH balance of at least `value`.\n * - the called Solidity function must be `payable`.\n *\n * _Available since v3.1._\n */\n function functionCallWithValue(\n address target,\n bytes memory data,\n uint256 value\n ) internal returns (bytes memory) {\n return functionCallWithValue(target, data, value, \"Address: low-level call with value failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but\n * with `errorMessage` as a fallback revert reason when `target` reverts.\n *\n * _Available since v3.1._\n */\n function functionCallWithValue(\n address target,\n bytes memory data,\n uint256 value,\n string memory errorMessage\n ) internal returns (bytes memory) {\n require(address(this).balance >= value, \"Address: insufficient balance for call\");\n require(isContract(target), \"Address: call to non-contract\");\n\n (bool success, bytes memory returndata) = target.call{value: value}(data);\n return verifyCallResult(success, returndata, errorMessage);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but performing a static call.\n *\n * _Available since v3.3._\n */\n function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {\n return functionStaticCall(target, data, \"Address: low-level static call failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\n * but performing a static call.\n *\n * _Available since v3.3._\n */\n function functionStaticCall(\n address target,\n bytes memory data,\n string memory errorMessage\n ) internal view returns (bytes memory) {\n require(isContract(target), \"Address: static call to non-contract\");\n\n (bool success, bytes memory returndata) = target.staticcall(data);\n return verifyCallResult(success, returndata, errorMessage);\n }\n\n /**\n * @dev Tool to verifies that a low level call was successful, and revert if it wasn't, either by bubbling the\n * revert reason using the provided one.\n *\n * _Available since v4.3._\n */\n function verifyCallResult(\n bool success,\n bytes memory returndata,\n string memory errorMessage\n ) internal pure returns (bytes memory) {\n if (success) {\n return returndata;\n } else {\n // Look for revert reason and bubble it up if present\n if (returndata.length > 0) {\n // The easiest way to bubble the revert reason is using memory via assembly\n /// @solidity memory-safe-assembly\n assembly {\n let returndata_size := mload(returndata)\n revert(add(32, returndata), returndata_size)\n }\n } else {\n revert(errorMessage);\n }\n }\n }\n}\n" + }, + "@openzeppelin/contracts-upgradeable/security/ReentrancyGuardUpgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (security/ReentrancyGuard.sol)\n\npragma solidity ^0.8.0;\nimport \"../proxy/utils/Initializable.sol\";\n\n/**\n * @dev Contract module that helps prevent reentrant calls to a function.\n *\n * Inheriting from `ReentrancyGuard` will make the {nonReentrant} modifier\n * available, which can be applied to functions to make sure there are no nested\n * (reentrant) calls to them.\n *\n * Note that because there is a single `nonReentrant` guard, functions marked as\n * `nonReentrant` may not call one another. This can be worked around by making\n * those functions `private`, and then adding `external` `nonReentrant` entry\n * points to them.\n *\n * TIP: If you would like to learn more about reentrancy and alternative ways\n * to protect against it, check out our blog post\n * https://blog.openzeppelin.com/reentrancy-after-istanbul/[Reentrancy After Istanbul].\n */\nabstract contract ReentrancyGuardUpgradeable is Initializable {\n // Booleans are more expensive than uint256 or any type that takes up a full\n // word because each write operation emits an extra SLOAD to first read the\n // slot's contents, replace the bits taken up by the boolean, and then write\n // back. This is the compiler's defense against contract upgrades and\n // pointer aliasing, and it cannot be disabled.\n\n // The values being non-zero value makes deployment a bit more expensive,\n // but in exchange the refund on every call to nonReentrant will be lower in\n // amount. Since refunds are capped to a percentage of the total\n // transaction's gas, it is best to keep them low in cases like this one, to\n // increase the likelihood of the full refund coming into effect.\n uint256 private constant _NOT_ENTERED = 1;\n uint256 private constant _ENTERED = 2;\n\n uint256 private _status;\n\n function __ReentrancyGuard_init() internal onlyInitializing {\n __ReentrancyGuard_init_unchained();\n }\n\n function __ReentrancyGuard_init_unchained() internal onlyInitializing {\n _status = _NOT_ENTERED;\n }\n\n /**\n * @dev Prevents a contract from calling itself, directly or indirectly.\n * Calling a `nonReentrant` function from another `nonReentrant`\n * function is not supported. It is possible to prevent this from happening\n * by making the `nonReentrant` function external, and making it call a\n * `private` function that does the actual work.\n */\n modifier nonReentrant() {\n // On the first call to nonReentrant, _notEntered will be true\n require(_status != _ENTERED, \"ReentrancyGuard: reentrant call\");\n\n // Any calls to nonReentrant after this point will fail\n _status = _ENTERED;\n\n _;\n\n // By storing the original value once again, a refund is triggered (see\n // https://eips.ethereum.org/EIPS/eip-2200)\n _status = _NOT_ENTERED;\n }\n\n /**\n * @dev This empty reserved space is put in place to allow future versions to add new\n * variables without shifting down storage in the inheritance chain.\n * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps\n */\n uint256[49] private __gap;\n}\n" + }, + "@openzeppelin/contracts/token/ERC20/extensions/IERC20Metadata.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (token/ERC20/extensions/IERC20Metadata.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../IERC20.sol\";\n\n/**\n * @dev Interface for the optional metadata functions from the ERC20 standard.\n *\n * _Available since v4.1._\n */\ninterface IERC20Metadata is IERC20 {\n /**\n * @dev Returns the name of the token.\n */\n function name() external view returns (string memory);\n\n /**\n * @dev Returns the symbol of the token.\n */\n function symbol() external view returns (string memory);\n\n /**\n * @dev Returns the decimals places of the token.\n */\n function decimals() external view returns (uint8);\n}\n" + }, + "@openzeppelin/contracts/token/ERC20/IERC20.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.6.0) (token/ERC20/IERC20.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Interface of the ERC20 standard as defined in the EIP.\n */\ninterface IERC20 {\n /**\n * @dev Emitted when `value` tokens are moved from one account (`from`) to\n * another (`to`).\n *\n * Note that `value` may be zero.\n */\n event Transfer(address indexed from, address indexed to, uint256 value);\n\n /**\n * @dev Emitted when the allowance of a `spender` for an `owner` is set by\n * a call to {approve}. `value` is the new allowance.\n */\n event Approval(address indexed owner, address indexed spender, uint256 value);\n\n /**\n * @dev Returns the amount of tokens in existence.\n */\n function totalSupply() external view returns (uint256);\n\n /**\n * @dev Returns the amount of tokens owned by `account`.\n */\n function balanceOf(address account) external view returns (uint256);\n\n /**\n * @dev Moves `amount` tokens from the caller's account to `to`.\n *\n * Returns a boolean value indicating whether the operation succeeded.\n *\n * Emits a {Transfer} event.\n */\n function transfer(address to, uint256 amount) external returns (bool);\n\n /**\n * @dev Returns the remaining number of tokens that `spender` will be\n * allowed to spend on behalf of `owner` through {transferFrom}. This is\n * zero by default.\n *\n * This value changes when {approve} or {transferFrom} are called.\n */\n function allowance(address owner, address spender) external view returns (uint256);\n\n /**\n * @dev Sets `amount` as the allowance of `spender` over the caller's tokens.\n *\n * Returns a boolean value indicating whether the operation succeeded.\n *\n * IMPORTANT: Beware that changing an allowance with this method brings the risk\n * that someone may use both the old and the new allowance by unfortunate\n * transaction ordering. One possible solution to mitigate this race\n * condition is to first reduce the spender's allowance to 0 and set the\n * desired value afterwards:\n * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729\n *\n * Emits an {Approval} event.\n */\n function approve(address spender, uint256 amount) external returns (bool);\n\n /**\n * @dev Moves `amount` tokens from `from` to `to` using the\n * allowance mechanism. `amount` is then deducted from the caller's\n * allowance.\n *\n * Returns a boolean value indicating whether the operation succeeded.\n *\n * Emits a {Transfer} event.\n */\n function transferFrom(\n address from,\n address to,\n uint256 amount\n ) external returns (bool);\n}\n" + }, + "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.7.0) (token/ERC20/utils/SafeERC20.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../IERC20.sol\";\nimport \"../extensions/draft-IERC20Permit.sol\";\nimport \"../../../utils/Address.sol\";\n\n/**\n * @title SafeERC20\n * @dev Wrappers around ERC20 operations that throw on failure (when the token\n * contract returns false). Tokens that return no value (and instead revert or\n * throw on failure) are also supported, non-reverting calls are assumed to be\n * successful.\n * To use this library you can add a `using SafeERC20 for IERC20;` statement to your contract,\n * which allows you to call the safe operations as `token.safeTransfer(...)`, etc.\n */\nlibrary SafeERC20 {\n using Address for address;\n\n function safeTransfer(\n IERC20 token,\n address to,\n uint256 value\n ) internal {\n _callOptionalReturn(token, abi.encodeWithSelector(token.transfer.selector, to, value));\n }\n\n function safeTransferFrom(\n IERC20 token,\n address from,\n address to,\n uint256 value\n ) internal {\n _callOptionalReturn(token, abi.encodeWithSelector(token.transferFrom.selector, from, to, value));\n }\n\n /**\n * @dev Deprecated. This function has issues similar to the ones found in\n * {IERC20-approve}, and its usage is discouraged.\n *\n * Whenever possible, use {safeIncreaseAllowance} and\n * {safeDecreaseAllowance} instead.\n */\n function safeApprove(\n IERC20 token,\n address spender,\n uint256 value\n ) internal {\n // safeApprove should only be called when setting an initial allowance,\n // or when resetting it to zero. To increase and decrease it, use\n // 'safeIncreaseAllowance' and 'safeDecreaseAllowance'\n require(\n (value == 0) || (token.allowance(address(this), spender) == 0),\n \"SafeERC20: approve from non-zero to non-zero allowance\"\n );\n _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, value));\n }\n\n function safeIncreaseAllowance(\n IERC20 token,\n address spender,\n uint256 value\n ) internal {\n uint256 newAllowance = token.allowance(address(this), spender) + value;\n _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));\n }\n\n function safeDecreaseAllowance(\n IERC20 token,\n address spender,\n uint256 value\n ) internal {\n unchecked {\n uint256 oldAllowance = token.allowance(address(this), spender);\n require(oldAllowance >= value, \"SafeERC20: decreased allowance below zero\");\n uint256 newAllowance = oldAllowance - value;\n _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));\n }\n }\n\n function safePermit(\n IERC20Permit token,\n address owner,\n address spender,\n uint256 value,\n uint256 deadline,\n uint8 v,\n bytes32 r,\n bytes32 s\n ) internal {\n uint256 nonceBefore = token.nonces(owner);\n token.permit(owner, spender, value, deadline, v, r, s);\n uint256 nonceAfter = token.nonces(owner);\n require(nonceAfter == nonceBefore + 1, \"SafeERC20: permit did not succeed\");\n }\n\n /**\n * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement\n * on the return value: the return value is optional (but if data is returned, it must not be false).\n * @param token The token targeted by the call.\n * @param data The call data (encoded using abi.encode or one of its variants).\n */\n function _callOptionalReturn(IERC20 token, bytes memory data) private {\n // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since\n // we're implementing it ourselves. We use {Address.functionCall} to perform this call, which verifies that\n // the target address contains contract code and also asserts for success in the low-level call.\n\n bytes memory returndata = address(token).functionCall(data, \"SafeERC20: low-level call failed\");\n if (returndata.length > 0) {\n // Return data is optional\n require(abi.decode(returndata, (bool)), \"SafeERC20: ERC20 operation did not succeed\");\n }\n }\n}\n" + }, + "contracts/interfaces/IAgToken.sol": { + "content": "// SPDX-License-Identifier: GPL-3.0\n\npragma solidity ^0.8.12;\n\nimport \"@openzeppelin/contracts-upgradeable/token/ERC20/IERC20Upgradeable.sol\";\n\n/// @title IAgToken\n/// @author Angle Labs, Inc.\n/// @notice Interface for the stablecoins `AgToken` contracts\n/// @dev This interface only contains functions of the `AgToken` contract which are called by other contracts\n/// of this module or of the first module of the Angle Protocol\ninterface IAgToken is IERC20Upgradeable {\n // ======================= Minter Role Only Functions ===========================\n\n /// @notice Lets the `StableMaster` contract or another whitelisted contract mint agTokens\n /// @param account Address to mint to\n /// @param amount Amount to mint\n /// @dev The contracts allowed to issue agTokens are the `StableMaster` contract, `VaultManager` contracts\n /// associated to this stablecoin as well as the flash loan module (if activated) and potentially contracts\n /// whitelisted by governance\n function mint(address account, uint256 amount) external;\n\n /// @notice Burns `amount` tokens from a `burner` address after being asked to by `sender`\n /// @param amount Amount of tokens to burn\n /// @param burner Address to burn from\n /// @param sender Address which requested the burn from `burner`\n /// @dev This method is to be called by a contract with the minter right after being requested\n /// to do so by a `sender` address willing to burn tokens from another `burner` address\n /// @dev The method checks the allowance between the `sender` and the `burner`\n function burnFrom(\n uint256 amount,\n address burner,\n address sender\n ) external;\n\n /// @notice Burns `amount` tokens from a `burner` address\n /// @param amount Amount of tokens to burn\n /// @param burner Address to burn from\n /// @dev This method is to be called by a contract with a minter right on the AgToken after being\n /// requested to do so by an address willing to burn tokens from its address\n function burnSelf(uint256 amount, address burner) external;\n\n // ========================= Treasury Only Functions ===========================\n\n /// @notice Adds a minter in the contract\n /// @param minter Minter address to add\n /// @dev Zero address checks are performed directly in the `Treasury` contract\n function addMinter(address minter) external;\n\n /// @notice Removes a minter from the contract\n /// @param minter Minter address to remove\n /// @dev This function can also be called by a minter wishing to revoke itself\n function removeMinter(address minter) external;\n\n /// @notice Sets a new treasury contract\n /// @param _treasury New treasury address\n function setTreasury(address _treasury) external;\n\n // ========================= External functions ================================\n\n /// @notice Checks whether an address has the right to mint agTokens\n /// @param minter Address for which the minting right should be checked\n /// @return Whether the address has the right to mint agTokens or not\n function isMinter(address minter) external view returns (bool);\n}\n" + }, + "contracts/interfaces/IOracle.sol": { + "content": "// SPDX-License-Identifier: GPL-3.0\n\npragma solidity ^0.8.12;\n\nimport \"./ITreasury.sol\";\n\n/// @title IOracle\n/// @author Angle Labs, Inc.\n/// @notice Interface for the `Oracle` contract\n/// @dev This interface only contains functions of the contract which are called by other contracts\n/// of this module\ninterface IOracle {\n /// @notice Reads the rate from the Chainlink circuit and other data provided\n /// @return quoteAmount The current rate between the in-currency and out-currency in the base\n /// of the out currency\n /// @dev For instance if the out currency is EUR (and hence agEUR), then the base of the returned\n /// value is 10**18\n function read() external view returns (uint256);\n\n /// @notice Changes the treasury contract\n /// @param _treasury Address of the new treasury contract\n /// @dev This function can be called by an approved `VaultManager` contract which can call\n /// this function after being requested to do so by a `treasury` contract\n /// @dev In some situations (like reactor contracts), the `VaultManager` may not directly be linked\n /// to the `oracle` contract and as such we may need governors to be able to call this function as well\n function setTreasury(address _treasury) external;\n\n /// @notice Reference to the `treasury` contract handling this `VaultManager`\n function treasury() external view returns (ITreasury treasury);\n}\n" + }, + "contracts/interfaces/ISwapper.sol": { + "content": "// SPDX-License-Identifier: GPL-3.0\n\npragma solidity ^0.8.12;\n\nimport \"@openzeppelin/contracts/token/ERC20/IERC20.sol\";\n\n/// @title ISwapper\n/// @author Angle Labs, Inc.\n/// @notice Interface for Swapper contracts\n/// @dev This interface defines the key functions `Swapper` contracts should have when interacting with\n/// Angle\ninterface ISwapper {\n /// @notice Notifies a contract that an address should be given `outToken` from `inToken`\n /// @param inToken Address of the token received\n /// @param outToken Address of the token to obtain\n /// @param outTokenRecipient Address to which the outToken should be sent\n /// @param outTokenOwed Minimum amount of outToken the `outTokenRecipient` address should have at the end of the call\n /// @param inTokenObtained Amount of collateral obtained by a related address prior\n /// to the call to this function\n /// @param data Extra data needed (to encode Uniswap swaps for instance)\n function swap(\n IERC20 inToken,\n IERC20 outToken,\n address outTokenRecipient,\n uint256 outTokenOwed,\n uint256 inTokenObtained,\n bytes calldata data\n ) external;\n}\n" + }, + "contracts/interfaces/ITreasury.sol": { + "content": "// SPDX-License-Identifier: GPL-3.0\n\npragma solidity ^0.8.12;\n\nimport \"./IAgToken.sol\";\nimport \"./ICoreBorrow.sol\";\nimport \"./IFlashAngle.sol\";\n\n/// @title ITreasury\n/// @author Angle Labs, Inc.\n/// @notice Interface for the `Treasury` contract\n/// @dev This interface only contains functions of the `Treasury` which are called by other contracts\n/// of this module\ninterface ITreasury {\n /// @notice Stablecoin handled by this `treasury` contract\n function stablecoin() external view returns (IAgToken);\n\n /// @notice Checks whether a given address has the governor role\n /// @param admin Address to check\n /// @return Whether the address has the governor role\n /// @dev Access control is only kept in the `CoreBorrow` contract\n function isGovernor(address admin) external view returns (bool);\n\n /// @notice Checks whether a given address has the guardian or the governor role\n /// @param admin Address to check\n /// @return Whether the address has the guardian or the governor role\n /// @dev Access control is only kept in the `CoreBorrow` contract which means that this function\n /// queries the `CoreBorrow` contract\n function isGovernorOrGuardian(address admin) external view returns (bool);\n\n /// @notice Checks whether a given address has well been initialized in this contract\n /// as a `VaultManager`\n /// @param _vaultManager Address to check\n /// @return Whether the address has been initialized or not\n function isVaultManager(address _vaultManager) external view returns (bool);\n\n /// @notice Sets a new flash loan module for this stablecoin\n /// @param _flashLoanModule Reference to the new flash loan module\n /// @dev This function removes the minting right to the old flash loan module and grants\n /// it to the new module\n function setFlashLoanModule(address _flashLoanModule) external;\n}\n" + }, + "contracts/interfaces/IVaultManager.sol": { + "content": "// SPDX-License-Identifier: GPL-3.0\n\npragma solidity ^0.8.12;\n\nimport \"@openzeppelin/contracts/interfaces/IERC721Metadata.sol\";\nimport \"@openzeppelin/contracts/token/ERC20/IERC20.sol\";\nimport \"./ITreasury.sol\";\nimport \"./IOracle.sol\";\n\n// ========================= Key Structs and Enums =============================\n\n/// @notice Parameters associated to a given `VaultManager` contract: these all correspond\n/// to parameters which signification is detailed in the `VaultManagerStorage` file\nstruct VaultParameters {\n uint256 debtCeiling;\n uint64 collateralFactor;\n uint64 targetHealthFactor;\n uint64 interestRate;\n uint64 liquidationSurcharge;\n uint64 maxLiquidationDiscount;\n bool whitelistingActivated;\n uint256 baseBoost;\n}\n\n/// @notice Data stored to track someone's loan (or equivalently called position)\nstruct Vault {\n // Amount of collateral deposited in the vault, in collateral decimals. For example, if the collateral\n // is USDC with 6 decimals, then `collateralAmount` will be in base 10**6\n uint256 collateralAmount;\n // Normalized value of the debt (that is to say of the stablecoins borrowed). It is expressed\n // in the base of Angle stablecoins (i.e. `BASE_TOKENS = 10**18`)\n uint256 normalizedDebt;\n}\n\n/// @notice For a given `vaultID`, this encodes a liquidation opportunity that is to say details about the maximum\n/// amount that could be repaid by liquidating the position\n/// @dev All the values are null in the case of a vault which cannot be liquidated under these conditions\nstruct LiquidationOpportunity {\n // Maximum stablecoin amount that can be repaid upon liquidating the vault\n uint256 maxStablecoinAmountToRepay;\n // Collateral amount given to the person in the case where the maximum amount to repay is given\n uint256 maxCollateralAmountGiven;\n // Threshold value of stablecoin amount to repay: it is ok for a liquidator to repay below threshold,\n // but if this threshold is non null and the liquidator wants to repay more than threshold, it should repay\n // the max stablecoin amount given in this vault\n uint256 thresholdRepayAmount;\n // Discount proposed to the liquidator on the collateral\n uint256 discount;\n // Amount of debt in the vault\n uint256 currentDebt;\n}\n\n/// @notice Data stored during a liquidation process to keep in memory what's due to a liquidator and some\n/// essential data for vaults being liquidated\nstruct LiquidatorData {\n // Current amount of stablecoins the liquidator should give to the contract\n uint256 stablecoinAmountToReceive;\n // Current amount of collateral the contract should give to the liquidator\n uint256 collateralAmountToGive;\n // Bad debt accrued across the liquidation process\n uint256 badDebtFromLiquidation;\n // Oracle value (in stablecoin base) at the time of the liquidation\n uint256 oracleValue;\n // Value of the `interestAccumulator` at the time of the call\n uint256 newInterestAccumulator;\n}\n\n/// @notice Data to track during a series of action the amount to give or receive in stablecoins and collateral\n/// to the caller or associated addresses\nstruct PaymentData {\n // Stablecoin amount the contract should give\n uint256 stablecoinAmountToGive;\n // Stablecoin amount owed to the contract\n uint256 stablecoinAmountToReceive;\n // Collateral amount the contract should give\n uint256 collateralAmountToGive;\n // Collateral amount owed to the contract\n uint256 collateralAmountToReceive;\n}\n\n/// @notice Actions possible when composing calls to the different entry functions proposed\nenum ActionType {\n createVault,\n closeVault,\n addCollateral,\n removeCollateral,\n repayDebt,\n borrow,\n getDebtIn,\n permit\n}\n\n// ========================= Interfaces =============================\n\n/// @title IVaultManagerFunctions\n/// @author Angle Labs, Inc.\n/// @notice Interface for the `VaultManager` contract\n/// @dev This interface only contains functions of the contract which are called by other contracts\n/// of this module (without getters)\ninterface IVaultManagerFunctions {\n /// @notice Accrues interest accumulated across all vaults to the surplus and sends the surplus to the treasury\n /// @return surplusValue Value of the surplus communicated to the `Treasury`\n /// @return badDebtValue Value of the bad debt communicated to the `Treasury`\n /// @dev `surplus` and `badDebt` should be reset to 0 once their current value have been given to the `treasury` contract\n function accrueInterestToTreasury() external returns (uint256 surplusValue, uint256 badDebtValue);\n\n /// @notice Removes debt from a vault after being requested to do so by another `VaultManager` contract\n /// @param vaultID ID of the vault to remove debt from\n /// @param amountStablecoins Amount of stablecoins to remove from the debt: this amount is to be converted to an\n /// internal debt amount\n /// @param senderBorrowFee Borrowing fees from the contract which requested this: this is to make sure that people are not\n /// arbitraging difference in minting fees\n /// @param senderRepayFee Repay fees from the contract which requested this: this is to make sure that people are not arbitraging\n /// differences in repay fees\n /// @dev This function can only be called from a vaultManager registered in the same Treasury\n function getDebtOut(\n uint256 vaultID,\n uint256 amountStablecoins,\n uint256 senderBorrowFee,\n uint256 senderRepayFee\n ) external;\n\n /// @notice Gets the current debt of a vault\n /// @param vaultID ID of the vault to check\n /// @return Debt of the vault\n function getVaultDebt(uint256 vaultID) external view returns (uint256);\n\n /// @notice Gets the total debt across all vaults\n /// @return Total debt across all vaults, taking into account the interest accumulated\n /// over time\n function getTotalDebt() external view returns (uint256);\n\n /// @notice Sets the treasury contract\n /// @param _treasury New treasury contract\n /// @dev All required checks when setting up a treasury contract are performed in the contract\n /// calling this function\n function setTreasury(address _treasury) external;\n\n /// @notice Creates a vault\n /// @param toVault Address for which the va\n /// @return vaultID ID of the vault created\n /// @dev This function just creates the vault without doing any collateral or\n function createVault(address toVault) external returns (uint256);\n\n /// @notice Allows composability between calls to the different entry points of this module. Any user calling\n /// this function can perform any of the allowed actions in the order of their choice\n /// @param actions Set of actions to perform\n /// @param datas Data to be decoded for each action: it can include like the `vaultID` or the `stablecoinAmount` to borrow\n /// @param from Address from which stablecoins will be taken if one action includes burning stablecoins. This address\n /// should either be the `msg.sender` or be approved by the latter\n /// @param to Address to which stablecoins and/or collateral will be sent in case of\n /// @param who Address of the contract to handle in case of repayment of stablecoins from received collateral\n /// @param repayData Data to pass to the repayment contract in case of\n /// @return paymentData Struct containing the accounting changes from the protocol's perspective (like how much of collateral\n /// or how much has been received). Note that the values in the struct are not aggregated and you could have in the output\n /// a positive amount of stablecoins to receive as well as a positive amount of stablecoins to give\n /// @dev This function is optimized to reduce gas cost due to payment from or to the user and that expensive calls\n /// or computations (like `oracleValue`) are done only once\n /// @dev When specifying `vaultID` in `data`, it is important to know that if you specify `vaultID = 0`, it will simply\n /// use the latest `vaultID`. This is the default behavior, and unless you're engaging into some complex protocol actions\n /// it is encouraged to use `vaultID = 0` only when the first action of the batch is `createVault`\n function angle(\n ActionType[] memory actions,\n bytes[] memory datas,\n address from,\n address to,\n address who,\n bytes memory repayData\n ) external returns (PaymentData memory paymentData);\n\n /// @notice This function is a wrapper built on top of the function above. It enables users to interact with the contract\n /// without having to provide `who` and `repayData` parameters\n function angle(\n ActionType[] memory actions,\n bytes[] memory datas,\n address from,\n address to\n ) external returns (PaymentData memory paymentData);\n\n /// @notice Initializes the `VaultManager` contract\n /// @param _treasury Treasury address handling the contract\n /// @param _collateral Collateral supported by this contract\n /// @param _oracle Oracle contract used\n /// @param _symbol Symbol used to define the `VaultManager` name and symbol\n /// @dev The parameters and the oracle are the only elements which could be modified once the\n /// contract has been initialized\n /// @dev For the contract to be fully initialized, governance needs to set the parameters for the liquidation\n /// boost\n function initialize(\n ITreasury _treasury,\n IERC20 _collateral,\n IOracle _oracle,\n VaultParameters calldata params,\n string memory _symbol\n ) external;\n\n /// @notice Minimum amount of debt a vault can have, expressed in `BASE_TOKENS` that is to say the base of the agTokens\n function dust() external view returns (uint256);\n}\n\n/// @title IVaultManagerStorage\n/// @author Angle Labs, Inc.\n/// @notice Interface for the `VaultManager` contract\n/// @dev This interface contains getters of the contract's public variables used by other contracts\n/// of this module\ninterface IVaultManagerStorage {\n /// @notice Encodes the maximum ratio stablecoin/collateral a vault can have before being liquidated. It's what\n /// determines the minimum collateral ratio of a position\n function collateralFactor() external view returns (uint64);\n\n /// @notice Stablecoin handled by this contract. Another `VaultManager` contract could have\n /// the same rights as this `VaultManager` on the stablecoin contract\n function stablecoin() external view returns (IAgToken);\n\n /// @notice Reference to the `treasury` contract handling this `VaultManager`\n function treasury() external view returns (ITreasury);\n\n /// @notice Oracle contract to get access to the price of the collateral with respect to the stablecoin\n function oracle() external view returns (IOracle);\n\n /// @notice The `interestAccumulator` variable keeps track of the interest that should accrue to the protocol.\n /// The stored value is not necessarily the true value: this one is recomputed every time an action takes place\n /// within the protocol. It is in base `BASE_INTEREST`\n function interestAccumulator() external view returns (uint256);\n\n /// @notice Reference to the collateral handled by this `VaultManager`\n function collateral() external view returns (IERC20);\n\n /// @notice Total normalized amount of stablecoins borrowed, not taking into account the potential bad debt accumulated\n /// This value is expressed in the base of Angle stablecoins (`BASE_TOKENS = 10**18`)\n function totalNormalizedDebt() external view returns (uint256);\n\n /// @notice Maximum amount of stablecoins that can be issued with this contract. It is expressed in `BASE_TOKENS`\n function debtCeiling() external view returns (uint256);\n\n /// @notice Maps a `vaultID` to its data (namely collateral amount and normalized debt)\n function vaultData(uint256 vaultID) external view returns (uint256 collateralAmount, uint256 normalizedDebt);\n\n /// @notice ID of the last vault created. The `vaultIDCount` variables serves as a counter to generate a unique\n /// `vaultID` for each vault: it is like `tokenID` in basic ERC721 contracts\n function vaultIDCount() external view returns (uint256);\n}\n\n/// @title IVaultManager\n/// @author Angle Labs, Inc.\n/// @notice Interface for the `VaultManager` contract\ninterface IVaultManager is IVaultManagerFunctions, IVaultManagerStorage, IERC721Metadata {\n function isApprovedOrOwner(address spender, uint256 vaultID) external view returns (bool);\n}\n\n/// @title IVaultManagerListing\n/// @author Angle Labs, Inc.\n/// @notice Interface for the `VaultManagerListing` contract\ninterface IVaultManagerListing is IVaultManager {\n /// @notice Get the collateral owned by `user` in the contract\n /// @dev This function effectively sums the collateral amounts of all the vaults owned by `user`\n function getUserCollateral(address user) external view returns (uint256);\n}\n" + }, + "contracts/interfaces/governance/IVeBoostProxy.sol": { + "content": "// SPDX-License-Identifier: GPL-3.0\n\npragma solidity ^0.8.12;\n\n/// @title IVeBoostProxy\n/// @author Angle Labs, Inc.\n/// @notice Interface for the `VeBoostProxy` contract\n/// @dev This interface only contains functions of the contract which are called by other contracts\n/// of this module\n/// @dev The `veBoostProxy` contract used by Angle is a full fork of Curve Finance implementation\ninterface IVeBoostProxy {\n /// @notice Reads the adjusted veANGLE balance of an address (adjusted by delegation)\n //solhint-disable-next-line\n function adjusted_balance_of(address) external view returns (uint256);\n}\n" + }, + "@openzeppelin/contracts-upgradeable/token/ERC721/extensions/IERC721MetadataUpgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (token/ERC721/extensions/IERC721Metadata.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../IERC721Upgradeable.sol\";\n\n/**\n * @title ERC-721 Non-Fungible Token Standard, optional metadata extension\n * @dev See https://eips.ethereum.org/EIPS/eip-721\n */\ninterface IERC721MetadataUpgradeable is IERC721Upgradeable {\n /**\n * @dev Returns the token collection name.\n */\n function name() external view returns (string memory);\n\n /**\n * @dev Returns the token collection symbol.\n */\n function symbol() external view returns (string memory);\n\n /**\n * @dev Returns the Uniform Resource Identifier (URI) for `tokenId` token.\n */\n function tokenURI(uint256 tokenId) external view returns (string memory);\n}\n" + }, + "@openzeppelin/contracts-upgradeable/token/ERC721/IERC721Upgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.7.0) (token/ERC721/IERC721.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../../utils/introspection/IERC165Upgradeable.sol\";\n\n/**\n * @dev Required interface of an ERC721 compliant contract.\n */\ninterface IERC721Upgradeable is IERC165Upgradeable {\n /**\n * @dev Emitted when `tokenId` token is transferred from `from` to `to`.\n */\n event Transfer(address indexed from, address indexed to, uint256 indexed tokenId);\n\n /**\n * @dev Emitted when `owner` enables `approved` to manage the `tokenId` token.\n */\n event Approval(address indexed owner, address indexed approved, uint256 indexed tokenId);\n\n /**\n * @dev Emitted when `owner` enables or disables (`approved`) `operator` to manage all of its assets.\n */\n event ApprovalForAll(address indexed owner, address indexed operator, bool approved);\n\n /**\n * @dev Returns the number of tokens in ``owner``'s account.\n */\n function balanceOf(address owner) external view returns (uint256 balance);\n\n /**\n * @dev Returns the owner of the `tokenId` token.\n *\n * Requirements:\n *\n * - `tokenId` must exist.\n */\n function ownerOf(uint256 tokenId) external view returns (address owner);\n\n /**\n * @dev Safely transfers `tokenId` token from `from` to `to`.\n *\n * Requirements:\n *\n * - `from` cannot be the zero address.\n * - `to` cannot be the zero address.\n * - `tokenId` token must exist and be owned by `from`.\n * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}.\n * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.\n *\n * Emits a {Transfer} event.\n */\n function safeTransferFrom(\n address from,\n address to,\n uint256 tokenId,\n bytes calldata data\n ) external;\n\n /**\n * @dev Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipients\n * are aware of the ERC721 protocol to prevent tokens from being forever locked.\n *\n * Requirements:\n *\n * - `from` cannot be the zero address.\n * - `to` cannot be the zero address.\n * - `tokenId` token must exist and be owned by `from`.\n * - If the caller is not `from`, it must have been allowed to move this token by either {approve} or {setApprovalForAll}.\n * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.\n *\n * Emits a {Transfer} event.\n */\n function safeTransferFrom(\n address from,\n address to,\n uint256 tokenId\n ) external;\n\n /**\n * @dev Transfers `tokenId` token from `from` to `to`.\n *\n * WARNING: Usage of this method is discouraged, use {safeTransferFrom} whenever possible.\n *\n * Requirements:\n *\n * - `from` cannot be the zero address.\n * - `to` cannot be the zero address.\n * - `tokenId` token must be owned by `from`.\n * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}.\n *\n * Emits a {Transfer} event.\n */\n function transferFrom(\n address from,\n address to,\n uint256 tokenId\n ) external;\n\n /**\n * @dev Gives permission to `to` to transfer `tokenId` token to another account.\n * The approval is cleared when the token is transferred.\n *\n * Only a single account can be approved at a time, so approving the zero address clears previous approvals.\n *\n * Requirements:\n *\n * - The caller must own the token or be an approved operator.\n * - `tokenId` must exist.\n *\n * Emits an {Approval} event.\n */\n function approve(address to, uint256 tokenId) external;\n\n /**\n * @dev Approve or remove `operator` as an operator for the caller.\n * Operators can call {transferFrom} or {safeTransferFrom} for any token owned by the caller.\n *\n * Requirements:\n *\n * - The `operator` cannot be the caller.\n *\n * Emits an {ApprovalForAll} event.\n */\n function setApprovalForAll(address operator, bool _approved) external;\n\n /**\n * @dev Returns the account approved for `tokenId` token.\n *\n * Requirements:\n *\n * - `tokenId` must exist.\n */\n function getApproved(uint256 tokenId) external view returns (address operator);\n\n /**\n * @dev Returns if the `operator` is allowed to manage all of the assets of `owner`.\n *\n * See {setApprovalForAll}\n */\n function isApprovedForAll(address owner, address operator) external view returns (bool);\n}\n" + }, + "@openzeppelin/contracts/token/ERC20/extensions/draft-IERC20Permit.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (token/ERC20/extensions/draft-IERC20Permit.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Interface of the ERC20 Permit extension allowing approvals to be made via signatures, as defined in\n * https://eips.ethereum.org/EIPS/eip-2612[EIP-2612].\n *\n * Adds the {permit} method, which can be used to change an account's ERC20 allowance (see {IERC20-allowance}) by\n * presenting a message signed by the account. By not relying on {IERC20-approve}, the token holder account doesn't\n * need to send a transaction, and thus is not required to hold Ether at all.\n */\ninterface IERC20Permit {\n /**\n * @dev Sets `value` as the allowance of `spender` over ``owner``'s tokens,\n * given ``owner``'s signed approval.\n *\n * IMPORTANT: The same issues {IERC20-approve} has related to transaction\n * ordering also apply here.\n *\n * Emits an {Approval} event.\n *\n * Requirements:\n *\n * - `spender` cannot be the zero address.\n * - `deadline` must be a timestamp in the future.\n * - `v`, `r` and `s` must be a valid `secp256k1` signature from `owner`\n * over the EIP712-formatted function arguments.\n * - the signature must use ``owner``'s current nonce (see {nonces}).\n *\n * For more information on the signature format, see the\n * https://eips.ethereum.org/EIPS/eip-2612#specification[relevant EIP\n * section].\n */\n function permit(\n address owner,\n address spender,\n uint256 value,\n uint256 deadline,\n uint8 v,\n bytes32 r,\n bytes32 s\n ) external;\n\n /**\n * @dev Returns the current nonce for `owner`. This value must be\n * included whenever a signature is generated for {permit}.\n *\n * Every successful call to {permit} increases ``owner``'s nonce by one. This\n * prevents a signature from being used multiple times.\n */\n function nonces(address owner) external view returns (uint256);\n\n /**\n * @dev Returns the domain separator used in the encoding of the signature for {permit}, as defined by {EIP712}.\n */\n // solhint-disable-next-line func-name-mixedcase\n function DOMAIN_SEPARATOR() external view returns (bytes32);\n}\n" + }, + "@openzeppelin/contracts/utils/Address.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.7.0) (utils/Address.sol)\n\npragma solidity ^0.8.1;\n\n/**\n * @dev Collection of functions related to the address type\n */\nlibrary Address {\n /**\n * @dev Returns true if `account` is a contract.\n *\n * [IMPORTANT]\n * ====\n * It is unsafe to assume that an address for which this function returns\n * false is an externally-owned account (EOA) and not a contract.\n *\n * Among others, `isContract` will return false for the following\n * types of addresses:\n *\n * - an externally-owned account\n * - a contract in construction\n * - an address where a contract will be created\n * - an address where a contract lived, but was destroyed\n * ====\n *\n * [IMPORTANT]\n * ====\n * You shouldn't rely on `isContract` to protect against flash loan attacks!\n *\n * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets\n * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract\n * constructor.\n * ====\n */\n function isContract(address account) internal view returns (bool) {\n // This method relies on extcodesize/address.code.length, which returns 0\n // for contracts in construction, since the code is only stored at the end\n // of the constructor execution.\n\n return account.code.length > 0;\n }\n\n /**\n * @dev Replacement for Solidity's `transfer`: sends `amount` wei to\n * `recipient`, forwarding all available gas and reverting on errors.\n *\n * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost\n * of certain opcodes, possibly making contracts go over the 2300 gas limit\n * imposed by `transfer`, making them unable to receive funds via\n * `transfer`. {sendValue} removes this limitation.\n *\n * https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more].\n *\n * IMPORTANT: because control is transferred to `recipient`, care must be\n * taken to not create reentrancy vulnerabilities. Consider using\n * {ReentrancyGuard} or the\n * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].\n */\n function sendValue(address payable recipient, uint256 amount) internal {\n require(address(this).balance >= amount, \"Address: insufficient balance\");\n\n (bool success, ) = recipient.call{value: amount}(\"\");\n require(success, \"Address: unable to send value, recipient may have reverted\");\n }\n\n /**\n * @dev Performs a Solidity function call using a low level `call`. A\n * plain `call` is an unsafe replacement for a function call: use this\n * function instead.\n *\n * If `target` reverts with a revert reason, it is bubbled up by this\n * function (like regular Solidity function calls).\n *\n * Returns the raw returned data. To convert to the expected return value,\n * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].\n *\n * Requirements:\n *\n * - `target` must be a contract.\n * - calling `target` with `data` must not revert.\n *\n * _Available since v3.1._\n */\n function functionCall(address target, bytes memory data) internal returns (bytes memory) {\n return functionCall(target, data, \"Address: low-level call failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with\n * `errorMessage` as a fallback revert reason when `target` reverts.\n *\n * _Available since v3.1._\n */\n function functionCall(\n address target,\n bytes memory data,\n string memory errorMessage\n ) internal returns (bytes memory) {\n return functionCallWithValue(target, data, 0, errorMessage);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but also transferring `value` wei to `target`.\n *\n * Requirements:\n *\n * - the calling contract must have an ETH balance of at least `value`.\n * - the called Solidity function must be `payable`.\n *\n * _Available since v3.1._\n */\n function functionCallWithValue(\n address target,\n bytes memory data,\n uint256 value\n ) internal returns (bytes memory) {\n return functionCallWithValue(target, data, value, \"Address: low-level call with value failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but\n * with `errorMessage` as a fallback revert reason when `target` reverts.\n *\n * _Available since v3.1._\n */\n function functionCallWithValue(\n address target,\n bytes memory data,\n uint256 value,\n string memory errorMessage\n ) internal returns (bytes memory) {\n require(address(this).balance >= value, \"Address: insufficient balance for call\");\n require(isContract(target), \"Address: call to non-contract\");\n\n (bool success, bytes memory returndata) = target.call{value: value}(data);\n return verifyCallResult(success, returndata, errorMessage);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but performing a static call.\n *\n * _Available since v3.3._\n */\n function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {\n return functionStaticCall(target, data, \"Address: low-level static call failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\n * but performing a static call.\n *\n * _Available since v3.3._\n */\n function functionStaticCall(\n address target,\n bytes memory data,\n string memory errorMessage\n ) internal view returns (bytes memory) {\n require(isContract(target), \"Address: static call to non-contract\");\n\n (bool success, bytes memory returndata) = target.staticcall(data);\n return verifyCallResult(success, returndata, errorMessage);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but performing a delegate call.\n *\n * _Available since v3.4._\n */\n function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {\n return functionDelegateCall(target, data, \"Address: low-level delegate call failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\n * but performing a delegate call.\n *\n * _Available since v3.4._\n */\n function functionDelegateCall(\n address target,\n bytes memory data,\n string memory errorMessage\n ) internal returns (bytes memory) {\n require(isContract(target), \"Address: delegate call to non-contract\");\n\n (bool success, bytes memory returndata) = target.delegatecall(data);\n return verifyCallResult(success, returndata, errorMessage);\n }\n\n /**\n * @dev Tool to verifies that a low level call was successful, and revert if it wasn't, either by bubbling the\n * revert reason using the provided one.\n *\n * _Available since v4.3._\n */\n function verifyCallResult(\n bool success,\n bytes memory returndata,\n string memory errorMessage\n ) internal pure returns (bytes memory) {\n if (success) {\n return returndata;\n } else {\n // Look for revert reason and bubble it up if present\n if (returndata.length > 0) {\n // The easiest way to bubble the revert reason is using memory via assembly\n /// @solidity memory-safe-assembly\n assembly {\n let returndata_size := mload(returndata)\n revert(add(32, returndata), returndata_size)\n }\n } else {\n revert(errorMessage);\n }\n }\n }\n}\n" + }, + "@openzeppelin/contracts-upgradeable/token/ERC20/IERC20Upgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.6.0) (token/ERC20/IERC20.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Interface of the ERC20 standard as defined in the EIP.\n */\ninterface IERC20Upgradeable {\n /**\n * @dev Emitted when `value` tokens are moved from one account (`from`) to\n * another (`to`).\n *\n * Note that `value` may be zero.\n */\n event Transfer(address indexed from, address indexed to, uint256 value);\n\n /**\n * @dev Emitted when the allowance of a `spender` for an `owner` is set by\n * a call to {approve}. `value` is the new allowance.\n */\n event Approval(address indexed owner, address indexed spender, uint256 value);\n\n /**\n * @dev Returns the amount of tokens in existence.\n */\n function totalSupply() external view returns (uint256);\n\n /**\n * @dev Returns the amount of tokens owned by `account`.\n */\n function balanceOf(address account) external view returns (uint256);\n\n /**\n * @dev Moves `amount` tokens from the caller's account to `to`.\n *\n * Returns a boolean value indicating whether the operation succeeded.\n *\n * Emits a {Transfer} event.\n */\n function transfer(address to, uint256 amount) external returns (bool);\n\n /**\n * @dev Returns the remaining number of tokens that `spender` will be\n * allowed to spend on behalf of `owner` through {transferFrom}. This is\n * zero by default.\n *\n * This value changes when {approve} or {transferFrom} are called.\n */\n function allowance(address owner, address spender) external view returns (uint256);\n\n /**\n * @dev Sets `amount` as the allowance of `spender` over the caller's tokens.\n *\n * Returns a boolean value indicating whether the operation succeeded.\n *\n * IMPORTANT: Beware that changing an allowance with this method brings the risk\n * that someone may use both the old and the new allowance by unfortunate\n * transaction ordering. One possible solution to mitigate this race\n * condition is to first reduce the spender's allowance to 0 and set the\n * desired value afterwards:\n * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729\n *\n * Emits an {Approval} event.\n */\n function approve(address spender, uint256 amount) external returns (bool);\n\n /**\n * @dev Moves `amount` tokens from `from` to `to` using the\n * allowance mechanism. `amount` is then deducted from the caller's\n * allowance.\n *\n * Returns a boolean value indicating whether the operation succeeded.\n *\n * Emits a {Transfer} event.\n */\n function transferFrom(\n address from,\n address to,\n uint256 amount\n ) external returns (bool);\n}\n" + }, + "contracts/interfaces/ICoreBorrow.sol": { + "content": "// SPDX-License-Identifier: GPL-3.0\n\npragma solidity ^0.8.12;\n\n/// @title ICoreBorrow\n/// @author Angle Labs, Inc.\n/// @notice Interface for the `CoreBorrow` contract\n/// @dev This interface only contains functions of the `CoreBorrow` contract which are called by other contracts\n/// of this module\ninterface ICoreBorrow {\n /// @notice Checks if an address corresponds to a treasury of a stablecoin with a flash loan\n /// module initialized on it\n /// @param treasury Address to check\n /// @return Whether the address has the `FLASHLOANER_TREASURY_ROLE` or not\n function isFlashLoanerTreasury(address treasury) external view returns (bool);\n\n /// @notice Checks whether an address is governor of the Angle Protocol or not\n /// @param admin Address to check\n /// @return Whether the address has the `GOVERNOR_ROLE` or not\n function isGovernor(address admin) external view returns (bool);\n\n /// @notice Checks whether an address is governor or a guardian of the Angle Protocol or not\n /// @param admin Address to check\n /// @return Whether the address has the `GUARDIAN_ROLE` or not\n /// @dev Governance should make sure when adding a governor to also give this governor the guardian\n /// role by calling the `addGovernor` function\n function isGovernorOrGuardian(address admin) external view returns (bool);\n}\n" + }, + "contracts/interfaces/IFlashAngle.sol": { + "content": "// SPDX-License-Identifier: GPL-3.0\n\npragma solidity ^0.8.12;\n\nimport \"./IAgToken.sol\";\nimport \"./ICoreBorrow.sol\";\n\n/// @title IFlashAngle\n/// @author Angle Labs, Inc.\n/// @notice Interface for the `FlashAngle` contract\n/// @dev This interface only contains functions of the contract which are called by other contracts\n/// of this module\ninterface IFlashAngle {\n /// @notice Reference to the `CoreBorrow` contract managing the FlashLoan module\n function core() external view returns (ICoreBorrow);\n\n /// @notice Sends the fees taken from flash loans to the treasury contract associated to the stablecoin\n /// @param stablecoin Stablecoin from which profits should be sent\n /// @return balance Amount of profits sent\n /// @dev This function can only be called by the treasury contract\n function accrueInterestToTreasury(IAgToken stablecoin) external returns (uint256 balance);\n\n /// @notice Adds support for a stablecoin\n /// @param _treasury Treasury associated to the stablecoin to add support for\n /// @dev This function can only be called by the `CoreBorrow` contract\n function addStablecoinSupport(address _treasury) external;\n\n /// @notice Removes support for a stablecoin\n /// @param _treasury Treasury associated to the stablecoin to remove support for\n /// @dev This function can only be called by the `CoreBorrow` contract\n function removeStablecoinSupport(address _treasury) external;\n\n /// @notice Sets a new core contract\n /// @param _core Core contract address to set\n /// @dev This function can only be called by the `CoreBorrow` contract\n function setCore(address _core) external;\n}\n" + }, + "@openzeppelin/contracts/interfaces/IERC721Metadata.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (interfaces/IERC721Metadata.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../token/ERC721/extensions/IERC721Metadata.sol\";\n" + }, + "@openzeppelin/contracts/token/ERC721/extensions/IERC721Metadata.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (token/ERC721/extensions/IERC721Metadata.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../IERC721.sol\";\n\n/**\n * @title ERC-721 Non-Fungible Token Standard, optional metadata extension\n * @dev See https://eips.ethereum.org/EIPS/eip-721\n */\ninterface IERC721Metadata is IERC721 {\n /**\n * @dev Returns the token collection name.\n */\n function name() external view returns (string memory);\n\n /**\n * @dev Returns the token collection symbol.\n */\n function symbol() external view returns (string memory);\n\n /**\n * @dev Returns the Uniform Resource Identifier (URI) for `tokenId` token.\n */\n function tokenURI(uint256 tokenId) external view returns (string memory);\n}\n" + }, + "@openzeppelin/contracts/token/ERC721/IERC721.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.7.0) (token/ERC721/IERC721.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../../utils/introspection/IERC165.sol\";\n\n/**\n * @dev Required interface of an ERC721 compliant contract.\n */\ninterface IERC721 is IERC165 {\n /**\n * @dev Emitted when `tokenId` token is transferred from `from` to `to`.\n */\n event Transfer(address indexed from, address indexed to, uint256 indexed tokenId);\n\n /**\n * @dev Emitted when `owner` enables `approved` to manage the `tokenId` token.\n */\n event Approval(address indexed owner, address indexed approved, uint256 indexed tokenId);\n\n /**\n * @dev Emitted when `owner` enables or disables (`approved`) `operator` to manage all of its assets.\n */\n event ApprovalForAll(address indexed owner, address indexed operator, bool approved);\n\n /**\n * @dev Returns the number of tokens in ``owner``'s account.\n */\n function balanceOf(address owner) external view returns (uint256 balance);\n\n /**\n * @dev Returns the owner of the `tokenId` token.\n *\n * Requirements:\n *\n * - `tokenId` must exist.\n */\n function ownerOf(uint256 tokenId) external view returns (address owner);\n\n /**\n * @dev Safely transfers `tokenId` token from `from` to `to`.\n *\n * Requirements:\n *\n * - `from` cannot be the zero address.\n * - `to` cannot be the zero address.\n * - `tokenId` token must exist and be owned by `from`.\n * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}.\n * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.\n *\n * Emits a {Transfer} event.\n */\n function safeTransferFrom(\n address from,\n address to,\n uint256 tokenId,\n bytes calldata data\n ) external;\n\n /**\n * @dev Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipients\n * are aware of the ERC721 protocol to prevent tokens from being forever locked.\n *\n * Requirements:\n *\n * - `from` cannot be the zero address.\n * - `to` cannot be the zero address.\n * - `tokenId` token must exist and be owned by `from`.\n * - If the caller is not `from`, it must have been allowed to move this token by either {approve} or {setApprovalForAll}.\n * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.\n *\n * Emits a {Transfer} event.\n */\n function safeTransferFrom(\n address from,\n address to,\n uint256 tokenId\n ) external;\n\n /**\n * @dev Transfers `tokenId` token from `from` to `to`.\n *\n * WARNING: Usage of this method is discouraged, use {safeTransferFrom} whenever possible.\n *\n * Requirements:\n *\n * - `from` cannot be the zero address.\n * - `to` cannot be the zero address.\n * - `tokenId` token must be owned by `from`.\n * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}.\n *\n * Emits a {Transfer} event.\n */\n function transferFrom(\n address from,\n address to,\n uint256 tokenId\n ) external;\n\n /**\n * @dev Gives permission to `to` to transfer `tokenId` token to another account.\n * The approval is cleared when the token is transferred.\n *\n * Only a single account can be approved at a time, so approving the zero address clears previous approvals.\n *\n * Requirements:\n *\n * - The caller must own the token or be an approved operator.\n * - `tokenId` must exist.\n *\n * Emits an {Approval} event.\n */\n function approve(address to, uint256 tokenId) external;\n\n /**\n * @dev Approve or remove `operator` as an operator for the caller.\n * Operators can call {transferFrom} or {safeTransferFrom} for any token owned by the caller.\n *\n * Requirements:\n *\n * - The `operator` cannot be the caller.\n *\n * Emits an {ApprovalForAll} event.\n */\n function setApprovalForAll(address operator, bool _approved) external;\n\n /**\n * @dev Returns the account approved for `tokenId` token.\n *\n * Requirements:\n *\n * - `tokenId` must exist.\n */\n function getApproved(uint256 tokenId) external view returns (address operator);\n\n /**\n * @dev Returns if the `operator` is allowed to manage all of the assets of `owner`.\n *\n * See {setApprovalForAll}\n */\n function isApprovedForAll(address owner, address operator) external view returns (bool);\n}\n" + }, + "@openzeppelin/contracts/utils/introspection/IERC165.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (utils/introspection/IERC165.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Interface of the ERC165 standard, as defined in the\n * https://eips.ethereum.org/EIPS/eip-165[EIP].\n *\n * Implementers can declare support of contract interfaces, which can then be\n * queried by others ({ERC165Checker}).\n *\n * For an implementation, see {ERC165}.\n */\ninterface IERC165 {\n /**\n * @dev Returns true if this contract implements the interface defined by\n * `interfaceId`. See the corresponding\n * https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section]\n * to learn more about how these ids are created.\n *\n * This function call must use less than 30 000 gas.\n */\n function supportsInterface(bytes4 interfaceId) external view returns (bool);\n}\n" + } + }, + "settings": { + "optimizer": { + "enabled": true, + "runs": 1 + }, + "outputSelection": { + "*": { + "*": [ + "abi", + "evm.bytecode", + "evm.deployedBytecode", + "evm.methodIdentifiers", + "metadata" + ], + "": [ + "ast" + ] + } + } + } +} \ No newline at end of file diff --git a/scripts/mainnet-fork/upgradeVaultManager.ts b/scripts/mainnet-fork/upgradeVaultManager.ts index dc2fa378..6acf33b6 100644 --- a/scripts/mainnet-fork/upgradeVaultManager.ts +++ b/scripts/mainnet-fork/upgradeVaultManager.ts @@ -33,12 +33,11 @@ async function main() { }); await network.provider.send('hardhat_setBalance', [governor, '0x10000000000000000000000000000']); const signer = await ethers.getSigner(governor); - /* + await proxyAdmin.connect(signer).upgrade(vaultManagerAddress, implementation); console.log('Upgrade OK'); console.log(vaultManager.address); - */ console.log(await vaultManager.treasury()); console.log(await vaultManager.collateral()); diff --git a/scripts/upgradeability.ts b/scripts/upgradeability.ts index f58e8a5d..cdaed281 100644 --- a/scripts/upgradeability.ts +++ b/scripts/upgradeability.ts @@ -29,13 +29,11 @@ async function main() { // console.log((await artifacts.getAllFullyQualifiedNames())); testUpgradeability('VaultManagerLiquidationBoost', 'contracts/vaultManager/VaultManagerLiquidationBoost.sol'); - testUpgradeability('OldVaultManager', 'contracts/deprecated/OldVaultManager.sol'); - testUpgradeability('OldAngleHelpers', 'contracts/deprecated/OldAngleHelpers.sol'); - testUpgradeability('AngleHelpers', 'contracts/ui-helpers/AngleHelpers.sol'); + testUpgradeability('OldVaultManager', 'contracts/deprecated/vaultManager/OldVaultManager.sol'); testStorage( 'OldVaultManager', - 'contracts/deprecated/OldVaultManager.sol', + 'contracts/deprecated/vaultManager/OldVaultManager.sol', 'VaultManagerLiquidationBoost', 'contracts/vaultManager/VaultManagerLiquidationBoost.sol', );